Skip to content

Commit

Permalink
rename to Open videos fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios committed Dec 8, 2024
1 parent b09b788 commit 981d2a0
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import app.revanced.extension.youtube.settings.Settings;

@SuppressWarnings("unused")
public class PortraitFullscreenPatch {
public class OpenVideosFullscreen {

/**
* Injection point.
*/
public static boolean openVideosInPortraitFullscreen() {
return Settings.PORTRAIT_FULLSCREEN_MODE.get();
public static boolean openVideoInFullscreenPortrait() {
return Settings.OPEN_VIDEOS_FULLSCREEN_PORTRAIT.get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting PLAYBACK_SPEED_DIALOG_BUTTON = new BooleanSetting("revanced_playback_speed_dialog_button", FALSE);
public static final BooleanSetting PLAYER_POPUP_PANELS = new BooleanSetting("revanced_hide_player_popup_panels", FALSE);
public static final IntegerSetting PLAYER_OVERLAY_OPACITY = new IntegerSetting("revanced_player_overlay_opacity", 100, true);
public static final BooleanSetting PORTRAIT_FULLSCREEN_MODE = new BooleanSetting("revanced_portrait_fullscreen", FALSE);
public static final BooleanSetting OPEN_VIDEOS_FULLSCREEN_PORTRAIT = new BooleanSetting("revanced_open_videos_fullscreen_portrait", FALSE);
// Miniplayer
public static final EnumSetting<MiniplayerType> MINIPLAYER_TYPE = new EnumSetting<>("revanced_miniplayer_type", MiniplayerType.ORIGINAL, true);
private static final Availability MINIPLAYER_ANY_MODERN = MINIPLAYER_TYPE.availability(MODERN_1, MODERN_2, MODERN_3, MODERN_4);
Expand Down
4 changes: 2 additions & 2 deletions patches/api/patches.api
Original file line number Diff line number Diff line change
Expand Up @@ -1164,8 +1164,8 @@ public final class app/revanced/patches/youtube/layout/player/background/PlayerC
public static final fun getPlayerControlsBackgroundPatch ()Lapp/revanced/patcher/patch/ResourcePatch;
}

public final class app/revanced/patches/youtube/layout/player/fullscreen/PortraitFullscreenModePatchKt {
public static final fun getPortraitFullscreenPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
public final class app/revanced/patches/youtube/layout/player/fullscreen/OpenVideosFullscreenKt {
public static final fun getOpenVideosFullscreenPatch ()Lapp/revanced/patcher/patch/BytecodePatch;
}

public final class app/revanced/patches/youtube/layout/player/overlay/CustomPlayerOverlayOpacityPatchKt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import app.revanced.patcher.fingerprint
import app.revanced.util.literal
import com.android.tools.smali.dexlib2.AccessFlags

internal const val OPEN_VIDEOS_IN_PORTRAIT_FULLSCREEN_FEATURE_FLAG = 45666112L
internal const val OPEN_VIDEOS_FULLSCREEN_PORTRAIT_FEATURE_FLAG = 45666112L

internal val portraitFullscreenModeFingerprint = fingerprint {
internal val openVideosFullscreenPortraitFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returns("V")
parameters("L", "Lj\$/util/Optional;")
literal {
OPEN_VIDEOS_IN_PORTRAIT_FULLSCREEN_FEATURE_FLAG
OPEN_VIDEOS_FULLSCREEN_PORTRAIT_FEATURE_FLAG
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction

private const val EXTENSION_CLASS_DESCRIPTOR =
"Lapp/revanced/extension/youtube/patches/PortraitFullscreenPatch;"
"Lapp/revanced/extension/youtube/patches/OpenVideosFullscreen;"

@Suppress("unused")
val portraitFullscreenPatch = bytecodePatch(
name = "Portrait fullscreen",
description = "Adds an option to always open videos in portrait full screen mode.",
val openVideosFullscreenPatch = bytecodePatch(
name = "Open videos fullscreen",
description = "Adds an option to open videos in portrait full screen mode.",
) {
dependsOn(
sharedExtensionPatch,
Expand All @@ -35,21 +35,21 @@ val portraitFullscreenPatch = bytecodePatch(
)

execute {
addResources("youtube", "layout.player.fullscreen.portraitFullscreenPatch")
addResources("youtube", "layout.player.fullscreen.openVideosFullscreen")

PreferenceScreen.PLAYER.addPreferences(
SwitchPreference("revanced_portrait_fullscreen")
SwitchPreference("revanced_open_videos_fullscreen_portrait")
)

portraitFullscreenModeFingerprint.method.apply {
val constIndex = indexOfFirstLiteralInstructionOrThrow(OPEN_VIDEOS_IN_PORTRAIT_FULLSCREEN_FEATURE_FLAG)
openVideosFullscreenPortraitFingerprint.method.apply {
val constIndex = indexOfFirstLiteralInstructionOrThrow(OPEN_VIDEOS_FULLSCREEN_PORTRAIT_FEATURE_FLAG)
val resultIndex = indexOfFirstInstructionOrThrow(constIndex, Opcode.MOVE_RESULT)
val register = getInstruction<OneRegisterInstruction>(resultIndex).registerA

addInstructions(
resultIndex + 1,
"""
invoke-static { }, $EXTENSION_CLASS_DESCRIPTOR->openVideosInPortraitFullscreen()Z
invoke-static { }, $EXTENSION_CLASS_DESCRIPTOR->openVideoInFullscreenPortrait()Z
move-result v$register
"""
)
Expand Down
8 changes: 4 additions & 4 deletions patches/src/main/resources/addresources/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -715,10 +715,10 @@ This is because Crowdin requires temporarily flattening this file and removing t
<string name="revanced_hide_player_popup_panels_summary_on">Player popup panels are hidden</string>
<string name="revanced_hide_player_popup_panels_summary_off">Player popup panels are shown</string>
</patch>
<patch id="layout.player.fullscreen.portraitFullscreenPatch">
<string name="revanced_portrait_fullscreen_title">Always open videos in portrait fullscreen</string>
<string name="revanced_portrait_fullscreen_summary_on">Videos open in fullscreen</string>
<string name="revanced_portrait_fullscreen_summary_off">Videos do not open in fullscreen</string>
<patch id="layout.player.fullscreen.openVideosFullscreen">
<string name="revanced_open_videos_fullscreen_portrait_title">Open videos in portrait fullscreen</string>
<string name="revanced_open_videos_fullscreen_portrait_summary_on">Videos open in fullscreen</string>
<string name="revanced_open_videos_fullscreen_portrait_summary_off">Videos do not open in fullscreen</string>
</patch>
<patch id="layout.player.overlay.customPlayerOverlayOpacityResourcePatch">
<string name="revanced_player_overlay_opacity_title">Player overlay opacity</string>
Expand Down

0 comments on commit 981d2a0

Please sign in to comment.