Merge "Refresh mNumAppsPerRowAllApps when device profile changes." into udc-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9235ef85ce
@@ -934,6 +934,7 @@ public class ActivityAllAppsContainerView<T extends Context & ActivityContext>
|
|||||||
public void onDeviceProfileChanged(DeviceProfile dp) {
|
public void onDeviceProfileChanged(DeviceProfile dp) {
|
||||||
for (AdapterHolder holder : mAH) {
|
for (AdapterHolder holder : mAH) {
|
||||||
holder.mAdapter.setAppsPerRow(dp.numShownAllAppsColumns);
|
holder.mAdapter.setAppsPerRow(dp.numShownAllAppsColumns);
|
||||||
|
holder.mAppsList.setNumAppsPerRowAllApps(dp.numShownAllAppsColumns);
|
||||||
if (holder.mRecyclerView != null) {
|
if (holder.mRecyclerView != null) {
|
||||||
// Remove all views and clear the pool, while keeping the data same. After this
|
// Remove all views and clear the pool, while keeping the data same. After this
|
||||||
// call, all the viewHolders will be recreated.
|
// call, all the viewHolders will be recreated.
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
|||||||
private final ArrayList<AdapterItem> mSearchResults = new ArrayList<>();
|
private final ArrayList<AdapterItem> mSearchResults = new ArrayList<>();
|
||||||
private BaseAllAppsAdapter<T> mAdapter;
|
private BaseAllAppsAdapter<T> mAdapter;
|
||||||
private AppInfoComparator mAppNameComparator;
|
private AppInfoComparator mAppNameComparator;
|
||||||
private final int mNumAppsPerRowAllApps;
|
private int mNumAppsPerRowAllApps;
|
||||||
private int mNumAppRowsInAdapter;
|
private int mNumAppRowsInAdapter;
|
||||||
private Predicate<ItemInfo> mItemFilter;
|
private Predicate<ItemInfo> mItemFilter;
|
||||||
|
|
||||||
@@ -92,12 +92,17 @@ public class AlphabeticalAppsList<T extends Context & ActivityContext> implement
|
|||||||
mActivityContext = ActivityContext.lookupContext(context);
|
mActivityContext = ActivityContext.lookupContext(context);
|
||||||
mAppNameComparator = new AppInfoComparator(context);
|
mAppNameComparator = new AppInfoComparator(context);
|
||||||
mWorkProviderManager = workProfileManager;
|
mWorkProviderManager = workProfileManager;
|
||||||
mNumAppsPerRowAllApps = mActivityContext.getDeviceProfile().inv.numAllAppsColumns;
|
mNumAppsPerRowAllApps = mActivityContext.getDeviceProfile().numShownAllAppsColumns;
|
||||||
if (mAllAppsStore != null) {
|
if (mAllAppsStore != null) {
|
||||||
mAllAppsStore.addUpdateListener(this);
|
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<ItemInfo> itemFilter) {
|
public void updateItemFilter(Predicate<ItemInfo> itemFilter) {
|
||||||
this.mItemFilter = itemFilter;
|
this.mItemFilter = itemFilter;
|
||||||
onAppsUpdated();
|
onAppsUpdated();
|
||||||
|
|||||||
Reference in New Issue
Block a user