feat(YouTube - Shorts components): Add Restore old player layout setting (YouTube 18.29.38 ~ 19.16.39)

This commit is contained in:
inotia00 2024-12-21 14:07:30 +09:00
parent 749900f6f8
commit 2b77e46f5e
6 changed files with 37 additions and 1 deletions

View File

@ -207,4 +207,8 @@ public class ShortsPatch {
);
}
public static boolean restoreShortsOldPlayerLayout() {
return !Settings.RESTORE_SHORTS_OLD_PLAYER_LAYOUT.get();
}
}

View File

@ -492,6 +492,7 @@ public class Settings extends BaseSettings {
public static final BooleanSetting HIDE_SHORTS_NAVIGATION_BAR = new BooleanSetting("revanced_hide_shorts_navigation_bar", FALSE, true);
public static final IntegerSetting SHORTS_NAVIGATION_BAR_HEIGHT_PERCENTAGE = new IntegerSetting("revanced_shorts_navigation_bar_height_percentage", 45, true, parent(HIDE_SHORTS_NAVIGATION_BAR));
public static final BooleanSetting REPLACE_CHANNEL_HANDLE = new BooleanSetting("revanced_replace_channel_handle", FALSE, true);
public static final BooleanSetting RESTORE_SHORTS_OLD_PLAYER_LAYOUT = new BooleanSetting("revanced_restore_shorts_old_player_layout", FALSE, true);
// PreferenceScreen: Swipe controls
public static final BooleanSetting ENABLE_SWIPE_BRIGHTNESS = new BooleanSetting("revanced_enable_swipe_brightness", TRUE, true);

View File

@ -177,3 +177,13 @@ internal val shortsToolBarFingerprint = legacyFingerprint(
method.parameterTypes.firstOrNull() == "Z"
}
)
internal const val FULLSCREEN_FEATURE_FLAG = 45398938L
internal val shortsFullscreenFeatureFingerprint = legacyFingerprint(
name = "shortsFullscreenFeatureFingerprint",
returnType = "Z",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
literals = listOf(FULLSCREEN_FEATURE_FLAG),
)

View File

@ -864,6 +864,18 @@ val shortsComponentPatch = bytecodePatch(
// endregion
// region patch for restore shorts old player layout
if (!is_19_25_or_greater) {
shortsFullscreenFeatureFingerprint.injectLiteralInstructionBooleanCall(
FULLSCREEN_FEATURE_FLAG,
"$SHORTS_CLASS_DESCRIPTOR->restoreShortsOldPlayerLayout()Z"
)
settingArray += "SETTINGS: RESTORE_SHORTS_OLD_PLAYER_LAYOUT"
}
// endregion
addLithoFilter(BUTTON_FILTER_CLASS_DESCRIPTOR)
addLithoFilter(SHELF_FILTER_CLASS_DESCRIPTOR)
addLithoFilter(RETURN_YOUTUBE_CHANNEL_NAME_FILTER_CLASS_DESCRIPTOR)

View File

@ -1432,6 +1432,10 @@ Limitations:
<string name="revanced_replace_channel_handle_title">Replace channel handle</string>
<string name="revanced_replace_channel_handle_summary_on">Channel name is used.</string>
<string name="revanced_replace_channel_handle_summary_off">Channel handle is used.</string>
<string name="revanced_restore_shorts_old_player_layout_title">Restore old player layout</string>
<string name="revanced_restore_shorts_old_player_layout_summary_on">"Old player layout is used.
No margins on top and bottom of player."</string>
<string name="revanced_restore_shorts_old_player_layout_summary_off">Old player layout is not used.</string>
<!-- PreferenceScreen: Swipe controls -->

View File

@ -617,7 +617,12 @@
<SwitchPreference android:title="@string/revanced_hide_shorts_toolbar_title" android:key="revanced_hide_shorts_toolbar" android:summaryOn="@string/revanced_hide_shorts_toolbar_summary_on" android:summaryOff="@string/revanced_hide_shorts_toolbar_summary_off" />
<SwitchPreference android:title="@string/revanced_hide_shorts_navigation_bar_title" android:key="revanced_hide_shorts_navigation_bar" android:summaryOn="@string/revanced_hide_shorts_navigation_bar_summary_on" android:summaryOff="@string/revanced_hide_shorts_navigation_bar_summary_off" />
<app.revanced.extension.shared.settings.preference.ResettableEditTextPreference android:hint="45" android:title="@string/revanced_shorts_navigation_bar_height_percentage_title" android:key="revanced_shorts_navigation_bar_height_percentage" android:summary="@string/revanced_shorts_navigation_bar_height_percentage_summary" android:inputType="number" />
<SwitchPreference android:title="@string/revanced_replace_channel_handle_title" android:key="revanced_replace_channel_handle" android:summaryOn="@string/revanced_replace_channel_handle_summary_on" android:summaryOff="@string/revanced_replace_channel_handle_summary_off" />
<SwitchPreference android:title="@string/revanced_replace_channel_handle_title" android:key="revanced_replace_channel_handle" android:summaryOn="@string/revanced_replace_channel_handle_summary_on" android:summaryOff="@string/revanced_replace_channel_handle_summary_off" />SETTINGS: SHORTS_COMPONENTS -->
<!-- SETTINGS: RESTORE_SHORTS_OLD_PLAYER_LAYOUT
<SwitchPreference android:title="@string/revanced_restore_shorts_old_player_layout_title" android:key="revanced_restore_shorts_old_player_layout" android:summaryOn="@string/revanced_restore_shorts_old_player_layout_summary_on" android:summaryOff="@string/revanced_restore_shorts_old_player_layout_summary_off" />SETTINGS: RESTORE_SHORTS_OLD_PLAYER_LAYOUT -->
<!-- SETTINGS: SHORTS_COMPONENTS
</PreferenceScreen>SETTINGS: SHORTS_COMPONENTS -->
<!-- SETTINGS: DISABLE_SHORTS_BACKGROUND_PLAYBACK