Add ReVanced bold icons

This commit is contained in:
LisoUseInAIKyrios 2025-10-20 21:48:15 +04:00
parent 64334b4f79
commit c37527f182
47 changed files with 745 additions and 108 deletions

View file

@ -38,9 +38,6 @@ public final class NavigationButtonsPatch {
private static final boolean DISABLE_TRANSLUCENT_NAVIGATION_BAR_DARK
= Settings.DISABLE_TRANSLUCENT_NAVIGATION_BAR_DARK.get();
private static final boolean NAVIGATION_BAR_DISABLE_BOLD_ICONS
= Settings.NAVIGATION_BAR_DISABLE_BOLD_ICONS.get();
/**
* Injection point.
*/
@ -71,13 +68,6 @@ public final class NavigationButtonsPatch {
return Settings.NAVIGATION_BAR_ANIMATIONS.get();
}
/**
* Injection point.
*/
public static boolean useBoldIcons(boolean original) {
return !NAVIGATION_BAR_DISABLE_BOLD_ICONS;
}
/**
* Injection point.
*/

View file

@ -0,0 +1,85 @@
package app.revanced.extension.youtube.patches.theme;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import app.revanced.extension.shared.ResourceType;
import app.revanced.extension.shared.Utils;
import app.revanced.extension.shared.settings.BaseSettings;
/**
* Dynamic drawable that is either the regular or bolded ReVanced preference icon.
*
* This is needed because the YouTube ReVanced preference intent is an AndroidX preference,
* and AndroidX classes are not built into Android which makes programmatically changing
* the preference thru patching overly complex. This solves the problem by using a drawable
* wrapper to dynamically pick which icon drawable to use at runtime.
*/
@SuppressWarnings("unused")
public class ReVancedSettingsIconDynamicDrawable extends Drawable {
private final Drawable icon;
public ReVancedSettingsIconDynamicDrawable() {
final int resId = Utils.getResourceIdentifier(ResourceType.DRAWABLE,
BaseSettings.SETTINGS_DISABLE_BOLD_ICONS.get()
? "revanced_settings_icon"
: "revanced_settings_icon_bold"
);
icon = Utils.getContext().getDrawable(resId);
}
@Override
public void draw(@NonNull Canvas canvas) {
icon.draw(canvas);
}
@Override
public void setAlpha(int alpha) {
icon.setAlpha(alpha);
}
@Override
public void setColorFilter(@Nullable ColorFilter colorFilter) {
icon.setColorFilter(colorFilter);
}
@Override
public int getOpacity() {
return icon.getOpacity();
}
@Override
public int getIntrinsicWidth() {
return icon.getIntrinsicWidth();
}
@Override
public int getIntrinsicHeight() {
return icon.getIntrinsicHeight();
}
@Override
public void setBounds(int left, int top, int right, int bottom) {
super.setBounds(left, top, right, bottom);
icon.setBounds(left, top, right, bottom);
}
@Override
public void setBounds(@NonNull Rect bounds) {
super.setBounds(bounds);
icon.setBounds(bounds);
}
@Override
public void onBoundsChange(@NonNull Rect bounds) {
super.onBoundsChange(bounds);
icon.setBounds(bounds);
}
}

View file

@ -285,7 +285,6 @@ public class Settings extends BaseSettings {
public static final BooleanSetting SWITCH_CREATE_WITH_NOTIFICATIONS_BUTTON = new BooleanSetting("revanced_switch_create_with_notifications_button", TRUE, true,
"revanced_switch_create_with_notifications_button_user_dialog_message");
public static final BooleanSetting NAVIGATION_BAR_ANIMATIONS = new BooleanSetting("revanced_navigation_bar_animations", FALSE);
public static final BooleanSetting NAVIGATION_BAR_DISABLE_BOLD_ICONS = new BooleanSetting("revanced_navigation_bar_disable_bold_icons", TRUE, true);
public static final BooleanSetting DISABLE_TRANSLUCENT_STATUS_BAR = new BooleanSetting("revanced_disable_translucent_status_bar", FALSE, true,
"revanced_disable_translucent_status_bar_user_dialog_message");
public static final BooleanSetting DISABLE_TRANSLUCENT_NAVIGATION_BAR_LIGHT = new BooleanSetting("revanced_disable_translucent_navigation_bar_light", FALSE, true);

View file

@ -21,6 +21,9 @@ import app.revanced.extension.youtube.settings.search.YouTubeSearchViewControlle
@SuppressWarnings("deprecation")
public class YouTubeActivityHook extends BaseActivityHook {
private static final boolean SETTINGS_DISABLE_BOLD_ICONS
= Settings.SETTINGS_DISABLE_BOLD_ICONS.get();
private static int currentThemeValueOrdinal = -1; // Must initially be a non-valid enum ordinal value.
/**
@ -148,4 +151,12 @@ public class YouTubeActivityHook extends BaseActivityHook {
public static boolean handleBackPress() {
return YouTubeSearchViewController.handleFinish(searchViewController);
}
/**
* Injection point.
*/
@SuppressWarnings("unused")
public static boolean useBoldIcons(boolean original) {
return !SETTINGS_DISABLE_BOLD_ICONS;
}
}

View file

@ -284,7 +284,7 @@ public final class NavigationBar {
private static final int fillBellCairoBlack = Utils.getResourceIdentifier(ResourceType.DRAWABLE,
// The bold cairo notification filled icon is present,
// but YT still has not fixed the icon not associated to the enum.
VersionCheckPatch.IS_20_31_OR_GREATER && !Settings.NAVIGATION_BAR_DISABLE_BOLD_ICONS.get()
VersionCheckPatch.IS_20_31_OR_GREATER && !Settings.SETTINGS_DISABLE_BOLD_ICONS.get()
? "yt_fill_experimental_bell_vd_theme_24"
: "revanced_fill_bell_cairo_black_24");