fix(youtube/theme): fix toast shown on fresh app install (#381)

This commit is contained in:
LisoUseInAIKyrios 2023-05-03 11:46:24 +04:00 committed by GitHub
parent 513d4e4542
commit 2dc431f1bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -1,17 +1,16 @@
package app.revanced.integrations.patches.theme; package app.revanced.integrations.patches.theme;
import android.graphics.Color; import android.graphics.Color;
import app.revanced.integrations.settings.SettingsEnum; import app.revanced.integrations.settings.SettingsEnum;
import app.revanced.integrations.utils.ReVancedUtils; import app.revanced.integrations.utils.ReVancedUtils;
public final class ThemePatch { public final class ThemePatch {
public static final int DEFAULT_SEEKBAR_COLOR = 0xffff0000; private static final int ORIGINAL_SEEKBAR_CLICKED_COLOR = -65536;
public static final int ORIGINAL_SEEKBAR_CLICKED_COLOR = -65536;
private static void resetSeekbarColor() { private static void resetSeekbarColor() {
ReVancedUtils.showToastShort("Invalid seekbar color value. Using default value."); ReVancedUtils.showToastShort("Invalid seekbar color value. Using default value.");
SettingsEnum.SEEKBAR_COLOR.saveValue("#" + Integer.toHexString(DEFAULT_SEEKBAR_COLOR)); SettingsEnum.SEEKBAR_COLOR.saveValue(SettingsEnum.SEEKBAR_COLOR.defaultValue);
} }
public static int getSeekbarClickedColorValue(final int colorValue) { public static int getSeekbarClickedColorValue(final int colorValue) {
@ -24,7 +23,7 @@ public final class ThemePatch {
return Color.parseColor(SettingsEnum.SEEKBAR_COLOR.getString()); return Color.parseColor(SettingsEnum.SEEKBAR_COLOR.getString());
} catch (IllegalArgumentException exception) { } catch (IllegalArgumentException exception) {
resetSeekbarColor(); resetSeekbarColor();
return DEFAULT_SEEKBAR_COLOR; return getSeekbarColorValue();
} }
} }
} }

View File

@ -106,7 +106,7 @@ public enum SettingsEnum {
SPOOF_APP_VERSION_TARGET("revanced_spoof_app_version_target", STRING, "17.30.35", true, parents(SPOOF_APP_VERSION)), 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), USE_TABLET_MINIPLAYER("revanced_tablet_miniplayer", BOOLEAN, FALSE, true),
WIDE_SEARCHBAR("revanced_wide_searchbar", BOOLEAN, FALSE, true), WIDE_SEARCHBAR("revanced_wide_searchbar", BOOLEAN, FALSE, true),
SEEKBAR_COLOR("revanced_seekbar_color", STRING, Integer.toHexString(ThemePatch.DEFAULT_SEEKBAR_COLOR), true), SEEKBAR_COLOR("revanced_seekbar_color", STRING, "#FF0000", true),
// Misc. Settings // Misc. Settings
SIGNATURE_SPOOFING("revanced_spoof_signature_verification", BOOLEAN, TRUE, "revanced_spoof_signature_verification_user_dialog_message"), SIGNATURE_SPOOFING("revanced_spoof_signature_verification", BOOLEAN, TRUE, "revanced_spoof_signature_verification_user_dialog_message"),