Merge "Create an alpha letter scroller" into main

This commit is contained in:
Brandon Dayauon authored and Android (Google) Code Review committed 2024-08-26 20:21:17 +00:00
commit 412821fadf
12 files changed
+415 -21

No files matched your search

@@ -29,6 +29,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.ScrollableLayoutManager.PREDICTIVE_BACK_MIN_SCALE;
import static com.android.launcher3.views.RecyclerViewFastScroller.FastScrollerLocation.ALL_APPS_SCROLLER;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -65,6 +66,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
import androidx.annotation.VisibleForTesting;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.graphics.ColorUtils;
import androidx.recyclerview.widget.RecyclerView;
@@ -168,6 +170,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
protected FloatingHeaderView mHeader;
protected View mBottomSheetBackground;
protected RecyclerViewFastScroller mFastScroller;
private ConstraintLayout mFastScrollLetterLayout;
/**
* View that defines the search box. Result is rendered inside {@link #mSearchRecyclerView}.
@@ -282,6 +285,13 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
mSearchRecyclerView = findViewById(R.id.search_results_list_view);
mFastScroller = findViewById(R.id.fast_scroller);
mFastScroller.setPopupView(findViewById(R.id.fast_scroller_popup));
mFastScrollLetterLayout = findViewById(R.id.scroll_letter_layout);
if (Flags.letterFastScroller()) {
// Set clip children to false otherwise the scroller letters will be clipped.
setClipChildren(false);
} else {
setClipChildren(true);
}
mSearchContainer = inflateSearchBar();
if (!isSearchBarFloating()) {
@@ -563,7 +573,8 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
mActivityContext.hideKeyboard();
}
if (mAH.get(currentActivePage).mRecyclerView != null) {
mAH.get(currentActivePage).mRecyclerView.bindFastScrollbar(mFastScroller);
mAH.get(currentActivePage).mRecyclerView.bindFastScrollbar(mFastScroller,
ALL_APPS_SCROLLER);
}
// Header keeps track of active recycler view to properly render header protection.
mHeader.setActiveRV(currentActivePage);
@@ -1500,6 +1511,10 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
}
}
ConstraintLayout getFastScrollerLetterList() {
return mFastScrollLetterLayout;
}
/**
* redraws header protection
*/
@@ -1567,7 +1582,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
void setup(@NonNull View rv, @Nullable Predicate<ItemInfo> matcher) {
mAppsList.updateItemFilter(matcher);
mRecyclerView = (AllAppsRecyclerView) rv;
mRecyclerView.bindFastScrollbar(mFastScroller);
mRecyclerView.bindFastScrollbar(mFastScroller, ALL_APPS_SCROLLER);
mRecyclerView.setEdgeEffectFactory(createEdgeEffectFactory());
mRecyclerView.setApps(mAppsList);
mRecyclerView.setLayoutManager(mLayoutManager);