Loading res/values/attrs.xml +1 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ <attr name="numFolderColumns" format="integer" /> <!-- numHotseatIcons defaults to numColumns, if not specified --> <attr name="numHotseatIcons" format="integer" /> <attr name="dbFile" format="string" /> <attr name="defaultLayoutId" format="reference" /> <attr name="demoModeLayoutId" format="reference" /> </declare-styleable> Loading res/xml/device_profiles.xml +3 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ launcher:numFolderRows="2" launcher:numFolderColumns="3" launcher:numHotseatIcons="3" launcher:dbFile="launcher_3_by_3.db" launcher:defaultLayoutId="@xml/default_workspace_3x3" > <display-option Loading Loading @@ -51,6 +52,7 @@ launcher:numFolderRows="3" launcher:numFolderColumns="4" launcher:numHotseatIcons="4" launcher:dbFile="launcher_4_by_4.db" launcher:defaultLayoutId="@xml/default_workspace_4x4" > <display-option Loading Loading @@ -102,6 +104,7 @@ launcher:numFolderRows="4" launcher:numFolderColumns="4" launcher:numHotseatIcons="5" launcher:dbFile="launcher.db" launcher:defaultLayoutId="@xml/default_workspace_5x5" > <display-option Loading robolectric_tests/src/com/android/launcher3/model/BackupRestoreTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ public class BackupRestoreTest { { APP_ICON, SHORTCUT, SHORTCUT, NO__ICON}, }}, 2, OLD_WORK_PROFILE_ID); // simulates the creation of backup upon restore new GridBackupTable(RuntimeEnvironment.application, mDb, mIdp.numHotseatIcons, new GridBackupTable(RuntimeEnvironment.application, mDb, mDb, mIdp.numHotseatIcons, mIdp.numColumns, mIdp.numRows).doBackup( MY_OLD_PROFILE_ID, GridBackupTable.OPTION_REQUIRES_SANITIZATION); // reset favorites table Loading robolectric_tests/src/com/android/launcher3/model/GridBackupTableTest.java +6 −6 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ public class GridBackupTableTest { @Test public void backupTableCreated() { GridBackupTable backupTable = new GridBackupTable(mContext, mDb, 4, 4, 4); GridBackupTable backupTable = new GridBackupTable(mContext, mDb, mDb, 4, 4, 4); assertFalse(backupTable.backupOrRestoreAsNeeded()); Settings.call(mContext.getContentResolver(), Settings.METHOD_REFRESH_BACKUP_TABLE); Loading @@ -75,14 +75,14 @@ public class GridBackupTableTest { @Test public void backupTableRestored() { assertFalse(new GridBackupTable(mContext, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); assertFalse(new GridBackupTable(mContext, mDb, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); Settings.call(mContext.getContentResolver(), Settings.METHOD_REFRESH_BACKUP_TABLE); // Delete entries mDb.delete(TABLE_NAME, null, null); assertEquals(0, queryNumEntries(mDb, TABLE_NAME)); GridBackupTable backupTable = new GridBackupTable(mContext, mDb, 3, 3, 3); GridBackupTable backupTable = new GridBackupTable(mContext, mDb, mDb, 3, 3, 3); assertTrue(backupTable.backupOrRestoreAsNeeded()); // Items have been restored Loading @@ -96,7 +96,7 @@ public class GridBackupTableTest { @Test public void backupTableRemovedOnAdd() { assertFalse(new GridBackupTable(mContext, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); assertFalse(new GridBackupTable(mContext, mDb, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); Settings.call(mContext.getContentResolver(), Settings.METHOD_REFRESH_BACKUP_TABLE); assertTrue(tableExists(mDb, BACKUP_TABLE_NAME)); Loading @@ -107,7 +107,7 @@ public class GridBackupTableTest { @Test public void backupTableRemovedOnDelete() { assertFalse(new GridBackupTable(mContext, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); assertFalse(new GridBackupTable(mContext, mDb, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); Settings.call(mContext.getContentResolver(), Settings.METHOD_REFRESH_BACKUP_TABLE); assertTrue(tableExists(mDb, BACKUP_TABLE_NAME)); Loading @@ -118,7 +118,7 @@ public class GridBackupTableTest { @Test public void backupTableRetainedOnUpdate() { assertFalse(new GridBackupTable(mContext, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); assertFalse(new GridBackupTable(mContext, mDb, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); Settings.call(mContext.getContentResolver(), Settings.METHOD_REFRESH_BACKUP_TABLE); assertTrue(tableExists(mDb, BACKUP_TABLE_NAME)); Loading src/com/android/launcher3/InvariantDeviceProfile.java +5 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ public class InvariantDeviceProfile { */ public int numAllAppsColumns; public String dbFile; public int defaultLayoutId; int demoModeLayoutId; Loading Loading @@ -146,6 +147,7 @@ public class InvariantDeviceProfile { iconTextSize = p.iconTextSize; numHotseatIcons = p.numHotseatIcons; numAllAppsColumns = p.numAllAppsColumns; dbFile = p.dbFile; defaultLayoutId = p.defaultLayoutId; demoModeLayoutId = p.demoModeLayoutId; mExtraAttrs = p.mExtraAttrs; Loading Loading @@ -292,6 +294,7 @@ public class InvariantDeviceProfile { numRows = closestProfile.numRows; numColumns = closestProfile.numColumns; numHotseatIcons = closestProfile.numHotseatIcons; dbFile = closestProfile.dbFile; defaultLayoutId = closestProfile.defaultLayoutId; demoModeLayoutId = closestProfile.demoModeLayoutId; numFolderRows = closestProfile.numFolderRows; Loading Loading @@ -559,6 +562,7 @@ public class InvariantDeviceProfile { private final int numHotseatIcons; private final String dbFile; private final int defaultLayoutId; private final int demoModeLayoutId; Loading @@ -571,6 +575,7 @@ public class InvariantDeviceProfile { numRows = a.getInt(R.styleable.GridDisplayOption_numRows, 0); numColumns = a.getInt(R.styleable.GridDisplayOption_numColumns, 0); dbFile = a.getString(R.styleable.GridDisplayOption_dbFile); defaultLayoutId = a.getResourceId( R.styleable.GridDisplayOption_defaultLayoutId, 0); demoModeLayoutId = a.getResourceId( Loading Loading
res/values/attrs.xml +1 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,7 @@ <attr name="numFolderColumns" format="integer" /> <!-- numHotseatIcons defaults to numColumns, if not specified --> <attr name="numHotseatIcons" format="integer" /> <attr name="dbFile" format="string" /> <attr name="defaultLayoutId" format="reference" /> <attr name="demoModeLayoutId" format="reference" /> </declare-styleable> Loading
res/xml/device_profiles.xml +3 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ launcher:numFolderRows="2" launcher:numFolderColumns="3" launcher:numHotseatIcons="3" launcher:dbFile="launcher_3_by_3.db" launcher:defaultLayoutId="@xml/default_workspace_3x3" > <display-option Loading Loading @@ -51,6 +52,7 @@ launcher:numFolderRows="3" launcher:numFolderColumns="4" launcher:numHotseatIcons="4" launcher:dbFile="launcher_4_by_4.db" launcher:defaultLayoutId="@xml/default_workspace_4x4" > <display-option Loading Loading @@ -102,6 +104,7 @@ launcher:numFolderRows="4" launcher:numFolderColumns="4" launcher:numHotseatIcons="5" launcher:dbFile="launcher.db" launcher:defaultLayoutId="@xml/default_workspace_5x5" > <display-option Loading
robolectric_tests/src/com/android/launcher3/model/BackupRestoreTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -134,7 +134,7 @@ public class BackupRestoreTest { { APP_ICON, SHORTCUT, SHORTCUT, NO__ICON}, }}, 2, OLD_WORK_PROFILE_ID); // simulates the creation of backup upon restore new GridBackupTable(RuntimeEnvironment.application, mDb, mIdp.numHotseatIcons, new GridBackupTable(RuntimeEnvironment.application, mDb, mDb, mIdp.numHotseatIcons, mIdp.numColumns, mIdp.numRows).doBackup( MY_OLD_PROFILE_ID, GridBackupTable.OPTION_REQUIRES_SANITIZATION); // reset favorites table Loading
robolectric_tests/src/com/android/launcher3/model/GridBackupTableTest.java +6 −6 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ public class GridBackupTableTest { @Test public void backupTableCreated() { GridBackupTable backupTable = new GridBackupTable(mContext, mDb, 4, 4, 4); GridBackupTable backupTable = new GridBackupTable(mContext, mDb, mDb, 4, 4, 4); assertFalse(backupTable.backupOrRestoreAsNeeded()); Settings.call(mContext.getContentResolver(), Settings.METHOD_REFRESH_BACKUP_TABLE); Loading @@ -75,14 +75,14 @@ public class GridBackupTableTest { @Test public void backupTableRestored() { assertFalse(new GridBackupTable(mContext, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); assertFalse(new GridBackupTable(mContext, mDb, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); Settings.call(mContext.getContentResolver(), Settings.METHOD_REFRESH_BACKUP_TABLE); // Delete entries mDb.delete(TABLE_NAME, null, null); assertEquals(0, queryNumEntries(mDb, TABLE_NAME)); GridBackupTable backupTable = new GridBackupTable(mContext, mDb, 3, 3, 3); GridBackupTable backupTable = new GridBackupTable(mContext, mDb, mDb, 3, 3, 3); assertTrue(backupTable.backupOrRestoreAsNeeded()); // Items have been restored Loading @@ -96,7 +96,7 @@ public class GridBackupTableTest { @Test public void backupTableRemovedOnAdd() { assertFalse(new GridBackupTable(mContext, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); assertFalse(new GridBackupTable(mContext, mDb, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); Settings.call(mContext.getContentResolver(), Settings.METHOD_REFRESH_BACKUP_TABLE); assertTrue(tableExists(mDb, BACKUP_TABLE_NAME)); Loading @@ -107,7 +107,7 @@ public class GridBackupTableTest { @Test public void backupTableRemovedOnDelete() { assertFalse(new GridBackupTable(mContext, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); assertFalse(new GridBackupTable(mContext, mDb, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); Settings.call(mContext.getContentResolver(), Settings.METHOD_REFRESH_BACKUP_TABLE); assertTrue(tableExists(mDb, BACKUP_TABLE_NAME)); Loading @@ -118,7 +118,7 @@ public class GridBackupTableTest { @Test public void backupTableRetainedOnUpdate() { assertFalse(new GridBackupTable(mContext, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); assertFalse(new GridBackupTable(mContext, mDb, mDb, 4, 4, 4).backupOrRestoreAsNeeded()); Settings.call(mContext.getContentResolver(), Settings.METHOD_REFRESH_BACKUP_TABLE); assertTrue(tableExists(mDb, BACKUP_TABLE_NAME)); Loading
src/com/android/launcher3/InvariantDeviceProfile.java +5 −0 Original line number Diff line number Diff line Loading @@ -119,6 +119,7 @@ public class InvariantDeviceProfile { */ public int numAllAppsColumns; public String dbFile; public int defaultLayoutId; int demoModeLayoutId; Loading Loading @@ -146,6 +147,7 @@ public class InvariantDeviceProfile { iconTextSize = p.iconTextSize; numHotseatIcons = p.numHotseatIcons; numAllAppsColumns = p.numAllAppsColumns; dbFile = p.dbFile; defaultLayoutId = p.defaultLayoutId; demoModeLayoutId = p.demoModeLayoutId; mExtraAttrs = p.mExtraAttrs; Loading Loading @@ -292,6 +294,7 @@ public class InvariantDeviceProfile { numRows = closestProfile.numRows; numColumns = closestProfile.numColumns; numHotseatIcons = closestProfile.numHotseatIcons; dbFile = closestProfile.dbFile; defaultLayoutId = closestProfile.defaultLayoutId; demoModeLayoutId = closestProfile.demoModeLayoutId; numFolderRows = closestProfile.numFolderRows; Loading Loading @@ -559,6 +562,7 @@ public class InvariantDeviceProfile { private final int numHotseatIcons; private final String dbFile; private final int defaultLayoutId; private final int demoModeLayoutId; Loading @@ -571,6 +575,7 @@ public class InvariantDeviceProfile { numRows = a.getInt(R.styleable.GridDisplayOption_numRows, 0); numColumns = a.getInt(R.styleable.GridDisplayOption_numColumns, 0); dbFile = a.getString(R.styleable.GridDisplayOption_dbFile); defaultLayoutId = a.getResourceId( R.styleable.GridDisplayOption_defaultLayoutId, 0); demoModeLayoutId = a.getResourceId( Loading