mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-02 23:54:33 +02:00
add enable-swipe-gesture-brightness-in-hdr-patch
This commit is contained in:
parent
b1c2aec296
commit
238f0f7140
@ -0,0 +1,8 @@
|
||||
package app.revanced.patches.youtube.swipe.swipebrightnessinhdr.bytecode.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||
|
||||
object HDRVideoFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
strings = listOf("mediaViewambientBrightnessSensor")
|
||||
)
|
@ -0,0 +1,40 @@
|
||||
package app.revanced.patches.youtube.swipe.swipebrightnessinhdr.bytecode.patch
|
||||
|
||||
import app.revanced.patcher.annotation.Name
|
||||
import app.revanced.patcher.annotation.Version
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.addInstructions
|
||||
import app.revanced.patcher.extensions.instruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchResult
|
||||
import app.revanced.patcher.patch.PatchResultSuccess
|
||||
import app.revanced.patcher.util.smali.ExternalLabel
|
||||
import app.revanced.patches.youtube.swipe.swipebrightnessinhdr.bytecode.fingerprints.HDRVideoFingerprint
|
||||
import app.revanced.shared.annotation.YouTubeCompatibility
|
||||
import app.revanced.shared.extensions.toErrorResult
|
||||
import app.revanced.shared.util.integrations.Constants.SWIPE_PATH
|
||||
|
||||
@Name("enable-swipe-gesture-brightness-in-hdr-patch")
|
||||
@YouTubeCompatibility
|
||||
@Version("0.0.1")
|
||||
class SwipeGestureBrightnessInHDRPatch : BytecodePatch(
|
||||
listOf(
|
||||
HDRVideoFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext): PatchResult {
|
||||
|
||||
HDRVideoFingerprint.result?.mutableMethod?.let {
|
||||
it.addInstructions(
|
||||
0, """
|
||||
invoke-static {}, $SWIPE_PATH/EnableSwipeGestureBrightnessInHDRPatch;->enableSwipeGestureBrightnessInHDR()Z
|
||||
move-result v0
|
||||
if-eqz v0, :default
|
||||
return-void
|
||||
""", listOf(ExternalLabel("default", it.instruction(0)))
|
||||
)
|
||||
} ?: return HDRVideoFingerprint.toErrorResult()
|
||||
|
||||
return PatchResultSuccess()
|
||||
}
|
||||
}
|
@ -5,7 +5,8 @@ internal object Constants {
|
||||
const val PATCHES_PATH = "$INTEGRATIONS_PATH/patches"
|
||||
|
||||
const val ADS_PATH = "$PATCHES_PATH/ads"
|
||||
const val BUTTON_PATH = "$PATCHES_PATH/button"
|
||||
|
||||
const val SWIPE_PATH = "$PATCHES_PATH/swipe"
|
||||
|
||||
const val GENERAL_LAYOUT = "$PATCHES_PATH/layout/GeneralLayoutPatch;"
|
||||
const val PLAYER_LAYOUT = "$PATCHES_PATH/layout/PlayerLayoutPatch;"
|
||||
@ -13,9 +14,12 @@ internal object Constants {
|
||||
const val FLYOUTPANEL_LAYOUT = "$PATCHES_PATH/layout/FlyoutPanelLayoutPatch;"
|
||||
const val SEEKBAR_LAYOUT = "$PATCHES_PATH/layout/SeekbarLayoutPatch;"
|
||||
|
||||
const val EXTENDED_PATH = "$PATCHES_PATH/extended"
|
||||
const val MISC_PATH = "$PATCHES_PATH/misc"
|
||||
|
||||
const val BUTTON_PATH = "$PATCHES_PATH/button"
|
||||
const val VIDEO_PATH = "$PATCHES_PATH/video"
|
||||
const val EXTENDED_PATH = "$PATCHES_PATH/extended"
|
||||
|
||||
const val UTILS_PATH = "$PATCHES_PATH/utils"
|
||||
|
||||
const val MUSIC_SETTINGS_PATH = "$INTEGRATIONS_PATH/settings/MusicSettings;"
|
||||
|
@ -246,6 +246,9 @@ Is it ready to submit?"</string>
|
||||
<string name="revanced_enable_swipe_brightness_summary_off">Brightness swipe is disabled</string>
|
||||
<string name="revanced_enable_swipe_brightness_summary_on">Brightness swipe is enabled</string>
|
||||
<string name="revanced_enable_swipe_brightness_title">Enable brightness gesture</string>
|
||||
<string name="revanced_enable_swipe_brightness_in_hdr_summary_off">When playing HDR videos, brightness values specified by YouTube are applied</string>
|
||||
<string name="revanced_enable_swipe_brightness_in_hdr_summary_on">When playing HDR video, swipe gesture brightness values are applied</string>
|
||||
<string name="revanced_enable_swipe_brightness_in_hdr_title">Enable swipe gesture brightness values in HDR video</string>
|
||||
<string name="revanced_enable_swipe_haptic_feedback_summary_off">Press-to-swipe haptic feedback is disabled</string>
|
||||
<string name="revanced_enable_swipe_haptic_feedback_summary_on">Press-to-swipe haptic feedback is enabled</string>
|
||||
<string name="revanced_enable_swipe_haptic_feedback_title">Enable press-to-swipe haptic feedback</string>
|
||||
|
@ -70,7 +70,9 @@
|
||||
<EditTextPreference android:title="@string/revanced_swipe_overlay_timeout_title" android:key="revanced_swipe_overlay_timeout" android:summary="@string/revanced_swipe_overlay_timeout_summary" android:defaultValue="500" android:inputType="number" />
|
||||
<EditTextPreference android:title="@string/revanced_swipe_overlay_text_size_title" android:key="revanced_swipe_overlay_text_size" android:summary="@string/revanced_swipe_overlay_text_size_summary" android:defaultValue="27" android:inputType="number" />
|
||||
<EditTextPreference android:title="@string/revanced_swipe_overlay_background_alpha_title" android:key="revanced_swipe_overlay_background_alpha" android:summary="@string/revanced_swipe_overlay_background_alpha_summary" android:defaultValue="127" android:inputType="number" />
|
||||
<EditTextPreference android:title="@string/revanced_swipe_magnitude_threshold_title" android:key="revanced_swipe_magnitude_threshold" android:summary="@string/revanced_swipe_magnitude_threshold_summary" android:defaultValue="0" android:inputType="number" />SETTINGS: SWIPE_CONTROLS -->
|
||||
<EditTextPreference android:title="@string/revanced_swipe_magnitude_threshold_title" android:key="revanced_swipe_magnitude_threshold" android:summary="@string/revanced_swipe_magnitude_threshold_summary" android:defaultValue="0" android:inputType="number" />
|
||||
<Preference android:title=" " android:selectable="false" android:key="revanced_experimental_flag" android:summary="@string/revanced_experimental_flag" />
|
||||
<SwitchPreference android:title="@string/revanced_enable_swipe_brightness_in_hdr_title" android:key="revanced_enable_swipe_brightness_in_hdr" android:defaultValue="false" android:summaryOn="@string/revanced_enable_swipe_brightness_in_hdr_summary_on" android:summaryOff="@string/revanced_enable_swipe_brightness_in_hdr_summary_off" />SETTINGS: SWIPE_CONTROLS -->
|
||||
|
||||
<!-- PREFERENCE: SWIPE_SETTINGS
|
||||
</PreferenceScreen>PREFERENCE: SWIPE_SETTINGS -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user