mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-19 10:48:19 +00:00
Add support for having more hotseat icons in the DB than we show
Split InvariantDeviceProfile#numHotseatIcons into two variables: numDatabaseHotseatIcons and numShownHotseatIcons. These are generally the same, but different DisplayOptions within the same GridOption can choose to show different numbers of hotseat icons while sharing the same database. numDatabaseHotseatIcons is used for all reading/writing/migrating purposes, while numShownHotseatIcons determines how many Hotseat icons to show in the UI. Test: Existing tests pass, added two new migration tests Bug: 184789479 Bug: 171917176 Change-Id: I54583504f61a47a4444b6a637ebb7e3ab31528b7
This commit is contained in:
@@ -110,7 +110,7 @@ public class GridSizeMigrationTaskV2 {
|
||||
String gridSizeString = getPointString(idp.numColumns, idp.numRows);
|
||||
|
||||
return !gridSizeString.equals(prefs.getString(KEY_MIGRATION_SRC_WORKSPACE_SIZE, ""))
|
||||
|| idp.numHotseatIcons != prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, -1);
|
||||
|| idp.numDatabaseHotseatIcons != prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, -1);
|
||||
}
|
||||
|
||||
/** See {@link #migrateGridIfNeeded(Context, InvariantDeviceProfile)} */
|
||||
@@ -148,7 +148,8 @@ public class GridSizeMigrationTaskV2 {
|
||||
SharedPreferences prefs = Utilities.getPrefs(context);
|
||||
String gridSizeString = getPointString(idp.numColumns, idp.numRows);
|
||||
HashSet<String> validPackages = getValidPackages(context);
|
||||
int srcHotseatCount = prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, idp.numHotseatIcons);
|
||||
int srcHotseatCount = prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT,
|
||||
idp.numDatabaseHotseatIcons);
|
||||
|
||||
if (migrateForPreview) {
|
||||
if (!LauncherSettings.Settings.call(
|
||||
@@ -177,11 +178,11 @@ public class GridSizeMigrationTaskV2 {
|
||||
DbReader destReader = new DbReader(t.getDb(),
|
||||
migrateForPreview ? LauncherSettings.Favorites.PREVIEW_TABLE_NAME
|
||||
: LauncherSettings.Favorites.TABLE_NAME,
|
||||
context, validPackages, idp.numHotseatIcons);
|
||||
context, validPackages, idp.numDatabaseHotseatIcons);
|
||||
|
||||
Point targetSize = new Point(idp.numColumns, idp.numRows);
|
||||
GridSizeMigrationTaskV2 task = new GridSizeMigrationTaskV2(context, t.getDb(),
|
||||
srcReader, destReader, idp.numHotseatIcons, targetSize);
|
||||
srcReader, destReader, idp.numDatabaseHotseatIcons, targetSize);
|
||||
task.migrate();
|
||||
|
||||
if (!migrateForPreview) {
|
||||
@@ -202,7 +203,7 @@ public class GridSizeMigrationTaskV2 {
|
||||
// Save current configuration, so that the migration does not run again.
|
||||
prefs.edit()
|
||||
.putString(KEY_MIGRATION_SRC_WORKSPACE_SIZE, gridSizeString)
|
||||
.putInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, idp.numHotseatIcons)
|
||||
.putInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, idp.numDatabaseHotseatIcons)
|
||||
.apply();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user