diff --git a/app/src/main/java/app/revanced/integrations/patches/ForceCodecPatch.java b/app/src/main/java/app/revanced/integrations/patches/ForceCodecPatch.java
new file mode 100644
index 0000000000..b78fdf178d
--- /dev/null
+++ b/app/src/main/java/app/revanced/integrations/patches/ForceCodecPatch.java
@@ -0,0 +1,22 @@
+package app.revanced.integrations.patches;
+
+import android.os.Build;
+
+import app.revanced.integrations.settings.SettingsEnum;
+
+public class ForceCodecPatch {
+
+ public static String getManufacturer() {
+ return SettingsEnum.CODEC_OVERRIDE_BOOLEAN.getBoolean() ? "samsung" : Build.MANUFACTURER;
+ }
+
+ public static String getModel() {
+ return SettingsEnum.CODEC_OVERRIDE_BOOLEAN.getBoolean() ? "SM-G920F" : Build.MODEL;
+ }
+
+ public static boolean shouldForceVP9() {
+ return SettingsEnum.CODEC_OVERRIDE_BOOLEAN.getBoolean();
+ }
+
+
+}
diff --git a/app/src/main/java/app/revanced/integrations/settings/Settings.java b/app/src/main/java/app/revanced/integrations/settings/Settings.java
index 5637f68abb..66bc59a91e 100644
--- a/app/src/main/java/app/revanced/integrations/settings/Settings.java
+++ b/app/src/main/java/app/revanced/integrations/settings/Settings.java
@@ -71,5 +71,22 @@ public static void setOldLayout(SharedPreferences sharedPreferences, String conf
}
LogHelper.debug("Settings", "setOldLayout: false");
}
+
+ public static boolean autoCaptions(boolean original) {
+ ReadSettings();
+ if (!settingsInitialized.booleanValue()) {
+ Log.e("XGlobals", "Context is null, returning " + original + "!");
+ return original;
+ }
+ Boolean captions = Boolean.valueOf(original);
+ if (prefAutoCaptions.booleanValue()) {
+ captions = true;
+ }
+ if (debug.booleanValue()) {
+ Log.d("XGlobals", "autoCaptions: " + captions);
+ }
+ return captions.booleanValue();
+ }
+
*/
}
diff --git a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java
index 297e777c27..3b01a06142 100644
--- a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java
+++ b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java
@@ -13,8 +13,6 @@ public enum SettingsEnum {
//Codec Override
CODEC_OVERRIDE_BOOLEAN("revanced_override_codec_enabled", true),
- MANUFACTURER_OVERRIDE_STRING("revanced_override_codec_manufacturer", null),
- MODEL_OVERRIDE_STRING("revanced_override_codec_model", null),
//Video Settings
OLD_STYLE_QUALITY_SETTINGS_BOOLEAN("revanced_use_old_style_quality_settings", true),
diff --git a/app/src/main/java/app/revanced/integrations/settingsmenu/ReVancedSettingsFragment.java b/app/src/main/java/app/revanced/integrations/settingsmenu/ReVancedSettingsFragment.java
index 8776c77280..6597d9943c 100644
--- a/app/src/main/java/app/revanced/integrations/settingsmenu/ReVancedSettingsFragment.java
+++ b/app/src/main/java/app/revanced/integrations/settingsmenu/ReVancedSettingsFragment.java
@@ -8,7 +8,6 @@
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
-import android.os.Build;
import android.os.Bundle;
import android.os.Process;
import android.preference.EditTextPreference;
@@ -23,8 +22,8 @@
import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.LogHelper;
import app.revanced.integrations.utils.ReVancedUtils;
-import app.revanced.integrations.videoplayer.autorepeat.AutoRepeat;
import app.revanced.integrations.utils.ScreenSizeHelper;
+import app.revanced.integrations.videoplayer.autorepeat.AutoRepeat;
import app.revanced.integrations.videoplayer.videourl.Copy;
import app.revanced.integrations.videoplayer.videourl.CopyWithTimeStamp;
@@ -40,9 +39,7 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
private PreferenceScreen codecPreferenceScreen;
private Preference codecVP9;
private PreferenceScreen layoutSettingsPreferenceScreen;
- private EditTextPreference manufacturerOverride;
private PreferenceScreen miscsPreferenceScreen;
- private EditTextPreference modelOverride;
private SwitchPreference tabletMiniplayer;
private PreferenceScreen videoAdSettingsPreferenceScreen;
private PreferenceScreen videoSettingsPreferenceScreen;
@@ -61,26 +58,6 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
SharedPreferences.OnSharedPreferenceChangeListener listener = (sharedPreferences, str) -> {
if (str.equals(SettingsEnum.DEBUG_BOOLEAN.getPath())) {
SettingsEnum.DEBUG_BOOLEAN.setValue(((SwitchPreference) findPreference(str)).isChecked());
- } else if (str.equals(SettingsEnum.CODEC_OVERRIDE_BOOLEAN.getPath())) {
- if (((SwitchPreference) codecPreferenceScreen.findPreference(str)).isChecked()) {
- SettingsEnum.MANUFACTURER_OVERRIDE_STRING.saveValue("samsung");
- SettingsEnum.MODEL_OVERRIDE_STRING.saveValue("SM-G920F");
- } else {
- SettingsEnum.MANUFACTURER_OVERRIDE_STRING.saveValue(null);
- SettingsEnum.MODEL_OVERRIDE_STRING.saveValue(null);
- }
- } else if (str.equals(SettingsEnum.MANUFACTURER_OVERRIDE_STRING.getPath())) {
- EditTextPreference editTextPreference = (EditTextPreference) codecPreferenceScreen.findPreference(str);
- if (editTextPreference != null) {
- editTextPreference.setSummary(editTextPreference.getText());
- SettingsEnum.MANUFACTURER_OVERRIDE_STRING.setValue(editTextPreference.getText());
- }
- } else if (str.equals(SettingsEnum.MODEL_OVERRIDE_STRING.getPath())) {
- EditTextPreference editTextPreference2 = (EditTextPreference) codecPreferenceScreen.findPreference(str);
- if (editTextPreference2 != null) {
- editTextPreference2.setSummary(editTextPreference2.getText());
- SettingsEnum.MODEL_OVERRIDE_STRING.setValue(editTextPreference2.getText());
- }
} else if (str.equals(SettingsEnum.HOME_ADS_SHOWN_BOOLEAN.getPath())) {
SettingsEnum.HOME_ADS_SHOWN_BOOLEAN.setValue(((SwitchPreference) adsSettingsPreferenceScreen.findPreference(str)).isChecked());
if (ReVancedUtils.getContext() != null && settingsInitialized) {
@@ -210,16 +187,10 @@ public void onCreate(Bundle bundle) {
this.miscsPreferenceScreen = (PreferenceScreen) getPreferenceScreen().findPreference("misc_screen");
this.xSwipeControlPreferenceScreen = (PreferenceScreen) getPreferenceScreen().findPreference("xfenster_screen");
this.vp9Override = (SwitchPreference) this.codecPreferenceScreen.findPreference("revanced_vp9_enabled");
- this.manufacturerOverride = (EditTextPreference) this.codecPreferenceScreen.findPreference("override_manufacturer");
- this.modelOverride = (EditTextPreference) this.codecPreferenceScreen.findPreference("override_model");
this.codecDefault = this.codecPreferenceScreen.findPreference("pref_default_override");
this.codecVP9 = this.codecPreferenceScreen.findPreference("pref_vp9_override");
this.tabletMiniplayer = (SwitchPreference) this.layoutSettingsPreferenceScreen.findPreference("tablet_miniplayer");
AutoRepeatLinks();
- EditTextPreference editTextPreference = this.manufacturerOverride;
- editTextPreference.setSummary(editTextPreference.getText());
- EditTextPreference editTextPreference2 = this.modelOverride;
- editTextPreference2.setSummary(editTextPreference2.getText());
final ListPreference listPreference = (ListPreference) this.videoSettingsPreferenceScreen.findPreference("pref_preferred_video_quality_wifi");
final ListPreference listPreference2 = (ListPreference) this.videoSettingsPreferenceScreen.findPreference("pref_preferred_video_quality_mobile");
setListPreferenceData(listPreference, true);
@@ -244,12 +215,12 @@ public void onCreate(Bundle bundle) {
Preference findPreference = findPreference("pref_about_field");
this.codecDefault.setOnPreferenceClickListener(preference -> {
- ReVancedSettingsFragment.this.changeCodec();
+ SettingsEnum.CODEC_OVERRIDE_BOOLEAN.saveValue(false);
return false;
});
this.codecVP9.setOnPreferenceClickListener(preference -> {
- ReVancedSettingsFragment.this.changeCodec();
+ SettingsEnum.CODEC_OVERRIDE_BOOLEAN.saveValue(true);
return false;
});
@@ -318,29 +289,6 @@ private String getPackageName() {
return PACKAGE_NAME;
}
- private void changeCodec() {
- String manufacturer = null;
- String model = null;
-
- if (SettingsEnum.CODEC_OVERRIDE_BOOLEAN.getBoolean()) {
- manufacturer = "samsung";
- model = "SM-G920F";
- } else {
- manufacturer = Build.MANUFACTURER;
- model = Build.MODEL;
- }
-
- SettingsEnum.MANUFACTURER_OVERRIDE_STRING.saveValue(manufacturer);
- SettingsEnum.MODEL_OVERRIDE_STRING.saveValue(model);
-
- manufacturerOverride.setText(manufacturer);
- modelOverride.setText(model);
- EditTextPreference editTextPreference = this.manufacturerOverride;
- editTextPreference.setSummary(editTextPreference.getText());
- EditTextPreference editTextPreference2 = this.modelOverride;
- editTextPreference2.setSummary(editTextPreference2.getText());
- }
-
private void AutoRepeatLinks() {
boolean z = this.sharedPreferences.getBoolean("pref_auto_repeat_button", false);
SwitchPreference switchPreference = (SwitchPreference) this.miscsPreferenceScreen.findPreference("pref_auto_repeat");
diff --git a/app/src/main/res/xml/revanced_prefs.xml b/app/src/main/res/xml/revanced_prefs.xml
index 7a3a492cdb..e56051400f 100644
--- a/app/src/main/res/xml/revanced_prefs.xml
+++ b/app/src/main/res/xml/revanced_prefs.xml
@@ -10,8 +10,6 @@
-
-