@@ -14,7 +14,7 @@ public final class SettingMigrations {
1414 /**
1515 * Version number for preferences. Must be incremented every time a migration is necessary.
1616 */
17- public static final int VERSION = 1 ;
17+ public static final int VERSION = 2 ;
1818 private static SharedPreferences sp ;
1919
2020 public static final Migration MIGRATION_0_1 = new Migration (0 , 1 ) {
@@ -31,14 +31,34 @@ public void migrate(final Context context) {
3131 }
3232 };
3333
34+ public static final Migration MIGRATION_1_2 = new Migration (1 , 2 ) {
35+ @ Override
36+ protected void migrate (final Context context ) {
37+ // The new application workflow introduced in #2907 allows minimizing videos
38+ // while playing to do other stuff within the app.
39+ // For an even better workflow, we minimize a stream when switching the app to play in
40+ // background.
41+ // Therefore, set default value to background, if it has not been changed yet.
42+ final String minimizeOnExitKey = context .getString (R .string .minimize_on_exit_key );
43+ if (sp .getString (minimizeOnExitKey , "" )
44+ .equals (context .getString (R .string .minimize_on_exit_none_key ))) {
45+ final SharedPreferences .Editor editor = sp .edit ();
46+ editor .putString (minimizeOnExitKey ,
47+ context .getString (R .string .minimize_on_exit_background_key ));
48+ editor .apply ();
49+ }
50+ }
51+ };
52+
3453 /**
3554 * List of all implemented migrations.
3655 * <p>
3756 * <b>Append new migrations to the end of the list</b> to keep it sorted ascending.
3857 * If not sorted correctly, migrations which depend on each other, may fail.
3958 */
4059 private static final Migration [] SETTING_MIGRATIONS = {
41- MIGRATION_0_1
60+ MIGRATION_0_1 ,
61+ MIGRATION_1_2
4262 };
4363
4464
0 commit comments