Commit 870ee5b7 authored by Jinho Bang's avatar Jinho Bang Committed by Commit Bot

PaymentRequest: Move error message view into body

Before this patch, the spacing between the error message view and the
separator bar is too small. So, this patch increases spacing the error
message view and the separator bar and then moves the view into body
instead of header as per UX team's guide[1].

[1] https://bugs.chromium.org/p/chromium/issues/attachment?aid=395704&signed_aid=l8n-5NyRLCXrKlEdr9wYTw==&inline=1

Bug: 967808
Change-Id: I19a21eca6d3d648e76819a10d880f33678fdc17b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1635075Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Jinho Bang <jinho.bang@samsung.com>
Cr-Commit-Position: refs/heads/master@{#671956}
parent 5da94302
......@@ -30,10 +30,19 @@
android:id="@+id/payment_container_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
android:orientation="vertical">
<TextView
android:id="@+id/retry_error"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:visibility="gone"
android:textAppearance="@style/TextAppearance.PaymentsUiSectionWarningText" />
</LinearLayout>
</org.chromium.chrome.browser.widget.FadingEdgeScrollView>
<include layout="@layout/payment_request_bottom_bar" />
</org.chromium.chrome.browser.widget.BoundedLinearLayout>
\ No newline at end of file
</org.chromium.chrome.browser.widget.BoundedLinearLayout>
......@@ -13,69 +13,55 @@
android:id="@+id/header"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_gravity="center_vertical"
android:orientation="vertical">
<FrameLayout
android:minHeight="64dp">
<ImageView
android:id="@+id/icon_view"
android:layout_height="24dp"
android:layout_width="24dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_gravity="start|center_vertical"
android:importantForAccessibility="no"
android:scaleType="centerInside" />
<LinearLayout
android:id="@+id/page_info"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="64dp">
<ImageView
android:id="@+id/icon_view"
android:layout_height="24dp"
android:layout_width="24dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_gravity="start|center_vertical"
android:importantForAccessibility="no"
android:scaleType="centerInside" />
<LinearLayout
android:id="@+id/page_info"
android:layout_width="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:layout_marginBottom="@dimen/payments_section_vertical_spacing"
android:layout_marginTop="@dimen/payments_section_vertical_spacing"
android:layout_gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/page_title"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginEnd="50dp"
android:layout_marginBottom="@dimen/payments_section_vertical_spacing"
android:layout_marginTop="@dimen/payments_section_vertical_spacing"
android:layout_gravity="center_vertical"
android:orientation="vertical">
<TextView
android:id="@+id/page_title"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingStart="6dp"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.PaymentRequestHeaderTitle" />
<TextView
android:id="@+id/hostname"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingStart="6dp"
android:gravity="center_vertical"
android:ellipsize="start"
android:maxLines="1"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.BlackBody" />
</LinearLayout>
<ImageView
android:id="@+id/close_button"
android:layout_gravity="end|center_vertical"
android:layout_height="56dp"
android:layout_width="56dp"
android:src="@drawable/btn_close"
android:contentDescription="@string/close"
android:background="?attr/selectableItemBackground"
android:scaleType="center"
app:tint="@color/standard_mode_tint" />
</FrameLayout>
<TextView
android:id="@+id/retry_error"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:visibility="gone"
android:textAppearance="@style/TextAppearance.PaymentsUiSectionWarningText" />
android:paddingStart="6dp"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.PaymentRequestHeaderTitle" />
<TextView
android:id="@+id/hostname"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingStart="6dp"
android:gravity="center_vertical"
android:ellipsize="start"
android:maxLines="1"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.BlackBody" />
</LinearLayout>
<ImageView
android:id="@+id/close_button"
android:layout_gravity="end|center_vertical"
android:layout_height="56dp"
android:layout_width="56dp"
android:src="@drawable/btn_close"
android:contentDescription="@string/close"
android:background="?attr/selectableItemBackground"
android:scaleType="center"
app:tint="@color/standard_mode_tint" />
</org.chromium.chrome.browser.payments.ui.PaymentRequestHeader>
</merge>
......@@ -9,11 +9,9 @@ import android.graphics.Bitmap;
import android.support.annotation.ColorInt;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils;
......@@ -25,7 +23,7 @@ import org.chromium.chrome.browser.util.UrlConstants;
import org.chromium.chrome.browser.widget.TintedDrawable;
/** This class represents a bar to display at the top of the payment request UI. */
public class PaymentRequestHeader extends LinearLayout {
public class PaymentRequestHeader extends FrameLayout {
private final @ColorInt int mBackgroundColor;
private Context mContext;
......@@ -83,19 +81,4 @@ public class PaymentRequestHeader extends LinearLayout {
hostName.setPaddingRelative(0, 0, 0, 0);
}
}
/**
* Sets the retry error message on the header.
*
* @param error The error message to display on the header.
*/
public void setRetryErrorMessage(String error) {
TextView errorMessageView = (TextView) findViewById(R.id.retry_error);
errorMessageView.setText(error);
if (TextUtils.isEmpty(error)) {
errorMessageView.setVisibility(View.GONE);
} else {
errorMessageView.setVisibility(View.VISIBLE);
}
}
}
......@@ -281,6 +281,7 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
private FadingEdgeScrollView mPaymentContainer;
private LinearLayout mPaymentContainerLayout;
private TextView mRetryErrorView;
private ViewGroup mBottomBar;
private Button mEditButton;
private Button mPayButton;
......@@ -498,6 +499,7 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
mPaymentContainer = (FadingEdgeScrollView) mRequestView.findViewById(R.id.option_container);
mPaymentContainerLayout =
(LinearLayout) mRequestView.findViewById(R.id.payment_container_layout);
mRetryErrorView = mRequestView.findViewById(R.id.retry_error);
mOrderSummarySection = new LineItemBreakdownSection(context,
context.getString(R.string.payments_order_summary_label), this,
context.getString(R.string.payments_updated_label));
......@@ -625,7 +627,23 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
* @param error The error message to display on the header.
*/
public void setRetryErrorMessage(String error) {
((PaymentRequestHeader) mRequestView.findViewById(R.id.header)).setRetryErrorMessage(error);
if (mRetryErrorView == null) return;
mRetryErrorView.setText(error);
if (TextUtils.isEmpty(error)) {
mRetryErrorView.setVisibility(View.GONE);
} else {
if (mIsExpandedToFullHeight) {
// Add paddings instead of margin to let getMeasuredHeight return correct value for
// section resize animation.
int paddingSize = mContext.getResources().getDimensionPixelSize(
R.dimen.editor_dialog_section_large_spacing);
ViewCompat.setPaddingRelative(mRetryErrorView, 0, paddingSize, 0, paddingSize);
} else {
ViewCompat.setPaddingRelative(mRetryErrorView, 0, 0, 0, 0);
}
mRetryErrorView.setVisibility(View.VISIBLE);
}
}
/**
......
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