Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(youtube/theme): change seekbar color via preference
- Loading branch information
Showing
3 changed files
with
34 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
app/src/main/java/app/revanced/integrations/patches/theme/ThemePatch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters