Commit 21d2ff72 authored by Jinsuk Kim's avatar Jinsuk Kim Committed by Commit Bot

Android: Fix for wrong gesture navigation sheet UI

This is a speculative fix for the report bugs on navigation sheet UI
working wrong, which is hard to repro locally. NavigationSheet view is
based on ListView that might not be guaranteed to work when
reused. This CL creates a new ListView for displaying the navigation
history entry list for each request.

Bug: 1007049, 1009059
Change-Id: Ibc0a65095e1c3f6b2cf06eede0db915755842053
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1831620Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Jinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701841}
parent 25a48a5b
......@@ -59,7 +59,6 @@ class NavigationSheetCoordinator implements BottomSheetContent, NavigationSheet
// his finger. Any delta smaller than (or equal to) than this are ignored.
private static final float DELTA_IGNORE = 2.f;
private final NavigationSheetView mContentView;
private final View mToolbarView;
private final LayoutInflater mLayoutInflater;
private final Supplier<BottomSheetController> mBottomSheetController;
......@@ -97,6 +96,8 @@ class NavigationSheetCoordinator implements BottomSheetContent, NavigationSheet
}
}
private NavigationSheetView mContentView;
private boolean mForward;
private boolean mShowCloseIndicator;
......@@ -119,8 +120,6 @@ class NavigationSheetCoordinator implements BottomSheetContent, NavigationSheet
Context context = parent.getContext();
mLayoutInflater = LayoutInflater.from(context);
mToolbarView = mLayoutInflater.inflate(R.layout.navigation_sheet_toolbar, null);
mContentView =
(NavigationSheetView) mLayoutInflater.inflate(R.layout.navigation_sheet, null);
mMediator = new NavigationSheetMediator(context, mModelList, (position, index) -> {
mDelegate.navigateToIndex(index);
close(false);
......@@ -134,8 +133,6 @@ class NavigationSheetCoordinator implements BottomSheetContent, NavigationSheet
mModelAdapter.registerType(NAVIGATION_LIST_ITEM_TYPE_ID, () -> {
return mLayoutInflater.inflate(R.layout.navigation_popup_item, null);
}, NavigationItemViewBinder::bind);
ListView listview = (ListView) mContentView.findViewById(R.id.navigation_entries);
listview.setAdapter(mModelAdapter);
mOpenSheetRunnable = () -> {
if (isHidden()) openSheet(false, true);
};
......@@ -154,9 +151,12 @@ class NavigationSheetCoordinator implements BottomSheetContent, NavigationSheet
// Transition to either peeked or expanded state.
private void openSheet(boolean fullyExpand, boolean animate) {
mContentView =
(NavigationSheetView) mLayoutInflater.inflate(R.layout.navigation_sheet, null);
ListView listview = (ListView) mContentView.findViewById(R.id.navigation_entries);
listview.setAdapter(mModelAdapter);
NavigationHistory history = mDelegate.getHistory(mForward);
mMediator.populateEntries(history);
mContentView.requestListViewLayout();
mBottomSheetController.get().requestShowContent(this, true);
mBottomSheetController.get().getBottomSheet().addObserver(mSheetObserver);
mSheetTriggered = true;
......
......@@ -35,13 +35,6 @@ public class NavigationSheetView extends RelativeLayout {
return v == null ? 0 : -(v.getTop() - mListView.getPaddingTop());
}
/**
* Request layout for the containing listview.
*/
void requestListViewLayout() {
mListView.requestLayout();
}
@Override
public void onFinishInflate() {
super.onFinishInflate();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment