mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
[Search] Support flexible results-per-row in AllApps
Bug: 181987314 Test: Manual Change-Id: Idc3d24dafc42944a7cc925e0991118c86a89b318
This commit is contained in:
@@ -240,20 +240,18 @@ public class AllAppsGridAdapter extends
|
||||
@Override
|
||||
public int getSpanSize(int position) {
|
||||
int viewType = mApps.getAdapterItems().get(position).viewType;
|
||||
int totalSpans = mGridLayoutMgr.getSpanCount();
|
||||
if (isIconViewType(viewType)) {
|
||||
return 1 * SPAN_MULTIPLIER;
|
||||
return totalSpans / mAppsPerRow;
|
||||
} else if (mSearchAdapterProvider.isSearchView(viewType)) {
|
||||
return mSearchAdapterProvider.getGridSpanSize(viewType, mAppsPerRow);
|
||||
return totalSpans / mSearchAdapterProvider.getItemsPerRow(viewType, mAppsPerRow);
|
||||
} else {
|
||||
// Section breaks span the full width
|
||||
return mAppsPerRow * SPAN_MULTIPLIER;
|
||||
return totalSpans;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// multiplier to support adapter item column count that is not mAppsPerRow.
|
||||
public static final int SPAN_MULTIPLIER = 3;
|
||||
|
||||
private final BaseDraggingActivity mLauncher;
|
||||
private final LayoutInflater mLayoutInflater;
|
||||
private final AlphabeticalAppsList mApps;
|
||||
@@ -285,14 +283,17 @@ public class AllAppsGridAdapter extends
|
||||
|
||||
mOnIconClickListener = launcher.getItemOnClickListener();
|
||||
|
||||
setAppsPerRow(mLauncher.getDeviceProfile().inv.numAllAppsColumns);
|
||||
|
||||
mSearchAdapterProvider = searchAdapterProvider;
|
||||
setAppsPerRow(mLauncher.getDeviceProfile().inv.numAllAppsColumns);
|
||||
}
|
||||
|
||||
public void setAppsPerRow(int appsPerRow) {
|
||||
mAppsPerRow = appsPerRow;
|
||||
mGridLayoutMgr.setSpanCount(mAppsPerRow * SPAN_MULTIPLIER);
|
||||
int totalSpans = mAppsPerRow;
|
||||
for (int itemPerRow : mSearchAdapterProvider.getSupportedItemsPerRow()) {
|
||||
totalSpans *= itemPerRow;
|
||||
}
|
||||
mGridLayoutMgr.setSpanCount(totalSpans);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user