feat(UI): Reorganize Settings (#1137)

- Accounts Section & Remove "account" from title.
- Security Section for Biometric that is hidden on TV.
- Move "send logs" to "Action" section.
This commit is contained in:
KingLucius 2024-06-17 04:01:14 +03:00 committed by GitHub
parent 4c061edd7c
commit 30d223cfe3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 53 additions and 36 deletions

View file

@ -299,6 +299,9 @@ class SettingsAccount : PreferenceFragmentCompat(), BiometricAuthenticator.Biome
hideKeyboard() hideKeyboard()
setPreferencesFromResource(R.xml.settings_account, rootKey) setPreferencesFromResource(R.xml.settings_account, rootKey)
//Hides the security category on TV as it's only Biometric for now
getPref(R.string.pref_category_security_key)?.hideOn(TV or EMULATOR)
getPref(R.string.biometric_key)?.hideOn(TV or EMULATOR)?.setOnPreferenceClickListener { getPref(R.string.biometric_key)?.hideOn(TV or EMULATOR)?.setOnPreferenceClickListener {
val ctx = context ?: return@setOnPreferenceClickListener false val ctx = context ?: return@setOnPreferenceClickListener false
@ -328,8 +331,7 @@ class SettingsAccount : PreferenceFragmentCompat(), BiometricAuthenticator.Biome
for ((key, api) in syncApis) { for ((key, api) in syncApis) {
getPref(key)?.apply { getPref(key)?.apply {
title = title = api.name
getString(R.string.login_format).format(api.name, getString(R.string.account))
setOnPreferenceClickListener { setOnPreferenceClickListener {
val info = api.loginInfo() val info = api.loginInfo()
if (info != null) { if (info != null) {

View file

@ -441,6 +441,9 @@
<string name="pref_category_android_tv_key" translatable="false" >pref_category_android_tv_key</string> <string name="pref_category_android_tv_key" translatable="false" >pref_category_android_tv_key</string>
<string name="pref_category_gestures">Gestures</string> <string name="pref_category_gestures">Gestures</string>
<string name="pref_category_gestures_key" translatable="false">pref_category_gestures_key</string> <string name="pref_category_gestures_key" translatable="false">pref_category_gestures_key</string>
<string name="pref_category_security">Security</string>
<string name="pref_category_security_key" translatable="false">pref_category_security_key</string>
<string name="pref_category_accounts">Accounts</string>
<string name="pref_category_player_features">Player features</string> <string name="pref_category_player_features">Player features</string>
<string name="pref_category_subtitles">Subtitles</string> <string name="pref_category_subtitles">Subtitles</string>
<string name="pref_category_player_layout">Layout</string> <string name="pref_category_player_layout">Layout</string>

View file

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<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">
<PreferenceCategory
android:title="@string/pref_category_accounts">
<Preference <Preference
android:icon="@drawable/mal_logo" android:icon="@drawable/mal_logo"
@ -27,6 +31,12 @@
android:key="@string/skip_startup_account_select_key" android:key="@string/skip_startup_account_select_key"
android:title="@string/skip_startup_account_select_pref" /> android:title="@string/skip_startup_account_select_pref" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/pref_category_security"
app:key="@string/pref_category_security_key">
<SwitchPreferenceCompat <SwitchPreferenceCompat
android:key="@string/biometric_key" android:key="@string/biometric_key"
android:defaultValue="false" android:defaultValue="false"
@ -34,4 +44,6 @@
android:icon="@drawable/ic_fingerprint" android:icon="@drawable/ic_fingerprint"
android:title="@string/biometric_setting" /> android:title="@string/biometric_setting" />
</PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View file

@ -1,13 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<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">
<SwitchPreference
android:defaultValue="true"
android:icon="@drawable/ic_baseline_bug_report_24"
android:key="acra.disable"
android:summaryOff="@string/bug_report_settings_off"
android:summaryOn="@string/bug_report_settings_on"
android:title="@string/pref_disable_acra" />
<PreferenceCategory <PreferenceCategory
android:title="@string/pref_category_app_updates"> android:title="@string/pref_category_app_updates">
@ -80,5 +73,12 @@
android:icon="@drawable/ic_baseline_construction_24" android:icon="@drawable/ic_baseline_construction_24"
android:title="@string/redo_setup_process" android:title="@string/redo_setup_process"
app:key="@string/redo_setup_key" /> app:key="@string/redo_setup_key" />
<SwitchPreference
android:defaultValue="true"
android:icon="@drawable/ic_baseline_bug_report_24"
android:key="acra.disable"
android:summaryOff="@string/bug_report_settings_off"
android:summaryOn="@string/bug_report_settings_on"
android:title="@string/pref_disable_acra" />
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>