Skip to content

Commit 98b3722

Browse files
Vishwas UppoorChromium LUCI CQ
Vishwas Uppoor
authored and
Chromium LUCI CQ
committed
[Metadata][Android] Update icon dimension for card art on Settings page
Update custom icon dimensions 32 x 20 -> 40 x 24 on "Payment methods" and "Edit card" pages. Payment methods page Mock: https://www.figma.com/file/N6F3DN9prdEzQiylOtVBCW/X-PA-share?node-id=2-7334&t=tHB6xlatk0CGPBjx-0 Current: https://screenshot.googleplex.com/9hXssgDwN7hefkt New: https://screenshot.googleplex.com/AbMbYZNW3X9G2Aw Edit card page Mock: https://www.figma.com/file/N6F3DN9prdEzQiylOtVBCW/X-PA-share?node-id=2-7011&t=tHB6xlatk0CGPBjx-0 Current: https://screenshot.googleplex.com/5JBvMxcC5QuGHag New: https://screenshot.googleplex.com/9Lr9bV24CC67fmR Note: Only custom icon dimensions are updated. Network icon dimensions will be updated in a future change. All updates are behind AutofillEnableNewCardArtAndNetworkImages flag. (cherry picked from commit ac96bff) Bug: 1417919, 1427669 Change-Id: I31b95e22e6624be3102e1dcbf1bd6be1aa5e467f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4357238 Reviewed-by: Friedrich Horschig <fhorschig@chromium.org> Reviewed-by: Lijin Shen <lazzzis@google.com> Commit-Queue: Vishwas Uppoor <vishwasuppoor@google.com> Cr-Original-Commit-Position: refs/heads/main@{#1122057} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4373879 Cr-Commit-Position: refs/branch-heads/5672@{#75} Cr-Branched-From: 5f2a724-refs/heads/main@{#1121455}
1 parent 7c8c4ce commit 98b3722

File tree

6 files changed

+38
-14
lines changed

6 files changed

+38
-14
lines changed

chrome/android/java/res/layout/autofill_server_card_editor.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ found in the LICENSE file.
1616

1717
<ImageView
1818
android:id="@+id/card_icon"
19-
android:layout_width="@dimen/settings_page_card_icon_width"
20-
android:layout_height="@dimen/settings_page_card_icon_height"
19+
android:layout_width="wrap_content"
20+
android:layout_height="wrap_content"
2121
android:layout_alignParentStart="true"
2222
android:layout_centerVertical="true"
2323
android:layout_marginEnd="@dimen/settings_page_card_icon_end_margin"

chrome/android/java/res/values/dimens.xml

-6
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,6 @@ found in the LICENSE file.
400400
<!-- Price Drop dimensions -->
401401
<dimen name="price_drop_spotted_iph_ntp_tabswitcher_y_inset">4dp</dimen>
402402

403-
<!-- Settings page -->
404-
<dimen name="settings_page_card_icon_width">32dp</dimen>
405-
<dimen name="settings_page_card_icon_height">20dp</dimen>
406-
<dimen name="settings_page_card_icon_end_margin">20dp</dimen>
407-
<dimen name="settings_page_margin_between_card_name_and_last_four_digits">4dp</dimen>
408-
409403
<!-- Card Unmask dialog -->
410404
<dimen name="card_unmask_dialog_credit_card_icon_width">32dp</dimen>
411405
<dimen name="card_unmask_dialog_credit_card_icon_height">20dp</dimen>

chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillPaymentMethodsFragment.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
package org.chromium.chrome.browser.autofill.settings;
66

7+
import static org.chromium.chrome.browser.autofill.AutofillUiUtils.getCardIcon;
8+
import static org.chromium.chrome.browser.autofill.AutofillUiUtils.getSettingsPageIconHeightId;
9+
import static org.chromium.chrome.browser.autofill.AutofillUiUtils.getSettingsPageIconWidthId;
10+
711
import android.content.Context;
812
import android.graphics.PorterDuff;
913
import android.graphics.drawable.Drawable;
@@ -22,7 +26,6 @@
2226
import org.chromium.base.ApiCompatibilityUtils;
2327
import org.chromium.chrome.R;
2428
import org.chromium.chrome.browser.autofill.AutofillEditorBase;
25-
import org.chromium.chrome.browser.autofill.AutofillUiUtils;
2629
import org.chromium.chrome.browser.autofill.PersonalDataManager;
2730
import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
2831
import org.chromium.chrome.browser.feedback.FragmentHelpAndFeedbackLauncher;
@@ -150,8 +153,8 @@ public boolean isPreferenceClickDisabled(Preference preference) {
150153
}
151154

152155
// Set card icon. It can be either a custom card art or a network icon.
153-
card_pref.setIcon(AutofillUiUtils.getCardIcon(getStyledContext(), card,
154-
R.dimen.settings_page_card_icon_width, R.dimen.settings_page_card_icon_height));
156+
card_pref.setIcon(getCardIcon(getStyledContext(), card, getSettingsPageIconWidthId(),
157+
getSettingsPageIconHeightId()));
155158

156159
if (card.getIsLocal()) {
157160
card_pref.setFragment(AutofillLocalCardEditor.class.getName());

chrome/android/java/src/org/chromium/chrome/browser/autofill/settings/AutofillServerCardEditor.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
package org.chromium.chrome.browser.autofill.settings;
66

7+
import static org.chromium.chrome.browser.autofill.AutofillUiUtils.getCardIcon;
8+
import static org.chromium.chrome.browser.autofill.AutofillUiUtils.getSettingsPageIconHeightId;
9+
import static org.chromium.chrome.browser.autofill.AutofillUiUtils.getSettingsPageIconWidthId;
10+
711
import android.os.Bundle;
812
import android.view.LayoutInflater;
913
import android.view.View;
@@ -22,7 +26,6 @@
2226
import org.chromium.build.annotations.UsedByReflection;
2327
import org.chromium.chrome.R;
2428
import org.chromium.chrome.browser.ChromeStringConstants;
25-
import org.chromium.chrome.browser.autofill.AutofillUiUtils;
2629
import org.chromium.chrome.browser.autofill.PersonalDataManager;
2730
import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile;
2831
import org.chromium.chrome.browser.customtabs.CustomTabActivity;
@@ -148,8 +151,8 @@ public View onCreateView(
148151

149152
// Set card icon. It can be either a custom card art or the network icon.
150153
ImageView cardIconContainer = v.findViewById(R.id.card_icon);
151-
cardIconContainer.setImageDrawable(AutofillUiUtils.getCardIcon(getContext(), mCard,
152-
R.dimen.settings_page_card_icon_width, R.dimen.settings_page_card_icon_height));
154+
cardIconContainer.setImageDrawable(getCardIcon(
155+
getContext(), mCard, getSettingsPageIconWidthId(), getSettingsPageIconHeightId()));
153156

154157
((TextView) v.findViewById(R.id.card_name)).setText(mCard.getCardNameForAutofillDisplay());
155158
((TextView) v.findViewById(R.id.card_last_four))

chrome/browser/autofill/android/java/src/org/chromium/chrome/browser/autofill/AutofillUiUtils.java

+16
Original file line numberDiff line numberDiff line change
@@ -525,4 +525,20 @@ public static Drawable getCardIcon(
525525
true);
526526
return new BitmapDrawable(resources, scaledBitmap);
527527
}
528+
529+
public static int getSettingsPageIconWidthId() {
530+
if (ChromeFeatureList.isEnabled(
531+
ChromeFeatureList.AUTOFILL_ENABLE_NEW_CARD_ART_AND_NETWORK_IMAGES)) {
532+
return R.dimen.settings_page_card_icon_width_new;
533+
}
534+
return R.dimen.settings_page_card_icon_width;
535+
}
536+
537+
public static int getSettingsPageIconHeightId() {
538+
if (ChromeFeatureList.isEnabled(
539+
ChromeFeatureList.AUTOFILL_ENABLE_NEW_CARD_ART_AND_NETWORK_IMAGES)) {
540+
return R.dimen.settings_page_card_icon_height_new;
541+
}
542+
return R.dimen.settings_page_card_icon_height;
543+
}
528544
}

components/autofill/android/java/res/values/dimens.xml

+8
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,12 @@ found in the LICENSE file.
4444
<dimen name="editable_option_section_logo_width">48dp</dimen>
4545
<dimen name="editable_option_section_logo_horizontal_padding">5dp</dimen>
4646
<dimen name="editable_option_section_logo_vertical_padding">13dp</dimen>
47+
48+
<!-- Settings page -->
49+
<dimen name="settings_page_card_icon_width">32dp</dimen>
50+
<dimen name="settings_page_card_icon_height">20dp</dimen>
51+
<dimen name="settings_page_card_icon_width_new">40dp</dimen>
52+
<dimen name="settings_page_card_icon_height_new">24dp</dimen>
53+
<dimen name="settings_page_card_icon_end_margin">20dp</dimen>
54+
<dimen name="settings_page_margin_between_card_name_and_last_four_digits">4dp</dimen>
4755
</resources>

0 commit comments

Comments
 (0)