Launcher3: Use 2 rows for smartspace in 5x7 grid

Otherwise it doesn't fit in most cases.

Change-Id: I6b842613e17eeeab1bd8e78846362aa80d26f791
This commit is contained in:
Adithya R 2023-11-07 19:19:46 +05:30 committed by fazilsheik96
parent a062daf025
commit 4eb6dc518d
6 changed files with 16 additions and 4 deletions

View File

@ -146,6 +146,8 @@
<attr name="numRows" format="integer" />
<attr name="numColumns" format="integer" />
<!-- numSearchContainerRows defaults to 1, if not specified -->
<attr name="numSearchContainerRows" format="integer" />
<!-- numSearchContainerColumns defaults to numColumns, if not specified -->
<attr name="numSearchContainerColumns" format="integer" />

View File

@ -231,6 +231,7 @@
launcher:name="5_by_7"
launcher:numRows="7"
launcher:numColumns="5"
launcher:numSearchContainerRows="2"
launcher:numFolderRows="6"
launcher:numFolderColumns="4"
launcher:numHotseatIcons="5"

View File

@ -1590,6 +1590,8 @@ public class DeviceProfile {
writer.println(prefix + "\tinv.numRows: " + inv.numRows);
writer.println(prefix + "\tinv.numColumns: " + inv.numColumns);
writer.println(prefix + "\tinv.numSearchContainerRows: "
+ inv.numSearchContainerRows);
writer.println(prefix + "\tinv.numSearchContainerColumns: "
+ inv.numSearchContainerColumns);

View File

@ -128,6 +128,7 @@ public class InvariantDeviceProfile implements OnSharedPreferenceChangeListener
*/
public int numRows;
public int numColumns;
public int numSearchContainerRows;
public int numSearchContainerColumns;
/**
@ -365,6 +366,7 @@ public class InvariantDeviceProfile implements OnSharedPreferenceChangeListener
GridOption closestProfile = displayOption.grid;
numRows = closestProfile.numRows;
numColumns = closestProfile.numColumns;
numSearchContainerRows = closestProfile.numSearchContainerRows;
numSearchContainerColumns = closestProfile.numSearchContainerColumns;
dbFile = closestProfile.dbFile;
defaultLayoutId = closestProfile.defaultLayoutId;
@ -489,8 +491,9 @@ public class InvariantDeviceProfile implements OnSharedPreferenceChangeListener
private Object[] toModelState() {
return new Object[]{
numColumns, numRows, numSearchContainerColumns, numDatabaseHotseatIcons,
iconPack, iconBitmapSize, fillResIconDpi, numDatabaseAllAppsColumns, dbFile};
numColumns, numRows, numSearchContainerRows, numSearchContainerColumns,
numDatabaseHotseatIcons, iconPack, iconBitmapSize, fillResIconDpi,
numDatabaseAllAppsColumns, dbFile};
}
private void onConfigChanged(Context context) {
@ -801,6 +804,7 @@ public class InvariantDeviceProfile implements OnSharedPreferenceChangeListener
public final String name;
public final int numRows;
public final int numColumns;
public final int numSearchContainerRows;
public final int numSearchContainerColumns;
public final int deviceCategory;
@ -834,6 +838,8 @@ public class InvariantDeviceProfile implements OnSharedPreferenceChangeListener
name = a.getString(R.styleable.GridDisplayOption_name);
numRows = a.getInt(R.styleable.GridDisplayOption_numRows, 0);
numColumns = a.getInt(R.styleable.GridDisplayOption_numColumns, 0);
numSearchContainerRows = a.getInt(
R.styleable.GridDisplayOption_numSearchContainerRows, 1);
numSearchContainerColumns = a.getInt(
R.styleable.GridDisplayOption_numSearchContainerColumns, numColumns);

View File

@ -607,7 +607,8 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
}
int cellHSpan = mLauncher.getDeviceProfile().inv.numSearchContainerColumns;
CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, cellHSpan, 1);
int cellVSpan = mLauncher.getDeviceProfile().inv.numSearchContainerRows;
CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, cellHSpan, cellVSpan);
lp.canReorder = false;
if (!firstPage.addViewToCellLayout(
mFirstPagePinnedItem, 0, R.id.search_container_workspace, lp, true)) {

View File

@ -541,7 +541,7 @@ public class LoaderCursor extends CursorWrapper {
// occupied (if the feature is enabled) in order to account for the search
// container.
int spanX = mIDP.numSearchContainerColumns;
int spanY = 1;
int spanY = mIDP.numSearchContainerRows;
screen.markCells(0, 0, spanX, spanY, true);
}
mOccupied.put(item.screenId, screen);