mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
Pre-inflate BubbleTextViews into Launcher/TaskBar All Apps RV
This CL ensures no inflation of BubbleTextView happens while binding applications, and reduces jank on slow device. 1. Let active/inactive all apps RVs share the same AllAppsRecyclerViewPool 2. Use worker thread to pre-inflate BubbleTextViews and add them to shared view pool on main thread Bug: 287523421 Test: See before/after screenshot/video/trace attached in bug Change-Id: I00213407be2c7c2d329997552785d0aa56c4d057
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.launcher3.allapps;
|
||||
import static com.android.launcher3.allapps.ActivityAllAppsContainerView.AdapterHolder.SEARCH;
|
||||
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_WORK_DISABLED_CARD;
|
||||
import static com.android.launcher3.allapps.BaseAllAppsAdapter.VIEW_TYPE_WORK_EDU_CARD;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_RV_PREINFLATION;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_COUNT;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_PERSONAL_TAB;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_TAP_ON_WORK_TAB;
|
||||
@@ -79,7 +80,6 @@ import com.android.launcher3.keyboard.FocusedItemDecorator;
|
||||
import com.android.launcher3.model.StringCache;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.testing.shared.TestProtocol;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.launcher3.util.Themes;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
@@ -141,7 +141,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
private final SearchTransitionController mSearchTransitionController;
|
||||
private final Paint mHeaderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Rect mInsets = new Rect();
|
||||
private final AllAppsStore mAllAppsStore = new AllAppsStore();
|
||||
private final AllAppsStore mAllAppsStore;
|
||||
private final RecyclerView.OnScrollListener mScrollListener =
|
||||
new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
@@ -194,6 +194,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
public ActivityAllAppsContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
mActivityContext = ActivityContext.lookupContext(context);
|
||||
mAllAppsStore = new AllAppsStore(mActivityContext);
|
||||
|
||||
mScrimColor = Themes.getAttrColor(context, R.attr.allAppsScrimColor);
|
||||
mHeaderThreshold = getResources().getDimensionPixelSize(
|
||||
@@ -559,6 +560,13 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
||||
mAH.get(AdapterHolder.MAIN).setup(mViewPager.getChildAt(0), mPersonalMatcher);
|
||||
mAH.get(AdapterHolder.WORK).setup(mViewPager.getChildAt(1), mWorkManager.getMatcher());
|
||||
mAH.get(AdapterHolder.WORK).mRecyclerView.setId(R.id.apps_list_view_work);
|
||||
if (ENABLE_ALL_APPS_RV_PREINFLATION.get()) {
|
||||
// Let main and work rv share same view pool.
|
||||
((RecyclerView) mViewPager.getChildAt(0))
|
||||
.setRecycledViewPool(mAllAppsStore.getRecyclerViewPool());
|
||||
((RecyclerView) mViewPager.getChildAt(1))
|
||||
.setRecycledViewPool(mAllAppsStore.getRecyclerViewPool());
|
||||
}
|
||||
if (FeatureFlags.ENABLE_EXPANDING_PAUSE_WORK_BUTTON.get()) {
|
||||
mAH.get(AdapterHolder.WORK).mRecyclerView.addOnScrollListener(
|
||||
mWorkManager.newScrollListener());
|
||||
|
||||
Reference in New Issue
Block a user