Loading src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +5 −3 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.keyboard.FocusedItemDecorator; import com.android.launcher3.model.StringCache; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.recyclerview.AllAppsRecyclerViewPool; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.Themes; import com.android.launcher3.views.ActivityContext; Loading @@ -93,7 +94,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.function.Predicate; import java.util.stream.Stream; /** * All apps container view with search support for use in a dragging activity. Loading Loading @@ -623,16 +623,18 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> private static void setUpCustomRecyclerViewPool( @NonNull AllAppsRecyclerView mainRecyclerView, @Nullable AllAppsRecyclerView workRecyclerView, @NonNull RecyclerView.RecycledViewPool recycledViewPool) { @NonNull AllAppsRecyclerViewPool recycledViewPool) { if (!ENABLE_ALL_APPS_RV_PREINFLATION.get()) { return; } final boolean hasWorkProfile = workRecyclerView != null; recycledViewPool.setHasWorkProfile(hasWorkProfile); mainRecyclerView.setRecycledViewPool(recycledViewPool); if (workRecyclerView != null) { workRecyclerView.setRecycledViewPool(recycledViewPool); } if (ALL_APPS_GONE_VISIBILITY.get()) { mainRecyclerView.updatePoolSize(); mainRecyclerView.updatePoolSize(hasWorkProfile); } } Loading src/com/android/launcher3/allapps/AllAppsRecyclerView.java +7 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,10 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView { } protected void updatePoolSize() { updatePoolSize(false); } void updatePoolSize(boolean hasWorkProfile) { DeviceProfile grid = ActivityContext.lookupContext(getContext()).getDeviceProfile(); RecyclerView.RecycledViewPool pool = getRecycledViewPool(); pool.setMaxRecycledViews(AllAppsGridAdapter.VIEW_TYPE_EMPTY_SEARCH, 1); Loading @@ -111,6 +115,9 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView { maxPoolSizeForAppIcons += PREINFLATE_ICONS_ROW_COUNT * grid.numShownAllAppsColumns + EXTRA_ICONS_COUNT; } if (hasWorkProfile) { maxPoolSizeForAppIcons *= 2; } pool.setMaxRecycledViews( AllAppsGridAdapter.VIEW_TYPE_ICON, maxPoolSizeForAppIcons); } Loading src/com/android/launcher3/allapps/AllAppsStore.java +1 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.RecyclerView.RecycledViewPool; import com.android.launcher3.BubbleTextView; import com.android.launcher3.model.data.AppInfo; Loading Loading @@ -110,7 +109,7 @@ public class AllAppsStore<T extends Context & ActivityContext> { } } RecycledViewPool getRecyclerViewPool() { AllAppsRecyclerViewPool getRecyclerViewPool() { return mAllAppsRecyclerViewPool; } Loading src/com/android/launcher3/recyclerview/AllAppsRecyclerViewPool.kt +5 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ class AllAppsRecyclerViewPool<T> : RecycledViewPool() { private var future: Future<Void>? = null var hasWorkProfile = false /** * Preinflate app icons. If all apps RV cannot be scrolled down, we don't need to preinflate. */ Loading Loading @@ -95,6 +97,9 @@ class AllAppsRecyclerViewPool<T> : RecycledViewPool() { val grid = ActivityContext.lookupContext<T>(context).deviceProfile targetPreinflateCount += grid.maxAllAppsRowCount * grid.numShownAllAppsColumns } if (hasWorkProfile) { targetPreinflateCount *= 2 } val existingPreinflateCount = getRecycledViewCount(BaseAllAppsAdapter.VIEW_TYPE_ICON) return targetPreinflateCount - existingPreinflateCount } Loading Loading
src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +5 −3 Original line number Diff line number Diff line Loading @@ -80,6 +80,7 @@ import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.keyboard.FocusedItemDecorator; import com.android.launcher3.model.StringCache; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.recyclerview.AllAppsRecyclerViewPool; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.Themes; import com.android.launcher3.views.ActivityContext; Loading @@ -93,7 +94,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.function.Predicate; import java.util.stream.Stream; /** * All apps container view with search support for use in a dragging activity. Loading Loading @@ -623,16 +623,18 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext> private static void setUpCustomRecyclerViewPool( @NonNull AllAppsRecyclerView mainRecyclerView, @Nullable AllAppsRecyclerView workRecyclerView, @NonNull RecyclerView.RecycledViewPool recycledViewPool) { @NonNull AllAppsRecyclerViewPool recycledViewPool) { if (!ENABLE_ALL_APPS_RV_PREINFLATION.get()) { return; } final boolean hasWorkProfile = workRecyclerView != null; recycledViewPool.setHasWorkProfile(hasWorkProfile); mainRecyclerView.setRecycledViewPool(recycledViewPool); if (workRecyclerView != null) { workRecyclerView.setRecycledViewPool(recycledViewPool); } if (ALL_APPS_GONE_VISIBILITY.get()) { mainRecyclerView.updatePoolSize(); mainRecyclerView.updatePoolSize(hasWorkProfile); } } Loading
src/com/android/launcher3/allapps/AllAppsRecyclerView.java +7 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,10 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView { } protected void updatePoolSize() { updatePoolSize(false); } void updatePoolSize(boolean hasWorkProfile) { DeviceProfile grid = ActivityContext.lookupContext(getContext()).getDeviceProfile(); RecyclerView.RecycledViewPool pool = getRecycledViewPool(); pool.setMaxRecycledViews(AllAppsGridAdapter.VIEW_TYPE_EMPTY_SEARCH, 1); Loading @@ -111,6 +115,9 @@ public class AllAppsRecyclerView extends FastScrollRecyclerView { maxPoolSizeForAppIcons += PREINFLATE_ICONS_ROW_COUNT * grid.numShownAllAppsColumns + EXTRA_ICONS_COUNT; } if (hasWorkProfile) { maxPoolSizeForAppIcons *= 2; } pool.setMaxRecycledViews( AllAppsGridAdapter.VIEW_TYPE_ICON, maxPoolSizeForAppIcons); } Loading
src/com/android/launcher3/allapps/AllAppsStore.java +1 −2 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.RecyclerView.RecycledViewPool; import com.android.launcher3.BubbleTextView; import com.android.launcher3.model.data.AppInfo; Loading Loading @@ -110,7 +109,7 @@ public class AllAppsStore<T extends Context & ActivityContext> { } } RecycledViewPool getRecyclerViewPool() { AllAppsRecyclerViewPool getRecyclerViewPool() { return mAllAppsRecyclerViewPool; } Loading
src/com/android/launcher3/recyclerview/AllAppsRecyclerViewPool.kt +5 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ class AllAppsRecyclerViewPool<T> : RecycledViewPool() { private var future: Future<Void>? = null var hasWorkProfile = false /** * Preinflate app icons. If all apps RV cannot be scrolled down, we don't need to preinflate. */ Loading Loading @@ -95,6 +97,9 @@ class AllAppsRecyclerViewPool<T> : RecycledViewPool() { val grid = ActivityContext.lookupContext<T>(context).deviceProfile targetPreinflateCount += grid.maxAllAppsRowCount * grid.numShownAllAppsColumns } if (hasWorkProfile) { targetPreinflateCount *= 2 } val existingPreinflateCount = getRecycledViewCount(BaseAllAppsAdapter.VIEW_TYPE_ICON) return targetPreinflateCount - existingPreinflateCount } Loading