diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2023-01-27 21:40:27 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2023-01-27 21:40:27 +0000 |
commit | 150b7b04970b4941e60cd79a84a7f6529b5588fa (patch) | |
tree | 17d6165135cbb6d0c56613188aad4d7ab6b444d4 /src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java | |
parent | 6f53364c14b9324fc9b1758e12985bfeec02b033 (diff) | |
parent | 49d153e4bfa96fff5a28d44343443c1754d2b826 (diff) | |
download | Launcher3-150b7b04970b4941e60cd79a84a7f6529b5588fa.tar.gz |
Merge "Removing unnecessary abstraction of AdapterProvider" into tm-qpr-dev
Diffstat (limited to 'src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java')
-rw-r--r-- | src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index 95e61b8a66..3aa9f7c475 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -143,7 +143,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> private boolean mRebindAdaptersAfterSearchAnimation; private int mNavBarScrimHeight = 0; private SearchRecyclerView mSearchRecyclerView; - private SearchAdapterProvider<?> mMainAdapterProvider; + protected SearchAdapterProvider<?> mMainAdapterProvider; private View mBottomSheetHandleArea; private boolean mHasWorkApps; private float[] mBottomSheetCornerRadii; @@ -202,9 +202,12 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> protected void initContent() { mMainAdapterProvider = createMainAdapterProvider(); - mAH.set(AdapterHolder.MAIN, new AdapterHolder(AdapterHolder.MAIN)); - mAH.set(AdapterHolder.WORK, new AdapterHolder(AdapterHolder.WORK)); - mAH.set(SEARCH, new AdapterHolder(SEARCH)); + mAH.set(AdapterHolder.MAIN, new AdapterHolder(AdapterHolder.MAIN, + new AlphabeticalAppsList<>(mActivityContext, mAllAppsStore, null))); + mAH.set(AdapterHolder.WORK, new AdapterHolder(AdapterHolder.WORK, + new AlphabeticalAppsList<>(mActivityContext, mAllAppsStore, mWorkManager))); + mAH.set(SEARCH, new AdapterHolder(SEARCH, + new AlphabeticalAppsList<>(mActivityContext, null, null))); getLayoutInflater().inflate(R.layout.all_apps_content, this); mHeader = findViewById(R.id.all_apps_header); @@ -344,7 +347,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> mAH.get(i).mRecyclerView.scrollToTop(); } } - if (isHeaderVisible()) { + if (mHeader != null && mHeader.getVisibility() == VISIBLE) { mHeader.reset(animate); } // Reset the base recycler view after transitioning home. @@ -627,10 +630,9 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> layoutParams.removeRule(RelativeLayout.ALIGN_PARENT_TOP); } - protected BaseAllAppsAdapter<T> createAdapter(AlphabeticalAppsList<T> appsList, - BaseAdapterProvider[] adapterProviders) { + protected BaseAllAppsAdapter<T> createAdapter(AlphabeticalAppsList<T> appsList) { return new AllAppsGridAdapter<>(mActivityContext, getLayoutInflater(), appsList, - adapterProviders); + mMainAdapterProvider); } // TODO(b/216683257): Remove when Taskbar All Apps supports search. @@ -1001,10 +1003,6 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> return rv == null ? null : rv.getScrollbar(); } - public boolean isHeaderVisible() { - return mHeader != null && mHeader.getVisibility() == View.VISIBLE; - } - /** * Adds an update listener to animator that adds springs to the animation. */ @@ -1155,15 +1153,10 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> final Rect mPadding = new Rect(); AllAppsRecyclerView mRecyclerView; - AdapterHolder(int type) { + AdapterHolder(int type, AlphabeticalAppsList<T> appsList) { mType = type; - mAppsList = new AlphabeticalAppsList<>(mActivityContext, - isSearch() ? null : mAllAppsStore, - isWork() ? mWorkManager : null); - BaseAdapterProvider[] adapterProviders = - new BaseAdapterProvider[]{mMainAdapterProvider}; - - mAdapter = createAdapter(mAppsList, adapterProviders); + mAppsList = appsList; + mAdapter = createAdapter(mAppsList); mAppsList.setAdapter(mAdapter); mLayoutManager = mAdapter.getLayoutManager(); } |