mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-02 15:44:37 +02:00
fix(YouTube - Custom branding icon): Splash animation background color is always white https://github.com/inotia00/ReVanced_Extended/issues/2892
This commit is contained in:
parent
7e4a71b385
commit
22b98336d5
@ -218,8 +218,7 @@ val customBrandingIconPatch = resourcePatch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val styleList = mutableListOf(
|
val styleList = mutableListOf(
|
||||||
Triple(
|
Pair(
|
||||||
"values-v31",
|
|
||||||
"Base.Theme.YouTube.Launcher",
|
"Base.Theme.YouTube.Launcher",
|
||||||
"@style/Theme.AppCompat.DayNight.NoActionBar"
|
"@style/Theme.AppCompat.DayNight.NoActionBar"
|
||||||
),
|
),
|
||||||
@ -227,21 +226,15 @@ val customBrandingIconPatch = resourcePatch(
|
|||||||
|
|
||||||
if (is_19_32_or_greater) {
|
if (is_19_32_or_greater) {
|
||||||
styleList += listOf(
|
styleList += listOf(
|
||||||
Triple(
|
Pair(
|
||||||
"values-night-v31",
|
|
||||||
"Theme.YouTube.Home",
|
|
||||||
"@style/Base.V27.Theme.YouTube.Home"
|
|
||||||
),
|
|
||||||
Triple(
|
|
||||||
"values-v31",
|
|
||||||
"Theme.YouTube.Home",
|
"Theme.YouTube.Home",
|
||||||
"@style/Base.V27.Theme.YouTube.Home"
|
"@style/Base.V27.Theme.YouTube.Home"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
styleList.forEach { (directory, nodeAttributeName, nodeAttributeParent) ->
|
styleList.forEach { (nodeAttributeName, nodeAttributeParent) ->
|
||||||
document("res/$directory/styles.xml").use { document ->
|
document("res/values-v31/styles.xml").use { document ->
|
||||||
val resourcesNode =
|
val resourcesNode =
|
||||||
document.getElementsByTagName("resources").item(0) as Element
|
document.getElementsByTagName("resources").item(0) as Element
|
||||||
|
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package app.revanced.patches.youtube.utils.fix.splash
|
package app.revanced.patches.youtube.utils.fix.splash
|
||||||
|
|
||||||
import app.revanced.patcher.patch.resourcePatch
|
import app.revanced.patcher.patch.resourcePatch
|
||||||
import app.revanced.patches.youtube.utils.compatibility.Constants.YOUTUBE_PACKAGE_NAME
|
|
||||||
import app.revanced.patches.youtube.utils.playservice.is_19_32_or_greater
|
import app.revanced.patches.youtube.utils.playservice.is_19_32_or_greater
|
||||||
import app.revanced.patches.youtube.utils.playservice.versionCheckPatch
|
import app.revanced.patches.youtube.utils.playservice.versionCheckPatch
|
||||||
import app.revanced.patches.youtube.utils.settings.ResourceUtils.youtubePackageName
|
import app.revanced.patches.youtube.utils.settings.ResourceUtils.restoreOldSplashAnimationIncluded
|
||||||
import app.revanced.util.findElementByAttributeValueOrThrow
|
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,16 +20,13 @@ val darkModeSplashScreenPatch = resourcePatch(
|
|||||||
) {
|
) {
|
||||||
dependsOn(versionCheckPatch)
|
dependsOn(versionCheckPatch)
|
||||||
|
|
||||||
execute {
|
finalize {
|
||||||
if (!is_19_32_or_greater) {
|
if (!is_19_32_or_greater) {
|
||||||
return@execute
|
return@finalize
|
||||||
}
|
}
|
||||||
|
|
||||||
arrayOf(
|
if (restoreOldSplashAnimationIncluded) {
|
||||||
"values-night",
|
document("res/values-night/styles.xml").use { document ->
|
||||||
"values-night-v27",
|
|
||||||
).forEach { directory ->
|
|
||||||
document("res/$directory/styles.xml").use { document ->
|
|
||||||
val resourcesNode = document.getElementsByTagName("resources").item(0) as Element
|
val resourcesNode = document.getElementsByTagName("resources").item(0) as Element
|
||||||
val childNodes = resourcesNode.childNodes
|
val childNodes = resourcesNode.childNodes
|
||||||
|
|
||||||
@ -45,6 +40,25 @@ val darkModeSplashScreenPatch = resourcePatch(
|
|||||||
style.setAttribute("name", "Theme.YouTube.Home")
|
style.setAttribute("name", "Theme.YouTube.Home")
|
||||||
style.setAttribute("parent", nodeAttributeParent)
|
style.setAttribute("parent", nodeAttributeParent)
|
||||||
|
|
||||||
|
val windowItem = document.createElement("item")
|
||||||
|
windowItem.setAttribute("name", "android:windowBackground")
|
||||||
|
windowItem.textContent = "@color/yt_black1"
|
||||||
|
style.appendChild(windowItem)
|
||||||
|
|
||||||
|
resourcesNode.removeChild(node)
|
||||||
|
resourcesNode.appendChild(style)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
document("res/values-night-v27/styles.xml").use { document ->
|
||||||
|
// Create a night mode specific override for the splash screen background.
|
||||||
|
val style = document.createElement("style")
|
||||||
|
style.setAttribute("name", "Theme.YouTube.Home")
|
||||||
|
style.setAttribute("parent", "@style/Base.V27.Theme.YouTube.Home")
|
||||||
|
|
||||||
|
// Fix status and navigation bar showing white on some Android devices,
|
||||||
|
// such as SDK 28 Android 10 medium tablet.
|
||||||
val colorSplashBackgroundColor = "@color/yt_black1"
|
val colorSplashBackgroundColor = "@color/yt_black1"
|
||||||
arrayOf(
|
arrayOf(
|
||||||
"android:navigationBarColor" to colorSplashBackgroundColor,
|
"android:navigationBarColor" to colorSplashBackgroundColor,
|
||||||
@ -59,25 +73,9 @@ val darkModeSplashScreenPatch = resourcePatch(
|
|||||||
style.appendChild(styleItem)
|
style.appendChild(styleItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
resourcesNode.removeChild(node)
|
val resourcesNode = document.getElementsByTagName("resources").item(0) as Element
|
||||||
resourcesNode.appendChild(style)
|
resourcesNode.appendChild(style)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
finalize {
|
|
||||||
// GmsCore support included
|
|
||||||
if (youtubePackageName != YOUTUBE_PACKAGE_NAME) {
|
|
||||||
document("AndroidManifest.xml").use { document ->
|
|
||||||
val mainActivityElement = document.childNodes.findElementByAttributeValueOrThrow(
|
|
||||||
"android:name",
|
|
||||||
"com.google.android.apps.youtube.app.watchwhile.MainActivity",
|
|
||||||
)
|
|
||||||
|
|
||||||
mainActivityElement.setAttribute("android:launchMode", "singleTask")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user