mirror of
https://github.com/revanced/revanced-integrations.git
synced 2024-12-04 09:42:55 +01:00
chore: merge branch dev
to main
(#280)
This commit is contained in:
commit
e833d16bb8
@ -1,3 +1,10 @@
|
|||||||
|
## [0.92.2-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.92.1...v0.92.2-dev.1) (2023-01-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* load numeric preferences as type String ([212d3a7](https://github.com/revanced/revanced-integrations/commit/212d3a72d879189c061fb77805cda81ca0519495))
|
||||||
|
|
||||||
## [0.92.1](https://github.com/revanced/revanced-integrations/compare/v0.92.0...v0.92.1) (2023-01-07)
|
## [0.92.1](https://github.com/revanced/revanced-integrations/compare/v0.92.0...v0.92.1) (2023-01-07)
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,7 +280,7 @@ public enum SettingsEnum {
|
|||||||
private static void load() {
|
private static void load() {
|
||||||
Context context = ReVancedUtils.getContext();
|
Context context = ReVancedUtils.getContext();
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
Log.e("revanced: SettingsEnum", "Context returned null! Setings NOT initialized");
|
LogHelper.printException(() -> "SettingsEnum.load() called before ReVancedUtils.init()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (SettingsEnum setting : values()) {
|
for (SettingsEnum setting : values()) {
|
||||||
|
@ -34,17 +34,36 @@ public class SharedPrefHelper {
|
|||||||
return getPreferences(prefName).getBoolean(key, _default);
|
return getPreferences(prefName).getBoolean(key, _default);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getLong(SharedPrefNames prefName, String key, long _default) {
|
// region Hack, unknown why required
|
||||||
return getPreferences(prefName).getLong(key, _default);
|
|
||||||
|
public static Long getLong(SharedPrefNames prefName, String key, Long _default) {
|
||||||
|
SharedPreferences sharedPreferences = getPreferences(prefName);
|
||||||
|
try {
|
||||||
|
return Long.valueOf(sharedPreferences.getString(key, _default + ""));
|
||||||
|
} catch (ClassCastException ex) {
|
||||||
|
return sharedPreferences.getLong(key, _default);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static float getFloat(SharedPrefNames prefName, String key, float _default) {
|
public static Float getFloat(SharedPrefNames prefName, String key, Float _default) {
|
||||||
return getPreferences(prefName).getFloat(key, _default);
|
SharedPreferences sharedPreferences = getPreferences(prefName);
|
||||||
|
try {
|
||||||
|
return Float.valueOf(sharedPreferences.getString(key, _default + ""));
|
||||||
|
} catch (ClassCastException ex) {
|
||||||
|
return sharedPreferences.getFloat(key, _default);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getInt(SharedPrefNames prefName, String key, int _default) {
|
public static Integer getInt(SharedPrefNames prefName, String key, Integer _default) {
|
||||||
return getPreferences(prefName).getInt(key, _default);
|
SharedPreferences sharedPreferences = getPreferences(prefName);
|
||||||
|
try {
|
||||||
|
return Integer.valueOf(sharedPreferences.getString(key, _default + ""));
|
||||||
|
} catch (ClassCastException ex) {
|
||||||
|
return sharedPreferences.getInt(key, _default);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// endregion
|
||||||
|
|
||||||
public static SharedPreferences getPreferences(SharedPrefNames name) {
|
public static SharedPreferences getPreferences(SharedPrefNames name) {
|
||||||
return Objects.requireNonNull(ReVancedUtils.getContext()).getSharedPreferences(name.getName(), Context.MODE_PRIVATE);
|
return Objects.requireNonNull(ReVancedUtils.getContext()).getSharedPreferences(name.getName(), Context.MODE_PRIVATE);
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
org.gradle.jvmargs = -Xmx2048m
|
org.gradle.jvmargs = -Xmx2048m
|
||||||
android.useAndroidX = true
|
android.useAndroidX = true
|
||||||
version = 0.92.1
|
version = 0.92.2-dev.1
|
||||||
|
Loading…
Reference in New Issue
Block a user