fix(youtube/theme): fix app crash if user clears seekbar color (#390)

This commit is contained in:
LisoUseInAIKyrios 2023-05-05 10:32:10 +04:00 committed by GitHub
parent 2882ec1c9c
commit e2f52905dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,9 @@ public final class ThemePatch {
SettingsEnum.SEEKBAR_COLOR.saveValue(SettingsEnum.SEEKBAR_COLOR.defaultValue); SettingsEnum.SEEKBAR_COLOR.saveValue(SettingsEnum.SEEKBAR_COLOR.defaultValue);
} }
/**
* Injection point.
*/
public static int getSeekbarClickedColorValue(final int colorValue) { public static int getSeekbarClickedColorValue(final int colorValue) {
// YouTube uses a specific color when the seekbar is clicked. Override in that case. // YouTube uses a specific color when the seekbar is clicked. Override in that case.
return colorValue == ORIGINAL_SEEKBAR_CLICKED_COLOR ? getSeekbarColorValue() : colorValue; return colorValue == ORIGINAL_SEEKBAR_CLICKED_COLOR ? getSeekbarColorValue() : colorValue;
@ -21,7 +24,7 @@ public final class ThemePatch {
public static int getSeekbarColorValue() { public static int getSeekbarColorValue() {
try { try {
return Color.parseColor(SettingsEnum.SEEKBAR_COLOR.getString()); return Color.parseColor(SettingsEnum.SEEKBAR_COLOR.getString());
} catch (IllegalArgumentException exception) { } catch (Exception exception) {
resetSeekbarColor(); resetSeekbarColor();
return getSeekbarColorValue(); return getSeekbarColorValue();
} }