Implement backup restore

This commit is contained in:
Suphon Thanakornpakapong
2022-05-18 23:04:07 +07:00
parent 2038c6722c
commit 84ae5c07d9
13 changed files with 416 additions and 28 deletions
@@ -81,11 +81,19 @@ public class DeviceGridState {
* Stores the device state to shared preferences
*/
public void writeToPrefs(Context context) {
Utilities.getPrefs(context).edit()
writeToPrefs(context, false);
}
public void writeToPrefs(Context context, boolean commit) {
SharedPreferences.Editor editor = Utilities.getPrefs(context).edit()
.putString(KEY_WORKSPACE_SIZE, mGridSizeString)
.putInt(KEY_HOTSEAT_COUNT, mNumHotseat)
.putInt(KEY_DEVICE_TYPE, mDeviceType)
.apply();
.putInt(KEY_DEVICE_TYPE, mDeviceType);
if (commit) {
editor.commit();
} else {
editor.apply();
}
}
public LawnchairProto.GridState toProtoMessage() {