Merge pull request #417 from Bnyro/master

material dialogs in settings
This commit is contained in:
Bnyro 2022-06-07 13:42:41 +02:00 committed by GitHub
commit 0590bf1025
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 23 deletions

View File

@ -18,6 +18,8 @@ class SettingsActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
DynamicColors.applyToActivityIfAvailable(this) DynamicColors.applyToActivityIfAvailable(this)
ThemeHelper().updateTheme(this) ThemeHelper().updateTheme(this)
// makes the preference dialogs use material dialogs
setTheme(R.style.MaterialAlertDialog)
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {

View File

@ -15,4 +15,12 @@
<item name="android:navigationBarColor">@android:color/transparent</item> <item name="android:navigationBarColor">@android:color/transparent</item>
</style> </style>
<style name="MaterialAlertDialog">
<item name="alertDialogTheme">@style/ThemeOverlay.Material3.MaterialAlertDialog</item>
<item name="dialogCornerRadius">28dp</item>
</style>
</resources> </resources>

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="@string/appearance"> <PreferenceCategory app:title="@string/appearance">
<androidx.preference.ListPreference <ListPreference
app:title="@string/app_theme" app:title="@string/app_theme"
app:key="theme_togglee" app:key="theme_togglee"
app:entries="@array/themes" app:entries="@array/themes"
@ -12,7 +12,7 @@
app:defaultValue="A" app:defaultValue="A"
android:icon="@drawable/ic_theme" /> android:icon="@drawable/ic_theme" />
<androidx.preference.ListPreference <ListPreference
app:title="@string/color_accent" app:title="@string/color_accent"
app:key="accent_color" app:key="accent_color"
app:entries="@array/accents" app:entries="@array/accents"
@ -20,7 +20,7 @@
app:defaultValue="red" app:defaultValue="red"
android:icon="@drawable/ic_color" /> android:icon="@drawable/ic_color" />
<androidx.preference.ListPreference <ListPreference
app:title="@string/app_icon" app:title="@string/app_icon"
app:key="icon_change" app:key="icon_change"
app:entries="@array/icons" app:entries="@array/icons"
@ -32,7 +32,7 @@
<PreferenceCategory app:title="@string/app_behavior"> <PreferenceCategory app:title="@string/app_behavior">
<androidx.preference.ListPreference <ListPreference
app:title="@string/defaultTab" app:title="@string/defaultTab"
app:key="default_tab" app:key="default_tab"
app:entries="@array/tabs" app:entries="@array/tabs"
@ -40,7 +40,7 @@
app:defaultValue="home" app:defaultValue="home"
android:icon="@drawable/ic_home_outlined" /> android:icon="@drawable/ic_home_outlined" />
<androidx.preference.ListPreference <ListPreference
app:title="@string/defres" app:title="@string/defres"
app:key="default_res" app:key="default_res"
app:entries="@array/defres" app:entries="@array/defres"
@ -49,7 +49,7 @@
android:icon="@drawable/ic_hd" android:icon="@drawable/ic_hd"
app:useSimpleSummaryProvider="true" /> app:useSimpleSummaryProvider="true" />
<androidx.preference.ListPreference <ListPreference
app:title="@string/grid" app:title="@string/grid"
app:key="grid" app:key="grid"
app:entries="@array/grid" app:entries="@array/grid"
@ -60,4 +60,4 @@
</PreferenceCategory> </PreferenceCategory>
</androidx.preference.PreferenceScreen> </PreferenceScreen>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto"> <PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="@string/downloads"> <PreferenceCategory app:title="@string/downloads">
@ -22,4 +22,4 @@
</PreferenceCategory> </PreferenceCategory>
</androidx.preference.PreferenceScreen> </PreferenceScreen>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="@string/search_history"> <PreferenceCategory app:title="@string/search_history">
@ -17,4 +17,4 @@
</PreferenceCategory> </PreferenceCategory>
</androidx.preference.PreferenceScreen> </PreferenceScreen>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory app:title="@string/location"> <PreferenceCategory app:title="@string/location">
@ -35,18 +35,18 @@
app:defaultValue="https://pipedapi.kavin.rocks/" app:defaultValue="https://pipedapi.kavin.rocks/"
android:icon="@drawable/ic_server" /> android:icon="@drawable/ic_server" />
<androidx.preference.EditTextPreference <EditTextPreference
app:key="customInstance" app:key="customInstance"
app:title="@string/customInstance" app:title="@string/customInstance"
app:isPreferenceVisible="false" /> app:isPreferenceVisible="false" />
<androidx.preference.Preference <Preference
app:key="login_register" app:key="login_register"
app:title="@string/login_register" app:title="@string/login_register"
android:icon="@drawable/ic_login" android:icon="@drawable/ic_login"
android:summary="@string/notgmail" /> android:summary="@string/notgmail" />
<androidx.preference.Preference <Preference
app:key="import_from_yt" app:key="import_from_yt"
app:title="@string/import_from_yt" app:title="@string/import_from_yt"
android:summary="@string/import_from_yt_summary" android:summary="@string/import_from_yt_summary"
@ -56,23 +56,23 @@
<PreferenceCategory app:title="@string/customization"> <PreferenceCategory app:title="@string/customization">
<androidx.preference.Preference <Preference
app:key="appearance" app:key="appearance"
app:title="@string/appearance" app:title="@string/appearance"
android:icon="@drawable/ic_color" /> android:icon="@drawable/ic_color" />
<androidx.preference.Preference <Preference
app:title="@string/sponsorblock" app:title="@string/sponsorblock"
app:key="sponsorblock" app:key="sponsorblock"
app:summary="@string/sponsorblock_summary" app:summary="@string/sponsorblock_summary"
android:icon="@drawable/ic_block" /> android:icon="@drawable/ic_block" />
<androidx.preference.Preference <Preference
app:title="@string/downloads" app:title="@string/downloads"
app:key="downloads" app:key="downloads"
android:icon="@drawable/ic_file_download" /> android:icon="@drawable/ic_file_download" />
<androidx.preference.Preference <Preference
app:key="history" app:key="history"
app:title="@string/history" app:title="@string/history"
android:icon="@drawable/ic_history" /> android:icon="@drawable/ic_history" />
@ -93,4 +93,4 @@
</PreferenceCategory> </PreferenceCategory>
</androidx.preference.PreferenceScreen> </PreferenceScreen>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<SwitchPreferenceCompat <SwitchPreferenceCompat
@ -43,4 +43,4 @@
</PreferenceCategory> </PreferenceCategory>
</androidx.preference.PreferenceScreen> </PreferenceScreen>