mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-06-11 15:48:02 +02:00
refactor: Rename setting keys
This commit is contained in:
parent
19486d7d22
commit
5e398be094
|
@ -16,7 +16,7 @@ import app.revanced.integrations.shared.Logger;
|
|||
* non existent value will be reverted to the default value
|
||||
* (the event is logged, but no user error is displayed).
|
||||
*
|
||||
* All JSON text is also converted to lowercase to keep the output less obnoxious.
|
||||
* All saved JSON text is converted to lowercase to keep the output less obnoxious.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class EnumSetting<T extends Enum> extends Setting<T> {
|
||||
|
|
|
@ -112,12 +112,11 @@ public class SharedPrefCategory {
|
|||
removeKey(key);
|
||||
}
|
||||
}
|
||||
return _default;
|
||||
} catch (ClassCastException ex) {
|
||||
// Value stored is a completely different type (should never happen).
|
||||
removeConflictingPreferenceKeyValue(key);
|
||||
return _default;
|
||||
}
|
||||
return _default;
|
||||
}
|
||||
|
||||
public boolean getBoolean(@NonNull String key, boolean _default) {
|
||||
|
@ -137,7 +136,6 @@ public class SharedPrefCategory {
|
|||
if (value != null) {
|
||||
return Integer.valueOf(value);
|
||||
}
|
||||
return _default;
|
||||
} catch (ClassCastException ex) {
|
||||
try {
|
||||
// Old data previously stored as primitive.
|
||||
|
@ -145,9 +143,9 @@ public class SharedPrefCategory {
|
|||
} catch (ClassCastException ex2) {
|
||||
// Value stored is a completely different type (should never happen).
|
||||
removeConflictingPreferenceKeyValue(key);
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
return _default;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -157,15 +155,14 @@ public class SharedPrefCategory {
|
|||
if (value != null) {
|
||||
return Long.valueOf(value);
|
||||
}
|
||||
return _default;
|
||||
} catch (ClassCastException ex) {
|
||||
try {
|
||||
return preferences.getLong(key, _default);
|
||||
} catch (ClassCastException ex2) {
|
||||
removeConflictingPreferenceKeyValue(key);
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
return _default;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -175,15 +172,14 @@ public class SharedPrefCategory {
|
|||
if (value != null) {
|
||||
return Float.valueOf(value);
|
||||
}
|
||||
return _default;
|
||||
} catch (ClassCastException ex) {
|
||||
try {
|
||||
return preferences.getFloat(key, _default);
|
||||
} catch (ClassCastException ex2) {
|
||||
removeConflictingPreferenceKeyValue(key);
|
||||
return _default;
|
||||
}
|
||||
}
|
||||
return _default;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -574,7 +574,7 @@ public final class AlternativeThumbnailsPatch {
|
|||
// to run the url connection thru the integrations thread pool which runs at the highest priority.
|
||||
final long start = System.currentTimeMillis();
|
||||
imageFileFound = Utils.submitOnBackgroundThread(() -> {
|
||||
final int connectionTimeoutMillis = 10000;
|
||||
final int connectionTimeoutMillis = 10000; // 10 seconds.
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(imageUrl).openConnection();
|
||||
connection.setConnectTimeout(connectionTimeoutMillis);
|
||||
connection.setReadTimeout(connectionTimeoutMillis);
|
||||
|
|
|
@ -56,10 +56,10 @@ public class Settings extends BaseSettings {
|
|||
public static final BooleanSetting HIDE_VIDEO_ADS = new BooleanSetting("revanced_hide_video_ads", TRUE, true);
|
||||
public static final BooleanSetting HIDE_WEB_SEARCH_RESULTS = new BooleanSetting("revanced_hide_web_search_results", TRUE);
|
||||
// Layout
|
||||
public static final EnumSetting<ThumbnailOption> ALT_THUMBNAIL_HOME = new EnumSetting<>("revanced_alt_thumbnail_dearrow_home", ThumbnailOption.ORIGINAL);
|
||||
public static final EnumSetting<ThumbnailOption> ALT_THUMBNAIL_SUBSCRIPTIONS = new EnumSetting<>("revanced_alt_thumbnail_dearrow_subscription", ThumbnailOption.ORIGINAL);
|
||||
public static final EnumSetting<ThumbnailOption> ALT_THUMBNAIL_SEARCH = new EnumSetting<>("revanced_alt_thumbnail_dearrow_search", ThumbnailOption.ORIGINAL);
|
||||
public static final EnumSetting<ThumbnailOption> ALT_THUMBNAIL_WATCH_HISTORY = new EnumSetting<>("revanced_alt_thumbnail_dearrow_history", ThumbnailOption.ORIGINAL);
|
||||
public static final EnumSetting<ThumbnailOption> ALT_THUMBNAIL_HOME = new EnumSetting<>("revanced_alt_thumbnail_home", ThumbnailOption.ORIGINAL);
|
||||
public static final EnumSetting<ThumbnailOption> ALT_THUMBNAIL_SUBSCRIPTIONS = new EnumSetting<>("revanced_alt_thumbnail_subscription", ThumbnailOption.ORIGINAL);
|
||||
public static final EnumSetting<ThumbnailOption> ALT_THUMBNAIL_SEARCH = new EnumSetting<>("revanced_alt_thumbnail_search", ThumbnailOption.ORIGINAL);
|
||||
public static final EnumSetting<ThumbnailOption> ALT_THUMBNAIL_WATCH_HISTORY = new EnumSetting<>("revanced_alt_thumbnail_history", ThumbnailOption.ORIGINAL);
|
||||
public static final StringSetting ALT_THUMBNAIL_DEARROW_API_URL = new StringSetting("revanced_alt_thumbnail_dearrow_api_url",
|
||||
"https://dearrow-thumb.ajay.app/api/v1/getThumbnail", true, new DeArrowAvailability());
|
||||
public static final BooleanSetting ALT_THUMBNAIL_DEARROW_CONNECTION_TOAST = new BooleanSetting("revanced_alt_thumbnail_dearrow_connection_toast", TRUE, new DeArrowAvailability());
|
||||
|
|
Loading…
Reference in New Issue
Block a user