Commit 187d0aa6 authored by Boris Sazonov's avatar Boris Sazonov Committed by Commit Bot

[Android] Update layouts of account rows in Settings and AccountSigninView

This CL changes layouts of account rows to confrom to Material spec and bring
consistensy to the account lists.

Bug: 701221, 722910
Change-Id: Ie70304cb9c9254335bbe7aaa94ac5e7d9c2ff519
Reviewed-on: https://chromium-review.googlesource.com/527098Reviewed-by: default avatarTheresa <twellington@chromium.org>
Reviewed-by: default avatarBernhard Bauer <bauerb@chromium.org>
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#478596}
parent feb596f1
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2017 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingEnd="16dp"
android:paddingStart="16dp">
<ImageView
android:id="@android:id/icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="16dp"
android:contentDescription="@null" />
<!-- Padding asymmetry (16dp top vs 18dp bottom) is necessary to move text 1dp up according to
the Material spec. See https://crbug.com/701221#c37. -->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:minHeight="56dp"
android:orientation="vertical"
android:paddingBottom="18dp"
android:paddingTop="16dp">
<TextView
android:id="@android:id/title"
style="@style/PreferenceTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@android:id/summary"
style="@style/PreferenceSummary"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:id="@android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone" />
</LinearLayout>
......@@ -2,41 +2,43 @@
<!-- Copyright 2016 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
found in the LICENSE file. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:orientation="horizontal"
android:paddingEnd="16dp"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal">
android:paddingStart="16dp">
<ImageView
android:id="@+id/account_image"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="16dp"
android:contentDescription="@null"/>
android:contentDescription="@null" />
<!-- 2dp bottom padding is necessary to move text 1dp up according to the Material spec.
See https://crbug.com/701221#c37. -->
<TextView
android:id="@+id/account_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:minHeight="56dp"
android:gravity="center_vertical"
android:minHeight="56dp"
android:paddingBottom="2dp"
android:textColor="@color/default_text_color"
android:textSize="@dimen/fre_normal_text_size"/>
android:textSize="@dimen/fre_normal_text_size" />
<ImageView
android:id="@+id/account_selection_mark"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="16dp"
android:src="@drawable/ic_check_googblue_24dp"
android:contentDescription="@null"
android:visibility="gone"/>
android:src="@drawable/ic_check_googblue_24dp"
android:visibility="gone" />
</LinearLayout>
......@@ -7,6 +7,7 @@
<org.chromium.chrome.browser.preferences.SignInPreference
android:key="sign_in"
android:layout="@layout/account_management_account_row"
android:title="@string/sign_in_to_chrome" />
<PreferenceCategory
......
......@@ -383,9 +383,9 @@ public class AccountManagementFragment extends PreferenceFragment
boolean isChildAccount = mProfile.isChild();
Account[] accounts = AccountManagerHelper.get().getGoogleAccounts();
for (final Account account : accounts) {
ChromeBasePreference pref = new ChromeBasePreference(getActivity());
Preference pref = new Preference(getActivity());
pref.setLayoutResource(R.layout.account_management_account_row);
pref.setTitle(account.name);
pref.setIcon(isChildAccount ? getBadgedUserPicture(getActivity(), account.name)
: getUserPicture(getActivity(), account.name));
......@@ -408,6 +408,7 @@ public class AccountManagementFragment extends PreferenceFragment
private ChromeBasePreference createAddAccountPreference() {
ChromeBasePreference addAccountPreference = new ChromeBasePreference(getActivity());
addAccountPreference.setLayoutResource(R.layout.account_management_account_row);
addAccountPreference.setIcon(R.drawable.add_circle_blue);
addAccountPreference.setTitle(R.string.account_management_add_account_title);
addAccountPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
......
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