mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-21 01:07:32 +01:00
feat: settings
patch
This commit is contained in:
parent
02e37c8e9f
commit
3e206967b7
@ -7,7 +7,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "app.revanced.integrations"
|
applicationId "app.revanced.integrations"
|
||||||
minSdkVersion 23
|
minSdkVersion 24
|
||||||
targetSdkVersion 32
|
targetSdkVersion 32
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
@ -15,7 +15,7 @@ import app.revanced.integrations.utils.ReVancedUtils;
|
|||||||
import app.revanced.integrations.utils.SharedPrefHelper;
|
import app.revanced.integrations.utils.SharedPrefHelper;
|
||||||
|
|
||||||
public class VideoQualityPatch {
|
public class VideoQualityPatch {
|
||||||
public static final int[] videoResolutions = {0, 144, 240, 360, 480, 720, 1080, 1440, 2160, 4320};
|
|
||||||
public static int selectedQuality1 = -2;
|
public static int selectedQuality1 = -2;
|
||||||
private static Boolean newVideo = false;
|
private static Boolean newVideo = false;
|
||||||
private static Boolean userChangedQuality = false;
|
private static Boolean userChangedQuality = false;
|
||||||
@ -24,7 +24,7 @@ public class VideoQualityPatch {
|
|||||||
Context context = ReVancedUtils.getContext();
|
Context context = ReVancedUtils.getContext();
|
||||||
if (isConnectedWifi(context)) {
|
if (isConnectedWifi(context)) {
|
||||||
try {
|
try {
|
||||||
SharedPrefHelper.saveInt(context, SharedPrefHelper.SharedPrefNames.REVANCED_PREFS, "wifi_quality", defaultQuality);
|
SharedPrefHelper.saveString(context, SharedPrefHelper.SharedPrefNames.REVANCED_PREFS, "wifi_quality", defaultQuality + "");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LogHelper.printException(VideoQualityPatch.class, "Failed to change default WI-FI quality:" + ex);
|
LogHelper.printException(VideoQualityPatch.class, "Failed to change default WI-FI quality:" + ex);
|
||||||
Toast.makeText(context, "Failed to change default WI-FI quality:", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "Failed to change default WI-FI quality:", Toast.LENGTH_SHORT).show();
|
||||||
@ -33,7 +33,7 @@ public class VideoQualityPatch {
|
|||||||
Toast.makeText(context, "Changing default Wi-Fi quality to: " + defaultQuality, Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "Changing default Wi-Fi quality to: " + defaultQuality, Toast.LENGTH_SHORT).show();
|
||||||
} else if (isConnectedMobile(context)) {
|
} else if (isConnectedMobile(context)) {
|
||||||
try {
|
try {
|
||||||
SharedPrefHelper.saveInt(context, SharedPrefHelper.SharedPrefNames.REVANCED_PREFS, "mobile_quality", defaultQuality);
|
SharedPrefHelper.saveString(context, SharedPrefHelper.SharedPrefNames.REVANCED_PREFS, "mobile_quality", defaultQuality + "");
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
LogHelper.debug(VideoQualityPatch.class, "Failed to change default mobile data quality" + ex);
|
LogHelper.debug(VideoQualityPatch.class, "Failed to change default mobile data quality" + ex);
|
||||||
Toast.makeText(context, "Failed to change default mobile data quality", Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, "Failed to change default mobile data quality", Toast.LENGTH_SHORT).show();
|
||||||
|
@ -13,7 +13,7 @@ import app.revanced.integrations.utils.SharedPrefHelper;
|
|||||||
public enum SettingsEnum {
|
public enum SettingsEnum {
|
||||||
|
|
||||||
//Codec Override
|
//Codec Override
|
||||||
CODEC_OVERRIDE("revanced_override_codec_enabled", true, ReturnType.BOOLEAN),
|
CODEC_OVERRIDE("revanced_override_codec_enabled", false, ReturnType.BOOLEAN),
|
||||||
|
|
||||||
//Video Settings
|
//Video Settings
|
||||||
OLD_STYLE_QUALITY_SETTINGS("revanced_use_old_style_quality_settings", true, ReturnType.BOOLEAN),
|
OLD_STYLE_QUALITY_SETTINGS("revanced_use_old_style_quality_settings", true, ReturnType.BOOLEAN),
|
||||||
@ -24,37 +24,37 @@ public enum SettingsEnum {
|
|||||||
ENABLE_WHITELIST("revanced_whitelist_ads_enabled", false, ReturnType.BOOLEAN),
|
ENABLE_WHITELIST("revanced_whitelist_ads_enabled", false, ReturnType.BOOLEAN),
|
||||||
|
|
||||||
//Ad settings
|
//Ad settings
|
||||||
HOME_ADS_SHOWN("revanced_home_ads_enabled", false, ReturnType.BOOLEAN),
|
HOME_ADS_SHOWN("revanced_home_ads_enabled", false, ReturnType.BOOLEAN, true),
|
||||||
VIDEO_ADS_SHOWN("revanced_video_ads_enabled", false, ReturnType.BOOLEAN),
|
VIDEO_ADS_SHOWN("revanced_video_ads_enabled", false, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_AD_REMOVAL("revanced_adremover_ad_removal", true, ReturnType.BOOLEAN),
|
ADREMOVER_AD_REMOVAL("revanced_adremover_ad_removal", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_MERCHANDISE_REMOVAL("revanced_adremover_merchandise", true, ReturnType.BOOLEAN),
|
ADREMOVER_MERCHANDISE_REMOVAL("revanced_adremover_merchandise", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_COMMUNITY_POSTS_REMOVAL("revanced_adremover_community_posts_removal", true, ReturnType.BOOLEAN),
|
ADREMOVER_COMMUNITY_POSTS_REMOVAL("revanced_adremover_community_posts_removal", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_COMPACT_BANNER_REMOVAL("revanced_adremover_compact_banner_removal", true, ReturnType.BOOLEAN),
|
ADREMOVER_COMPACT_BANNER_REMOVAL("revanced_adremover_compact_banner_removal", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_COMMENTS_REMOVAL("revanced_adremover_comments_removal", false, ReturnType.BOOLEAN),
|
ADREMOVER_COMMENTS_REMOVAL("revanced_adremover_comments_removal", false, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_MOVIE_REMOVAL("revanced_adremover_movie", true, ReturnType.BOOLEAN),
|
ADREMOVER_MOVIE_REMOVAL("revanced_adremover_movie", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_FEED_SURVEY_REMOVAL("revanced_adremover_feed_survey", true, ReturnType.BOOLEAN),
|
ADREMOVER_FEED_SURVEY_REMOVAL("revanced_adremover_feed_survey", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_SHORTS_SHELF("revanced_adremover_shorts_shelf", true, ReturnType.BOOLEAN),
|
ADREMOVER_SHORTS_SHELF("revanced_adremover_shorts_shelf", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_COMMUNITY_GUIDELINES("revanced_adremover_community_guidelines", true, ReturnType.BOOLEAN),
|
ADREMOVER_COMMUNITY_GUIDELINES("revanced_adremover_community_guidelines", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_EMERGENCY_BOX_REMOVAL("revanced_adremover_emergency_box_removal", true, ReturnType.BOOLEAN),
|
ADREMOVER_EMERGENCY_BOX_REMOVAL("revanced_adremover_emergency_box_removal", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_INFO_PANEL_REMOVAL("revanced_adremover_info_panel", true, ReturnType.BOOLEAN),
|
ADREMOVER_INFO_PANEL_REMOVAL("revanced_adremover_info_panel", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_MEDICAL_PANEL_REMOVAL("revanced_adremover_medical_panel", true, ReturnType.BOOLEAN),
|
ADREMOVER_MEDICAL_PANEL_REMOVAL("revanced_adremover_medical_panel", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_PAID_CONTECT_REMOVAL("revanced_adremover_paid_content", true, ReturnType.BOOLEAN),
|
ADREMOVER_PAID_CONTECT_REMOVAL("revanced_adremover_paid_content", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_SUGGESTED_FOR_YOU_REMOVAL("revanced_adremover_suggested", true, ReturnType.BOOLEAN),
|
ADREMOVER_SUGGESTED_FOR_YOU_REMOVAL("revanced_adremover_suggested", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_HIDE_SUGGESTIONS("revanced_adremover_hide_suggestions", true, ReturnType.BOOLEAN),
|
ADREMOVER_HIDE_SUGGESTIONS("revanced_adremover_hide_suggestions", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_HIDE_LATEST_POSTS("revanced_adremover_hide_latest_posts", true, ReturnType.BOOLEAN),
|
ADREMOVER_HIDE_LATEST_POSTS("revanced_adremover_hide_latest_posts", true, ReturnType.BOOLEAN, true),
|
||||||
ADREMOVER_HIDE_CHANNEL_GUIDELINES("revanced_adremover_hide_channel_guidelines", true, ReturnType.BOOLEAN),
|
ADREMOVER_HIDE_CHANNEL_GUIDELINES("revanced_adremover_hide_channel_guidelines", true, ReturnType.BOOLEAN, true),
|
||||||
|
|
||||||
//Layout settings
|
//Layout settings
|
||||||
REEL_BUTTON_SHOWN("revanced_reel_button_enabled", false, ReturnType.BOOLEAN),
|
REEL_BUTTON_SHOWN("revanced_reel_button_enabled", false, ReturnType.BOOLEAN, true),
|
||||||
INFO_CARDS_SHOWN("revanced_info_cards_enabled", false, ReturnType.BOOLEAN),
|
INFO_CARDS_SHOWN("revanced_info_cards_enabled", false, ReturnType.BOOLEAN),
|
||||||
BRANDING_SHOWN("revanced_branding_watermark_enabled", false, ReturnType.BOOLEAN),
|
BRANDING_SHOWN("revanced_branding_watermark_enabled", false, ReturnType.BOOLEAN),
|
||||||
CAST_BUTTON_SHOWN("revanced_cast_button_enabled", false, ReturnType.BOOLEAN),
|
CAST_BUTTON_SHOWN("revanced_cast_button_enabled", false, ReturnType.BOOLEAN, true),
|
||||||
AUTOPLAY_BUTTON_SHOWN("revanced_autoplay_button_enabled", false, ReturnType.BOOLEAN),
|
AUTOPLAY_BUTTON_SHOWN("revanced_autoplay_button_enabled", false, ReturnType.BOOLEAN, true),
|
||||||
//ToDo: Not used atm, Patch missing
|
//ToDo: Not used atm, Patch missing
|
||||||
USE_TABLET_MINIPLAYER("revanced_tablet_miniplayer", false, ReturnType.BOOLEAN),
|
USE_TABLET_MINIPLAYER("revanced_tablet_miniplayer", false, ReturnType.BOOLEAN),
|
||||||
CREATE_BUTTON_SHOWN("revanced_create_button_enabled", false, ReturnType.BOOLEAN),
|
CREATE_BUTTON_SHOWN("revanced_create_button_enabled", false, ReturnType.BOOLEAN, true),
|
||||||
USE_NEW_ACTIONBAR("revanced_new_actionbar", true, ReturnType.BOOLEAN),
|
USE_NEW_ACTIONBAR("revanced_new_actionbar", false, ReturnType.BOOLEAN, true),
|
||||||
SHORTS_BUTTON_SHOWN("revanced_shorts_button_enabled", false, ReturnType.BOOLEAN),
|
SHORTS_BUTTON_SHOWN("revanced_shorts_button_enabled", false, ReturnType.BOOLEAN, true),
|
||||||
FULLSCREEN_PANELS_SHOWN("revanced_fullscreen_panels_enabled", false, ReturnType.BOOLEAN), //ToDo: Add to prefs
|
FULLSCREEN_PANELS_SHOWN("revanced_fullscreen_panels_enabled", false, ReturnType.BOOLEAN), //ToDo: Add to prefs
|
||||||
|
|
||||||
//Misc. Settings
|
//Misc. Settings
|
||||||
@ -81,7 +81,7 @@ public enum SettingsEnum {
|
|||||||
MAX_PLAYBACK_BUFFER_AFTER_REBUFFER("revanced_pref_buffer_for_playback_after_rebuffer_ms", 5000, ReturnType.INTEGER),
|
MAX_PLAYBACK_BUFFER_AFTER_REBUFFER("revanced_pref_buffer_for_playback_after_rebuffer_ms", 5000, ReturnType.INTEGER),
|
||||||
|
|
||||||
//ReVanced General Settings
|
//ReVanced General Settings
|
||||||
DEBUG("revanced_debug_enabled", false, ReturnType.BOOLEAN),
|
DEBUG("revanced_debug_enabled", false, ReturnType.BOOLEAN, true),
|
||||||
USE_DARK_THEME("app_theme_dark", false, ReturnType.BOOLEAN),
|
USE_DARK_THEME("app_theme_dark", false, ReturnType.BOOLEAN),
|
||||||
|
|
||||||
//RYD Settings
|
//RYD Settings
|
||||||
@ -92,7 +92,7 @@ public enum SettingsEnum {
|
|||||||
SB_ENABLED("sb-enabled", true, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
SB_ENABLED("sb-enabled", true, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||||
SB_SHOW_TOAST_WHEN_SKIP("show-toast", true, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
SB_SHOW_TOAST_WHEN_SKIP("show-toast", true, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||||
SB_COUNT_SKIPS("count-skips", true, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
SB_COUNT_SKIPS("count-skips", true, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||||
SB_UUID("uuid", null, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.STRING),
|
SB_UUID("uuid", "", SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.STRING),
|
||||||
SB_ADJUST_NEW_SEGMENT_STEP("new-segment-step-accuracy", 150, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.INTEGER),
|
SB_ADJUST_NEW_SEGMENT_STEP("new-segment-step-accuracy", 150, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.INTEGER),
|
||||||
SB_MIN_DURATION("sb-min-duration", 0F, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.FLOAT),
|
SB_MIN_DURATION("sb-min-duration", 0F, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.FLOAT),
|
||||||
SB_SEEN_GUIDELINES("sb-seen-gl", false, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
SB_SEEN_GUIDELINES("sb-seen-gl", false, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||||
@ -110,6 +110,7 @@ public enum SettingsEnum {
|
|||||||
private final Object defaultValue;
|
private final Object defaultValue;
|
||||||
private final SharedPrefHelper.SharedPrefNames sharedPref;
|
private final SharedPrefHelper.SharedPrefNames sharedPref;
|
||||||
private final ReturnType returnType;
|
private final ReturnType returnType;
|
||||||
|
private final boolean rebootApp;
|
||||||
|
|
||||||
private Object value = null;
|
private Object value = null;
|
||||||
|
|
||||||
@ -118,6 +119,7 @@ public enum SettingsEnum {
|
|||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
this.sharedPref = SharedPrefHelper.SharedPrefNames.YOUTUBE;
|
this.sharedPref = SharedPrefHelper.SharedPrefNames.YOUTUBE;
|
||||||
this.returnType = returnType;
|
this.returnType = returnType;
|
||||||
|
this.rebootApp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsEnum(String path, Object defaultValue, SharedPrefHelper.SharedPrefNames prefName, ReturnType returnType) {
|
SettingsEnum(String path, Object defaultValue, SharedPrefHelper.SharedPrefNames prefName, ReturnType returnType) {
|
||||||
@ -125,6 +127,15 @@ public enum SettingsEnum {
|
|||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
this.sharedPref = prefName;
|
this.sharedPref = prefName;
|
||||||
this.returnType = returnType;
|
this.returnType = returnType;
|
||||||
|
this.rebootApp = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsEnum(String path, Object defaultValue, ReturnType returnType, Boolean rebootApp) {
|
||||||
|
this.path = path;
|
||||||
|
this.defaultValue = defaultValue;
|
||||||
|
this.sharedPref = SharedPrefHelper.SharedPrefNames.YOUTUBE;
|
||||||
|
this.returnType = returnType;
|
||||||
|
this.rebootApp = rebootApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -136,6 +147,7 @@ public enum SettingsEnum {
|
|||||||
if (context == null) {
|
if (context == null) {
|
||||||
Log.e("revanced: SettingsEnum", "Context returned null! Setings NOT initialized");
|
Log.e("revanced: SettingsEnum", "Context returned null! Setings NOT initialized");
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
for (SettingsEnum setting : values()) {
|
for (SettingsEnum setting : values()) {
|
||||||
Object value = setting.getDefaultValue();
|
Object value = setting.getDefaultValue();
|
||||||
|
|
||||||
@ -144,19 +156,19 @@ public enum SettingsEnum {
|
|||||||
|
|
||||||
switch (setting.getReturnType()) {
|
switch (setting.getReturnType()) {
|
||||||
case FLOAT:
|
case FLOAT:
|
||||||
value = SharedPrefHelper.getFloat(context, SharedPrefHelper.SharedPrefNames.YOUTUBE, setting.getPath(), (float) setting.getDefaultValue());
|
value = SharedPrefHelper.getFloat(context, setting.sharedPref, setting.getPath(), (float) setting.getDefaultValue());
|
||||||
break;
|
break;
|
||||||
case LONG:
|
case LONG:
|
||||||
value = SharedPrefHelper.getLong(context, SharedPrefHelper.SharedPrefNames.YOUTUBE, setting.getPath(), (long) setting.getDefaultValue());
|
value = SharedPrefHelper.getLong(context, setting.sharedPref, setting.getPath(), (long) setting.getDefaultValue());
|
||||||
break;
|
break;
|
||||||
case BOOLEAN:
|
case BOOLEAN:
|
||||||
value = SharedPrefHelper.getBoolean(context, SharedPrefHelper.SharedPrefNames.YOUTUBE, setting.getPath(), (boolean) setting.getDefaultValue());
|
value = SharedPrefHelper.getBoolean(context, setting.sharedPref, setting.getPath(), (boolean) setting.getDefaultValue());
|
||||||
break;
|
break;
|
||||||
case INTEGER:
|
case INTEGER:
|
||||||
value = SharedPrefHelper.getInt(context, SharedPrefHelper.SharedPrefNames.YOUTUBE, setting.getPath(), (int) setting.getDefaultValue());
|
value = SharedPrefHelper.getInt(context, setting.sharedPref, setting.getPath(), (int) setting.getDefaultValue());
|
||||||
break;
|
break;
|
||||||
case STRING:
|
case STRING:
|
||||||
value = SharedPrefHelper.getString(context, SharedPrefHelper.SharedPrefNames.YOUTUBE, setting.getPath(), (String) setting.getDefaultValue());
|
value = SharedPrefHelper.getString(context, setting.sharedPref, setting.getPath(), (String) setting.getDefaultValue());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LogHelper.printException(SettingsEnum.class, "Setting does not have a valid Type. Name is: " + setting.name());
|
LogHelper.printException(SettingsEnum.class, "Setting does not have a valid Type. Name is: " + setting.name());
|
||||||
@ -167,6 +179,9 @@ public enum SettingsEnum {
|
|||||||
//LogHelper is not initialized here
|
//LogHelper is not initialized here
|
||||||
Log.d("revanced: SettingsEnum", "Loaded Setting: " + setting.name() + " Value: " + value);
|
Log.d("revanced: SettingsEnum", "Loaded Setting: " + setting.name() + " Value: " + value);
|
||||||
}
|
}
|
||||||
|
} catch (Throwable th) {
|
||||||
|
LogHelper.printException(SettingsEnum.class, "Error during load()!", th);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,25 +202,10 @@ public enum SettingsEnum {
|
|||||||
public void saveValue(Object newValue) {
|
public void saveValue(Object newValue) {
|
||||||
Context context = ReVancedUtils.getContext();
|
Context context = ReVancedUtils.getContext();
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
switch (getReturnType()) {
|
if (returnType == ReturnType.BOOLEAN) {
|
||||||
case BOOLEAN:
|
SharedPrefHelper.saveBoolean(context, sharedPref, path, (Boolean) newValue);
|
||||||
SharedPrefHelper.saveBoolean(context, sharedPref, getPath(), (Boolean) newValue);
|
} else {
|
||||||
break;
|
SharedPrefHelper.saveString(context, sharedPref, path, newValue + "");
|
||||||
case INTEGER:
|
|
||||||
SharedPrefHelper.saveInt(context, sharedPref, getPath(), (int) newValue);
|
|
||||||
break;
|
|
||||||
case STRING:
|
|
||||||
SharedPrefHelper.saveString(context, sharedPref, getPath(), (String) newValue);
|
|
||||||
break;
|
|
||||||
case LONG:
|
|
||||||
SharedPrefHelper.saveLong(context, sharedPref, getPath(), (Long) newValue);
|
|
||||||
break;
|
|
||||||
case FLOAT:
|
|
||||||
SharedPrefHelper.saveFloat(context, sharedPref, getPath(), (Float) newValue);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LogHelper.printException(SettingsEnum.class, "Setting does not have with a valid Type. Name is: " + name());
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
value = newValue;
|
value = newValue;
|
||||||
} else {
|
} else {
|
||||||
@ -245,4 +245,8 @@ public enum SettingsEnum {
|
|||||||
return returnType;
|
return returnType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shouldRebootOnChange() {
|
||||||
|
return rebootApp;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,112 +1,91 @@
|
|||||||
package app.revanced.integrations.settingsmenu;
|
package app.revanced.integrations.settingsmenu;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.preference.PreferenceFragment;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.google.android.libraries.social.licenses.LicenseActivity;
|
||||||
|
|
||||||
import app.revanced.integrations.utils.LogHelper;
|
import app.revanced.integrations.utils.LogHelper;
|
||||||
import app.revanced.integrations.utils.ReVancedUtils;
|
import app.revanced.integrations.utils.ReVancedUtils;
|
||||||
import app.revanced.integrations.utils.ThemeHelper;
|
import app.revanced.integrations.utils.ThemeHelper;
|
||||||
|
|
||||||
/* loaded from: classes6.dex */
|
public class ReVancedSettingActivity {
|
||||||
public class ReVancedSettingActivity extends Activity {
|
|
||||||
private static Context context;
|
|
||||||
private boolean currentTheme;
|
|
||||||
|
|
||||||
@Override // android.app.Activity
|
public static void setTheme(LicenseActivity base) {
|
||||||
protected void onCreate(Bundle bundle) {
|
final var whiteTheme = "Theme.YouTube.Settings";
|
||||||
this.currentTheme = ThemeHelper.isDarkTheme();
|
final var darkTheme = "Theme.YouTube.Settings.Dark";
|
||||||
if (currentTheme) {
|
|
||||||
LogHelper.debug(ReVancedSettingActivity.class, "set Theme.YouTube.Settings.Dark");
|
final var theme = ThemeHelper.isDarkTheme() ? darkTheme : whiteTheme;
|
||||||
setTheme(getIdentifier("Theme.YouTube.Settings.Dark", "style"));
|
|
||||||
} else {
|
LogHelper.debug(ReVancedSettingActivity.class, "Using theme: " + theme);
|
||||||
LogHelper.debug(ReVancedSettingActivity.class, "set Theme.YouTube.Settings");
|
base.setTheme(getIdentifier(theme, "style"));
|
||||||
setTheme(getIdentifier("Theme.YouTube.Settings", "style"));
|
|
||||||
}
|
|
||||||
super.onCreate(bundle);
|
|
||||||
setContentView(getIdentifier("xsettings_with_toolbar", "layout"));
|
|
||||||
initImageButton(this.currentTheme);
|
|
||||||
String dataString = getIntent().getDataString();
|
|
||||||
if (dataString.equalsIgnoreCase("sponsorblock_settings")) {
|
|
||||||
trySetTitle(getIdentifier("sb_settings", "string"));
|
|
||||||
getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), new SponsorBlockSettingsFragment()).commit();
|
|
||||||
} else if (dataString.equalsIgnoreCase("ryd_settings")) {
|
|
||||||
trySetTitle(getIdentifier("revanced_ryd_settings_title", "string"));
|
|
||||||
getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), new ReturnYouTubeDislikeSettingsFragment()).commit();
|
|
||||||
} else {
|
|
||||||
trySetTitle(getIdentifier("revanced_settings", "string"));
|
|
||||||
getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), new ReVancedSettingsFragment()).commit();
|
|
||||||
}
|
|
||||||
context = getApplicationContext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ImageButton getImageButton(ViewGroup viewGroup) {
|
public static void initializeSettings(LicenseActivity base) {
|
||||||
if (viewGroup == null) {
|
base.setContentView(getIdentifier("xsettings_with_toolbar", "layout"));
|
||||||
return null;
|
|
||||||
}
|
|
||||||
int childCount = viewGroup.getChildCount();
|
|
||||||
for (int i = 0; i < childCount; i++) {
|
|
||||||
View childAt = viewGroup.getChildAt(i);
|
|
||||||
if (childAt instanceof ImageButton) {
|
|
||||||
return (ImageButton) childAt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TextView getTextView(ViewGroup viewGroup) {
|
|
||||||
if (viewGroup == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
int childCount = viewGroup.getChildCount();
|
|
||||||
for (int i = 0; i < childCount; i++) {
|
|
||||||
View childAt = viewGroup.getChildAt(i);
|
|
||||||
if (childAt instanceof TextView) {
|
|
||||||
return (TextView) childAt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int getIdentifier(String str, String str2) {
|
|
||||||
Context appContext = ReVancedUtils.getContext();
|
|
||||||
return appContext.getResources().getIdentifier(str, str2, appContext.getPackageName());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void trySetTitle(int i) {
|
|
||||||
try {
|
try {
|
||||||
getTextView((ViewGroup) findViewById(getIdentifier("toolbar", "id"))).setText(i);
|
ImageButton imageButton = getImageButton(base.findViewById(getIdentifier("toolbar", "id")));
|
||||||
} catch (Exception e) {
|
imageButton.setOnClickListener(view -> base.onBackPressed());
|
||||||
LogHelper.printException(ReVancedSettingActivity.class, "Couldn't set Toolbar title", e);
|
imageButton.setImageDrawable(base.getResources().getDrawable(getIdentifier(ThemeHelper.isDarkTheme() ? "quantum_ic_arrow_back_white_24" : "quantum_ic_arrow_back_grey600_24", "drawable"), null));
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void trySetTitle(String str) {
|
|
||||||
try {
|
|
||||||
getTextView((ViewGroup) findViewById(getIdentifier("toolbar", "id"))).setText(str);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LogHelper.printException(ReVancedSettingActivity.class, "Couldn't set Toolbar title", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initImageButton(boolean z) {
|
|
||||||
try {
|
|
||||||
ImageButton imageButton = getImageButton((ViewGroup) findViewById(getIdentifier("toolbar", "id")));
|
|
||||||
imageButton.setOnClickListener(new View.OnClickListener() { // from class: app.revanced.integrations.theme.ReVancedSettingActivity.1
|
|
||||||
@Override // android.view.View.OnClickListener
|
|
||||||
public void onClick(View view) {
|
|
||||||
ReVancedSettingActivity.this.onBackPressed();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
imageButton.setImageDrawable(getResources().getDrawable(getIdentifier(z ? "quantum_ic_arrow_back_white_24" : "quantum_ic_arrow_back_grey600_24", "drawable"), null));
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogHelper.printException(ReVancedSettingActivity.class, "Couldn't set Toolbar click handler", e);
|
LogHelper.printException(ReVancedSettingActivity.class, "Couldn't set Toolbar click handler", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PreferenceFragment preferenceFragment;
|
||||||
|
String preferenceIdentifier;
|
||||||
|
|
||||||
|
String dataString = base.getIntent().getDataString();
|
||||||
|
if (dataString.equalsIgnoreCase("sponsorblock_settings")) {
|
||||||
|
preferenceIdentifier = "sb_settings";
|
||||||
|
preferenceFragment = new SponsorBlockSettingsFragment();
|
||||||
|
} else if (dataString.equalsIgnoreCase("ryd_settings")) {
|
||||||
|
preferenceIdentifier = "revanced_ryd_settings_title";
|
||||||
|
preferenceFragment = new ReturnYouTubeDislikeSettingsFragment();
|
||||||
|
} else {
|
||||||
|
preferenceIdentifier = "revanced_settings";
|
||||||
|
preferenceFragment = new ReVancedSettingsFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var resourceIdentifier = getIdentifier(preferenceIdentifier, "string");
|
||||||
|
getTextView(base.findViewById(getIdentifier("toolbar", "id"))).setText(resourceIdentifier);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogHelper.printException(ReVancedSettingActivity.class, "Couldn't set Toolbar title", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
base.getFragmentManager().beginTransaction().replace(getIdentifier("xsettings_fragments", "id"), preferenceFragment).commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T extends View> T getView(Class<T> typeClass, ViewGroup viewGroup) {
|
||||||
|
if (viewGroup == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
int childCount = viewGroup.getChildCount();
|
||||||
|
for (int i = 0; i < childCount; i++) {
|
||||||
|
View childAt = viewGroup.getChildAt(i);
|
||||||
|
if (childAt.getClass() == typeClass) {
|
||||||
|
return (T) childAt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ImageButton getImageButton(ViewGroup viewGroup) {
|
||||||
|
return getView(ImageButton.class, viewGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TextView getTextView(ViewGroup viewGroup) {
|
||||||
|
return getView(TextView.class, viewGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int getIdentifier(String name, String defType) {
|
||||||
|
Context appContext = ReVancedUtils.getContext();
|
||||||
|
assert appContext != null;
|
||||||
|
return appContext.getResources().getIdentifier(name, defType, appContext.getPackageName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,9 @@ import android.preference.SwitchPreference;
|
|||||||
|
|
||||||
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
|
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import app.revanced.integrations.settings.SettingsEnum;
|
import app.revanced.integrations.settings.SettingsEnum;
|
||||||
import app.revanced.integrations.utils.LogHelper;
|
import app.revanced.integrations.utils.LogHelper;
|
||||||
import app.revanced.integrations.utils.ReVancedUtils;
|
import app.revanced.integrations.utils.ReVancedUtils;
|
||||||
@ -30,7 +33,7 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
|
|||||||
|
|
||||||
public static Class homeActivityClass;
|
public static Class homeActivityClass;
|
||||||
|
|
||||||
private PreferenceScreen[] screens;
|
private List<PreferenceScreen> screens;
|
||||||
|
|
||||||
private boolean Registered = false;
|
private boolean Registered = false;
|
||||||
private boolean settingsInitialized = false;
|
private boolean settingsInitialized = false;
|
||||||
@ -79,10 +82,14 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
|
|||||||
} else if (pref instanceof ListPreference) {
|
} else if (pref instanceof ListPreference) {
|
||||||
ListPreference listPref = (ListPreference) pref;
|
ListPreference listPref = (ListPreference) pref;
|
||||||
if (setting == SettingsEnum.PREFERRED_VIDEO_SPEED) {
|
if (setting == SettingsEnum.PREFERRED_VIDEO_SPEED) {
|
||||||
Float value = SettingsEnum.PREFERRED_VIDEO_SPEED.getFloat();
|
try {
|
||||||
|
String value = sharedPreferences.getString(setting.getPath(), setting.getDefaultValue() + "");
|
||||||
listPref.setDefaultValue(value);
|
listPref.setDefaultValue(value);
|
||||||
listPref.setSummary(videoSpeedEntries[listPref.findIndexOfValue(String.valueOf(value))]);
|
listPref.setSummary(videoSpeedEntries[listPref.findIndexOfValue(String.valueOf(value))]);
|
||||||
SettingsEnum.PREFERRED_VIDEO_SPEED.setValue(value);
|
SettingsEnum.PREFERRED_VIDEO_SPEED.saveValue(value);
|
||||||
|
} catch (Throwable th) {
|
||||||
|
LogHelper.printException(ReVancedSettingsFragment.class, "Error setting value of speed" + th);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LogHelper.printException(ReVancedSettingsFragment.class, "No valid setting found: " + setting.toString());
|
LogHelper.printException(ReVancedSettingsFragment.class, "No valid setting found: " + setting.toString());
|
||||||
}
|
}
|
||||||
@ -97,7 +104,7 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
|
|||||||
LogHelper.printException(ReVancedSettingsFragment.class, "Setting cannot be handled! " + pref.toString());
|
LogHelper.printException(ReVancedSettingsFragment.class, "Setting cannot be handled! " + pref.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ReVancedUtils.getContext() != null && settingsInitialized) {
|
if (ReVancedUtils.getContext() != null && settingsInitialized && setting.shouldRebootOnChange()) {
|
||||||
rebootDialog(getActivity());
|
rebootDialog(getActivity());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,16 +123,18 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
|
|||||||
this.settingsInitialized = sharedPreferences.getBoolean("revanced_initialized", false);
|
this.settingsInitialized = sharedPreferences.getBoolean("revanced_initialized", false);
|
||||||
sharedPreferences.registerOnSharedPreferenceChangeListener(this.listener);
|
sharedPreferences.registerOnSharedPreferenceChangeListener(this.listener);
|
||||||
this.Registered = true;
|
this.Registered = true;
|
||||||
this.screens[0] = (PreferenceScreen) getPreferenceScreen().findPreference("codec_override");
|
this.screens = new ArrayList<>();
|
||||||
this.screens[1] = (PreferenceScreen) getPreferenceScreen().findPreference("video_settings");
|
this.screens.add((PreferenceScreen) getPreferenceScreen().findPreference("codec_override"));
|
||||||
this.screens[2] = (PreferenceScreen) getPreferenceScreen().findPreference("video_ad_settings");
|
this.screens.add((PreferenceScreen) getPreferenceScreen().findPreference("video_settings"));
|
||||||
this.screens[3] = (PreferenceScreen) getPreferenceScreen().findPreference("ad_settings");
|
this.screens.add((PreferenceScreen) getPreferenceScreen().findPreference("video_ad_settings"));
|
||||||
this.screens[4] = (PreferenceScreen) getPreferenceScreen().findPreference("layout_settings");
|
this.screens.add((PreferenceScreen) getPreferenceScreen().findPreference("ad_settings"));
|
||||||
this.screens[5] = (PreferenceScreen) getPreferenceScreen().findPreference("buffer_screen");
|
this.screens.add((PreferenceScreen) getPreferenceScreen().findPreference("layout_settings"));
|
||||||
this.screens[6] = (PreferenceScreen) getPreferenceScreen().findPreference("misc_screen");
|
this.screens.add((PreferenceScreen) getPreferenceScreen().findPreference("buffer_screen"));
|
||||||
this.screens[7] = (PreferenceScreen) getPreferenceScreen().findPreference("swipe_screen");
|
this.screens.add((PreferenceScreen) getPreferenceScreen().findPreference("misc_screen"));
|
||||||
|
this.screens.add((PreferenceScreen) getPreferenceScreen().findPreference("swipe_screen"));
|
||||||
|
|
||||||
final ListPreference listPreference3 = (ListPreference) screens[1].findPreference("pref_preferred_video_speed");
|
|
||||||
|
final ListPreference listPreference3 = (ListPreference) screens.get(1).findPreference("revanced_pref_video_speed");
|
||||||
setSpeedListPreferenceData(listPreference3);
|
setSpeedListPreferenceData(listPreference3);
|
||||||
|
|
||||||
listPreference3.setOnPreferenceClickListener(preference -> {
|
listPreference3.setOnPreferenceClickListener(preference -> {
|
||||||
@ -136,7 +145,7 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
|
|||||||
sharedPreferences.edit().putBoolean("revanced_initialized", true);
|
sharedPreferences.edit().putBoolean("revanced_initialized", true);
|
||||||
this.settingsInitialized = true;
|
this.settingsInitialized = true;
|
||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
LogHelper.printException(ReVancedSettingsFragment.class, "Unable to retrieve resourceId for xfile_prefs", th);
|
LogHelper.printException(ReVancedSettingsFragment.class, "Error during onCreate()", th);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
|||||||
SwitchPreference preference = new SwitchPreference(context);
|
SwitchPreference preference = new SwitchPreference(context);
|
||||||
preferenceScreen.addPreference(preference);
|
preferenceScreen.addPreference(preference);
|
||||||
preference.setKey(SettingsEnum.SB_NEW_SEGMENT_ENABLED.getPath());
|
preference.setKey(SettingsEnum.SB_NEW_SEGMENT_ENABLED.getPath());
|
||||||
preference.setDefaultValue(SettingsEnum.SB_NEW_SEGMENT_ENABLED.getBoolean());
|
preference.setDefaultValue(SettingsEnum.SB_NEW_SEGMENT_ENABLED.getDefaultValue());
|
||||||
preference.setChecked(SettingsEnum.SB_NEW_SEGMENT_ENABLED.getBoolean());
|
preference.setChecked(SettingsEnum.SB_NEW_SEGMENT_ENABLED.getBoolean());
|
||||||
preference.setTitle(str("enable_segmadding"));
|
preference.setTitle(str("enable_segmadding"));
|
||||||
preference.setSummary(str("enable_segmadding_sum"));
|
preference.setSummary(str("enable_segmadding_sum"));
|
||||||
@ -99,7 +99,7 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
|||||||
preference.setTitle(str("enable_voting"));
|
preference.setTitle(str("enable_voting"));
|
||||||
preference.setSummary(str("enable_voting_sum"));
|
preference.setSummary(str("enable_voting_sum"));
|
||||||
preference.setKey(SettingsEnum.SB_VOTING_ENABLED.getPath());
|
preference.setKey(SettingsEnum.SB_VOTING_ENABLED.getPath());
|
||||||
preference.setDefaultValue(SettingsEnum.SB_VOTING_ENABLED.getBoolean());
|
preference.setDefaultValue(SettingsEnum.SB_VOTING_ENABLED.getDefaultValue());
|
||||||
preference.setChecked(SettingsEnum.SB_VOTING_ENABLED.getBoolean());
|
preference.setChecked(SettingsEnum.SB_VOTING_ENABLED.getBoolean());
|
||||||
preferencesToDisableWhenSBDisabled.add(preference);
|
preferencesToDisableWhenSBDisabled.add(preference);
|
||||||
}
|
}
|
||||||
@ -231,7 +231,7 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
|||||||
preference.setTitle(str("general_skiptoast"));
|
preference.setTitle(str("general_skiptoast"));
|
||||||
preference.setSummary(str("general_skiptoast_sum"));
|
preference.setSummary(str("general_skiptoast_sum"));
|
||||||
preference.setKey(SettingsEnum.SB_SHOW_TOAST_WHEN_SKIP.getPath());
|
preference.setKey(SettingsEnum.SB_SHOW_TOAST_WHEN_SKIP.getPath());
|
||||||
preference.setDefaultValue(SettingsEnum.SB_SHOW_TOAST_WHEN_SKIP.getBoolean());
|
preference.setDefaultValue(SettingsEnum.SB_SHOW_TOAST_WHEN_SKIP.getDefaultValue());
|
||||||
preference.setOnPreferenceClickListener(preference12 -> {
|
preference.setOnPreferenceClickListener(preference12 -> {
|
||||||
Toast.makeText(preference12.getContext(), str("skipped_sponsor"), Toast.LENGTH_SHORT).show();
|
Toast.makeText(preference12.getContext(), str("skipped_sponsor"), Toast.LENGTH_SHORT).show();
|
||||||
return false;
|
return false;
|
||||||
@ -245,7 +245,7 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
|||||||
preference.setTitle(str("general_skipcount"));
|
preference.setTitle(str("general_skipcount"));
|
||||||
preference.setSummary(str("general_skipcount_sum"));
|
preference.setSummary(str("general_skipcount_sum"));
|
||||||
preference.setKey(SettingsEnum.SB_COUNT_SKIPS.getPath());
|
preference.setKey(SettingsEnum.SB_COUNT_SKIPS.getPath());
|
||||||
preference.setDefaultValue(SettingsEnum.SB_COUNT_SKIPS.getBoolean());
|
preference.setDefaultValue(SettingsEnum.SB_COUNT_SKIPS.getDefaultValue());
|
||||||
preferencesToDisableWhenSBDisabled.add(preference);
|
preferencesToDisableWhenSBDisabled.add(preference);
|
||||||
screen.addPreference(preference);
|
screen.addPreference(preference);
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
|||||||
preference.setTitle(str("general_time_without_sb"));
|
preference.setTitle(str("general_time_without_sb"));
|
||||||
preference.setSummary(str("general_time_without_sb_sum"));
|
preference.setSummary(str("general_time_without_sb_sum"));
|
||||||
preference.setKey(SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.getPath());
|
preference.setKey(SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.getPath());
|
||||||
preference.setDefaultValue(SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.getBoolean());
|
preference.setDefaultValue(SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.getDefaultValue());
|
||||||
preferencesToDisableWhenSBDisabled.add(preference);
|
preferencesToDisableWhenSBDisabled.add(preference);
|
||||||
screen.addPreference(preference);
|
screen.addPreference(preference);
|
||||||
}
|
}
|
||||||
@ -274,7 +274,7 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
|||||||
preference.setTitle(str("general_browser_button"));
|
preference.setTitle(str("general_browser_button"));
|
||||||
preference.setSummary(str("general_browser_button_sum"));
|
preference.setSummary(str("general_browser_button_sum"));
|
||||||
preference.setKey(SettingsEnum.SB_SHOW_BROWSER_BUTTON.getPath());
|
preference.setKey(SettingsEnum.SB_SHOW_BROWSER_BUTTON.getPath());
|
||||||
preference.setDefaultValue(SettingsEnum.SB_SHOW_BROWSER_BUTTON.getBoolean());
|
preference.setDefaultValue(SettingsEnum.SB_SHOW_BROWSER_BUTTON.getDefaultValue());
|
||||||
preferencesToDisableWhenSBDisabled.add(preference);
|
preferencesToDisableWhenSBDisabled.add(preference);
|
||||||
screen.addPreference(preference);
|
screen.addPreference(preference);
|
||||||
}
|
}
|
||||||
@ -285,7 +285,7 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
|||||||
preference.setTitle(str("general_adjusting"));
|
preference.setTitle(str("general_adjusting"));
|
||||||
preference.setSummary(str("general_adjusting_sum"));
|
preference.setSummary(str("general_adjusting_sum"));
|
||||||
preference.setKey(SettingsEnum.SB_ADJUST_NEW_SEGMENT_STEP.getPath());
|
preference.setKey(SettingsEnum.SB_ADJUST_NEW_SEGMENT_STEP.getPath());
|
||||||
preference.setDefaultValue(SettingsEnum.SB_ADJUST_NEW_SEGMENT_STEP.getInt());
|
preference.setDefaultValue(SettingsEnum.SB_ADJUST_NEW_SEGMENT_STEP.getDefaultValue() + "");
|
||||||
screen.addPreference(preference);
|
screen.addPreference(preference);
|
||||||
preferencesToDisableWhenSBDisabled.add(preference);
|
preferencesToDisableWhenSBDisabled.add(preference);
|
||||||
}
|
}
|
||||||
@ -296,7 +296,7 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
|||||||
preference.setTitle(str("general_min_duration"));
|
preference.setTitle(str("general_min_duration"));
|
||||||
preference.setSummary(str("general_min_duration_sum"));
|
preference.setSummary(str("general_min_duration_sum"));
|
||||||
preference.setKey(SettingsEnum.SB_MIN_DURATION.getPath());
|
preference.setKey(SettingsEnum.SB_MIN_DURATION.getPath());
|
||||||
preference.setDefaultValue(SettingsEnum.SB_MIN_DURATION.getFloat());
|
preference.setDefaultValue(SettingsEnum.SB_MIN_DURATION.getDefaultValue() + "");
|
||||||
screen.addPreference(preference);
|
screen.addPreference(preference);
|
||||||
preferencesToDisableWhenSBDisabled.add(preference);
|
preferencesToDisableWhenSBDisabled.add(preference);
|
||||||
}
|
}
|
||||||
@ -306,7 +306,7 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
|||||||
preference.setTitle(str("general_uuid"));
|
preference.setTitle(str("general_uuid"));
|
||||||
preference.setSummary(str("general_uuid_sum"));
|
preference.setSummary(str("general_uuid_sum"));
|
||||||
preference.setKey(SettingsEnum.SB_UUID.getPath());
|
preference.setKey(SettingsEnum.SB_UUID.getPath());
|
||||||
preference.setDefaultValue(SettingsEnum.SB_UUID.getString());
|
preference.setDefaultValue(SettingsEnum.SB_UUID.getDefaultValue() + "");
|
||||||
screen.addPreference(preference);
|
screen.addPreference(preference);
|
||||||
preferencesToDisableWhenSBDisabled.add(preference);
|
preferencesToDisableWhenSBDisabled.add(preference);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package app.revanced.integrations.sponsorblock;
|
package app.revanced.integrations.sponsorblock;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@ -7,6 +8,7 @@ import androidx.annotation.NonNull;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import app.revanced.integrations.utils.LogHelper;
|
import app.revanced.integrations.utils.LogHelper;
|
||||||
|
import app.revanced.integrations.utils.ReVancedUtils;
|
||||||
|
|
||||||
public class StringRef {
|
public class StringRef {
|
||||||
private static Resources resources;
|
private static Resources resources;
|
||||||
@ -88,6 +90,9 @@ public class StringRef {
|
|||||||
@NonNull
|
@NonNull
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
|
Context context = ReVancedUtils.getContext();
|
||||||
|
resources = context.getResources();
|
||||||
|
packageName = context.getPackageName();
|
||||||
resolved = true;
|
resolved = true;
|
||||||
if (resources != null) {
|
if (resources != null) {
|
||||||
final int identifier = resources.getIdentifier(value, "string", packageName);
|
final int identifier = resources.getIdentifier(value, "string", packageName);
|
||||||
@ -95,6 +100,8 @@ public class StringRef {
|
|||||||
LogHelper.printException(StringRef.class, "Resource not found: " + value);
|
LogHelper.printException(StringRef.class, "Resource not found: " + value);
|
||||||
else
|
else
|
||||||
value = resources.getString(identifier);
|
value = resources.getString(identifier);
|
||||||
|
} else {
|
||||||
|
LogHelper.printException(StringRef.class, "Could not resolve resources!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
@ -12,7 +12,6 @@ import app.revanced.integrations.utils.LogHelper;
|
|||||||
import app.revanced.integrations.utils.ReVancedUtils;
|
import app.revanced.integrations.utils.ReVancedUtils;
|
||||||
import app.revanced.integrations.utils.SharedPrefHelper;
|
import app.revanced.integrations.utils.SharedPrefHelper;
|
||||||
|
|
||||||
/* loaded from: classes6.dex */
|
|
||||||
public class SwipeHelper {
|
public class SwipeHelper {
|
||||||
static FrameLayout _frameLayout;
|
static FrameLayout _frameLayout;
|
||||||
public static boolean isTabletMode;
|
public static boolean isTabletMode;
|
||||||
|
@ -151,7 +151,12 @@ public class SponsorBlockView {
|
|||||||
|
|
||||||
private static void checkLayout() {
|
private static void checkLayout() {
|
||||||
if (inlineSponsorOverlay.getHeight() == 0) {
|
if (inlineSponsorOverlay.getHeight() == 0) {
|
||||||
View layout = SwipeHelper.nextGenWatchLayout.findViewById(getIdentifier("player_overlays", "id"));
|
ViewGroup watchLayout = SwipeHelper.nextGenWatchLayout;
|
||||||
|
if (watchLayout == null) {
|
||||||
|
LogHelper.debug(SponsorBlockView.class, "nextGenWatchLayout is null!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
View layout = watchLayout.findViewById(getIdentifier("player_overlays", "id"));
|
||||||
|
|
||||||
if (layout == null) {
|
if (layout == null) {
|
||||||
LogHelper.debug(SponsorBlockView.class, "player_overlays was not found for SB");
|
LogHelper.debug(SponsorBlockView.class, "player_overlays was not found for SB");
|
||||||
|
@ -14,21 +14,6 @@ public class SharedPrefHelper {
|
|||||||
sharedPreferences.edit().putBoolean(key, value).apply();
|
sharedPreferences.edit().putBoolean(key, value).apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void saveInt(Context context, SharedPrefNames prefName, String key, Integer value) {
|
|
||||||
SharedPreferences sharedPreferences = getPreferences(context, prefName);
|
|
||||||
sharedPreferences.edit().putInt(key, value).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void saveLong(Context context, SharedPrefNames prefName, String key, Long value) {
|
|
||||||
SharedPreferences sharedPreferences = getPreferences(context, prefName);
|
|
||||||
sharedPreferences.edit().putLong(key, value).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void saveFloat(Context context, SharedPrefNames prefName, String key, Float value) {
|
|
||||||
SharedPreferences sharedPreferences = getPreferences(context, prefName);
|
|
||||||
sharedPreferences.edit().putFloat(key, value).apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getString(Context context, SharedPrefNames prefName, String key, String _default) {
|
public static String getString(Context context, SharedPrefNames prefName, String key, String _default) {
|
||||||
SharedPreferences sharedPreferences = getPreferences(context, prefName);
|
SharedPreferences sharedPreferences = getPreferences(context, prefName);
|
||||||
return (sharedPreferences.getString(key, _default));
|
return (sharedPreferences.getString(key, _default));
|
||||||
@ -41,17 +26,17 @@ public class SharedPrefHelper {
|
|||||||
|
|
||||||
public static Long getLong(Context context, SharedPrefNames prefName, String key, Long _default) {
|
public static Long getLong(Context context, SharedPrefNames prefName, String key, Long _default) {
|
||||||
SharedPreferences sharedPreferences = getPreferences(context, prefName);
|
SharedPreferences sharedPreferences = getPreferences(context, prefName);
|
||||||
return sharedPreferences.getLong(key, _default);
|
return Long.valueOf(sharedPreferences.getString(key, _default + ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Float getFloat(Context context, SharedPrefNames prefName, String key, Float _default) {
|
public static Float getFloat(Context context, SharedPrefNames prefName, String key, Float _default) {
|
||||||
SharedPreferences sharedPreferences = getPreferences(context, prefName);
|
SharedPreferences sharedPreferences = getPreferences(context, prefName);
|
||||||
return sharedPreferences.getFloat(key, _default);
|
return Float.valueOf(sharedPreferences.getString(key, _default + ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Integer getInt(Context context, SharedPrefNames prefName, String key, Integer _default) {
|
public static Integer getInt(Context context, SharedPrefNames prefName, String key, Integer _default) {
|
||||||
SharedPreferences sharedPreferences = getPreferences(context, prefName);
|
SharedPreferences sharedPreferences = getPreferences(context, prefName);
|
||||||
return sharedPreferences.getInt(key, _default);
|
return Integer.valueOf(sharedPreferences.getString(key, _default + ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SharedPreferences getPreferences(Context context, SharedPrefNames name) {
|
public static SharedPreferences getPreferences(Context context, SharedPrefNames name) {
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package app.revanced.integrations.utils;
|
package app.revanced.integrations.utils;
|
||||||
|
|
||||||
/* loaded from: classes6.dex */
|
|
||||||
public class ThemeHelper {
|
public class ThemeHelper {
|
||||||
private static int themeValue;
|
private static int themeValue;
|
||||||
|
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.google.android.libraries.social.licenses;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
|
||||||
|
// Dummy class
|
||||||
|
public final class LicenseActivity extends Activity { }
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user