mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-18 10:18:20 +00:00
Fix layout for multi-element rows (e.g. Screenshots).
Demo with standard 3 element row and overflowing 2 element row: https://drive.google.com/drive/folders/1o1gvD3mOxFmVW2vqjn3D1Gukz-ie_kmW?resourcekey=0-bHRsdqpUWITEUo39tAMJDg&usp=sharing Test: Manually with 1, 2, 3, and 4 length rows of 3 screenshots and putting web suggestions into 2 columns. Fix: 247837336 Bug: 239927522 Change-Id: I391beb7a24f189b5e55cb7b65c5ffc8349c83cfc
This commit is contained in:
@@ -42,25 +42,29 @@ public class AllAppsGridAdapter<T extends Context & ActivityContext> extends
|
||||
BaseAllAppsAdapter<T> {
|
||||
|
||||
public static final String TAG = "AppsGridAdapter";
|
||||
private final GridLayoutManager mGridLayoutMgr;
|
||||
private final GridSpanSizer mGridSizer;
|
||||
private final AppsGridLayoutManager mGridLayoutMgr;
|
||||
|
||||
public AllAppsGridAdapter(T activityContext, LayoutInflater inflater,
|
||||
AlphabeticalAppsList apps, BaseAdapterProvider[] adapterProviders) {
|
||||
super(activityContext, inflater, apps, adapterProviders);
|
||||
mGridSizer = new GridSpanSizer();
|
||||
mGridLayoutMgr = new AppsGridLayoutManager(mActivityContext);
|
||||
mGridLayoutMgr.setSpanSizeLookup(mGridSizer);
|
||||
mGridLayoutMgr.setSpanSizeLookup(new GridSpanSizer());
|
||||
setAppsPerRow(activityContext.getDeviceProfile().numShownAllAppsColumns);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the grid layout manager.
|
||||
*/
|
||||
public RecyclerView.LayoutManager getLayoutManager() {
|
||||
public AppsGridLayoutManager getLayoutManager() {
|
||||
return mGridLayoutMgr;
|
||||
}
|
||||
|
||||
/** @return the column index that the given adapter index falls. */
|
||||
public int getSpanIndex(int adapterIndex) {
|
||||
AppsGridLayoutManager lm = getLayoutManager();
|
||||
return lm.getSpanSizeLookup().getSpanIndex(adapterIndex, lm.getSpanCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* A subclass of GridLayoutManager that overrides accessibility values during app search.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user