mirror of
https://github.com/revanced/revanced-integrations.git
synced 2025-01-29 21:27:32 +01:00
feat(youtube/theme): change seekbar color via preference
This commit is contained in:
parent
2ee18fce69
commit
1185ceedf7
@ -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.ReVancedUtils;
|
||||||
import app.revanced.integrations.utils.ThemeHelper;
|
import app.revanced.integrations.utils.ThemeHelper;
|
||||||
|
|
||||||
public class LithoThemePatch {
|
public class ThemeLithoComponentsPatch {
|
||||||
// color constants used in relation with litho components
|
// color constants used in relation with litho components
|
||||||
private static final int[] WHITE_VALUES = {
|
private static final int[] WHITE_VALUES = {
|
||||||
-1, // comments chip background
|
-1, // comments chip background
|
||||||
@ -31,7 +31,7 @@ public class LithoThemePatch {
|
|||||||
* @param originalValue The original color value.
|
* @param originalValue The original color value.
|
||||||
* @return The new or 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 (ThemeHelper.isDarkTheme()) {
|
||||||
if (anyEquals(originalValue, DARK_VALUES)) return getBlackColor();
|
if (anyEquals(originalValue, DARK_VALUES)) return getBlackColor();
|
||||||
} else {
|
} else {
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,21 +1,17 @@
|
|||||||
package app.revanced.integrations.settings;
|
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.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import app.revanced.integrations.utils.StringRef;
|
||||||
|
import app.revanced.integrations.patches.theme.ThemePatch;
|
||||||
|
|
||||||
import java.util.Objects;
|
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 {
|
public enum SettingsEnum {
|
||||||
//Download Settings
|
//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)),
|
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),
|
||||||
|
|
||||||
// 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"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user