mirror of
https://github.com/revanced/revanced-integrations
synced 2024-11-22 05:02:19 +01:00
feat(youtube/hide-seekbar): more fine grained hiding of seekbar (#409)
This commit is contained in:
parent
8ff9ebc592
commit
40def9e036
@ -22,7 +22,7 @@ public class ProgressBarDrawable extends Drawable {
|
||||
|
||||
@Override
|
||||
public void draw(@NonNull Canvas canvas) {
|
||||
if (SettingsEnum.HIDE_SEEKBAR.getBoolean()) {
|
||||
if (SettingsEnum.HIDE_SEEKBAR_THUMBNAIL.getBoolean()) {
|
||||
return;
|
||||
}
|
||||
paint.setColor(SeekbarColorPatch.getCustomSeekbarColor());
|
||||
|
@ -51,12 +51,31 @@ public final class SeekbarColorPatch {
|
||||
return customSeekbarColor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*
|
||||
* Overrides color when seekbar is clicked, and all Litho components that use the YouTube seekbar color.
|
||||
* Overrides all Litho components that use the YouTube seekbar color.
|
||||
* Used only for the video thumbnails seekbar.
|
||||
*
|
||||
* If {@link SettingsEnum#HIDE_SEEKBAR_THUMBNAIL} is enabled, this returns a fully transparent color.
|
||||
*/
|
||||
public static int getSeekbarColorOverride(int colorValue) {
|
||||
public static int getLithoColor(int colorValue) {
|
||||
if (colorValue == ORIGINAL_SEEKBAR_COLOR) {
|
||||
if (SettingsEnum.HIDE_SEEKBAR_THUMBNAIL.getBoolean()) {
|
||||
return 0x00000000;
|
||||
}
|
||||
return getSeekbarColorValue(ORIGINAL_SEEKBAR_COLOR);
|
||||
}
|
||||
return colorValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection point.
|
||||
*
|
||||
* Overrides color when video player seekbar is clicked.
|
||||
*/
|
||||
public static int getVideoPlayerSeekbarClickedColor(int colorValue) {
|
||||
return colorValue == ORIGINAL_SEEKBAR_COLOR
|
||||
? getSeekbarColorValue(ORIGINAL_SEEKBAR_COLOR)
|
||||
: colorValue;
|
||||
@ -65,18 +84,20 @@ public final class SeekbarColorPatch {
|
||||
/**
|
||||
* Injection point.
|
||||
*
|
||||
* If {@link SettingsEnum#HIDE_SEEKBAR} is enabled, this returns a fully transparent color.
|
||||
*
|
||||
* Otherwise the original color is changed to the custom seekbar color, while retaining
|
||||
* Overrides color used for the video player seekbar.
|
||||
*/
|
||||
public static int getVideoPlayerSeekbarColor(int originalColor) {
|
||||
return getSeekbarColorValue(originalColor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Color parameter is changed to the custom seekbar color, while retaining
|
||||
* the brightness and alpha changes of the parameter value compared to the original seekbar color.
|
||||
*/
|
||||
public static int getSeekbarColorValue(int originalColor) {
|
||||
private static int getSeekbarColorValue(int originalColor) {
|
||||
try {
|
||||
if (SettingsEnum.HIDE_SEEKBAR.getBoolean()) {
|
||||
return 0x00000000;
|
||||
}
|
||||
if (customSeekbarColor == ORIGINAL_SEEKBAR_COLOR) {
|
||||
return originalColor; // Nothing to do
|
||||
return originalColor; // nothing to do
|
||||
}
|
||||
final int alphaDifference = Color.alpha(originalColor) - Color.alpha(ORIGINAL_SEEKBAR_COLOR);
|
||||
|
||||
|
@ -116,6 +116,7 @@ public enum SettingsEnum {
|
||||
HIDE_PLAYER_OVERLAY("revanced_hide_player_overlay", BOOLEAN, FALSE, true),
|
||||
HIDE_PREVIEW_COMMENT("revanced_hide_preview_comment", BOOLEAN, FALSE, true),
|
||||
HIDE_SEEKBAR("revanced_hide_seekbar", BOOLEAN, FALSE, true),
|
||||
HIDE_SEEKBAR_THUMBNAIL("revanced_hide_seekbar_thumbnail", BOOLEAN, FALSE, true),
|
||||
HIDE_HOME_BUTTON("revanced_hide_home_button", BOOLEAN, FALSE, true),
|
||||
HIDE_SHORTS_BUTTON("revanced_hide_shorts_button", BOOLEAN, TRUE, true),
|
||||
HIDE_SUBSCRIPTIONS_BUTTON("revanced_hide_subscriptions_button", BOOLEAN, FALSE, true),
|
||||
|
Loading…
Reference in New Issue
Block a user