Commit 66daa4eb authored by Alice Wang's avatar Alice Wang Committed by Commit Bot

[Android][Signin] Move add account icon to xml

This CL moves the add account icon from code to xml file to make it
easier to reuse the xml file in other places.

Bug: 1107423
Change-Id: Id77a69d982b97088e58a7b357993587f05e6025e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2377937Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Reviewed-by: default avatarTanmoy Mollik <triploblastic@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805211}
parent 57da5904
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<TextView <TextView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawablePadding="22dp" android:drawablePadding="22dp"
...@@ -14,4 +15,5 @@ ...@@ -14,4 +15,5 @@
android:paddingBottom="8dp" android:paddingBottom="8dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:text="@string/signin_add_account_to_device" android:text="@string/signin_add_account_to_device"
android:textAppearance="@style/TextAppearance.TextLarge.Primary" /> android:textAppearance="@style/TextAppearance.TextLarge.Primary"
app:drawableStartCompat="@drawable/ic_person_add_24dp" />
...@@ -34,16 +34,17 @@ class AddAccountRowViewBinder { ...@@ -34,16 +34,17 @@ class AddAccountRowViewBinder {
} }
static void bindView(PropertyModel model, View view, PropertyKey propertyKey) { static void bindView(PropertyModel model, View view, PropertyKey propertyKey) {
TextView textView = (TextView) view; if (!ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)) {
int drawableRes = ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY) // Set the vector drawable programmatically because app:drawableStartCompat is
? R.drawable.ic_person_add_24dp // only available after AndroidX appcompat library.
: R.drawable.ic_add_circle_40dp;
// Set the vector drawable programmatically because app:drawableStartCompat is // TODO(https://crbug.com/948367): Use app:drawableStartCompat.
// only available after AndroidX appcompat library. TextView textView = (TextView) view;
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(
// TODO(https://crbug.com/948367): Use app:drawableStartCompat. AppCompatResources.getDrawable(
textView.setCompoundDrawablesRelativeWithIntrinsicBounds( view.getContext(), R.drawable.ic_add_circle_40dp),
AppCompatResources.getDrawable(view.getContext(), drawableRes), null, null, null); null, null, null);
}
if (propertyKey == AddAccountRowProperties.ON_CLICK_LISTENER) { if (propertyKey == AddAccountRowProperties.ON_CLICK_LISTENER) {
view.setOnClickListener(model.get(AddAccountRowProperties.ON_CLICK_LISTENER)); view.setOnClickListener(model.get(AddAccountRowProperties.ON_CLICK_LISTENER));
} else { } else {
......
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