Skip to content

Commit

Permalink
feat(youtube/theme): extend theming to splash screen (#769)
Browse files Browse the repository at this point in the history
  • Loading branch information
OxrxL committed Oct 25, 2022
1 parent 682ce61 commit 800b82e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
}

Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/theme/values-night-v31/styles.xml
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 800b82e

Please sign in to comment.