fix(YouTube/Settings): contextual action bar has a background layer

This commit is contained in:
inotia00 2024-04-23 22:22:39 +09:00
parent 1765d0575f
commit 4667cbfde9
4 changed files with 42 additions and 1 deletions

View File

@ -96,7 +96,9 @@ object SettingsPatch : BaseResourcePatch(
*/ */
arrayOf( arrayOf(
"arrays.xml", "arrays.xml",
"strings.xml" "dimens.xml",
"strings.xml",
"styles.xml"
).forEach { xmlFile -> ).forEach { xmlFile ->
context.copyXmlNode("youtube/settings/host", "values/$xmlFile", "resources") context.copyXmlNode("youtube/settings/host", "values/$xmlFile", "resources")
} }

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="dimen" name="revanced_edit_text_dialog_min_width_major">80.0%</item>
<item type="dimen" name="revanced_edit_text_dialog_min_width_minor">90.0%</item>
</resources>

View File

@ -1085,6 +1085,7 @@ Limitation: Dislikes may not appear in incognito mode."</string>
<string name="revanced_sb_color_invalid">Invalid color code.</string> <string name="revanced_sb_color_invalid">Invalid color code.</string>
<string name="revanced_sb_reset">Reset</string> <string name="revanced_sb_reset">Reset</string>
<string name="revanced_sb_reset_color">Reset color</string> <string name="revanced_sb_reset_color">Reset color</string>
<string name="revanced_sb_share_copy_settings_success">Settings copied to clipboard.</string>
<!-- PreferenceScreen: SponsorBlock, PreferenceCategory: Creating new segments --> <!-- PreferenceScreen: SponsorBlock, PreferenceCategory: Creating new segments -->
<string name="revanced_sb_create_segment_category">Creating new segments</string> <string name="revanced_sb_create_segment_category">Creating new segments</string>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
'android.R.style.ThemeOverlay_Material_Dialog' is a theme added in Android 6.0+.
'android:windowBackground' is the background color of the alert dialog.
If not overridden, the background color of the parent theme 'android.R.style.ThemeOverlay_Material_Dialog' is used.
'R.attr.ytBaseBackground' is the background color in YouTube settings.
'R.color.yt_white1' color is used in light theme, and the 'R.color.yt_black3' color is used in dark theme.
'android:windowIsTranslucent' makes the dialog window transparent.
'android:background' needs to be transparent for the 'contextual action bar' to be displayed properly.
Referenced documentation and framework source code:
https://android.googlesource.com/platform/frameworks/base/+/android-6.0.1_r81/core/res/res/values/themes_material.xml#1142
https://developer.android.com/reference/android/R.style#ThemeOverlay_Material_Dialog
https://developer.android.com/about/versions/marshmallow/android-6.0-changes#behavior-text-selection
-->
<resources>
<style name="revanced_edit_text_dialog_style" parent="@android:style/ThemeOverlay.Material.Dialog">
<item name="android:windowBackground">?ytBaseBackground</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:background">@android:color/transparent</item>
<item name="windowMinWidthMajor">@dimen/revanced_edit_text_dialog_min_width_major</item>
<item name="windowMinWidthMinor">@dimen/revanced_edit_text_dialog_min_width_minor</item>
</style>
<style name="revanced_edit_text_dialog_max_width_style" parent="@android:style/ThemeOverlay.Material.Dialog.Alert">
<item name="android:windowBackground">?ytBaseBackground</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:background">@android:color/transparent</item>
</style>
</resources>