diff --git a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java index 82ed9621dd..40382b2a45 100644 --- a/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/ActivityAllAppsContainerView.java @@ -934,6 +934,7 @@ public class ActivityAllAppsContainerView public void onDeviceProfileChanged(DeviceProfile dp) { for (AdapterHolder holder : mAH) { holder.mAdapter.setAppsPerRow(dp.numShownAllAppsColumns); + holder.mAppsList.setNumAppsPerRowAllApps(dp.numShownAllAppsColumns); if (holder.mRecyclerView != null) { // Remove all views and clear the pool, while keeping the data same. After this // call, all the viewHolders will be recreated. diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java index 0657178ad5..ee4b5bc5f9 100644 --- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java +++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java @@ -82,7 +82,7 @@ public class AlphabeticalAppsList implement private final ArrayList mSearchResults = new ArrayList<>(); private BaseAllAppsAdapter mAdapter; private AppInfoComparator mAppNameComparator; - private final int mNumAppsPerRowAllApps; + private int mNumAppsPerRowAllApps; private int mNumAppRowsInAdapter; private Predicate mItemFilter; @@ -92,12 +92,17 @@ public class AlphabeticalAppsList implement mActivityContext = ActivityContext.lookupContext(context); mAppNameComparator = new AppInfoComparator(context); mWorkProviderManager = workProfileManager; - mNumAppsPerRowAllApps = mActivityContext.getDeviceProfile().inv.numAllAppsColumns; + mNumAppsPerRowAllApps = mActivityContext.getDeviceProfile().numShownAllAppsColumns; if (mAllAppsStore != null) { mAllAppsStore.addUpdateListener(this); } } + /** Set the number of apps per row when device profile changes. */ + public void setNumAppsPerRowAllApps(int numAppsPerRow) { + mNumAppsPerRowAllApps = numAppsPerRow; + } + public void updateItemFilter(Predicate itemFilter) { this.mItemFilter = itemFilter; onAppsUpdated();