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

Introduces WorkflowActivityRunner. #248

Merged
merged 1 commit into from
Apr 2, 2019
Merged

Introduces WorkflowActivityRunner. #248

merged 1 commit into from
Apr 2, 2019

Conversation

rjrjr
Copy link
Contributor

@rjrjr rjrjr commented Apr 2, 2019

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

@rjrjr
Copy link
Contributor Author

rjrjr commented Apr 2, 2019

Update fixes various lint checks and compiler warnings.

@rjrjr rjrjr requested a review from loganj April 2, 2019 18:26
Copy link
Collaborator

@zach-klippenstein zach-klippenstein left a 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!

// until this activity is finished.

@Suppress("UNCHECKED_CAST")
val viewModel = ViewModelProviders.of(this, factory)[WorkflowViewModel::class.java]
Copy link
Collaborator

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?

Copy link
Contributor Author

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>

Copy link
Collaborator

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.

Copy link
Contributor Author

@rjrjr rjrjr Apr 2, 2019

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.

Copy link
Collaborator

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.

@rjrjr
Copy link
Contributor Author

rjrjr commented Apr 2, 2019

Update…

  • Adds missing kdoc for WorkflowLayout. (Note that it's an internal class for now.)
  • Changes asParcelable to a function
  • Better name, updated doc on R.id.workflow_activity_layout

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
@rjrjr
Copy link
Contributor Author

rjrjr commented Apr 2, 2019

Update adds a todo to WorkflowViewModel for #252

@rjrjr rjrjr merged commit 972d093 into master Apr 2, 2019
@rjrjr rjrjr deleted the ray/capstone branch April 2, 2019 23:53
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.

3 participants