mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
feat(YouTube Music): Add Dark theme
patch, Remove Amoled
patch
This commit is contained in:
@ -8,13 +8,16 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import app.revanced.extension.music.patches.utils.PatchStatus;
|
||||
import app.revanced.extension.music.settings.Settings;
|
||||
import app.revanced.extension.shared.utils.ResourceUtils;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class NavigationPatch {
|
||||
private static final int colorGrey12 =
|
||||
ResourceUtils.getColor("revanced_color_grey_12");
|
||||
private static final int colorGrey12 = PatchStatus.DarkTheme()
|
||||
? ResourceUtils.getColor("ytm_color_grey_12")
|
||||
: ResourceUtils.getColor("revanced_color_grey_12");
|
||||
|
||||
public static Enum<?> lastPivotTab;
|
||||
|
||||
public static int enableBlackNavigationBar() {
|
||||
|
@ -1,21 +1,44 @@
|
||||
package app.revanced.extension.music.patches.utils;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import app.revanced.extension.shared.utils.ResourceUtils;
|
||||
import app.revanced.extension.shared.utils.Utils;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class DrawableColorPatch {
|
||||
private static final int[] DARK_VALUES = {
|
||||
-14606047 // comments box background
|
||||
-14606047, // comments box background
|
||||
-16579837, // button container background in album
|
||||
-16777216, // button container background in playlist
|
||||
};
|
||||
|
||||
public static int getLithoColor(int originalValue) {
|
||||
if (anyEquals(originalValue, DARK_VALUES))
|
||||
return -16777215;
|
||||
// background colors
|
||||
private static final Drawable headerGradient =
|
||||
ResourceUtils.getDrawable("revanced_header_gradient");
|
||||
private static final int blackColor =
|
||||
ResourceUtils.getColor("yt_black1");
|
||||
|
||||
return originalValue;
|
||||
public static int getLithoColor(int originalValue) {
|
||||
return ArrayUtils.contains(DARK_VALUES, originalValue)
|
||||
? blackColor
|
||||
: originalValue;
|
||||
}
|
||||
|
||||
private static boolean anyEquals(int value, int... of) {
|
||||
for (int v : of) if (value == v) return true;
|
||||
return false;
|
||||
public static void setHeaderGradient(ViewGroup viewGroup) {
|
||||
viewGroup.getViewTreeObserver().addOnGlobalLayoutListener(() -> Utils.runOnMainThreadDelayed(() -> {
|
||||
if (!(viewGroup.getChildAt(0) instanceof ViewGroup parentViewGroup))
|
||||
return;
|
||||
if (!(parentViewGroup.getChildAt(0) instanceof ImageView gradientView))
|
||||
return;
|
||||
if (headerGradient != null) {
|
||||
gradientView.setForeground(headerGradient);
|
||||
}
|
||||
}, 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,11 @@ package app.revanced.extension.music.patches.utils;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public class PatchStatus {
|
||||
public static boolean DarkTheme() {
|
||||
// Replace this with true if the Dark theme patch succeeds
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean SpoofAppVersionDefaultBoolean() {
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user