diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 5c9c037a62..7be1138b5f 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -94,6 +94,14 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo private final ItemInfoMatcher mWorkMatcher = mPersonalMatcher.negate(); private final AllAppsStore mAllAppsStore = new AllAppsStore(); + private final RecyclerView.OnScrollListener mScrollListener = + new RecyclerView.OnScrollListener() { + @Override + public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { + updateHeaderScroll(((AllAppsRecyclerView) recyclerView).getCurrentScrollY()); + } + }; + private final Paint mNavBarScrimPaint; private int mNavBarScrimHeight = 0; @@ -149,7 +157,6 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo mLauncher.addOnDeviceProfileChangeListener(this); - mSearchAdapterProvider = mLauncher.createSearchAdapterProvider(this); mSearchQueryBuilder = new SpannableStringBuilder(); Selection.setSelection(mSearchQueryBuilder, 0); @@ -676,6 +683,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo anim1.start(); super.onRelease(); } + @Override public void getDrawingRect(Rect outRect) { super.getDrawingRect(outRect); @@ -738,6 +746,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo recyclerView.setHasFixedSize(true); // No animations will occur when changes occur to the items in this RecyclerView. recyclerView.setItemAnimator(null); + recyclerView.addOnScrollListener(mScrollListener); FocusedItemDecorator focusedItemDecorator = new FocusedItemDecorator(recyclerView); recyclerView.addItemDecoration(focusedItemDecorator); adapter.setIconFocusListener(focusedItemDecorator.getFocusListener()); diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index 197d74c401..c6c9c9b72b 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -38,7 +38,6 @@ import androidx.recyclerview.widget.RecyclerView; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.BaseRecyclerView; import com.android.launcher3.DeviceProfile; -import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.logging.StatsLogManager; @@ -53,7 +52,6 @@ import java.util.List; public class AllAppsRecyclerView extends BaseRecyclerView { private static final String TAG = "AllAppsContainerView"; private static final boolean DEBUG = false; - private final Launcher mLauncher; private AlphabeticalAppsList mApps; private final int mNumAppsPerRow; @@ -89,7 +87,6 @@ public class AllAppsRecyclerView extends BaseRecyclerView { R.dimen.all_apps_empty_search_bg_top_offset); mNumAppsPerRow = LauncherAppState.getIDP(context).numColumns; mFastScrollHelper = new AllAppsFastScrollHelper(this); - mLauncher = Launcher.getLauncher(context); } /** @@ -202,12 +199,6 @@ public class AllAppsRecyclerView extends BaseRecyclerView { } } - @Override - public void onScrolled(int dx, int dy) { - super.onScrolled(dx, dy); - mLauncher.getAppsView().updateHeaderScroll(getCurrentScrollY()); - } - @Override public boolean onInterceptTouchEvent(MotionEvent e) { boolean result = super.onInterceptTouchEvent(e);