Coordinate scrolling between two lists on contact card
FRAGMENT CHANGES: - Add a method on each of these fragments to scroll the list by a given offset (only when the first "fake" item in the list is at the first visible position on the list). If any other item (2nd, 3rd, etc..) is the first visible position on the list, then it gets too complicated to figure out how much to offset the list, so it's better to just animate the tab carousel to be at the right spot. - Add a method that returns the top position of the first item in the list if the first item in list is visible (to verify that the offset was done properly). If the offset is not what we expect, then we know the list couldn't be scrolled. TAB CAROUSEL: - Keep track of the Y position of the carousel the last time the user was on the details page, and the last time the user was on the updates page. This is because syncing the scroll position of the 2 lists or animating the tab carousel vertically is only necessary if the tab carousel position has changed between the two pages. LAYOUT CONTROLLER: - We need to be able to animate the tab carousel to the correct Y position anyways because if the list in the fragment is not scrollable (but the other list is scrollable), we need to rely on animation to hide the big white space below the carousel. - When a list (i.e. in the ContactDetailFragment) is idle, the user has stopped interacting with the list, so use the time to sync its position with the other list (since this may involve a requestLayout() if a scroll is triggered). - Because the list may not become completely idle (i.e. the user flings the list and then starts to swipe), we still need a check when the user starts swiping the view pager to sync the two lists. If it's already at the right spot, then do nothing. If we can't scroll the other list dynamically and we need to animate the tab carousel, and we should only do this when the view pager has settled down and is idle. MISCELLANEOUSE EDGE CASES: - Fix the tab carousel jumping to the starting position (if a sync happens and the loader data is refreshed) because the layout is likely being redrawn and the tab carousel is potentially redrawn back inside the bounds of its parent. Hence store and reset the tab carousel position to its previous Y value (which could be outside the bounds of its parent). - If the list is scrollable but only by a little bit, allow the tab carousel to compensate by animating down the rest of the offset amount - Tapping on the tab should also work now - Make photo in updates tab fill the whole tab, change updates fragment background except for the tablet landscape mode Bug: 5044680 Change-Id: Icc9445606ea52779dea97b194763c74a0b2a27ee
Loading
Please register or sign in to comment