feat(YouTube - Navigation bar components): Add Cairo icon (Library tab)

This commit is contained in:
inotia00 2025-03-24 20:56:17 +09:00
parent 6dfd88c75e
commit 8ec5f19bdb
5 changed files with 47 additions and 0 deletions

View File

@ -40,6 +40,8 @@ import java.util.EnumMap;
import java.util.Map;
import java.util.Objects;
import app.revanced.extension.shared.settings.BaseSettings;
import app.revanced.extension.shared.utils.Logger;
import app.revanced.extension.shared.utils.ResourceUtils;
import app.revanced.extension.shared.utils.Utils;
import app.revanced.extension.youtube.settings.Settings;
@ -234,6 +236,17 @@ public class GeneralPatch {
}
}
public static int getLibraryDrawableId(int original) {
if (ExtendedUtils.IS_19_26_OR_GREATER &&
!ExtendedUtils.isSpoofingToLessThan("19.27.00")) {
int libraryCairoId = ResourceUtils.getDrawableIdentifier("yt_outline_library_cairo_black_24");
if (libraryCairoId != 0) {
return libraryCairoId;
}
}
return original;
}
public static boolean switchCreateWithNotificationButton(boolean original) {
return Settings.SWITCH_CREATE_WITH_NOTIFICATIONS_BUTTON.get() || original;
}

View File

@ -1,6 +1,7 @@
package app.revanced.patches.youtube.general.navigation
import app.revanced.patches.youtube.utils.resourceid.ytFillBell
import app.revanced.patches.youtube.utils.resourceid.ytOutlineLibrary
import app.revanced.util.fingerprint.legacyFingerprint
import app.revanced.util.or
import com.android.tools.smali.dexlib2.AccessFlags
@ -74,6 +75,11 @@ internal val setEnumMapFingerprint = legacyFingerprint(
literals = listOf(ytFillBell),
)
internal val setEnumMapSecondaryFingerprint = legacyFingerprint(
name = "setEnumMapSecondaryFingerprint",
literals = listOf(ytOutlineLibrary),
)
internal const val TRANSLUCENT_NAVIGATION_BAR_FEATURE_FLAG = 45630927L
internal val translucentNavigationBarFingerprint = legacyFingerprint(

View File

@ -15,6 +15,7 @@ import app.revanced.patches.youtube.utils.playservice.is_19_25_or_greater
import app.revanced.patches.youtube.utils.playservice.is_19_28_or_greater
import app.revanced.patches.youtube.utils.playservice.versionCheckPatch
import app.revanced.patches.youtube.utils.resourceid.sharedResourceIdPatch
import app.revanced.patches.youtube.utils.resourceid.ytOutlineLibrary
import app.revanced.patches.youtube.utils.settings.ResourceUtils.addPreference
import app.revanced.patches.youtube.utils.settings.settingsPatch
import app.revanced.util.ResourceGroup
@ -25,6 +26,7 @@ import app.revanced.util.fingerprint.methodOrThrow
import app.revanced.util.getReference
import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
import app.revanced.util.indexOfFirstLiteralInstructionOrThrow
import app.revanced.util.indexOfFirstStringInstructionOrThrow
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
@ -56,6 +58,14 @@ private val navigationBarComponentsResourcePatch = resourcePatch(
)
)
}
copyResources(
"youtube/navigationbuttons",
ResourceGroup(
"drawable-xxxhdpi",
"yt_outline_library_cairo_black_24.png"
)
)
}
}
}
@ -204,6 +214,18 @@ val navigationBarComponentsPatch = bytecodePatch(
"""
)
}
setEnumMapSecondaryFingerprint.methodOrThrow().apply {
val index = indexOfFirstLiteralInstructionOrThrow(ytOutlineLibrary)
val register = getInstruction<OneRegisterInstruction>(index).registerA
addInstructions(
index + 1, """
invoke-static {v$register}, $GENERAL_CLASS_DESCRIPTOR->getLibraryDrawableId(I)I
move-result v$register
"""
)
}
}
// endregion

View File

@ -237,6 +237,8 @@ var youTubeLogo = -1L
private set
var ytFillBell = -1L
private set
var ytOutlineLibrary = -1L
private set
var ytOutlineMoonZ = -1L
private set
var ytOutlinePictureInPictureWhite = -1L
@ -706,6 +708,10 @@ internal val sharedResourceIdPatch = resourcePatch(
DRAWABLE,
"yt_fill_bell_black_24"
]
ytOutlineLibrary = resourceMappings[
DRAWABLE,
"yt_outline_library_black_24"
]
ytOutlineMoonZ = resourceMappings[
DRAWABLE,
"yt_outline_moon_z_vd_theme_24"

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B