Skip to content

Commit

Permalink
feat(YouTube - Navigation bar components): Add `Enable translucent st…
Browse files Browse the repository at this point in the history
…atus bar` setting (for YouTube 19.25+)
  • Loading branch information
anddea committed Dec 23, 2024
1 parent 2e6d3af commit 2cf269b
Show file tree
Hide file tree
Showing 24 changed files with 92 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ public static boolean enableTranslucentNavigationBar() {
return Settings.ENABLE_TRANSLUCENT_NAVIGATION_BAR.get();
}

public static boolean enableTranslucentStatusBar() {
return Settings.ENABLE_TRANSLUCENT_STATUS_BAR.get();
}

private static final Boolean DISABLE_TRANSLUCENT_NAVIGATION_BAR_LIGHT
= Settings.DISABLE_TRANSLUCENT_NAVIGATION_BAR_LIGHT.get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ public class Settings extends BaseSettings {
new ChangeStartPagePatch.ChangeStartPageTypeAvailability());
public static final BooleanSetting DISABLE_AUTO_AUDIO_TRACKS = new BooleanSetting("revanced_disable_auto_audio_tracks", FALSE);
public static final BooleanSetting DISABLE_SPLASH_ANIMATION = new BooleanSetting("revanced_disable_splash_animation", FALSE, true);
public static final BooleanSetting ENABLE_TRANSLUCENT_STATUS_BAR = new BooleanSetting("revanced_enable_translucent_status_bar", FALSE, true);
public static final BooleanSetting DISABLE_TRANSLUCENT_STATUS_BAR = new BooleanSetting("revanced_disable_translucent_status_bar", FALSE, true);
public static final BooleanSetting ENABLE_GRADIENT_LOADING_SCREEN = new BooleanSetting("revanced_enable_gradient_loading_screen", FALSE, true);
public static final BooleanSetting HIDE_FLOATING_MICROPHONE = new BooleanSetting("revanced_hide_floating_microphone", TRUE, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ internal val setEnumMapFingerprint = legacyFingerprint(
literals = listOf(ytFillBell),
)

internal val translucentNavigationBarFingerprint = legacyFingerprint(
name = "translucentNavigationBarFingerprint",
literals = listOf(45630927L),
)

internal const val TRANSLUCENT_NAVIGATION_STATUS_BAR_FEATURE_FLAG = 45400535L

internal val translucentStatusBarFingerprint = legacyFingerprint(
name = "translucentStatusBarFingerprint",
literals = listOf(TRANSLUCENT_NAVIGATION_STATUS_BAR_FEATURE_FLAG),
)

internal val translucentNavigationStatusBarFeatureFlagFingerprint = legacyFingerprint(
name = "translucentNavigationStatusBarFeatureFlagFingerprint",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
Expand All @@ -90,6 +90,11 @@ internal val translucentNavigationStatusBarFeatureFlagFingerprint = legacyFinger

internal const val TRANSLUCENT_NAVIGATION_BUTTONS_FEATURE_FLAG = 45630927L

internal val translucentNavigationBarFingerprint = legacyFingerprint(
name = "translucentNavigationBarFingerprint",
literals = listOf(TRANSLUCENT_NAVIGATION_BUTTONS_FEATURE_FLAG),
)

internal val translucentNavigationButtonsFeatureFlagFingerprint = legacyFingerprint(
name = "translucentNavigationButtonsFeatureFlagFingerprint",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
Expand All @@ -102,6 +107,11 @@ internal val translucentNavigationButtonsFeatureFlagFingerprint = legacyFingerpr
*/
internal const val TRANSLUCENT_NAVIGATION_BUTTONS_SYSTEM_FEATURE_FLAG = 45632194L

internal val translucentNavigationBarSystemFingerprint = legacyFingerprint(
name = "translucentNavigationBarSystemFingerprint",
literals = listOf(TRANSLUCENT_NAVIGATION_BUTTONS_SYSTEM_FEATURE_FLAG),
)

internal val translucentNavigationButtonsSystemFeatureFlagFingerprint = legacyFingerprint(
name = "translucentNavigationButtonsSystemFeatureFlagFingerprint",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ val navigationBarComponentsPatch = bytecodePatch(

if (is_19_23_or_greater) {
translucentNavigationBarFingerprint.injectLiteralInstructionBooleanCall(
45630927L,
TRANSLUCENT_NAVIGATION_BUTTONS_FEATURE_FLAG,
"$GENERAL_CLASS_DESCRIPTOR->enableTranslucentNavigationBar()Z"
)

Expand Down Expand Up @@ -118,6 +118,16 @@ val navigationBarComponentsPatch = bytecodePatch(
)
}

translucentStatusBarFingerprint.injectLiteralInstructionBooleanCall(
TRANSLUCENT_NAVIGATION_STATUS_BAR_FEATURE_FLAG,
"$GENERAL_CLASS_DESCRIPTOR->enableTranslucentStatusBar()Z"
)

translucentNavigationBarSystemFingerprint.injectLiteralInstructionBooleanCall(
TRANSLUCENT_NAVIGATION_BUTTONS_SYSTEM_FEATURE_FLAG,
"$GENERAL_CLASS_DESCRIPTOR->enableTranslucentNavigationBar()Z"
)

settingArray += "SETTINGS: DISABLE_TRANSLUCENT_STATUS_BAR"
settingArray += "SETTINGS: TRANSLUCENT_NAVIGATION_BAR"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,9 @@ Limitations:
<string name="revanced_enable_translucent_navigation_bar_summary_off">Navigation bar is opaque.</string>
<string name="revanced_enable_translucent_navigation_bar_summary_on">Navigation bar is translucent.</string>
<string name="revanced_enable_translucent_navigation_bar_title">Enable translucent navigation bar</string>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_enable_watch_panel_gestures_summary_off">Entering fullscreen when swiping down below the video player is disabled.</string>
<string name="revanced_enable_watch_panel_gestures_summary_on">Entering fullscreen when swiping down below the video player is enabled.</string>
<string name="revanced_enable_watch_panel_gestures_title">Enable watch panel gestures</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
<SwitchPreference android:title="@string/revanced_disable_splash_animation_title" android:key="revanced_disable_splash_animation" android:summaryOn="@string/revanced_disable_splash_animation_summary_on" android:summaryOff="@string/revanced_disable_splash_animation_summary_off" />SETTINGS: DISABLE_SPLASH_ANIMATION -->

<!-- SETTINGS: DISABLE_TRANSLUCENT_STATUS_BAR
<SwitchPreference android:title="@string/revanced_enable_translucent_status_bar_title" android:key="revanced_enable_translucent_status_bar" android:summaryOn="@string/revanced_enable_translucent_status_bar_summary_on" android:summaryOff="@string/revanced_enable_translucent_status_bar_summary_off" />
<SwitchPreference android:title="@string/revanced_disable_translucent_status_bar_title" android:key="revanced_disable_translucent_status_bar" android:summaryOn="@string/revanced_disable_translucent_status_bar_summary_on" android:summaryOff="@string/revanced_disable_translucent_status_bar_summary_off" />SETTINGS: DISABLE_TRANSLUCENT_STATUS_BAR -->

<!-- SETTINGS: ENABLE_GRADIENT_LOADING_SCREEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<resources>
<string name="gms_core_dialog_dismiss_text">Don\'t show again</string>
<string name="revanced_change_start_page_entry_courses">Courses / Learning</string>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_external_downloader_package_name_video_long_press_summary">Package name of your installed external downloader app, such as NewPipe or YTDLnis, on long press.</string>
<string name="revanced_external_downloader_package_name_video_long_press_title">Long press video downloader package name</string>
<string name="revanced_gms_show_dialog_summary">Displays the optimization dialog for GMSCore at each application startup.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ Limitations:

Press and hold the More button to show the Custom actions dialog."</string>
<string name="revanced_enable_shorts_custom_actions_toolbar_title">Enable custom actions in toolbar</string>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_external_downloader_package_name_video_long_press_summary">Package name of your installed external downloader app, such as NewPipe or YTDLnis, on long press.</string>
<string name="revanced_external_downloader_package_name_video_long_press_title">Long press video downloader package name</string>
<string name="revanced_gms_show_dialog_summary">Displays the optimization dialog for GMSCore at each application startup.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ Limitations:

Press and hold the More button to show the Custom actions dialog."</string>
<string name="revanced_enable_shorts_custom_actions_toolbar_title">Enable custom actions in toolbar</string>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_external_downloader_package_name_playlist_summary">Package name of your installed external downloader app, such as YTDLnis.</string>
<string name="revanced_external_downloader_package_name_playlist_title">Playlist downloader package name</string>
<string name="revanced_external_downloader_package_name_video_long_press_summary">Package name of your installed external downloader app, such as NewPipe or YTDLnis, on long press.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<resources>
<string name="gms_core_dialog_dismiss_text">Don\'t show again</string>
<string name="revanced_change_start_page_entry_courses">Courses / Learning</string>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_external_downloader_package_name_video_long_press_summary">Package name of your installed external downloader app, such as NewPipe or YTDLnis, on long press.</string>
<string name="revanced_external_downloader_package_name_video_long_press_title">Long press video downloader package name</string>
<string name="revanced_gms_show_dialog_summary">Displays the optimization dialog for GMSCore at each application startup.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<resources>
<string name="gms_core_dialog_dismiss_text">Don\'t show again</string>
<string name="revanced_change_start_page_entry_courses">Courses / Learning</string>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_external_downloader_package_name_video_long_press_summary">Package name of your installed external downloader app, such as NewPipe or YTDLnis, on long press.</string>
<string name="revanced_external_downloader_package_name_video_long_press_title">Long press video downloader package name</string>
<string name="revanced_gms_show_dialog_summary">Displays the optimization dialog for GMSCore at each application startup.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<resources>
<string name="gms_core_dialog_dismiss_text">Don\'t show again</string>
<string name="revanced_change_start_page_entry_courses">Courses / Learning</string>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_external_downloader_package_name_video_long_press_summary">Package name of your installed external downloader app, such as NewPipe or YTDLnis, on long press.</string>
<string name="revanced_external_downloader_package_name_video_long_press_title">Long press video downloader package name</string>
<string name="revanced_gms_show_dialog_summary">Displays the optimization dialog for GMSCore at each application startup.</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
<string name="revanced_disable_watch_panel_gestures_summary_off">Entering fullscreen when swiping down below the video player is enabled.</string>
<string name="revanced_disable_watch_panel_gestures_summary_on">Entering fullscreen when swiping down below the video player is disabled.</string>
<string name="revanced_disable_watch_panel_gestures_title">Disable watch panel gestures</string>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_external_downloader_package_name_video_long_press_summary">Package name of your installed external downloader app, such as NewPipe or YTDLnis, on long press.</string>
<string name="revanced_external_downloader_package_name_video_long_press_title">Long press video downloader package name</string>
<string name="revanced_gms_show_dialog_summary">Displays the optimization dialog for GMSCore at each application startup.</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_external_downloader_package_name_video_long_press_summary">Package name of your installed external downloader app, such as NewPipe or YTDLnis, on long press.</string>
<string name="revanced_external_downloader_package_name_video_long_press_title">Long press video downloader package name</string>
<string name="revanced_icon_mmt_orange">MMT Orange</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_icon_mmt_orange">MMT Orange</string>
<string name="revanced_icon_mmt_pink">MMT Pink</string>
<string name="revanced_icon_mmt_turquoise">MMT Turquoise</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_spoof_streaming_data_android_only_user_dialog_message">Turning off this setting may cause video playback issues.</string>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<resources>
<string name="gms_core_dialog_dismiss_text">Don\'t show again</string>
<string name="revanced_change_start_page_entry_courses">Courses / Learning</string>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_external_downloader_package_name_video_long_press_summary">Package name of your installed external downloader app, such as NewPipe or YTDLnis, on long press.</string>
<string name="revanced_external_downloader_package_name_video_long_press_title">Long press video downloader package name</string>
<string name="revanced_gms_show_dialog_summary">Displays the optimization dialog for GMSCore at each application startup.</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_external_downloader_package_name_video_long_press_summary">Package name of your installed external downloader app, such as NewPipe or YTDLnis, on long press.</string>
<string name="revanced_external_downloader_package_name_video_long_press_title">Long press video downloader package name</string>
<string name="revanced_icon_mmt_orange">MMT Orange</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ Limitations:

Press and hold the More button to show the Custom actions dialog."</string>
<string name="revanced_enable_shorts_custom_actions_toolbar_title">Enable custom actions in toolbar</string>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_external_downloader_package_name_video_long_press_summary">Package name of your installed external downloader app, such as NewPipe or YTDLnis, on long press.</string>
<string name="revanced_external_downloader_package_name_video_long_press_title">Long press video downloader package name</string>
<string name="revanced_gms_show_dialog_summary">Displays the optimization dialog for GMSCore at each application startup.</string>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="revanced_enable_translucent_status_bar_summary_off">Status bar is opaque.</string>
<string name="revanced_enable_translucent_status_bar_summary_on">Status bar is translucent.</string>
<string name="revanced_enable_translucent_status_bar_title">Enable translucent status bar</string>
<string name="revanced_spoof_streaming_data_android_only_user_dialog_message">Turning off this setting may cause video playback issues.</string>
<string name="revanced_spoof_streaming_data_side_effects_ios_compatibility">"• Videos may end 1 second early.
• OPUS audio codec may not be supported."</string>
Expand Down
Loading

0 comments on commit 2cf269b

Please sign in to comment.