feat(youtube/theme): extend theming to splash screen (#769)

This commit is contained in:
OxrxL 2022-10-25 08:30:42 +02:00 committed by GitHub
parent 5be3ecfb82
commit f7bb937ef2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -9,6 +9,8 @@ import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.youtube.layout.theme.annotations.ThemeCompatibility
import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch
import app.revanced.util.resources.ResourceUtils
import app.revanced.util.resources.ResourceUtils.copyResources
import org.w3c.dom.Element
@Patch
@ -31,16 +33,22 @@ class ThemePatch : ResourcePatch {
node.textContent = when (node.getAttribute("name")) {
"yt_black1", "yt_black1_opacity95", "yt_black1_opacity98", "yt_black2", "yt_black3", "yt_black4",
"yt_status_bar_background_dark", "material_grey_100", "material_grey_50", "material_grey_600",
"material_grey_800", "material_grey_850", "material_grey_900", "material_grey_white_1000" -> darkThemeBackgroundColor
"material_grey_800", "material_grey_850", "material_grey_900", "material_grey_white_1000",
"sud_glif_v3_dialog_background_color_dark" -> darkThemeBackgroundColor
"yt_white1", "yt_white1_opacity95", "yt_white1_opacity98", "yt_white2", "yt_white3",
"yt_white4" -> lightThemeBackgroundColor
"yt_white4", "sud_glif_v3_dialog_background_color_light" -> lightThemeBackgroundColor
else -> continue
}
}
}
// copies the resource file to change the splash screen color
context.copyResources("theme",
ResourceUtils.ResourceGroup("values-night-v31", "styles.xml")
)
return PatchResultSuccess()
}

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Base.Theme.YouTube.Launcher" parent="@style/Theme.AppCompat.NoActionBar">
<item name="android:windowSplashScreenBackground">@android:color/black</item>
<item name="android:windowSplashScreenAnimatedIcon">@drawable/avd_anim</item>
<item name="android:windowSplashScreenAnimationDuration">1000</item>
</style>
</resources>