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
// Add 'Add credit card' button. Tap of it brings up card editor which allows users type in
// new credit cards.
Preference add_card_pref = new Preference(getActivity());
Drawable plusIcon = ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.plus);
plusIcon.mutate();
plusIcon.setColorFilter(
ApiCompatibilityUtils.getColor(getResources(), R.color.pref_accent_color),
PorterDuff.Mode.SRC_IN);
add_card_pref.setIcon(plusIcon);
add_card_pref.setTitle(R.string.autofill_create_credit_card);
add_card_pref.setFragment(AutofillLocalCardEditor.class.getName());
add_card_pref.setEnabled(PersonalDataManager.isAutofillCreditCardEnabled());
getPreferenceScreen().addPreference(add_card_pref);
if (PersonalDataManager.isAutofillCreditCardEnabled()) {
Preference add_card_pref = new Preference(getActivity());
Drawable plusIcon = ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.plus);
plusIcon.mutate();
plusIcon.setColorFilter(
ApiCompatibilityUtils.getColor(getResources(), R.color.pref_accent_color),
PorterDuff.Mode.SRC_IN);
add_card_pref.setIcon(plusIcon);
add_card_pref.setTitle(R.string.autofill_create_credit_card);
add_card_pref.setFragment(AutofillLocalCardEditor.class.getName());
getPreferenceScreen().addPreference(add_card_pref);
}
// Add the link to payment apps only after the credit card list is rebuilt.
if (ChromeFeatureList.isEnabled(ChromeFeatureList.ANDROID_PAYMENT_APPS)
......
......@@ -102,20 +102,21 @@ public class AutofillProfilesFragment
// Add 'Add address' button. Tap of it brings up address editor which allows users type in
// new addresses.
AutofillProfileEditorPreference pref =
new AutofillProfileEditorPreference(getActivity(), sObserverForTest);
Drawable plusIcon = ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.plus);
plusIcon.mutate();
plusIcon.setColorFilter(
ApiCompatibilityUtils.getColor(getResources(), R.color.pref_accent_color),
PorterDuff.Mode.SRC_IN);
pref.setIcon(plusIcon);
pref.setTitle(R.string.autofill_create_profile);
pref.setKey(PREF_NEW_PROFILE); // For testing.
pref.setEnabled(PersonalDataManager.isAutofillProfileEnabled());
try (StrictModeContext unused = StrictModeContext.allowDiskWrites()) {
getPreferenceScreen().addPreference(pref);
if (PersonalDataManager.isAutofillProfileEnabled()) {
AutofillProfileEditorPreference pref =
new AutofillProfileEditorPreference(getActivity(), sObserverForTest);
Drawable plusIcon = ApiCompatibilityUtils.getDrawable(getResources(), R.drawable.plus);
plusIcon.mutate();
plusIcon.setColorFilter(
ApiCompatibilityUtils.getColor(getResources(), R.color.pref_accent_color),
PorterDuff.Mode.SRC_IN);
pref.setIcon(plusIcon);
pref.setTitle(R.string.autofill_create_profile);
pref.setKey(PREF_NEW_PROFILE); // For testing.
try (StrictModeContext unused = StrictModeContext.allowDiskWrites()) {
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