Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating index to fix the quickstart so that it actually works. #220

Closed
wants to merge 2 commits into from

Conversation

lgleasain
Copy link
Contributor

I found a bunch of broken stuff in the index documents for Formula. If you try following the example listed in the quick start it also
does not work and is different from the sample project it references. This PR updates that. I also created a separate project here https://github.com/lgleasain/counterexample that reflects what index guides you through creating. We will want to bring that into Formula or as a separate Instacart Public repo. Please let me know if I missed anything or if you have any ideas etc..

has two buttons to increment and decrement it.

One of the best practises when working with Formula is to first think what the UI needs for rendering and what
actions the user will be able to take. This concept is called a `RenderModel` and is represented by a Kotlin data class.

### Project Setup
To get started create a new Android application called `Counter Application` with a blank activity. Next, rename (via refactor)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of this, I would recommend cloning the repository and going into samples/counter

#### Render Model
Render Model is an immutable representation of your view. It will be used to update Android views. Typically,
it will also contain callbacks that will be invoked when user interacts with the UI.
it will also contain callbacks that will be invoked when user interacts with the UI. Create a file called
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we really need to be so explicit with Create a file called CounterRenderModel in the same package as your activity and add the following content.

Next you will need to update your application in your `manifest.xml` to reference your new app class. Your new one
should look like this:
```xml
<application
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably avoid introducing such details as most Android devs should know how to register Application.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could change this to just mention to remember to update your application to use the new MyApp class.

currently have. To fix that replace your activity view with the following.

```xml
<?xml version="1.0" encoding="utf-8"?>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should include this whole XML, makes the example pretty dense. Maybe it would be enough to include a screenshot of the UI and provide a link to XML layout.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to have an example that a user can follow along with, unless we have a starter project, this is the only other way to do that given that these are referenced in our examples.

@Laimiux Laimiux closed this Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants