-
Notifications
You must be signed in to change notification settings - Fork 69
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
Introduces WorkflowActivityRunner. #248
Conversation
kotlin/workflow-ui-android/src/main/java/com/squareup/workflow/ui/WorkflowActivityRunner.kt
Show resolved
Hide resolved
Update fixes various lint checks and compiler warnings. |
kotlin/workflow-ui-android/src/main/java/com/squareup/workflow/ui/WorkflowViewModel.kt
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so cool!
kotlin/samples/tictactoe/android/src/main/java/com/squareup/sample/mainactivity/MainActivity.kt
Outdated
Show resolved
Hide resolved
kotlin/workflow-ui-android/src/main/java/com/squareup/workflow/ui/WorkflowActivityRunner.kt
Show resolved
Hide resolved
// until this activity is finished. | ||
|
||
@Suppress("UNCHECKED_CAST") | ||
val viewModel = ViewModelProviders.of(this, factory)[WorkflowViewModel::class.java] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised to see subscripts here since I didn't think ViewModelProviders.of
returned a list. Was the IDE complaining about a .get
call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No list involved here. The complaint is because of the parameter types, we're casting WorkflowViewModel<*, *>
to WorkflowViewModel<O, R>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean seeing […]
looks weird since there's no list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It returns a ViewModelProvider
, which has a get method, and is essentially intended to act as a map of models indexed by the class names. Google's sample docs used this consistently, so I figured I'd do the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that seems fine then. I hadn't seen that the last time I read them.
kotlin/workflow-ui-android/src/main/java/com/squareup/workflow/ui/WorkflowLayout.kt
Show resolved
Hide resolved
Update…
|
One stop shopping to drive your activity from a workflow tree. See the kdoc on [FragmentActivity.setContentWorkflow] in [WorkflowActivityRunner.kt] for details. This API is seriously locked down, suitable only for driving an entire activity. We can open it up as other use cases emerge -- perhaps a `WorkflowViewRunner` for embedding in legacy apps. Closes #217
Update adds a todo to WorkflowViewModel for #252 |
One stop shopping to drive your activity from a workflow tree.
See the kdoc on [FragmentActivity.setContentWorkflow] in
[WorkflowActivityRunner.kt] for details.
This API is seriously locked down, suitable only for driving an entire
activity. We can open it up as other use cases emerge -- perhaps
a
WorkflowViewRunner
for embedding in legacy apps.Closes #217