Skip to content

Commit

Permalink
feat(YouTube - Shorts components): Add Restore old player layout se…
Browse files Browse the repository at this point in the history
…tting (YouTube 18.29.38 ~ 19.16.39)
  • Loading branch information
inotia00 authored and anddea committed Dec 21, 2024
1 parent b81d32e commit bf8afdd
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,8 @@ private static void setNavigationBarLayoutParams(@NonNull ShortsPlayerState shor
);
}

public static boolean restoreShortsOldPlayerLayout() {
return !Settings.RESTORE_SHORTS_OLD_PLAYER_LAYOUT.get();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
)

Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,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
Expand Down

0 comments on commit bf8afdd

Please sign in to comment.