summaryrefslogtreecommitdiff
path: root/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2023-01-25 10:24:18 -0800
committerSunny Goyal <sunnygoyal@google.com>2023-01-27 16:55:55 +0000
commit49d153e4bfa96fff5a28d44343443c1754d2b826 (patch)
treefd6131c8ec287fe8e35d0dc9e306932a0de80a7f /src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java
parentdbc5e56e074bcabc22465734b9eedb4e951e5653 (diff)
downloadLauncher3-49d153e4bfa96fff5a28d44343443c1754d2b826.tar.gz
Removing unnecessary abstraction of AdapterProvider
Bug: 266605714 Test: Presubmit Change-Id: Ib5ccecc33e66e61cb27d083591c8fb7c13a96698 Merged-In: Ib5ccecc33e66e61cb27d083591c8fb7c13a96698
Diffstat (limited to 'src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java')
-rw-r--r--src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java33
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 8a02a5452e..cb659ea001 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.
@@ -625,10 +628,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.
@@ -999,10 +1001,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.
*/
@@ -1153,15 +1151,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();
}