Commit 0b4b79d2 authored by Hui(Andy) Wu's avatar Hui(Andy) Wu Committed by Commit Bot

[Autofill Assistant] Allow user to swipe down the assistant UI.

Avoid blocking important part of the underlying page.

Screenshots:
https://drive.google.com/file/d/1QHMmX0s2uIE1v82TNmj7KwR-3PJIipGO/view?usp=sharing
https://drive.google.com/file/d/13EipCdWx5sJDn8-BTeS9f3vb_v5poJQA/view?usp=sharing

Bug: 119282188
Change-Id: I4a5c5144f0dd4ef6803c270129d18cb716438a17
Reviewed-on: https://chromium-review.googlesource.com/c/1340940Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarGanggui Tang <gogerald@chromium.org>
Commit-Queue: Hui Wu <wuandy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612344}
parent 1e501e3d
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 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. -->
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/autofill_assistant_light_grey"/>
<corners android:radius="2dp"/>
<size android:height="4dp" android:width="36dp"/>
</shape>
......@@ -10,6 +10,7 @@
android:layout_height="match_parent"
android:visibility="invisible"
android:gravity="bottom">
<org.chromium.chrome.browser.autofill_assistant.ui.TouchEventFilter
android:id="@+id/touch_event_filter"
android:layout_width="match_parent"
......@@ -20,24 +21,41 @@
android:focusable="false"
android:orientation="vertical"/>
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom">
<LinearLayout
android:id="@+id/bottombar"
android:id="@+id/autofill_assistant_bottombar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:clickable="true"
android:background="@drawable/autofill_assistant_bottombar_bg"
android:orientation="vertical">
android:orientation="vertical"
app:behavior_peekHeight="34dp"
app:layout_behavior="@string/bottom_sheet_behavior">
<org.chromium.ui.widget.ChromeImageView
android:id="@+id/swipe_indicator"
android:layout_width="36dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="10dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/autofill_assistant_swipe_indicator"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="56dp"
android:layout_marginTop="16dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:orientation="horizontal"
android:gravity="center_vertical">
<org.chromium.ui.widget.ChromeImageView
android:id="@+id/assistant_image"
android:layout_width="24dp"
android:layout_height="24dp"
app:srcCompat="@drawable/ic_autofill_assistant_24dp" />
......@@ -54,7 +72,7 @@
android:maxLines="2"
android:ellipsize="end"/>
<ImageButton
<org.chromium.ui.widget.ChromeImageButton
android:id="@+id/feedback_button"
android:layout_width="24dp"
android:layout_height="24dp"
......@@ -64,7 +82,7 @@
android:background="?attr/selectableItemBackground"
android:contentDescription="@string/menu_send_feedback" />
<ImageButton
<org.chromium.ui.widget.ChromeImageButton
android:id="@+id/close_button"
android:layout_width="24dp"
android:layout_height="24dp"
......@@ -78,6 +96,7 @@
android:id="@+id/progress_bar"
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_marginTop="17dp"
app:colorBackground="@color/modern_grey_100"
app:colorProgress="@color/modern_blue_600" />
......@@ -140,4 +159,5 @@
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
</FrameLayout>
......@@ -10,4 +10,5 @@
Please see src/ui/android/java/res/values/colors.xml for the shared common colors.
-->
<color name="autofill_assistant_light_blue">#e9f0fd</color>
<color name="autofill_assistant_light_grey">@color/modern_grey_300</color>
</resources>
......@@ -19,6 +19,7 @@ import android.media.ThumbnailUtils;
import android.support.annotation.ColorInt;
import android.support.annotation.IntDef;
import android.support.annotation.Nullable;
import android.support.design.widget.BottomSheetBehavior;
import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
import android.support.v4.text.TextUtilsCompat;
......@@ -92,6 +93,7 @@ class AutofillAssistantUiDelegate {
private final View mFullContainer;
private final TouchEventFilter mTouchEventFilter;
private final LinearLayout mBottomBar;
private final BottomSheetBehavior mBottomBarBehavior;
private final HorizontalScrollView mCarouselScroll;
private final ViewGroup mChipsViewContainer;
private final TextView mStatusMessageView;
......@@ -255,6 +257,7 @@ class AutofillAssistantUiDelegate {
// TODO(crbug.com/806868): Set hint text on overlay.
mTouchEventFilter = (TouchEventFilter) mFullContainer.findViewById(R.id.touch_event_filter);
mBottomBar = mFullContainer.findViewById(R.id.bottombar);
mBottomBarBehavior = BottomSheetBehavior.from(mBottomBar);
mBottomBar.findViewById(R.id.close_button)
.setOnClickListener(unusedView -> mClient.onDismiss());
mBottomBar.findViewById(R.id.feedback_button)
......@@ -423,6 +426,7 @@ class AutofillAssistantUiDelegate {
mTouchEventFilter.init(mClient, mActivity.getFullscreenManager(),
mActivity.getActivityTab().getWebContents());
mFullContainer.setVisibility(View.VISIBLE);
mBottomBarBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
// Announce Autofill Assistant is available for accessibility.
mBottomBar.announceForAccessibility(
......
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