mirror of
https://github.com/TeamNewPipe/NewPipe.git
synced 2024-11-21 18:42:35 +01:00
Fix settings migration
This commit is contained in:
parent
704e9bd7b6
commit
4bb45c001d
@ -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 New Issue
Block a user