generated from ReVanced/revanced-patches-template
-
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(YouTube - Miniplayer): Rename
Tablet mini player
and allow sel…
…ecting the style of the in-app miniplayer (#3302) Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
- Loading branch information
1 parent
64ac233
commit 5511736
Showing
31 changed files
with
805 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
370 changes: 370 additions & 0 deletions
370
src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerPatch.kt
Large diffs are not rendered by default.
Oops, something went wrong.
81 changes: 81 additions & 0 deletions
81
src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerResourcePatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package app.revanced.patches.youtube.layout.miniplayer | ||
|
||
import app.revanced.patcher.data.ResourceContext | ||
import app.revanced.patcher.patch.PatchException | ||
import app.revanced.patcher.patch.ResourcePatch | ||
import app.revanced.patcher.patch.annotation.Patch | ||
import app.revanced.patches.shared.misc.mapping.ResourceMappingPatch | ||
|
||
@Patch(dependencies = [ResourceMappingPatch::class]) | ||
internal object MiniplayerResourcePatch : ResourcePatch() { | ||
var floatyBarButtonTopMargin = -1L | ||
|
||
// Only available in 19.15 and upwards. | ||
var ytOutlineXWhite24 = -1L | ||
var ytOutlinePictureInPictureWhite24 = -1L | ||
var scrimOverlay = -1L | ||
var modernMiniplayerClose = -1L | ||
var modernMiniplayerExpand = -1L | ||
var modernMiniplayerRewindButton = -1L | ||
var modernMiniplayerForwardButton = -1L | ||
var playerOverlays = -1L | ||
|
||
override fun execute(context: ResourceContext) { | ||
floatyBarButtonTopMargin = ResourceMappingPatch[ | ||
"dimen", | ||
"floaty_bar_button_top_margin" | ||
] | ||
|
||
try { | ||
ytOutlinePictureInPictureWhite24 = ResourceMappingPatch[ | ||
"drawable", | ||
"yt_outline_picture_in_picture_white_24" | ||
] | ||
} catch (exception: PatchException) { | ||
// Ignore, and assume the app is 19.14 or earlier. | ||
return | ||
} | ||
|
||
ytOutlineXWhite24 = ResourceMappingPatch[ | ||
"drawable", | ||
"yt_outline_x_white_24" | ||
] | ||
|
||
scrimOverlay = ResourceMappingPatch[ | ||
"id", | ||
"scrim_overlay" | ||
] | ||
|
||
modernMiniplayerClose = ResourceMappingPatch[ | ||
"id", | ||
"modern_miniplayer_close" | ||
] | ||
|
||
modernMiniplayerExpand = ResourceMappingPatch[ | ||
"id", | ||
"modern_miniplayer_expand" | ||
] | ||
|
||
modernMiniplayerRewindButton = ResourceMappingPatch[ | ||
"id", | ||
"modern_miniplayer_rewind_button" | ||
] | ||
|
||
modernMiniplayerForwardButton = ResourceMappingPatch[ | ||
"id", | ||
"modern_miniplayer_forward_button" | ||
] | ||
|
||
playerOverlays = ResourceMappingPatch[ | ||
"layout", | ||
"player_overlays" | ||
] | ||
|
||
// Resource id is not used during patching, but is used by integrations. | ||
// Verify the resource is present while patching. | ||
ResourceMappingPatch[ | ||
"id", | ||
"modern_miniplayer_subtitle_text" | ||
] | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...youtube/layout/miniplayer/fingerprints/MiniplayerDimensionsCalculatorParentFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package app.revanced.patches.youtube.layout.miniplayer.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patches.youtube.layout.miniplayer.MiniplayerResourcePatch | ||
import app.revanced.util.patch.LiteralValueFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
internal object MiniplayerDimensionsCalculatorParentFingerprint : LiteralValueFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
returnType = "V", | ||
parameters = listOf("L"), | ||
literalSupplier = { MiniplayerResourcePatch.floatyBarButtonTopMargin } | ||
) |
14 changes: 14 additions & 0 deletions
14
...ches/youtube/layout/miniplayer/fingerprints/MiniplayerModernAddViewListenerFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package app.revanced.patches.youtube.layout.miniplayer.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
/** | ||
* Resolves using the class found in [MiniplayerModernViewParentFingerprint]. | ||
*/ | ||
internal object MiniplayerModernAddViewListenerFingerprint : MethodFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
returnType = "V", | ||
parameters = listOf("Landroid/view/View;") | ||
) |
16 changes: 16 additions & 0 deletions
16
.../patches/youtube/layout/miniplayer/fingerprints/MiniplayerModernCloseButtonFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package app.revanced.patches.youtube.layout.miniplayer.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patches.youtube.layout.miniplayer.MiniplayerResourcePatch | ||
import app.revanced.util.patch.LiteralValueFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
/** | ||
* Resolves using the class found in [MiniplayerModernViewParentFingerprint]. | ||
*/ | ||
internal object MiniplayerModernCloseButtonFingerprint : LiteralValueFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
returnType = "Landroid/widget/ImageView;", | ||
parameters = listOf(), | ||
literalSupplier = { MiniplayerResourcePatch.modernMiniplayerClose } | ||
) |
11 changes: 11 additions & 0 deletions
11
.../patches/youtube/layout/miniplayer/fingerprints/MiniplayerModernConstructorFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package app.revanced.patches.youtube.layout.miniplayer.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.util.patch.LiteralValueFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
internal object MiniplayerModernConstructorFingerprint : LiteralValueFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, | ||
parameters = listOf("L"), | ||
literalSupplier = { 45623000L } // Magic number found in the constructor. | ||
) |
16 changes: 16 additions & 0 deletions
16
...patches/youtube/layout/miniplayer/fingerprints/MiniplayerModernExpandButtonFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package app.revanced.patches.youtube.layout.miniplayer.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patches.youtube.layout.miniplayer.MiniplayerResourcePatch | ||
import app.revanced.util.patch.LiteralValueFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
/** | ||
* Resolves using the class found in [MiniplayerModernViewParentFingerprint]. | ||
*/ | ||
internal object MiniplayerModernExpandButtonFingerprint : LiteralValueFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
returnType = "Landroid/widget/ImageView;", | ||
parameters = listOf(), | ||
literalSupplier = { MiniplayerResourcePatch.modernMiniplayerExpand } | ||
) |
16 changes: 16 additions & 0 deletions
16
...youtube/layout/miniplayer/fingerprints/MiniplayerModernExpandCloseDrawablesFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package app.revanced.patches.youtube.layout.miniplayer.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patches.youtube.layout.miniplayer.MiniplayerResourcePatch | ||
import app.revanced.util.patch.LiteralValueFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
/** | ||
* Resolves using the class found in [MiniplayerModernViewParentFingerprint]. | ||
*/ | ||
internal object MiniplayerModernExpandCloseDrawablesFingerprint : LiteralValueFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
returnType = "V", | ||
parameters = listOf("L"), | ||
literalSupplier = { MiniplayerResourcePatch.ytOutlinePictureInPictureWhite24 } | ||
) |
16 changes: 16 additions & 0 deletions
16
...atches/youtube/layout/miniplayer/fingerprints/MiniplayerModernForwardButtonFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package app.revanced.patches.youtube.layout.miniplayer.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patches.youtube.layout.miniplayer.MiniplayerResourcePatch | ||
import app.revanced.util.patch.LiteralValueFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
/** | ||
* Resolves using the class found in [MiniplayerModernViewParentFingerprint]. | ||
*/ | ||
internal object MiniplayerModernForwardButtonFingerprint : LiteralValueFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
returnType = "Landroid/widget/ImageView;", | ||
parameters = listOf(), | ||
literalSupplier = { MiniplayerResourcePatch.modernMiniplayerForwardButton } | ||
) |
16 changes: 16 additions & 0 deletions
16
.../patches/youtube/layout/miniplayer/fingerprints/MiniplayerModernOverlayViewFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package app.revanced.patches.youtube.layout.miniplayer.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patches.youtube.layout.miniplayer.MiniplayerResourcePatch | ||
import app.revanced.util.patch.LiteralValueFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
/** | ||
* Resolves using the class found in [MiniplayerModernViewParentFingerprint]. | ||
*/ | ||
internal object MiniplayerModernOverlayViewFingerprint : LiteralValueFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
returnType = "V", | ||
parameters = listOf(), | ||
literalSupplier = { MiniplayerResourcePatch.scrimOverlay } | ||
) |
16 changes: 16 additions & 0 deletions
16
...patches/youtube/layout/miniplayer/fingerprints/MiniplayerModernRewindButtonFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package app.revanced.patches.youtube.layout.miniplayer.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patches.youtube.layout.miniplayer.MiniplayerResourcePatch | ||
import app.revanced.util.patch.LiteralValueFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
/** | ||
* Resolves using the class found in [MiniplayerModernViewParentFingerprint]. | ||
*/ | ||
internal object MiniplayerModernRewindButtonFingerprint : LiteralValueFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
returnType = "Landroid/widget/ImageView;", | ||
parameters = listOf(), | ||
literalSupplier = { MiniplayerResourcePatch.modernMiniplayerRewindButton } | ||
) |
12 changes: 12 additions & 0 deletions
12
...d/patches/youtube/layout/miniplayer/fingerprints/MiniplayerModernViewParentFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package app.revanced.patches.youtube.layout.miniplayer.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
|
||
internal object MiniplayerModernViewParentFingerprint : MethodFingerprint( | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
returnType = "Ljava/lang/String;", | ||
parameters = listOf(), | ||
strings = listOf("player_overlay_modern_mini_player_controls") | ||
) |
4 changes: 2 additions & 2 deletions
4
...erprints/MiniPlayerOverrideFingerprint.kt → ...erprints/MiniplayerOverrideFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
.../patches/youtube/layout/miniplayer/fingerprints/MiniplayerOverrideNoContextFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package app.revanced.patches.youtube.layout.miniplayer.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
import com.android.tools.smali.dexlib2.Opcode | ||
|
||
internal object MiniplayerOverrideNoContextFingerprint : MethodFingerprint( | ||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL, | ||
returnType = "Z", | ||
opcodes = listOf(Opcode.IGET_BOOLEAN), // anchor to insert the instruction | ||
) |
12 changes: 6 additions & 6 deletions
12
...layerResponseModelSizeCheckFingerprint.kt → ...layerResponseModelSizeCheckFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
.../patches/youtube/layout/miniplayer/fingerprints/YouTubePlayerOverlaysLayoutFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package app.revanced.patches.youtube.layout.miniplayer.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import app.revanced.patches.youtube.layout.miniplayer.fingerprints.YouTubePlayerOverlaysLayoutFingerprint.YOUTUBE_PLAYER_OVERLAYS_LAYOUT_CLASS_NAME | ||
|
||
internal object YouTubePlayerOverlaysLayoutFingerprint : MethodFingerprint( | ||
customFingerprint = { _, classDef -> | ||
classDef.type == YOUTUBE_PLAYER_OVERLAYS_LAYOUT_CLASS_NAME | ||
} | ||
) { | ||
const val YOUTUBE_PLAYER_OVERLAYS_LAYOUT_CLASS_NAME = | ||
"Lcom/google/android/apps/youtube/app/common/player/overlay/YouTubePlayerOverlaysLayout;" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.