mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-01-03 14:00:32 +00:00
Make some constants private and annotate params
This commit is contained in:
parent
96a7cc2971
commit
78e577d260
@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.preference.PreferenceManager;
|
import androidx.preference.PreferenceManager;
|
||||||
|
|
||||||
import org.schabi.newpipe.R;
|
import org.schabi.newpipe.R;
|
||||||
@ -30,9 +31,9 @@ public final class SettingMigrations {
|
|||||||
private static final String TAG = SettingMigrations.class.toString();
|
private static final String TAG = SettingMigrations.class.toString();
|
||||||
private static SharedPreferences sp;
|
private static SharedPreferences sp;
|
||||||
|
|
||||||
public static final Migration MIGRATION_0_1 = new Migration(0, 1) {
|
private static final Migration MIGRATION_0_1 = new Migration(0, 1) {
|
||||||
@Override
|
@Override
|
||||||
public void migrate(final Context context) {
|
public void migrate(@NonNull final Context context) {
|
||||||
// We changed the content of the dialog which opens when sharing a link to NewPipe
|
// We changed the content of the dialog which opens when sharing a link to NewPipe
|
||||||
// by removing the "open detail page" option.
|
// by removing the "open detail page" option.
|
||||||
// Therefore, show the dialog once again to ensure users need to choose again and are
|
// Therefore, show the dialog once again to ensure users need to choose again and are
|
||||||
@ -44,9 +45,9 @@ public final class SettingMigrations {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Migration MIGRATION_1_2 = new Migration(1, 2) {
|
private static final Migration MIGRATION_1_2 = new Migration(1, 2) {
|
||||||
@Override
|
@Override
|
||||||
protected void migrate(final Context context) {
|
protected void migrate(@NonNull final Context context) {
|
||||||
// The new application workflow introduced in #2907 allows minimizing videos
|
// The new application workflow introduced in #2907 allows minimizing videos
|
||||||
// while playing to do other stuff within the app.
|
// while playing to do other stuff within the app.
|
||||||
// For an even better workflow, we minimize a stream when switching the app to play in
|
// For an even better workflow, we minimize a stream when switching the app to play in
|
||||||
@ -63,9 +64,9 @@ public final class SettingMigrations {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Migration MIGRATION_2_3 = new Migration(2, 3) {
|
private static final Migration MIGRATION_2_3 = new Migration(2, 3) {
|
||||||
@Override
|
@Override
|
||||||
protected void migrate(final Context context) {
|
protected void migrate(@NonNull final Context context) {
|
||||||
// Storage Access Framework implementation was improved in #5415, allowing the modern
|
// Storage Access Framework implementation was improved in #5415, allowing the modern
|
||||||
// and standard way to access folders and files to be used consistently everywhere.
|
// and standard way to access folders and files to be used consistently everywhere.
|
||||||
// We reset the setting to its default value, i.e. "use SAF", since now there are no
|
// We reset the setting to its default value, i.e. "use SAF", since now there are no
|
||||||
@ -79,9 +80,9 @@ public final class SettingMigrations {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Migration MIGRATION_3_4 = new Migration(3, 4) {
|
private static final Migration MIGRATION_3_4 = new Migration(3, 4) {
|
||||||
@Override
|
@Override
|
||||||
protected void migrate(final Context context) {
|
protected void migrate(@NonNull final Context context) {
|
||||||
// Pull request #3546 added support for choosing the type of search suggestions to
|
// Pull request #3546 added support for choosing the type of search suggestions to
|
||||||
// show, replacing the on-off switch used before, so migrate the previous user choice
|
// show, replacing the on-off switch used before, so migrate the previous user choice
|
||||||
|
|
||||||
@ -108,9 +109,9 @@ public final class SettingMigrations {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final Migration MIGRATION_4_5 = new Migration(4, 5) {
|
private static final Migration MIGRATION_4_5 = new Migration(4, 5) {
|
||||||
@Override
|
@Override
|
||||||
protected void migrate(final Context context) {
|
protected void migrate(@NonNull final Context context) {
|
||||||
final boolean brightness = sp.getBoolean("brightness_gesture_control", true);
|
final boolean brightness = sp.getBoolean("brightness_gesture_control", true);
|
||||||
final boolean volume = sp.getBoolean("volume_gesture_control", true);
|
final boolean volume = sp.getBoolean("volume_gesture_control", true);
|
||||||
|
|
||||||
@ -144,10 +145,10 @@ public final class SettingMigrations {
|
|||||||
/**
|
/**
|
||||||
* Version number for preferences. Must be incremented every time a migration is necessary.
|
* Version number for preferences. Must be incremented every time a migration is necessary.
|
||||||
*/
|
*/
|
||||||
public static final int VERSION = 5;
|
private static final int VERSION = 5;
|
||||||
|
|
||||||
|
|
||||||
public static void initMigrations(final Context context, final boolean isFirstRun) {
|
public static void initMigrations(@NonNull final Context context, final boolean isFirstRun) {
|
||||||
// setup migrations and check if there is something to do
|
// setup migrations and check if there is something to do
|
||||||
sp = PreferenceManager.getDefaultSharedPreferences(context);
|
sp = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
final String lastPrefVersionKey = context.getString(R.string.last_used_preferences_version);
|
final String lastPrefVersionKey = context.getString(R.string.last_used_preferences_version);
|
||||||
@ -212,7 +213,7 @@ public final class SettingMigrations {
|
|||||||
return oldVersion >= currentVersion;
|
return oldVersion >= currentVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void migrate(Context context);
|
protected abstract void migrate(@NonNull Context context);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user