mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-06-12 21:27:43 +02:00
feat(youtube): add add-splash-animation
patch
This commit is contained in:
@ -0,0 +1,66 @@
|
||||
package app.revanced.patches.youtube.layout.splashanimation.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Description
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotations.Patch
|
||||
import app.revanced.patches.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.util.resources.ResourceUtils
|
||||
import app.revanced.util.resources.ResourceUtils.copyResources
|
||||
import app.revanced.util.resources.ResourceUtils.copyXmlNode
|
||||
import kotlin.io.path.exists
|
||||
|
||||
@Patch
|
||||
@Name("add-splash-animation")
|
||||
@Description("Adds splash animation, which was removed in YT v18.19.36+. (cannot be used with 'custom-branding-icon' patch)")
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class AddSplashAnimationPatch : ResourcePatch {
|
||||
override fun execute(context: ResourceContext): PatchResult {
|
||||
|
||||
val resDirectory = context["res"]
|
||||
val targetXml = resDirectory.resolve("drawable").resolve("avd_anim.xml").toPath()
|
||||
|
||||
/**
|
||||
* avd_anim.xml removed from YouTube v18.19.36+
|
||||
*/
|
||||
if (!targetXml.exists()) {
|
||||
|
||||
/**
|
||||
* merge Splash animation drawables to main drawables
|
||||
* extract from YouTube v18.18.39
|
||||
*/
|
||||
arrayOf(
|
||||
ResourceUtils.ResourceGroup(
|
||||
"drawable",
|
||||
"\$\$avd_anim__1__0.xml",
|
||||
"\$\$avd_anim__1__1.xml",
|
||||
"\$\$avd_anim__2__0.xml",
|
||||
"\$\$avd_anim__2__1.xml",
|
||||
"\$\$avd_anim__3__0.xml",
|
||||
"\$\$avd_anim__3__1.xml",
|
||||
"\$avd_anim__0.xml",
|
||||
"\$avd_anim__1.xml",
|
||||
"\$avd_anim__2.xml",
|
||||
"\$avd_anim__3.xml",
|
||||
"\$avd_anim__4.xml",
|
||||
"avd_anim.xml"
|
||||
)
|
||||
).forEach { resourceGroup ->
|
||||
context.copyResources("youtube/splashscreen", resourceGroup)
|
||||
}
|
||||
|
||||
/**
|
||||
* merge Splash animation styles to main styles
|
||||
* extract from YouTube v18.18.39
|
||||
*/
|
||||
context.copyXmlNode("youtube/splashscreen", "values-v31/styles.xml", "resources")
|
||||
}
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.2,0 0.6,1 1.0,1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" />
|
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.2,0 0.6,1 1.0,1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" />
|
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.05,0 0,1 1.0,1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" />
|
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.05,0 0,1 1.0,1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" />
|
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.05,0 0,1 1.0,1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" />
|
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pathInterpolator android:pathData="M 0.0,0.0 c0.05,0 0,1 1.0,1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt" />
|
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector android:height="432.0dip" android:width="432.0dip" android:viewportWidth="432.0" android:viewportHeight="432.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
|
||||
<group android:name="_R_G">
|
||||
<group android:name="_R_G_L_2_G" android:pivotX="60.992" android:pivotY="42.77" android:scaleX="1.69" android:scaleY="1.69" android:translateX="157.008" android:translateY="175.23">
|
||||
<path android:name="_R_G_L_2_G_D_0_P_0" android:fillColor="#ff9aa0a6" android:pathData=" M119.2 13.53 C117.8,8.3 113.68,4.19 108.46,2.79 C98.98,0.25 60.99,0.25 60.99,0.25 C60.99,0.25 23,0.25 13.53,2.79 C8.3,4.19 4.18,8.3 2.79,13.53 C0.25,23 0.25,42.77 0.25,42.77 C0.25,42.77 0.25,62.54 2.79,72.01 C4.18,77.24 8.3,81.35 13.53,82.75 C23,85.29 60.99,85.29 60.99,85.29 C60.99,85.29 98.98,85.29 108.46,82.75 C113.68,81.35 117.8,77.24 119.2,72.01 C121.73,62.54 121.73,42.77 121.73,42.77 C121.73,42.77 121.73,23 119.2,13.53c " android:fillAlpha="0.35" />
|
||||
</group>
|
||||
<group android:name="_R_G_L_1_G" android:pivotX="60.992" android:pivotY="42.77" android:scaleX="1.69" android:scaleY="1.69" android:translateX="157.008" android:translateY="175.23">
|
||||
<clip-path android:name="maskx" android:pathData=" M119.2 13.53 C117.8,8.3 113.68,4.19 108.46,2.79 C98.98,0.25 60.99,0.25 60.99,0.25 C60.99,0.25 23,0.25 13.53,2.79 C8.3,4.19 4.18,8.3 2.79,13.53 C0.25,23 0.25,42.77 0.25,42.77 C0.25,42.77 0.25,62.54 2.79,72.01 C4.18,77.24 8.3,81.35 13.53,82.75 C23,85.29 60.99,85.29 60.99,85.29 C60.99,85.29 98.98,85.29 108.46,82.75 C113.68,81.35 117.8,77.24 119.2,72.01 C121.73,62.54 121.73,42.77 121.73,42.77 C121.73,42.77 121.73,23 119.2,13.53c " />
|
||||
<path android:name="_R_G_L_1_G_D_0_P_0" android:fillColor="#ffff0000" android:pathData=" M-184.91 148.88 C-184.91,148.88 -1.22,42.83 -1.22,42.83 C-1.22,42.83 -184.91,-63.23 -184.91,-63.23 C-184.91,-63.23 -184.91,148.88 -184.91,148.88c " android:fillAlpha="0.0" />
|
||||
<path android:name="_R_G_L_1_G_D_1_P_0" android:fillColor="#ffffffff" android:pathData=" M-5.69 46.08 C-5.69,46.08 -0.03,42.82 -0.03,42.82 C-0.03,42.82 -5.69,39.55 -5.69,39.55 C-5.69,39.55 -5.69,46.08 -5.69,46.08c " android:fillAlpha="1.0" />
|
||||
</group>
|
||||
</group>
|
||||
<group android:name="time_group" />
|
||||
</vector>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:ordering="together"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
|
||||
<objectAnimator android:interpolator="@drawable/$$avd_anim__1__0" android:duration="167" android:startOffset="0" android:valueFrom="0" android:valueTo="0" android:valueType="floatType" android:propertyName="fillAlpha" />
|
||||
<objectAnimator android:interpolator="@drawable/$$avd_anim__1__1" android:duration="750" android:startOffset="167" android:valueFrom="0" android:valueTo="1" android:valueType="floatType" android:propertyName="fillAlpha" />
|
||||
</set>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:ordering="together"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
|
||||
<objectAnimator android:interpolator="@drawable/$$avd_anim__2__0" android:duration="167" android:startOffset="0" android:valueFrom="M-184.91 148.88 C-184.91,148.88 -1.22,42.83 -1.22,42.83 C-1.22,42.83 -184.91,-63.23 -184.91,-63.23 C-184.91,-63.23 -184.91,148.88 -184.91,148.88c " android:valueTo="M-184.91 148.88 C-184.91,148.88 -1.22,42.83 -1.22,42.83 C-1.22,42.83 -184.91,-63.23 -184.91,-63.23 C-184.91,-63.23 -184.91,148.88 -184.91,148.88c " android:valueType="pathType" android:propertyName="pathData" />
|
||||
<objectAnimator android:interpolator="@drawable/$$avd_anim__2__1" android:duration="383" android:startOffset="167" android:valueFrom="M-184.91 148.88 C-184.91,148.88 -1.22,42.83 -1.22,42.83 C-1.22,42.83 -184.91,-63.23 -184.91,-63.23 C-184.91,-63.23 -184.91,148.88 -184.91,148.88c " android:valueTo="M-3.25 148.9 C-3.25,148.9 180.44,42.85 180.44,42.85 C180.44,42.85 -3.25,-63.21 -3.25,-63.21 C-3.25,-63.21 -3.25,148.9 -3.25,148.9c " android:valueType="pathType" android:propertyName="pathData" />
|
||||
</set>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:ordering="together"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
|
||||
<objectAnimator android:interpolator="@drawable/$$avd_anim__3__0" android:duration="217" android:startOffset="0" android:valueFrom="M-5.69 46.08 C-5.69,46.08 -0.03,42.82 -0.03,42.82 C-0.03,42.82 -5.69,39.55 -5.69,39.55 C-5.69,39.55 -5.69,46.08 -5.69,46.08c " android:valueTo="M-5.69 46.08 C-5.69,46.08 -0.03,42.82 -0.03,42.82 C-0.03,42.82 -5.69,39.55 -5.69,39.55 C-5.69,39.55 -5.69,46.08 -5.69,46.08c " android:valueType="pathType" android:propertyName="pathData" />
|
||||
<objectAnimator android:interpolator="@drawable/$$avd_anim__3__1" android:duration="617" android:startOffset="217" android:valueFrom="M-5.69 46.08 C-5.69,46.08 -0.03,42.82 -0.03,42.82 C-0.03,42.82 -5.69,39.55 -5.69,39.55 C-5.69,39.55 -5.69,46.08 -5.69,46.08c " android:valueTo="M48.82 61.37 C48.82,61.37 80.38,43.15 80.38,43.15 C80.38,43.15 48.82,24.93 48.82,24.93 C48.82,24.93 48.82,61.37 48.82,61.37c " android:valueType="pathType" android:propertyName="pathData" />
|
||||
</set>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:ordering="together"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
|
||||
<objectAnimator android:duration="2017" android:startOffset="0" android:valueFrom="0" android:valueTo="1" android:valueType="floatType" android:propertyName="translateX" />
|
||||
</set>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<animated-vector android:drawable="@drawable/$avd_anim__0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
|
||||
<target android:name="_R_G_L_1_G_D_0_P_0" android:animation="@drawable/$avd_anim__1" />
|
||||
<target android:name="_R_G_L_1_G_D_0_P_0" android:animation="@drawable/$avd_anim__2" />
|
||||
<target android:name="_R_G_L_1_G_D_1_P_0" android:animation="@drawable/$avd_anim__3" />
|
||||
<target android:name="time_group" android:animation="@drawable/$avd_anim__4" />
|
||||
</animated-vector>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Base.Theme.YouTube.Launcher" parent="@style/Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/avd_anim</item>
|
||||
<item name="android:windowSplashScreenAnimationDuration">1000</item>
|
||||
</style>
|
||||
</resources>
|
Reference in New Issue
Block a user