For #18240 - Add a Credit Card preference screen (#18410)

- Removes an unused preference key "pref_key_credit_cards_addresses"
upstream-sync
Gabriel Luong 3 years ago committed by GitHub
parent 83018c813b
commit 578d6b5205
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -276,6 +276,9 @@ class SettingsFragment : PreferenceFragmentCompat() {
resources.getString(R.string.pref_key_passwords) -> {
SettingsFragmentDirections.actionSettingsFragmentToSavedLoginsAuthFragment()
}
resources.getString(R.string.pref_key_credit_cards) -> {
SettingsFragmentDirections.actionSettingsFragmentToCreditCardsSettingFragment()
}
resources.getString(R.string.pref_key_about) -> {
SettingsFragmentDirections.actionSettingsFragmentToAboutFragment()
}
@ -423,12 +426,18 @@ class SettingsFragment : PreferenceFragmentCompat() {
}
preferenceFxAOverride?.onPreferenceChangeListener = syncFxAOverrideUpdater
preferenceSyncOverride?.onPreferenceChangeListener = syncFxAOverrideUpdater
findPreference<Preference>(
getPreferenceKey(R.string.pref_key_debug_settings)
)?.isVisible = requireContext().settings().showSecretDebugMenuThisSession
findPreference<Preference>(
getPreferenceKey(R.string.pref_key_secret_debug_info)
)?.isVisible = requireContext().settings().showSecretDebugMenuThisSession
with(requireContext().settings()) {
findPreference<Preference>(
getPreferenceKey(R.string.pref_key_credit_cards)
)?.isVisible = creditCardsFeature
findPreference<Preference>(
getPreferenceKey(R.string.pref_key_debug_settings)
)?.isVisible = showSecretDebugMenuThisSession
findPreference<Preference>(
getPreferenceKey(R.string.pref_key_secret_debug_info)
)?.isVisible = showSecretDebugMenuThisSession
}
setupAmoCollectionOverridePreference(requireContext().settings())
}

@ -0,0 +1,27 @@
/* 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/. */
package org.mozilla.fenix.settings.creditcards
import android.os.Bundle
import androidx.preference.PreferenceFragmentCompat
import org.mozilla.fenix.R
import org.mozilla.fenix.ext.showToolbar
/**
* "Credit cards" settings fragment displays a list of settings related to autofilling, adding and
* syncing credit cards.
*/
class CreditCardsSettingFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.credit_cards_preferences, rootKey)
}
override fun onResume() {
super.onResume()
showToolbar(getString(R.string.preferences_credit_cards))
}
}

@ -0,0 +1,40 @@
<?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/. -->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/credit_cards_add_credit_card_button_height"
android:background="?android:selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingStart="@dimen/top_bar_alignment_margin_start"
tools:ignore="RtlSymmetry">
<ImageView
android:id="@+id/add_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:importantForAccessibility="no"
android:textAlignment="textStart"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_new" />
<TextView
android:id="@+id/add_credit_card_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/credit_cards_add_credit_card_text_horizontal_margin"
android:layout_marginEnd="@dimen/credit_cards_add_credit_card_text_horizontal_margin"
android:text="@string/preferences_credit_cards_add_credit_card"
android:textColor="?primaryText"
android:textSize="@dimen/credit_cards_add_credit_card_text_size"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/add_icon"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

@ -443,6 +443,13 @@
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right" />
<action
android:id="@+id/action_settingsFragment_to_creditCardsSettingFragment"
app:destination="@id/credit_cards_graph"
app:enterAnim="@anim/slide_in_right"
app:exitAnim="@anim/slide_out_left"
app:popEnterAnim="@anim/slide_in_left"
app:popExitAnim="@anim/slide_out_right" />
<action
android:id="@+id/action_settingsFragment_to_accessibilityFragment"
app:destination="@id/accessibilityFragment"
@ -993,4 +1000,14 @@
app:argType="string" />
</fragment>
</navigation>
<navigation
android:id="@+id/credit_cards_graph"
app:startDestination="@id/creditCardsSettingFragment">
<fragment
android:id="@+id/creditCardsSettingFragment"
android:name="org.mozilla.fenix.settings.creditcards.CreditCardsSettingFragment"
android:label="@string/preferences_credit_cards">
</fragment>
</navigation>
</navigation>

@ -213,6 +213,15 @@
<dimen name="top_sites_item_margin_bottom">12dp</dimen>
<dimen name="top_sites_text_margin_top">8dp</dimen>
<!-- Credit Cards Fragment -->
<!-- The height of the "Add credit card" button in the Credit Cards fragment.
This should be the same value as search_engine_radio_button_height. -->
<dimen name="credit_cards_add_credit_card_button_height">48dp</dimen>
<!-- The horizontal margin for the "Add credit card" text.
This should be the same value as radio_button_padding_horizontal. -->
<dimen name="credit_cards_add_credit_card_text_horizontal_margin">16dp</dimen>
<dimen name="credit_cards_add_credit_card_text_size">16sp</dimen>
<!-- a11y -->
<dimen name="accessibility_min_height">48dp</dimen>

@ -7,7 +7,6 @@
<string name="pref_key_search_engine" translatable="false">pref_key_search_engine</string>
<string name="pref_key_add_search_engine" translatable="false">pref_key_add_Search_engine</string>
<string name="pref_key_passwords" translatable="false">pref_key_passwords</string>
<string name="pref_key_credit_cards_addresses" translatable="false">pref_key_credit_cards_addresses</string>
<string name="pref_key_site_permissions" translatable="false">pref_key_site_permissions</string>
<string name="pref_key_add_private_browsing_shortcut" translatable="false">pref_key_add_private_browsing_shortcut</string>
<string name="pref_key_accessibility" translatable="false">pref_key_accessibility</string>
@ -169,6 +168,16 @@
<string name="pref_key_logins_secure_warning_sync" translatable="false">pref_key_logins_secure_warning_sync</string>
<string name="pref_key_logins_secure_warning" translatable="false">pref_key_logins_secure_warning</string>
<!-- Credit Cards 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 -->
<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 -->
<string name="pref_key_credit_cards_sync_cards_across_devices" translatable="false">pref_key_credit_cards_sync_cards_across_devices</string>
<!-- Key for the "Add credit card" preference in the "Credit cards" fragment -->
<string name="pref_key_credit_cards_add_credit_card" translatable="false">pref_key_credit_cards_add_credit_card</string>
<!-- Privacy Settings -->
<string name="pref_key_open_links_in_a_private_tab" translatable="false">pref_key_open_links_in_a_private_tab</string>
<string name="pref_key_open_links_in_external_app" translatable="false">pref_key_open_links_in_external_app</string>

@ -1512,6 +1512,18 @@
<!-- Content description (not visible, for screen readers etc.): Sort saved logins dropdown menu chevron icon -->
<string name="saved_logins_menu_dropdown_chevron_icon_content_description">Sort logins menu</string>
<!-- Credit Cards Autofill -->
<!-- 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 -->
<string name="preferences_credit_cards_save_and_autofill_cards">Save and autofill cards</string>
<!-- Preference summary for saving and autofilling credit card data -->
<string name="preferences_credit_cards_save_and_autofill_cards_summary">Data is encrypted</string>
<!-- Preference option for syncing credit cards across devices. This is displayed when the user is not signed into sync -->
<string name="preferences_credit_cards_sync_cards_across_devices">Sync cards across devices</string>
<!-- Preference option for adding a credit card -->
<string name="preferences_credit_cards_add_credit_card">Add credit card</string>
<!-- Title of the Add search engine screen -->
<string name="search_engine_add_custom_search_engine_title">Add search engine</string>
<!-- Title of the Edit search engine screen -->

@ -0,0 +1,20 @@
<?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">
<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" />
<Preference
android:key="@string/pref_key_credit_cards_sync_cards_across_devices"
android:title="@string/preferences_credit_cards_sync_cards_across_devices" />
<Preference
android:key="@string/pref_key_credit_cards_add_credit_card"
android:title="@string/preferences_credit_cards_add_credit_card"
android:layout="@layout/preference_credit_cards_add_credit_card"
app:allowDividerAbove="true" />
</PreferenceScreen>

@ -68,6 +68,11 @@
android:key="@string/pref_key_passwords"
android:title="@string/preferences_passwords_logins_and_passwords" />
<androidx.preference.Preference
android:icon="@drawable/ic_formfill"
android:key="@string/pref_key_credit_cards"
android:title="@string/preferences_credit_cards" />
<androidx.preference.Preference
android:icon="@drawable/ic_accessibility"
android:key="@string/pref_key_accessibility"

@ -12,13 +12,13 @@
android:layout="@layout/sign_in_preference"
android:summary="@string/preferences_sign_in_description"
android:title="@string/preferences_sync"
app:allowDividerBelow="false"/>
app:allowDividerBelow="false" />
<androidx.preference.PreferenceCategory
android:key="@string/pref_key_account_category"
android:title="@string/preferences_category_account"
app:isPreferenceVisible="false"
android:layout="@layout/preference_category_no_icon_style" >
android:layout="@layout/preference_category_no_icon_style">
<org.mozilla.fenix.settings.account.AccountPreference
android:icon="@drawable/ic_account"
@ -26,7 +26,7 @@
<org.mozilla.fenix.settings.account.AccountAuthErrorPreference
android:icon="@drawable/ic_account_warning"
android:key="@string/pref_key_account_auth_error"/>
android:key="@string/pref_key_account_auth_error" />
</androidx.preference.PreferenceCategory>
<androidx.preference.EditTextPreference
@ -34,14 +34,14 @@
android:title="@string/preferences_override_fxa_server"
android:inputType="textUri"
app:iconSpaceReserved="false"
app:isPreferenceVisible="false"/>
app:isPreferenceVisible="false" />
<androidx.preference.EditTextPreference
android:key="@string/pref_key_override_sync_tokenserver"
android:title="@string/preferences_override_sync_tokenserver"
android:inputType="textUri"
app:iconSpaceReserved="false"
app:isPreferenceVisible="false"/>
app:isPreferenceVisible="false" />
<androidx.preference.PreferenceCategory
android:title="@string/preferences_category_general"
@ -66,6 +66,11 @@
app:iconSpaceReserved="false"
android:title="@string/preferences_passwords_logins_and_passwords" />
<androidx.preference.Preference
app:iconSpaceReserved="false"
android:key="@string/pref_key_credit_cards"
android:title="@string/preferences_credit_cards" />
<androidx.preference.Preference
android:key="@string/pref_key_accessibility"
app:iconSpaceReserved="false"
@ -89,7 +94,7 @@
<androidx.preference.Preference
android:key="@string/pref_key_private_browsing"
app:iconSpaceReserved="false"
android:title="@string/preferences_private_browsing_options"/>
android:title="@string/preferences_private_browsing_options" />
<androidx.preference.Preference
android:key="@string/pref_key_tracking_protection_settings"
@ -135,7 +140,7 @@
<androidx.preference.Preference
android:key="@string/pref_key_override_amo_collection"
app:iconSpaceReserved="false"
android:title="@string/preferences_customize_amo_collection"/>
android:title="@string/preferences_customize_amo_collection" />
<androidx.preference.SwitchPreference
android:defaultValue="false"
@ -147,7 +152,7 @@
android:defaultValue="false"
android:key="@string/pref_key_external_download_manager"
app:iconSpaceReserved="false"
android:title="@string/preferences_external_download_manager"/>
android:title="@string/preferences_external_download_manager" />
<androidx.preference.SwitchPreference
android:defaultValue="true"

Loading…
Cancel
Save