Commit 0ec5dd1a authored by Lijin Shen's avatar Lijin Shen Committed by Commit Bot

[Messages] Set max width of message and hide container on animation end

1. Set a max width of message if the width is greater than the max
2. Show/hide container on animation start/end, handled by single
action message

Bug: 1123947
Change-Id: I72d717bc2d5fe15005c5cbf9c662e08d6357d8bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2526628
Commit-Queue: Lijin Shen <lazzzis@google.com>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarPavel Yatsuk <pavely@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827562}
parent 628e5dd9
...@@ -44,12 +44,12 @@ public class MessageContainerCoordinator implements BrowserControlsStateProvider ...@@ -44,12 +44,12 @@ public class MessageContainerCoordinator implements BrowserControlsStateProvider
mContainer.setLayoutParams(params); mContainer.setLayoutParams(params);
} }
public void showMessageContainer() { protected void showMessageContainer() {
mContainer.setVisibility(View.VISIBLE); mContainer.setVisibility(View.VISIBLE);
updateMargins(); updateMargins();
} }
public void hideMessageContainer() { protected void hideMessageContainer() {
mContainer.setVisibility(View.GONE); mContainer.setVisibility(View.GONE);
} }
......
...@@ -9,15 +9,19 @@ ...@@ -9,15 +9,19 @@
<org.chromium.components.messages.MessageBannerView <org.chromium.components.messages.MessageBannerView
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
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"
tools:ignore="UnusedResources" tools:ignore="UnusedResources"
android:layout_height="@dimen/message_banner_height" android:layout_height="@dimen/message_banner_height"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_gravity="center_horizontal"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_marginTop="@dimen/message_shadow_top_margin" android:layout_marginTop="@dimen/message_shadow_top_margin"
android:layout_marginBottom="@dimen/message_shadow_bottom_margin" android:layout_marginBottom="@dimen/message_shadow_bottom_margin"
android:layout_marginStart="@dimen/message_shadow_lateral_margin" android:layout_marginStart="@dimen/message_shadow_lateral_margin"
android:layout_marginEnd="@dimen/message_shadow_lateral_margin" android:layout_marginEnd="@dimen/message_shadow_lateral_margin"
android:elevation="@dimen/message_banner_elevation" android:elevation="@dimen/message_banner_elevation"
app:maxWidthPortrait="@dimen/message_max_width"
app:maxWidthLandscape="@dimen/message_max_width"
android:background="@drawable/message_bg_tinted"> android:background="@drawable/message_bg_tinted">
<ImageView <ImageView
......
...@@ -18,5 +18,6 @@ ...@@ -18,5 +18,6 @@
<dimen name="message_shadow_bottom_margin">16dp</dimen> <dimen name="message_shadow_bottom_margin">16dp</dimen>
<dimen name="message_bubble_inset">8dp</dimen> <dimen name="message_bubble_inset">8dp</dimen>
<dimen name="message_hide_threshold">16dp</dimen> <dimen name="message_hide_threshold">16dp</dimen>
<dimen name="message_max_width">380dp</dimen>
</resources> </resources>
\ No newline at end of file
...@@ -11,18 +11,18 @@ import android.util.AttributeSet; ...@@ -11,18 +11,18 @@ import android.util.AttributeSet;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import org.chromium.components.browser_ui.widget.BoundedLinearLayout;
import org.chromium.components.browser_ui.widget.gesture.SwipeGestureListener; import org.chromium.components.browser_ui.widget.gesture.SwipeGestureListener;
import org.chromium.components.browser_ui.widget.gesture.SwipeGestureListener.SwipeHandler; import org.chromium.components.browser_ui.widget.gesture.SwipeGestureListener.SwipeHandler;
/** /**
* View representing the message banner. * View representing the message banner.
*/ */
public class MessageBannerView extends LinearLayout { public class MessageBannerView extends BoundedLinearLayout {
private ImageView mIconView; private ImageView mIconView;
private TextView mTitle; private TextView mTitle;
private TextView mDescription; private TextView mDescription;
......
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