Skip to content

Commit 768cdea

Browse files
Use same small icon for all built-in branding styles
1 parent b9f85bc commit 768cdea

File tree

5 files changed

+21
-57
lines changed

5 files changed

+21
-57
lines changed

extensions/shared/library/src/main/java/app/revanced/extension/shared/patches/CustomBrandingPatch.java

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,11 @@ public enum BrandingTheme {
4343
*/
4444
CUSTOM;
4545

46-
private final String alias;
47-
48-
BrandingTheme() {
49-
alias = name().toLowerCase(Locale.US);
50-
}
51-
5246
private String packageAndNameIndexToClassAlias(String packageName, int appIndex) {
5347
if (appIndex <= 0) {
5448
throw new IllegalArgumentException("App index starts at index 1");
5549
}
56-
return packageName + ".revanced_" + alias + '_' + appIndex;
57-
}
58-
59-
private int getNotificationIcon() {
60-
// Original icon is quantum_ic_video_youtube_white_24
61-
final int iconResource = Utils.getResourceIdentifier(
62-
"revanced_notification_icon_" + alias, "drawable");
63-
if (iconResource == 0) {
64-
Logger.printException(() -> "Could not load notification small icon");
65-
}
66-
return iconResource;
50+
return packageName + ".revanced_" + name().toLowerCase(Locale.US) + '_' + appIndex;
6751
}
6852
}
6953

@@ -74,7 +58,16 @@ private int getNotificationIcon() {
7458
if (branding == BrandingTheme.ORIGINAL) {
7559
notificationSmallIcon = 0;
7660
} else {
77-
notificationSmallIcon = branding.getNotificationIcon();
61+
// Original icon is quantum_ic_video_youtube_white_24
62+
String iconName = "revanced_notification_icon";
63+
if (branding == BrandingTheme.CUSTOM) {
64+
iconName += "_custom";
65+
}
66+
67+
notificationSmallIcon = Utils.getResourceIdentifier(iconName, "drawable");
68+
if (notificationSmallIcon == 0) {
69+
Logger.printException(() -> "Could not load notification small icon");
70+
}
7871
}
7972
}
8073

patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ private const val LAUNCHER_RESOURCE_NAME_PREFIX = "revanced_launcher_"
5858
private const val LAUNCHER_ADAPTIVE_BACKGROUND_PREFIX = "revanced_adaptive_background_"
5959
private const val LAUNCHER_ADAPTIVE_FOREGROUND_PREFIX = "revanced_adaptive_foreground_"
6060
private const val LAUNCHER_ADAPTIVE_MONOCHROME_PREFIX = "revanced_adaptive_monochrome_"
61-
private const val NOTIFICATION_ICON_PREFIX = "revanced_notification_icon_"
61+
private const val NOTIFICATION_ICON_NAME = "revanced_notification_icon"
6262

6363
private val USER_CUSTOM_ADAPTIVE_FILE_NAMES = arrayOf(
6464
"$LAUNCHER_ADAPTIVE_BACKGROUND_PREFIX$CUSTOM_USER_ICON_STYLE_NAME.png",
6565
"$LAUNCHER_ADAPTIVE_FOREGROUND_PREFIX$CUSTOM_USER_ICON_STYLE_NAME.png"
6666
)
6767

6868
private const val USER_CUSTOM_MONOCHROME_FILE_NAME = "$LAUNCHER_ADAPTIVE_MONOCHROME_PREFIX$CUSTOM_USER_ICON_STYLE_NAME.xml"
69-
private const val USER_CUSTOM_NOTIFICATION_ICON_FILE_NAME = "$NOTIFICATION_ICON_PREFIX$CUSTOM_USER_ICON_STYLE_NAME.xml"
69+
private const val USER_CUSTOM_NOTIFICATION_ICON_FILE_NAME = "${NOTIFICATION_ICON_NAME}_$CUSTOM_USER_ICON_STYLE_NAME.xml"
7070

7171
internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/shared/patches/CustomBrandingPatch;"
7272

@@ -210,7 +210,6 @@ internal fun baseCustomBrandingPatch(
210210
"$LAUNCHER_ADAPTIVE_BACKGROUND_PREFIX$style.xml",
211211
"$LAUNCHER_ADAPTIVE_FOREGROUND_PREFIX$style.xml",
212212
"$LAUNCHER_ADAPTIVE_MONOCHROME_PREFIX$style.xml",
213-
"$NOTIFICATION_ICON_PREFIX$style.xml"
214213
),
215214
ResourceGroup(
216215
"mipmap-anydpi",
@@ -219,9 +218,16 @@ internal fun baseCustomBrandingPatch(
219218
)
220219
}
221220

222-
// Copy template user icon, because the aliases must be added even if no user icon is provided.
221+
223222
copyResources(
224223
"custom-branding",
224+
// Push notification 'small' icon.
225+
ResourceGroup(
226+
"drawable",
227+
"$NOTIFICATION_ICON_NAME.xml"
228+
),
229+
230+
// Copy template user icon, because the aliases must be added even if no user icon is provided.
225231
ResourceGroup(
226232
"drawable",
227233
USER_CUSTOM_MONOCHROME_FILE_NAME,

patches/src/main/resources/custom-branding/drawable/revanced_notification_icon_rounded.xml

Lines changed: 0 additions & 23 deletions
This file was deleted.

patches/src/main/resources/custom-branding/drawable/revanced_notification_icon_scaled.xml

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)