Commit f3a9a058 authored by Fabio Tirelo's avatar Fabio Tirelo Committed by Commit Bot

[AF] Do not show 'Add' button when toggle is disabled

This was suggested during UI review for finer-grained Autofill settings.

Screenshots in the bug.

Bug: 891373
Change-Id: Ia14a9573e1ac0ffe010c98c38af7301dfb1b435d
Reviewed-on: https://chromium-review.googlesource.com/c/1257624Reviewed-by: default avatarSebastien Seguin-Gagnon <sebsg@chromium.org>
Commit-Queue: Fabio Tirelo <ftirelo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595970}
parent dde055db
...@@ -101,17 +101,18 @@ public class AutofillPaymentMethodsFragment ...@@ -101,17 +101,18 @@ public class AutofillPaymentMethodsFragment
// Add 'Add credit card' button. Tap of it brings up card editor which allows users type in // Add 'Add credit card' button. Tap of it brings up card editor which allows users type in
// new credit cards. // new credit cards.
Preference add_card_pref = new Preference(getActivity()); if (PersonalDataManager.isAutofillCreditCardEnabled()) {
Drawable plusIcon = ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.plus); Preference add_card_pref = new Preference(getActivity());
plusIcon.mutate(); Drawable plusIcon = ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.plus);
plusIcon.setColorFilter( plusIcon.mutate();
ApiCompatibilityUtils.getColor(getResources(), R.color.pref_accent_color), plusIcon.setColorFilter(
PorterDuff.Mode.SRC_IN); ApiCompatibilityUtils.getColor(getResources(), R.color.pref_accent_color),
add_card_pref.setIcon(plusIcon); PorterDuff.Mode.SRC_IN);
add_card_pref.setTitle(R.string.autofill_create_credit_card); add_card_pref.setIcon(plusIcon);
add_card_pref.setFragment(AutofillLocalCardEditor.class.getName()); add_card_pref.setTitle(R.string.autofill_create_credit_card);
add_card_pref.setEnabled(PersonalDataManager.isAutofillCreditCardEnabled()); add_card_pref.setFragment(AutofillLocalCardEditor.class.getName());
getPreferenceScreen().addPreference(add_card_pref); getPreferenceScreen().addPreference(add_card_pref);
}
// Add the link to payment apps only after the credit card list is rebuilt. // Add the link to payment apps only after the credit card list is rebuilt.
if (ChromeFeatureList.isEnabled(ChromeFeatureList.ANDROID_PAYMENT_APPS) if (ChromeFeatureList.isEnabled(ChromeFeatureList.ANDROID_PAYMENT_APPS)
......
...@@ -102,20 +102,21 @@ public class AutofillProfilesFragment ...@@ -102,20 +102,21 @@ public class AutofillProfilesFragment
// Add 'Add address' button. Tap of it brings up address editor which allows users type in // Add 'Add address' button. Tap of it brings up address editor which allows users type in
// new addresses. // new addresses.
AutofillProfileEditorPreference pref = if (PersonalDataManager.isAutofillProfileEnabled()) {
new AutofillProfileEditorPreference(getActivity(), sObserverForTest); AutofillProfileEditorPreference pref =
Drawable plusIcon = ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.plus); new AutofillProfileEditorPreference(getActivity(), sObserverForTest);
plusIcon.mutate(); Drawable plusIcon = ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.plus);
plusIcon.setColorFilter( plusIcon.mutate();
ApiCompatibilityUtils.getColor(getResources(), R.color.pref_accent_color), plusIcon.setColorFilter(
PorterDuff.Mode.SRC_IN); ApiCompatibilityUtils.getColor(getResources(), R.color.pref_accent_color),
pref.setIcon(plusIcon); PorterDuff.Mode.SRC_IN);
pref.setTitle(R.string.autofill_create_profile); pref.setIcon(plusIcon);
pref.setKey(PREF_NEW_PROFILE); // For testing. pref.setTitle(R.string.autofill_create_profile);
pref.setEnabled(PersonalDataManager.isAutofillProfileEnabled()); pref.setKey(PREF_NEW_PROFILE); // For testing.
try (StrictModeContext unused = StrictModeContext.allowDiskWrites()) { try (StrictModeContext unused = StrictModeContext.allowDiskWrites()) {
getPreferenceScreen().addPreference(pref); getPreferenceScreen().addPreference(pref);
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment