Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upIssue/4727 notifs detail view horizontal navigation #4796
Conversation
|
I found an issue where the details screen can be blank upon screen rotation.
|
|
Hey @nbradbury - Since you've worked with the |
|
Howdy @daniloercoli, sure I'll take a look later today. In the meantime, now that I see this I think we should reconsider the left/right icons in the toolbar. This isn't the only area of the app that uses a ViewPager (the reader being the obvious other place), and I think we'll want a consistent UI for letting the user know they can move between pages. I don't see the left/right icons working well in the reader since there are already a couple of toolbar icons there. I think what we really want is to simply let the user know they can swipe between pages - once they know they can do it, it's much easier than tapping an icon. I think the USA Today app handles this nicely. The first few times you open an article, a snackbar-ish message animates in at the bottom of the screen letting you know you can swipe. Once you swipe, it animates back out. What do we think about that approach instead? |
|
I agree with you @nbradbury, and the proposed solution looks much nicer. Curious to hear what @drw158 thinks about it. /cc @kwonye |
It looks like this ViewPager adapter is based on the one I coded for the reader a while ago, and that has been pretty reliable. I do recommend adding this change, though, to address this Android bug. Note, also, that the use of |
That will be a tough one. I needed to use getChildFragmentManager addresses exactly that kind of situation) than implementing the feature itself.
That said, I believe a workaround could be using tags for fragments (so we can search for them individually as opposed to what happens with xml ids), but we'd have to take care of fragment states and pages artificially, outside the fragment manager to circumvent this problem. Any thoughts are appreciated |
|
let's blame the jet lag - looking a bit closer this should be in in the support libraries. Let me get back to this later. |
|
re: not using the left/right arrows on the action bar, and instead using the toast/snackbar to inform the user they have the option to swipe to navigate through notifications, I love that. I'd definitely go that way unless @kwonye or @drw158 feel differently |
|
Also, if we go the way @nbradbury suggests, maybe we'd like to just keep the EDIT button where it was? (check this #4782) @kwonye @drw158 |
|
My memory is fuzzy, but I remember we were using ChildFragments in Stats, and switched to using "normal" Android Fragments and tags. |
|
Just opened a new PR for discussing the support library usage and related topics here #4806 . |
|
Using a notice to inform the user that they can swipe seems like a great idea. No need for the navigation buttons in that case. Seems more natural for iOS to have the navigation buttons, maybe that's just because it's a standard set by Mail.app. I'm ok that Android and iOS are different in this area. |
|
Thank you @drw158 ! Going that way then. |
…r, so we are sure to change the right fragment in fragment transaction without the need to use the ChildFragmentManager which is only available on API level 17+
…nce user does first use swipe
|
Thank you @nbradbury ! made these changes here 61b4f76 |
| super.onStart(); | ||
| //if the user hasn't used swipe yet, hint the user they can navigate through notifications detail | ||
| //using swipe on the ViewPager | ||
| if (!AppPrefs.isSwipeToNavigateShown()) { |
This comment has been minimized.
This comment has been minimized.
nbradbury
Nov 22, 2016
Contributor
Are there situations where only one note is shown, so there's no swiping? If so, we should make sure not to show this snackbar in those situations.
This comment has been minimized.
This comment has been minimized.
| getFragmentManager().invalidateOptionsMenu(); | ||
| } | ||
|
|
||
| private void setIdForCommentContainer(){ | ||
| if (mComment != null && mCommentContentLayout != null) { | ||
| mCommentContentLayout.setId((int)mComment.commentID); |
This comment has been minimized.
This comment has been minimized.
daniloercoli
Nov 22, 2016
Contributor
Note that a comment could have a value for the ID field that overflows MAX_INT.
Can we use setTag and getTag to avoid potential issues where 2 comments have IDs > MAX_INT.
This comment has been minimized.
This comment has been minimized.
mzorz
Nov 22, 2016
Author
Contributor
A note on using tags vs IDs, the fragment transaction needs the container id where to add the fragment to, and there doesn't seem to be a way to replace the container contents without knowing its id in FragmentManager (though this artifact we're making by having a different ID for each viewpager page's container is handled seamlessly by the manager returned by getChildFragmentManager, which is the main purpose of its existence, i.e. handling nested fragments). Setting a tag to find it by tag later then having to set the id anyways seems dumb, so what I did is I'm generating an id with a base id plus the Note position index in the notes adapter array to make probability of id collision low (while it is theoretically possible, I don't think it'll ever happen in practice, as we'd have to have a list of more than 65535 items in the notifications list...)
BTW there is also an API to generate a unique id on runtime, but it's also only available since API level 17, which is what we were trying to avoid in the first place
Commit addressing all this here 8da2cea
| import android.support.v7.app.ActionBar; | ||
| import android.support.v7.app.AppCompatActivity; | ||
| import android.text.TextUtils; | ||
| import android.view.MenuItem; | ||
| import android.view.View; |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| @@ -11,16 +11,16 @@ | |||
| * zoom & depth are based on examples here, with many fixes and simplifications: | |||
| * http://developer.android.com/training/animation/screen-slide.html#pagetransformer | |||
| */ | |||
| class ReaderViewPagerTransformer implements ViewPager.PageTransformer { | |||
| enum TransformType { | |||
| public class ReaderViewPagerTransformer implements ViewPager.PageTransformer { | |||
This comment has been minimized.
This comment has been minimized.
daniloercoli
Nov 22, 2016
Contributor
We should move this class to Widgets (or Utils) and call it WPViewPagerTransformer.
This comment has been minimized.
This comment has been minimized.
| @@ -855,6 +855,8 @@ | |||
| <string name="follows">Follows</string> | |||
| <string name="notifications_label_new_notifications">New notifications</string> | |||
| <string name="notifications_label_new_notifications_subtitle">Tap to show them</string> | |||
| <string name="notifications_label_swipe_for_more_snackbar">Swipe for more notifications</string> | |||
| <string name="notifications_label_swipe_snackbar_dont_show_again">OKAY</string> | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…ment
|
I'll defer to everyones' judgement here: design's Thanks @drw158 for the feedback! |
|
This is ready for a (I guess final) review @daniloercoli ! |
…ank-screen-resumed Deleted notification can result in blank screen when resumed
| @@ -420,6 +433,13 @@ private void setNoteWithNoteId(String noteId) { | |||
| setRemoteBlogId(note.getSiteId()); | |||
| } | |||
|
|
|||
| private void setIdForFragmentContainer(int id){ | |||
This comment has been minimized.
This comment has been minimized.
daniloercoli
Nov 23, 2016
Contributor
What do you think if we remove this method and move the assignment mIdForFragmentContainer = id; in newInstance ? Since it's called only there, and the name of this method is quite similar to setIdForCommentContainer confusing me a bit at the beginning of the review.
This comment has been minimized.
This comment has been minimized.
mzorz
Nov 23, 2016
Author
Contributor
uhm not sure what you mean - newInstance is a static method that creates a new instance of CommentDetailFragment, and performs any relevant parameter initialization by using its setter methods (such as setNoteWithNoteId, or setReplyText or setIdForFragmentContainer). Should stay as is FWIW
This comment has been minimized.
This comment has been minimized.
| @@ -124,6 +124,7 @@ | |||
| NOTIFICATION_UNLIKED, | |||
| NOTIFICATION_TRASHED, | |||
| NOTIFICATION_FLAGGED_AS_SPAM, | |||
| NOTIFICATION_SWIPE_PAGE_CHANGED, | |||
This comment has been minimized.
This comment has been minimized.
daniloercoli
Nov 23, 2016
Contributor
We should bump Analytics for this new event in both AnalyticsTrackerMixpanel and AnalyticsTrackerNosara. Please read the documentation about adding new events (or ping me in Slack) before setting a name for this event.
This comment has been minimized.
This comment has been minimized.
mzorz
Nov 23, 2016
Author
Contributor
Thanks a lot for your explanation and directions on chat! addressed in 9651cdf - would you take another look please?
|
I see this following crash upon device rotation:
|
|
gotcha - let me check it out right away. |
|
addressed crash in commit 6210d32 |
|
|



mzorz commentedNov 17, 2016
Fixes #4727
This PR implements 2 ways to horizontally navigate through Notifications detail:
To test:
See video here https://cloudup.com/cBZOd5sFriD
cc @daniloercoli @jleandroperez @kwonye