Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
feat(YouTube Music - Player components): Add `Enable black player bac…
Browse files Browse the repository at this point in the history
…kground` setting
  • Loading branch information
inotia00 authored and anddea committed May 28, 2024
1 parent d020bc8 commit d27d362
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -22,6 +23,9 @@

@SuppressWarnings("unused")
public class PlayerPatch {
private static final int MUSIC_VIDEO_GREY_BACKGROUND_COLOR = -12566464;
private static final int MUSIC_VIDEO_ORIGINAL_BACKGROUND_COLOR = -16579837;

@SuppressLint("StaticFieldLeak")
public static View previousButton;
@SuppressLint("StaticFieldLeak")
Expand All @@ -31,6 +35,13 @@ public static boolean enableColorMatchPlayer() {
return Settings.ENABLE_COLOR_MATCH_PLAYER.get();
}

public static int enableBlackPlayerBackground(int originalColor) {
return Settings.ENABLE_BLACK_PLAYER_BACKGROUND.get()
&& originalColor != MUSIC_VIDEO_GREY_BACKGROUND_COLOR
? Color.BLACK
: originalColor;
}

public static boolean enableForceMinimizedPlayer(boolean original) {
return Settings.ENABLE_FORCE_MINIMIZED_PLAYER.get() || original;
}
Expand Down Expand Up @@ -107,9 +118,6 @@ public static Object enableSwipeToDismissMiniPlayer(Object object) {
return Settings.ENABLE_SWIPE_TO_DISMISS_MINI_PLAYER.get() ? null : object;
}

private static final int MUSIC_VIDEO_GREY_BACKGROUND_COLOR = -12566464;
private static final int MUSIC_VIDEO_ORIGINAL_BACKGROUND_COLOR = -16579837;

public static int enableZenMode(int originalColor) {
if (Settings.ENABLE_ZEN_MODE.get() && originalColor == MUSIC_VIDEO_ORIGINAL_BACKGROUND_COLOR) {
if (Settings.ENABLE_ZEN_MODE_PODCAST.get() || !VideoType.getCurrent().isPodCast()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public class Settings extends BaseSettings {


// PreferenceScreen: Player
public static final BooleanSetting ENABLE_BLACK_PLAYER_BACKGROUND = new BooleanSetting("revanced_enable_black_player_background", FALSE, true);
public static final BooleanSetting ENABLE_COLOR_MATCH_PLAYER = new BooleanSetting("revanced_enable_color_match_player", TRUE);
public static final BooleanSetting ENABLE_FORCE_MINIMIZED_PLAYER = new BooleanSetting("revanced_enable_force_minimized_player", TRUE);
public static final BooleanSetting ENABLE_MINI_PLAYER_NEXT_BUTTON = new BooleanSetting("revanced_enable_mini_player_next_button", TRUE, true);
Expand Down

0 comments on commit d27d362

Please sign in to comment.