Commit 49e791b2 authored by Friedrich Horschig's avatar Friedrich Horschig Committed by Commit Bot

[TouchToFill][Android] Adjust paddings and margins to specs

With this CL, the peeking height is set depending on whether a second
suggestion will be half visible.

Additionally, various paddings and margins are adjusted to match the
specs. The see the differences with layout bounds, find screenshots in
the linked bug.

Bug: 1009331
Change-Id: Ib522938becca2012efbd30200f8a19e6c56c5380
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1866629
Commit-Queue: Friedrich [CET] <fhorschig@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707296}
parent 58e0bb42
......@@ -24,7 +24,10 @@
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
......
......@@ -9,32 +9,24 @@
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginBottom="16dp"
android:orientation="vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp">
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginEnd="@dimen/touch_to_fill_sheet_margin"
android:layout_marginStart="@dimen/touch_to_fill_sheet_margin"
android:importantForAccessibility="no"
app:srcCompat="@drawable/touch_to_fill_header_image" />
<org.chromium.ui.widget.TextViewWithLeading
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/touch_to_fill_sheet_margin"
android:layout_marginStart="@dimen/touch_to_fill_sheet_margin"
android:layout_gravity="center_horizontal"
android:text="@string/touch_to_fill_sheet_title"
android:textAppearance="@style/TextAppearance.BlackHeadline" />
<org.chromium.ui.widget.TextViewWithLeading
android:id="@+id/touch_to_fill_sheet_subtitle"
android:layout_marginEnd="@dimen/touch_to_fill_sheet_margin"
android:layout_marginStart="@dimen/touch_to_fill_sheet_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
......
......@@ -9,7 +9,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:minHeight="340dp"
android:orientation="vertical">
<ImageView
......@@ -29,11 +28,10 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginTop="16dp"
android:layout_marginEnd="@dimen/touch_to_fill_sheet_margin"
android:layout_marginStart="@dimen/touch_to_fill_sheet_margin"
android:clipToPadding="false"
android:paddingBottom="16dp"
android:paddingBottom="8dp"
android:divider="@null"
tools:listitem="@layout/touch_to_fill_credential_item"/>
......
......@@ -6,4 +6,6 @@
<resources>
<dimen name="touch_to_fill_favicon_size">24dp</dimen>
<dimen name="touch_to_fill_sheet_margin">16dp</dimen>
<dimen name="touch_to_fill_sheet_height_multiple_credentials">326dp</dimen>
<dimen name="touch_to_fill_sheet_height_single_credential">298dp</dimen>
</resources>
......@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.touch_to_fill;
import android.content.Context;
import android.support.annotation.DimenRes;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
......@@ -128,7 +129,7 @@ class TouchToFillView implements BottomSheet.BottomSheetContent {
@Override
public int getPeekHeight() {
return Math.min(mContentView.getMinimumHeight(),
return Math.min(mContext.getResources().getDimensionPixelSize(getDesiredSheetHeight()),
(int) mBottomSheetController.getBottomSheet().getSheetContainerHeight());
}
......@@ -161,4 +162,13 @@ class TouchToFillView implements BottomSheet.BottomSheetContent {
public int getSheetClosedAccessibilityStringId() {
return R.string.touch_to_fill_sheet_closed;
}
// TODO(crbug.com/1009331): This should add up the height of all items up to the 2nd credential.
private @DimenRes int getDesiredSheetHeight() {
if (mSheetItemListView.getAdapter() != null
&& mSheetItemListView.getAdapter().getItemCount() > 2) {
return R.dimen.touch_to_fill_sheet_height_multiple_credentials;
}
return R.dimen.touch_to_fill_sheet_height_single_credential;
}
}
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