diff --git a/res/values/dimens.xml b/res/values/dimens.xml index d041dfe52b..321aef5c19 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -93,6 +93,8 @@ --> 58dp -26dp + + 4dp 500dp @@ -139,11 +141,6 @@ 2dp 10dp - - 3dp - 16dp - 6dp - 8dp diff --git a/src/com/android/launcher3/FastScrollRecyclerView.java b/src/com/android/launcher3/FastScrollRecyclerView.java index 2f927d3142..3504b24cb8 100644 --- a/src/com/android/launcher3/FastScrollRecyclerView.java +++ b/src/com/android/launcher3/FastScrollRecyclerView.java @@ -77,11 +77,15 @@ public abstract class FastScrollRecyclerView extends RecyclerView { return getPaddingTop(); } + public int getScrollBarMarginBottom() { + return getPaddingBottom(); + } + /** * Returns the height of the fast scroll bar */ public int getScrollbarTrackHeight() { - return mScrollbar.getHeight() - getScrollBarTop() - getPaddingBottom(); + return mScrollbar.getHeight() - getScrollBarTop() - getScrollBarMarginBottom(); } /** diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index 3aa9f7c475..3bb8fb4391 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -215,9 +215,9 @@ public class ActivityAllAppsContainerView mBottomSheetHandleArea = findViewById(R.id.bottom_sheet_handle_area); mSearchRecyclerView = findViewById(R.id.search_results_list_view); - // Add the search box next to the header + // Add the search box above everything else. mSearchContainer = inflateSearchBox(); - addView(mSearchContainer, indexOfChild(mHeader) + 1); + addView(mSearchContainer); mSearchUiManager = (SearchUiManager) mSearchContainer; } @@ -469,6 +469,16 @@ public class ActivityAllAppsContainerView } setupHeader(); + if (FeatureFlags.ENABLE_FLOATING_SEARCH_BAR.get()) { + // Keep the scroller above the search bar. + RelativeLayout.LayoutParams scrollerLayoutParams = + (LayoutParams) findViewById(R.id.fast_scroller).getLayoutParams(); + scrollerLayoutParams.addRule(RelativeLayout.ABOVE, R.id.search_container_all_apps); + scrollerLayoutParams.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM); + scrollerLayoutParams.bottomMargin = getResources().getDimensionPixelSize( + R.dimen.fastscroll_bottom_margin_floating_search); + } + mAllAppsStore.registerIconContainer(mAH.get(AdapterHolder.MAIN).mRecyclerView); mAllAppsStore.registerIconContainer(mAH.get(AdapterHolder.WORK).mRecyclerView); mAllAppsStore.registerIconContainer(mAH.get(AdapterHolder.SEARCH).mRecyclerView); diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index 7789191370..6b45fe64b2 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -261,12 +261,19 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView { } } + @Override public int getScrollBarTop() { return ActivityContext.lookupContext(getContext()).getAppsView().isSearchSupported() ? getResources().getDimensionPixelOffset(R.dimen.all_apps_header_top_padding) : 0; } + @Override + public int getScrollBarMarginBottom() { + return getRootWindowInsets() == null ? 0 + : getRootWindowInsets().getSystemWindowInsetBottom(); + } + public RecyclerViewFastScroller getScrollbar() { return mScrollbar; }