Skip to content

Commit 78e577d

Browse files
committed
Make some constants private and annotate params
1 parent 96a7cc2 commit 78e577d

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

app/src/main/java/org/schabi/newpipe/settings/SettingMigrations.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.content.SharedPreferences;
55
import android.util.Log;
66

7+
import androidx.annotation.NonNull;
78
import androidx.preference.PreferenceManager;
89

910
import org.schabi.newpipe.R;
@@ -30,9 +31,9 @@ public final class SettingMigrations {
3031
private static final String TAG = SettingMigrations.class.toString();
3132
private static SharedPreferences sp;
3233

33-
public static final Migration MIGRATION_0_1 = new Migration(0, 1) {
34+
private static final Migration MIGRATION_0_1 = new Migration(0, 1) {
3435
@Override
35-
public void migrate(final Context context) {
36+
public void migrate(@NonNull final Context context) {
3637
// We changed the content of the dialog which opens when sharing a link to NewPipe
3738
// by removing the "open detail page" option.
3839
// Therefore, show the dialog once again to ensure users need to choose again and are
@@ -44,9 +45,9 @@ public void migrate(final Context context) {
4445
}
4546
};
4647

47-
public static final Migration MIGRATION_1_2 = new Migration(1, 2) {
48+
private static final Migration MIGRATION_1_2 = new Migration(1, 2) {
4849
@Override
49-
protected void migrate(final Context context) {
50+
protected void migrate(@NonNull final Context context) {
5051
// The new application workflow introduced in #2907 allows minimizing videos
5152
// while playing to do other stuff within the app.
5253
// For an even better workflow, we minimize a stream when switching the app to play in
@@ -63,9 +64,9 @@ protected void migrate(final Context context) {
6364
}
6465
};
6566

66-
public static final Migration MIGRATION_2_3 = new Migration(2, 3) {
67+
private static final Migration MIGRATION_2_3 = new Migration(2, 3) {
6768
@Override
68-
protected void migrate(final Context context) {
69+
protected void migrate(@NonNull final Context context) {
6970
// Storage Access Framework implementation was improved in #5415, allowing the modern
7071
// and standard way to access folders and files to be used consistently everywhere.
7172
// We reset the setting to its default value, i.e. "use SAF", since now there are no
@@ -79,9 +80,9 @@ protected void migrate(final Context context) {
7980
}
8081
};
8182

82-
public static final Migration MIGRATION_3_4 = new Migration(3, 4) {
83+
private static final Migration MIGRATION_3_4 = new Migration(3, 4) {
8384
@Override
84-
protected void migrate(final Context context) {
85+
protected void migrate(@NonNull final Context context) {
8586
// Pull request #3546 added support for choosing the type of search suggestions to
8687
// show, replacing the on-off switch used before, so migrate the previous user choice
8788

@@ -108,9 +109,9 @@ protected void migrate(final Context context) {
108109
}
109110
};
110111

111-
public static final Migration MIGRATION_4_5 = new Migration(4, 5) {
112+
private static final Migration MIGRATION_4_5 = new Migration(4, 5) {
112113
@Override
113-
protected void migrate(final Context context) {
114+
protected void migrate(@NonNull final Context context) {
114115
final boolean brightness = sp.getBoolean("brightness_gesture_control", true);
115116
final boolean volume = sp.getBoolean("volume_gesture_control", true);
116117

@@ -144,10 +145,10 @@ protected void migrate(final Context context) {
144145
/**
145146
* Version number for preferences. Must be incremented every time a migration is necessary.
146147
*/
147-
public static final int VERSION = 5;
148+
private static final int VERSION = 5;
148149

149150

150-
public static void initMigrations(final Context context, final boolean isFirstRun) {
151+
public static void initMigrations(@NonNull final Context context, final boolean isFirstRun) {
151152
// setup migrations and check if there is something to do
152153
sp = PreferenceManager.getDefaultSharedPreferences(context);
153154
final String lastPrefVersionKey = context.getString(R.string.last_used_preferences_version);
@@ -212,7 +213,7 @@ private boolean shouldMigrate(final int currentVersion) {
212213
return oldVersion >= currentVersion;
213214
}
214215

215-
protected abstract void migrate(Context context);
216+
protected abstract void migrate(@NonNull Context context);
216217

217218
}
218219

0 commit comments

Comments
 (0)