feat(YouTube - Theme): Add option for black and white splash screen animation (#5119)
This commit is contained in:

committed by
GitHub

parent
50b68f03d4
commit
42db0c2e36
@ -44,6 +44,19 @@ internal val themeHelperLightColorFingerprint = fingerprint {
|
||||
}
|
||||
}
|
||||
|
||||
internal const val GRADIENT_LOADING_SCREEN_AB_CONSTANT = 45412406L
|
||||
|
||||
internal val useGradientLoadingScreenFingerprint = fingerprint {
|
||||
literal { GRADIENT_LOADING_SCREEN_AB_CONSTANT }
|
||||
}
|
||||
|
||||
internal const val SPLASH_SCREEN_STYLE_FEATURE_FLAG = 269032877L
|
||||
|
||||
internal val splashScreenStyleFingerprint = fingerprint {
|
||||
returns("V")
|
||||
parameters("Landroid/os/Bundle;")
|
||||
literal { SPLASH_SCREEN_STYLE_FEATURE_FLAG }
|
||||
custom { method, classDef ->
|
||||
method.name == "onCreate" && classDef.endsWith("/MainActivity;")
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import app.revanced.patches.all.misc.resources.addResourcesPatch
|
||||
import app.revanced.patches.shared.misc.mapping.resourceMappingPatch
|
||||
import app.revanced.patches.shared.misc.settings.preference.BasePreference
|
||||
import app.revanced.patches.shared.misc.settings.preference.InputType
|
||||
import app.revanced.patches.shared.misc.settings.preference.ListPreference
|
||||
import app.revanced.patches.shared.misc.settings.preference.PreferenceCategory
|
||||
import app.revanced.patches.shared.misc.settings.preference.PreferenceScreenPreference.Sorting
|
||||
import app.revanced.patches.shared.misc.settings.preference.SwitchPreference
|
||||
@ -17,6 +18,7 @@ import app.revanced.patches.shared.misc.settings.preference.TextPreference
|
||||
import app.revanced.patches.youtube.layout.seekbar.seekbarColorPatch
|
||||
import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_25_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.is_19_47_or_greater
|
||||
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
|
||||
import app.revanced.patches.youtube.misc.settings.PreferenceScreen
|
||||
import app.revanced.patches.youtube.misc.settings.settingsPatch
|
||||
@ -27,8 +29,6 @@ import org.w3c.dom.Element
|
||||
private const val EXTENSION_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/extension/youtube/patches/theme/ThemePatch;"
|
||||
|
||||
internal const val GRADIENT_LOADING_SCREEN_AB_CONSTANT = 45412406L
|
||||
|
||||
val themePatch = bytecodePatch(
|
||||
name = "Theme",
|
||||
description = "Adds options for theming and applies a custom background theme (dark background theme defaults to amoled black).",
|
||||
@ -232,15 +232,32 @@ val themePatch = bytecodePatch(
|
||||
addResources("youtube", "layout.theme.themePatch")
|
||||
|
||||
PreferenceScreen.GENERAL_LAYOUT.addPreferences(
|
||||
SwitchPreference("revanced_gradient_loading_screen"),
|
||||
SwitchPreference("revanced_gradient_loading_screen")
|
||||
)
|
||||
|
||||
if (is_19_47_or_greater) {
|
||||
PreferenceScreen.GENERAL_LAYOUT.addPreferences(
|
||||
ListPreference(
|
||||
key = "splash_screen_animation_style",
|
||||
summaryKey = null
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
useGradientLoadingScreenFingerprint.method.insertLiteralOverride(
|
||||
GRADIENT_LOADING_SCREEN_AB_CONSTANT,
|
||||
"$EXTENSION_CLASS_DESCRIPTOR->gradientLoadingScreenEnabled(Z)Z"
|
||||
)
|
||||
|
||||
mapOf(
|
||||
if (is_19_47_or_greater) {
|
||||
// Lottie splash screen exists in earlier versions, but it may not be always on.
|
||||
splashScreenStyleFingerprint.method.insertLiteralOverride(
|
||||
SPLASH_SCREEN_STYLE_FEATURE_FLAG,
|
||||
"$EXTENSION_CLASS_DESCRIPTOR->getLoadingScreenType(I)I"
|
||||
)
|
||||
}
|
||||
|
||||
arrayOf(
|
||||
themeHelperLightColorFingerprint to lightThemeBackgroundColor,
|
||||
themeHelperDarkColorFingerprint to darkThemeBackgroundColor,
|
||||
).forEach { (fingerprint, color) ->
|
||||
|
@ -187,6 +187,21 @@
|
||||
<item>AUTOMOTIVE</item>
|
||||
</string-array>
|
||||
</patch>
|
||||
<patch id="layout.theme.themePatch">
|
||||
<!-- Since the 30fps looks bad, and the 2/5 second styles are not useful
|
||||
(YouTube closes the animation as soon as the feed is loaded),
|
||||
only the 60fps 1 second styles are exposed in the settings.
|
||||
Imported settings data can still be manually edited to force the other styles. -->
|
||||
<string-array name="splash_screen_animation_style_entries">
|
||||
<item>@string/splash_screen_animation_style_entry_1</item>
|
||||
<item>@string/splash_screen_animation_style_entry_2</item>
|
||||
</string-array>
|
||||
<string-array name="splash_screen_animation_style_entry_values">
|
||||
<item>FPS_60_ONE_SECOND</item>
|
||||
<item>FPS_60_BLACK_AND_WHITE</item>
|
||||
</string-array>
|
||||
</patch>
|
||||
|
||||
<patch id="layout.player.fullscreen.exitFullscreenPatch">
|
||||
<string-array name="revanced_exit_fullscreen_entries">
|
||||
<item>@string/revanced_exit_fullscreen_entry_1</item>
|
||||
|
@ -1323,6 +1323,9 @@ Swipe to expand or close"</string>
|
||||
<string name="revanced_gradient_loading_screen_title">Enable gradient loading screen</string>
|
||||
<string name="revanced_gradient_loading_screen_summary_on">Loading screen will have a gradient background</string>
|
||||
<string name="revanced_gradient_loading_screen_summary_off">Loading screen will have a solid background</string>
|
||||
<string name="splash_screen_animation_style_title">Splash screen style</string>
|
||||
<string name="splash_screen_animation_style_entry_1">Color</string>
|
||||
<string name="splash_screen_animation_style_entry_2">Black and white</string>
|
||||
<string name="revanced_seekbar_custom_color_title">Enable custom seekbar color</string>
|
||||
<string name="revanced_seekbar_custom_color_summary_on">Custom seekbar color is shown</string>
|
||||
<string name="revanced_seekbar_custom_color_summary_off">Original seekbar color is shown</string>
|
||||
|
Reference in New Issue
Block a user