Use custom navigation bar notification filled icon (20.39 still needs a bytecode fix)

This commit is contained in:
LisoUseInAIKyrios
2025-10-01 11:57:53 +04:00
parent 636bded69c
commit 4d9de1a81a
13 changed files with 33 additions and 10 deletions

View File

@@ -278,13 +278,13 @@ public final class NavigationBar {
}
/**
* Use the bundled non cairo filled icon instead of a custom icon.
* Use the old non cairo filled icon, which is almost identical to
* the what would be the filled cairo icon.
* Custom cairo notification filled icon to fix unpatched app missing resource.
* Custom icon is modified starting from
* <a href="https://fontawesome.com/icons/bell?f=classic&s=solid">Font Awesome</a>.
*/
private static final int fillBellCairoBlack = Utils.getResourceIdentifier(
ResourceType.DRAWABLE,
"yt_fill_bell_black_24");
"revanced_fill_bell_cairo_black_24");
/**
* Injection point.
@@ -292,13 +292,12 @@ public final class NavigationBar {
*/
@SuppressWarnings({"unchecked", "rawtypes"})
public static void setCairoNotificationFilledIcon(EnumMap enumMap, Enum tabActivityCairo) {
if (fillBellCairoBlack != 0) {
// Show a popup informing this fix is no longer needed to those who might care.
if (BaseSettings.DEBUG.get() && enumMap.containsKey(tabActivityCairo)) {
Logger.printException(() -> "YouTube fixed the cairo notification icons");
}
enumMap.putIfAbsent(tabActivityCairo, fillBellCairoBlack);
// Show a popup informing this fix is no longer needed to those who might care.
if (BaseSettings.DEBUG.get() && enumMap.containsKey(tabActivityCairo)) {
Logger.printException(() -> "YouTube fixed the cairo notification icons");
}
enumMap.putIfAbsent(tabActivityCairo, fillBellCairoBlack);
}
public enum NavigationButton {

View File

@@ -6,6 +6,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.instructions
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.bytecodePatch
import app.revanced.patcher.patch.resourcePatch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
@@ -17,6 +18,8 @@ import app.revanced.patches.youtube.misc.playservice.is_20_28_or_greater
import app.revanced.patches.youtube.misc.playservice.is_20_39_or_greater
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
import app.revanced.patches.youtube.shared.mainActivityOnBackPressedFingerprint
import app.revanced.util.ResourceGroup
import app.revanced.util.copyResources
import app.revanced.util.findFreeRegister
import app.revanced.util.getReference
import com.android.tools.smali.dexlib2.AccessFlags
@@ -46,6 +49,27 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig
versionCheckPatch,
playerTypeHookPatch, // Required to detect the search bar in all situations.
resourceMappingPatch, // Used by fingerprints
resourcePatch {
// Copy missing notification icon.
execute {
arrayOf(
// App does not use ldpi icons.
"mdpi",
"hdpi",
"xhdpi",
"xxhdpi",
"xxxhdpi",
).forEach { mipmap ->
copyResources(
"navigationbuttons",
ResourceGroup(
"drawable-$mipmap",
"revanced_fill_bell_cairo_black_24.png"
)
)
}
}
}
)
execute {

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB