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

Extract and re-use details screen starting code. #589 #591

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lemonboston
Copy link
Contributor

No description provided.

*
* @author Gabor Keszthelyi
*/
public interface TaskDetailsUi
Copy link
Owner

Choose a reason for hiding this comment

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

The interface looks quite generic. Why not just call it after something that can launch any activity? I mean, how would the same interface for the task editor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, this can be more generic. How about something like this?:

interface Showable<C extends Context>
{
    void show(C context);
}

It could represent a 'meaningful' UI of the app that can be shown. By 'meaningful' I mean that it represents a use-case, like 'details of the task', or like a 'permission request dialog'. Something that makes sense on its own and may be fired/shown independently of the place(s) where it is used.

The followings could be covered by this for example:

  • opening a new screen by starting an Activity (C as Context)
  • showing a DialogFragment (C as Activity to call getFragmentManager())
  • showing a Toast (C as Context)
  • showing a SnackBar (using findViewById(..content) (C as Activity)
  • showing a Notification (using activity.getSystemService(NotificationManager).notify(n)) (C as Context)

Fragment transactions would not be included. (Except for DialogFragment)

Of course we wouldn't need to actually start to use it everywhere, I mentioned them just for the concept.
Let me know if you think that interface makes sense, I would update the code in this PR in that case.

@lemonboston lemonboston force-pushed the mx/589-details-intent branch from 5997f2c to 980c57a Compare January 16, 2018 19:13
@lemonboston
Copy link
Contributor Author

I've updated this with using that Showable interface, and squashed and rebased.

I also noticed however that there are 5 more places in the codebase where Intents are created with Intent.ACTION_VIEW, so those should probably be reviewed as well. But that leads to questions on how we should generally handle these Intents and extras.
So now I am not sure that the changes in this pull request makes sense to merge, it introduces something new in that matter which may be inconsistent with usage elsewhere.

More specifically, we could create Single<Intent>s but I am not sure if that's good. Also, the Box solution (with Keys and Argument) could also effect how it is good to approach this.

It probably makes sense to put this on hold, and discuss it before proceeding.

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.

2 participants