Fix settings migration
This commit is contained in:
parent
704e9bd7b6
commit
4bb45c001d
1 changed files with 8 additions and 22 deletions
|
@ -111,31 +111,17 @@ public final class SettingMigrations {
|
|||
public static final Migration MIGRATION_4_5 = new Migration(4, 5) {
|
||||
@Override
|
||||
protected void migrate(final Context context) {
|
||||
final boolean brightnessGestureSwitch = sp.getBoolean(
|
||||
context.getString(R.string.left_gesture_control_key), true);
|
||||
final boolean volumeGestureSwitch = sp.getBoolean(
|
||||
context.getString(R.string.right_gesture_control_key), true);
|
||||
final boolean brightness = sp.getBoolean("brightness_gesture_control", true);
|
||||
final boolean volume = sp.getBoolean("volume_gesture_control", true);
|
||||
|
||||
final SharedPreferences.Editor editor = sp.edit();
|
||||
|
||||
if (volumeGestureSwitch) {
|
||||
if (!brightnessGestureSwitch) {
|
||||
editor.putString(context.getString(R.string.left_gesture_control_key),
|
||||
context.getString(R.string.brightness));
|
||||
}
|
||||
editor.putString(context.getString(R.string.right_gesture_control_key),
|
||||
context.getString(R.string.volume));
|
||||
} else if (brightnessGestureSwitch) {
|
||||
editor.putString(context.getString(R.string.right_gesture_control_key),
|
||||
context.getString(R.string.brightness));
|
||||
editor.putString(context.getString(R.string.left_gesture_control_key),
|
||||
context.getString(R.string.volume));
|
||||
} else {
|
||||
editor.putString(context.getString(R.string.left_gesture_control_key),
|
||||
context.getString(R.string.none));
|
||||
editor.putString(context.getString(R.string.right_gesture_control_key),
|
||||
context.getString(R.string.none));
|
||||
}
|
||||
editor.putString(context.getString(R.string.right_gesture_control_key),
|
||||
context.getString(volume
|
||||
? R.string.volume_control_key : R.string.none_control_key));
|
||||
editor.putString(context.getString(R.string.left_gesture_control_key),
|
||||
context.getString(brightness
|
||||
? R.string.brightness_control_key : R.string.none_control_key));
|
||||
|
||||
editor.apply();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue