diff --git a/app/src/main/java/app/revanced/integrations/patches/LithoThemePatch.java b/app/src/main/java/app/revanced/integrations/patches/theme/ThemeLithoComponentsPatch.java similarity index 93% rename from app/src/main/java/app/revanced/integrations/patches/LithoThemePatch.java rename to app/src/main/java/app/revanced/integrations/patches/theme/ThemeLithoComponentsPatch.java index f544970b..da9f3963 100644 --- a/app/src/main/java/app/revanced/integrations/patches/LithoThemePatch.java +++ b/app/src/main/java/app/revanced/integrations/patches/theme/ThemeLithoComponentsPatch.java @@ -1,9 +1,9 @@ -package app.revanced.integrations.patches; +package app.revanced.integrations.patches.theme; import app.revanced.integrations.utils.ReVancedUtils; import app.revanced.integrations.utils.ThemeHelper; -public class LithoThemePatch { +public class ThemeLithoComponentsPatch { // color constants used in relation with litho components private static final int[] WHITE_VALUES = { -1, // comments chip background @@ -31,7 +31,7 @@ public class LithoThemePatch { * @param originalValue The original color value. * @return The new or original color value */ - public static int applyLithoTheme(int originalValue) { + public static int getValue(int originalValue) { if (ThemeHelper.isDarkTheme()) { if (anyEquals(originalValue, DARK_VALUES)) return getBlackColor(); } else { diff --git a/app/src/main/java/app/revanced/integrations/patches/theme/ThemePatch.java b/app/src/main/java/app/revanced/integrations/patches/theme/ThemePatch.java new file mode 100644 index 00000000..ef19df21 --- /dev/null +++ b/app/src/main/java/app/revanced/integrations/patches/theme/ThemePatch.java @@ -0,0 +1,23 @@ +package app.revanced.integrations.patches.theme; + +import android.graphics.Color; +import app.revanced.integrations.settings.SettingsEnum; +import app.revanced.integrations.utils.ReVancedUtils; + +public final class ThemePatch { + public static final int DEFAULT_SEEKBAR_COLOR = 0xffff0000; + + private static void resetSeekbarColor() { + ReVancedUtils.showToastShort("Invalid seekbar color value. Using default value."); + SettingsEnum.SEEKBAR_COLOR.saveValue(Integer.toHexString(DEFAULT_SEEKBAR_COLOR)); + } + + public static int getSeekbarColorValue() { + try { + return Color.parseColor(SettingsEnum.SEEKBAR_COLOR.getString()); + } catch (IllegalArgumentException exception) { + resetSeekbarColor(); + return DEFAULT_SEEKBAR_COLOR; + } + } +} 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 c5a21902..e46f5253 100644 --- a/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java +++ b/app/src/main/java/app/revanced/integrations/settings/SettingsEnum.java @@ -1,21 +1,17 @@ package app.revanced.integrations.settings; -import static java.lang.Boolean.FALSE; -import static java.lang.Boolean.TRUE; -import static app.revanced.integrations.settings.SettingsEnum.ReturnType.BOOLEAN; -import static app.revanced.integrations.settings.SettingsEnum.ReturnType.FLOAT; -import static app.revanced.integrations.settings.SettingsEnum.ReturnType.INTEGER; -import static app.revanced.integrations.settings.SettingsEnum.ReturnType.LONG; -import static app.revanced.integrations.settings.SettingsEnum.ReturnType.STRING; -import static app.revanced.integrations.settings.SharedPrefCategory.RETURN_YOUTUBE_DISLIKE; -import static app.revanced.integrations.settings.SharedPrefCategory.SPONSOR_BLOCK; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import app.revanced.integrations.utils.StringRef; +import app.revanced.integrations.patches.theme.ThemePatch; import java.util.Objects; -import app.revanced.integrations.utils.StringRef; +import static app.revanced.integrations.settings.SettingsEnum.ReturnType.*; +import static app.revanced.integrations.settings.SharedPrefCategory.RETURN_YOUTUBE_DISLIKE; +import static app.revanced.integrations.settings.SharedPrefCategory.SPONSOR_BLOCK; +import static java.lang.Boolean.FALSE; +import static java.lang.Boolean.TRUE; public enum SettingsEnum { //Download Settings @@ -107,6 +103,7 @@ public enum SettingsEnum { SPOOF_APP_VERSION_TARGET("revanced_spoof_app_version_target", STRING, "17.30.35", true, parents(SPOOF_APP_VERSION)), USE_TABLET_MINIPLAYER("revanced_tablet_miniplayer", BOOLEAN, FALSE, true), WIDE_SEARCHBAR("revanced_wide_searchbar", BOOLEAN, FALSE, true), + SEEKBAR_COLOR("revanced_seekbar_color", STRING, Integer.toHexString(ThemePatch.DEFAULT_SEEKBAR_COLOR), true), // Misc. Settings SIGNATURE_SPOOFING("revanced_spoof_signature_verification", BOOLEAN, TRUE, "revanced_spoof_signature_verification_user_dialog_message"),