For #24845 - Add Address preference category to Autofill settings

This commit is contained in:
Gabriel Luong 2022-04-15 18:57:12 -04:00 committed by mergify[bot]
parent 5a21e75267
commit 11448ddd88
4 changed files with 50 additions and 5 deletions

View File

@ -82,7 +82,14 @@ class AutofillSettingFragment : BiometricPromptPreferenceFragment() {
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.credit_cards_preferences, rootKey)
setPreferencesFromResource(
if (requireComponents.settings.addressFeature) {
R.xml.autofill_preferences
} else {
R.xml.credit_cards_preferences
},
rootKey
)
requirePreference<SwitchPreference>(R.string.pref_key_credit_cards_save_and_autofill_cards).apply {
isChecked = context.settings().shouldAutofillCreditCardDetails

View File

@ -173,15 +173,17 @@
<string name="pref_key_logins_secure_warning_sync" translatable="false">pref_key_logins_secure_warning_sync</string>
<string name="pref_key_secure_warning" translatable="false">pref_key_secure_warning</string>
<!-- Credit Cards Settings -->
<!-- Autofill Settings -->
<!-- Key for the "Credit cards" preference in the "Settings" fragment -->
<string name="pref_key_credit_cards" translatable="false">pref_key_credit_cards</string>
<!-- Key for the "Save and autofill cards" preference in the "Credit cards" fragment -->
<!-- Key for the "Save and autofill cards" preference in the "Autofill" fragment -->
<string name="pref_key_credit_cards_save_and_autofill_cards" translatable="false">pref_key_credit_cards_save_and_autofill_cards</string>
<!-- Key for the "Sync cards across devices" preference in the "Credit cards" fragment -->
<!-- Key for the "Sync cards across devices" preference in the "Autofill" fragment -->
<string name="pref_key_credit_cards_sync_cards_across_devices" translatable="false">pref_key_credit_cards_sync_cards_across_devices</string>
<!-- Key for the "Manage saved cards" preference in the "Credit cards" fragment -->
<!-- Key for the "Manage saved cards" preference in the "Autofill" fragment -->
<string name="pref_key_credit_cards_manage_cards" translatable="false">pref_key_credit_cards_manage_cards</string>
<!-- Key for the "Manage addresses" preference in the "Autofill" fragment -->
<string name="pref_key_addresses_manage_addresses" translatable="false">pref_key_addresses_manage_addresses</string>
<!-- Privacy Settings -->
<string name="pref_key_open_links_in_a_private_tab" translatable="false">pref_key_open_links_in_a_private_tab</string>

View File

@ -1483,6 +1483,8 @@
<!-- Autofill -->
<!-- Preference and title for managing the autofill settings -->
<string name="preferences_autofill">Autofill</string>
<!-- Preference and title for managing the settings for addresses -->
<string name="preferences_addresses">Addresses</string>
<!-- Preference and title for managing the settings for credit cards -->
<string name="preferences_credit_cards">Credit cards</string>
<!-- Preference for saving and autofilling credit cards -->
@ -1497,6 +1499,8 @@
<string name="preferences_credit_cards_add_credit_card">Add credit card</string>
<!-- Preference option for managing saved credit cards -->
<string name="preferences_credit_cards_manage_saved_cards">Manage saved cards</string>
<!-- Preference option for managing saved addresses -->
<string name="preferences_addresses_manage_addresses">Manage addresses</string>
<!-- Title of the "Add card" screen -->
<string name="credit_cards_add_card">Add card</string>
<!-- Title of the "Edit card" screen -->

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.preference.PreferenceCategory
android:layout="@layout/preference_cat_style"
android:title="@string/preferences_addresses">
<Preference
android:key="@string/pref_key_addresses_manage_addresses"
android:title="@string/preferences_addresses_manage_addresses" />
</androidx.preference.PreferenceCategory>
<androidx.preference.PreferenceCategory
android:layout="@layout/preference_cat_style"
android:title="@string/preferences_credit_cards">
<SwitchPreference
android:defaultValue="true"
android:key="@string/pref_key_credit_cards_save_and_autofill_cards"
android:summary="@string/preferences_credit_cards_save_and_autofill_cards_summary"
android:title="@string/preferences_credit_cards_save_and_autofill_cards" />
<org.mozilla.fenix.settings.SyncPreference
android:key="@string/pref_key_credit_cards_sync_cards_across_devices"
android:title="@string/preferences_credit_cards_sync_cards_across_devices"
app:singleLineTitle="false" />
<Preference
android:key="@string/pref_key_credit_cards_manage_cards"
android:title="@string/preferences_credit_cards_manage_saved_cards" />
</androidx.preference.PreferenceCategory>
</PreferenceScreen>