use of com.android.launcher3.model.GridBackupTable in project android_packages_apps_Launcher3 by crdroidandroid.
the class HotseatRestoreHelper method createBackup.
/**
* Creates a snapshot backup of Favorite table for future restoration use.
*/
public static void createBackup(Context context) {
MODEL_EXECUTOR.execute(() -> {
try (LauncherDbUtils.SQLiteTransaction transaction = (LauncherDbUtils.SQLiteTransaction) LauncherSettings.Settings.call(context.getContentResolver(), LauncherSettings.Settings.METHOD_NEW_TRANSACTION).getBinder(LauncherSettings.Settings.EXTRA_VALUE)) {
InvariantDeviceProfile idp = LauncherAppState.getIDP(context);
GridBackupTable backupTable = new GridBackupTable(context, transaction.getDb(), idp.numDatabaseHotseatIcons, idp.numColumns, idp.numRows);
backupTable.createCustomBackupTable(HYBRID_HOTSEAT_BACKUP_TABLE);
transaction.commit();
LauncherSettings.Settings.call(context.getContentResolver(), LauncherSettings.Settings.METHOD_REFRESH_HOTSEAT_RESTORE_TABLE);
}
});
}
use of com.android.launcher3.model.GridBackupTable in project android_packages_apps_Launcher3 by crdroidandroid.
the class HotseatRestoreHelper method restoreBackup.
/**
* Finds and restores a previously saved snapshow of Favorites table
*/
public static void restoreBackup(Context context) {
MODEL_EXECUTOR.execute(() -> {
try (LauncherDbUtils.SQLiteTransaction transaction = (LauncherDbUtils.SQLiteTransaction) LauncherSettings.Settings.call(context.getContentResolver(), LauncherSettings.Settings.METHOD_NEW_TRANSACTION).getBinder(LauncherSettings.Settings.EXTRA_VALUE)) {
if (!tableExists(transaction.getDb(), HYBRID_HOTSEAT_BACKUP_TABLE)) {
return;
}
InvariantDeviceProfile idp = LauncherAppState.getIDP(context);
GridBackupTable backupTable = new GridBackupTable(context, transaction.getDb(), idp.numDatabaseHotseatIcons, idp.numColumns, idp.numRows);
backupTable.restoreFromCustomBackupTable(HYBRID_HOTSEAT_BACKUP_TABLE, true);
transaction.commit();
LauncherAppState.getInstance(context).getModel().forceReload();
}
});
}
use of com.android.launcher3.model.GridBackupTable in project android_packages_apps_Launcher3 by crdroidandroid.
the class RestoreDbTask method backupWorkspace.
/**
* Backup the workspace so that if things go south in restore, we can recover these entries.
*/
private void backupWorkspace(Context context, SQLiteDatabase db) throws Exception {
InvariantDeviceProfile idp = LauncherAppState.getIDP(context);
new GridBackupTable(context, db, idp.numDatabaseHotseatIcons, idp.numColumns, idp.numRows).doBackup(getDefaultProfileId(db), GridBackupTable.OPTION_REQUIRES_SANITIZATION);
}
use of com.android.launcher3.model.GridBackupTable in project android_packages_apps_Trebuchet by LineageOS.
the class HotseatRestoreHelper method restoreBackup.
/**
* Finds and restores a previously saved snapshow of Favorites table
*/
public void restoreBackup() {
MODEL_EXECUTOR.execute(() -> {
try (LauncherDbUtils.SQLiteTransaction transaction = (LauncherDbUtils.SQLiteTransaction) LauncherSettings.Settings.call(mLauncher.getContentResolver(), LauncherSettings.Settings.METHOD_NEW_TRANSACTION).getBinder(LauncherSettings.Settings.EXTRA_VALUE)) {
if (!tableExists(transaction.getDb(), HYBRID_HOTSEAT_BACKUP_TABLE)) {
return;
}
InvariantDeviceProfile idp = mLauncher.getDeviceProfile().inv;
GridBackupTable backupTable = new GridBackupTable(mLauncher, transaction.getDb(), idp.numHotseatIcons, idp.numColumns, idp.numRows);
backupTable.restoreFromCustomBackupTable(HYBRID_HOTSEAT_BACKUP_TABLE, true);
transaction.commit();
mLauncher.getModel().forceReload();
}
});
}
use of com.android.launcher3.model.GridBackupTable in project android_packages_apps_Trebuchet by LineageOS.
the class HotseatRestoreHelper method createBackup.
/**
* Creates a snapshot backup of Favorite table for future restoration use.
*/
public void createBackup() {
MODEL_EXECUTOR.execute(() -> {
try (LauncherDbUtils.SQLiteTransaction transaction = (LauncherDbUtils.SQLiteTransaction) LauncherSettings.Settings.call(mLauncher.getContentResolver(), LauncherSettings.Settings.METHOD_NEW_TRANSACTION).getBinder(LauncherSettings.Settings.EXTRA_VALUE)) {
InvariantDeviceProfile idp = mLauncher.getDeviceProfile().inv;
GridBackupTable backupTable = new GridBackupTable(mLauncher, transaction.getDb(), idp.numHotseatIcons, idp.numColumns, idp.numRows);
backupTable.createCustomBackupTable(HYBRID_HOTSEAT_BACKUP_TABLE);
transaction.commit();
LauncherSettings.Settings.call(mLauncher.getContentResolver(), LauncherSettings.Settings.METHOD_REFRESH_HOTSEAT_RESTORE_TABLE);
}
});
}
Aggregations