mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-20 16:27:17 +02:00
feat(YouTube): add Enable bottom player gestures
patch
This commit is contained in:
parent
75d62ccaf9
commit
d701a9acb6
@ -0,0 +1,79 @@
|
||||
package app.revanced.patches.youtube.buttomplayer.gestures
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.buttomplayer.gestures.fingerprints.BottomPlayerGesturesFingerprint
|
||||
import app.revanced.patches.youtube.utils.integrations.Constants.BOTTOM_PLAYER
|
||||
import app.revanced.patches.youtube.utils.settings.SettingsPatch
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getWideLiteralInstructionIndex
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Enable bottom player gestures",
|
||||
description = "Switching to fullscreen by swiping the bottom area of the player.",
|
||||
dependencies = [SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
[
|
||||
"18.25.40",
|
||||
"18.27.36",
|
||||
"18.29.38",
|
||||
"18.30.37",
|
||||
"18.31.40",
|
||||
"18.32.39",
|
||||
"18.33.40",
|
||||
"18.34.38",
|
||||
"18.35.36",
|
||||
"18.36.39",
|
||||
"18.37.36",
|
||||
"18.38.44",
|
||||
"18.39.41",
|
||||
"18.40.34",
|
||||
"18.41.39",
|
||||
"18.42.41",
|
||||
"18.43.45",
|
||||
"18.44.41",
|
||||
"18.45.43"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object BottomPlayerGesturesPatch : BytecodePatch(
|
||||
setOf(BottomPlayerGesturesFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
|
||||
BottomPlayerGesturesFingerprint.result?.let {
|
||||
it.mutableMethod.apply {
|
||||
val targetIndex = getWideLiteralInstructionIndex(45372793) + 3
|
||||
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||
|
||||
addInstructions(
|
||||
targetIndex + 1, """
|
||||
invoke-static {}, $BOTTOM_PLAYER->enableBottomPlayerGestures()Z
|
||||
move-result v$targetRegister
|
||||
"""
|
||||
)
|
||||
}
|
||||
} ?: throw BottomPlayerGesturesFingerprint.exception
|
||||
|
||||
/**
|
||||
* Add settings
|
||||
*/
|
||||
SettingsPatch.addPreference(
|
||||
arrayOf(
|
||||
"PREFERENCE: BOTTOM_PLAYER_SETTINGS",
|
||||
"SETTINGS: ENABLE_BOTTOM_PLAYER_GESTURES"
|
||||
)
|
||||
)
|
||||
|
||||
SettingsPatch.updatePatchStatus("Enable bottom player gestures")
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package app.revanced.patches.youtube.buttomplayer.gestures.fingerprints
|
||||
|
||||
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||
|
||||
object BottomPlayerGesturesFingerprint : LiteralValueFingerprint(
|
||||
returnType = "V",
|
||||
literalSupplier = { 45372793 }
|
||||
)
|
@ -7,6 +7,7 @@ object Constants {
|
||||
|
||||
const val ADS_PATH = "$PATCHES_PATH/ads"
|
||||
const val ALTERNATIVE_THUMBNAILS_PATH = "$PATCHES_PATH/alternativethumbnails"
|
||||
const val BOTTOM_PLAYER_PATH = "$PATCHES_PATH/bottomplayer"
|
||||
const val COMPONENTS_PATH = "$PATCHES_PATH/components"
|
||||
const val FLYOUT_PANEL_PATH = "$PATCHES_PATH/flyoutpanel"
|
||||
const val FULLSCREEN_PATH = "$PATCHES_PATH/fullscreen"
|
||||
@ -22,6 +23,7 @@ object Constants {
|
||||
const val VIDEO_PATH = "$PATCHES_PATH/video"
|
||||
|
||||
const val ALTERNATIVE_THUMBNAILS = "$ALTERNATIVE_THUMBNAILS_PATH/AlternativeThumbnailsPatch;"
|
||||
const val BOTTOM_PLAYER = "$BOTTOM_PLAYER_PATH/BottomPlayerPatch;"
|
||||
const val FLYOUT_PANEL = "$FLYOUT_PANEL_PATH/FlyoutPanelPatch;"
|
||||
const val FULLSCREEN = "$FULLSCREEN_PATH/FullscreenPatch;"
|
||||
const val GENERAL = "$GENERAL_PATH/GeneralPatch;"
|
||||
|
@ -135,6 +135,9 @@ Note: Disabling the speed overlay restores the 'Slide to seek' behavior of the o
|
||||
<string name="revanced_disable_startup_shorts_player_title">Disable shorts player at app startup</string>
|
||||
<string name="revanced_double_back_timeout_summary">The amount of seconds the double press back to exit.</string>
|
||||
<string name="revanced_double_back_timeout_title">Double back timeout</string>
|
||||
<string name="revanced_enable_bottom_player_gestures_summary_off">Switching to fullscreen by swiping the bottom area of the player has been disabled.</string>
|
||||
<string name="revanced_enable_bottom_player_gestures_summary_on">Switching to fullscreen by swiping the bottom area of the player has been enabled.</string>
|
||||
<string name="revanced_enable_bottom_player_gestures_title">Enable bottom player gestures</string>
|
||||
<string name="revanced_enable_compact_controls_overlay_summary_off">Compact controls overlay is disabled.</string>
|
||||
<string name="revanced_enable_compact_controls_overlay_summary_on">Compact controls overlay is enabled.</string>
|
||||
<string name="revanced_enable_compact_controls_overlay_title">Enable compact controls overlay</string>
|
||||
|
@ -51,6 +51,10 @@
|
||||
<!-- PREFERENCE: BOTTOM_PLAYER_SETTINGS
|
||||
<PreferenceScreen android:title="@string/revanced_bottom_player" android:key="bottom_player">PREFERENCE: BOTTOM_PLAYER_SETTINGS -->
|
||||
|
||||
<!-- SETTINGS: ENABLE_BOTTOM_PLAYER_GESTURES
|
||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_bottom_player" />
|
||||
<SwitchPreference android:title="@string/revanced_enable_bottom_player_gestures_title" android:key="revanced_enable_bottom_player_gestures" android:defaultValue="true" android:summaryOn="@string/revanced_enable_bottom_player_gestures_summary_on" android:summaryOff="@string/revanced_enable_bottom_player_gestures_summary_off" />SETTINGS: ENABLE_BOTTOM_PLAYER_GESTURES -->
|
||||
|
||||
<!-- SETTINGS: HIDE_CHANNEL_BAR_BUTTON
|
||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_channel_bar_title" />
|
||||
<SwitchPreference android:title="@string/revanced_hide_join_button_title" android:key="revanced_hide_join_button" android:defaultValue="true" android:summaryOn="@string/revanced_hide_join_button_summary_on" android:summaryOff="@string/revanced_hide_join_button_summary_off" />
|
||||
@ -381,6 +385,7 @@
|
||||
<Preference android:title="Alternative thumbnails" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
|
||||
<Preference android:title=" " android:selectable="false" android:summary="@string/revanced_bottom_player" />
|
||||
<Preference android:title="Enable bottom player gestures" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="Hide button container" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
<Preference android:title="Hide comment component" android:summary="@string/revanced_patches_excluded" android:selectable="false"/>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user