Commit 911038cc authored by Clemens Arbesser's avatar Clemens Arbesser Committed by Commit Bot

[Autofill Assistant] Removed the link to the chrome settings from the expanded payment request.

It takes up space and is redundant, since the user can access more specific settings pages by tapping the edit/add buttons next to the payment methods and contact details.

Bug: 806868
Change-Id: I0ac076930dc605102931bfe2c7d958aa4ad36c3a
Reviewed-on: https://chromium-review.googlesource.com/c/1337503Reviewed-by: default avatarMathias Carlen <mcarlen@chromium.org>
Commit-Queue: Clemens Arbesser <arbesser@google.com>
Cr-Commit-Position: refs/heads/master@{#608364}
parent 33d9de49
...@@ -15,11 +15,8 @@ import android.app.Activity; ...@@ -15,11 +15,8 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.support.annotation.IntDef; import android.support.annotation.IntDef;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.animation.LinearOutSlowInInterpolator; import android.support.v4.view.animation.LinearOutSlowInInterpolator;
import android.text.SpannableString;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.StyleSpan; import android.text.style.StyleSpan;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -33,7 +30,6 @@ import android.widget.FrameLayout; ...@@ -33,7 +30,6 @@ import android.widget.FrameLayout;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.Callback; import org.chromium.base.Callback;
import org.chromium.chrome.autofill_assistant.R; import org.chromium.chrome.autofill_assistant.R;
import org.chromium.chrome.browser.ChromeVersionInfo; import org.chromium.chrome.browser.ChromeVersionInfo;
...@@ -51,11 +47,8 @@ import org.chromium.chrome.browser.widget.FadingEdgeScrollView; ...@@ -51,11 +47,8 @@ import org.chromium.chrome.browser.widget.FadingEdgeScrollView;
import org.chromium.chrome.browser.widget.animation.FocusAnimator; import org.chromium.chrome.browser.widget.animation.FocusAnimator;
import org.chromium.chrome.browser.widget.prefeditor.EditableOption; import org.chromium.chrome.browser.widget.prefeditor.EditableOption;
import org.chromium.chrome.browser.widget.prefeditor.EditorDialog; import org.chromium.chrome.browser.widget.prefeditor.EditorDialog;
import org.chromium.components.signin.ChromeSigninController;
import org.chromium.ui.text.NoUnderlineClickableSpan;
import org.chromium.ui.text.SpanApplier; import org.chromium.ui.text.SpanApplier;
import org.chromium.ui.text.SpanApplier.SpanInfo; import org.chromium.ui.text.SpanApplier.SpanInfo;
import org.chromium.ui.widget.TextViewWithClickableSpans;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
...@@ -740,9 +733,6 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View ...@@ -740,9 +733,6 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
FadingEdgeScrollView.EdgeType.HARD, FadingEdgeScrollView.EdgeType.FADING); FadingEdgeScrollView.EdgeType.HARD, FadingEdgeScrollView.EdgeType.FADING);
mSectionSeparators.add(new SectionSeparator(mPaymentContainerLayout, -1)); mSectionSeparators.add(new SectionSeparator(mPaymentContainerLayout, -1));
// Add a link to Autofill settings.
addCardAndAddressOptionsSettingsView(mPaymentContainerLayout);
// Expand all the dividers. // Expand all the dividers.
for (int i = 0; i < mSectionSeparators.size(); i++) mSectionSeparators.get(i).expand(); for (int i = 0; i < mSectionSeparators.size(); i++) mSectionSeparators.get(i).expand();
mPaymentContainerLayout.requestLayout(); mPaymentContainerLayout.requestLayout();
...@@ -783,35 +773,6 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View ...@@ -783,35 +773,6 @@ public class PaymentRequestUI implements DialogInterface.OnDismissListener, View
} }
} }
private void addCardAndAddressOptionsSettingsView(LinearLayout parent) {
String message;
if (!mShowDataSource) {
message = mContext.getString(R.string.payments_card_and_address_settings);
} else if (ChromeSigninController.get().isSignedIn()) {
message = mContext.getString(R.string.payments_card_and_address_settings_signed_in,
ChromeSigninController.get().getSignedInAccountName());
} else {
message = mContext.getString(R.string.payments_card_and_address_settings_signed_out);
}
NoUnderlineClickableSpan settingsSpan =
new NoUnderlineClickableSpan((widget) -> mClient.onCardAndAddressSettingsClicked());
SpannableString spannableMessage = SpanApplier.applySpans(
message, new SpanInfo("BEGIN_LINK", "END_LINK", settingsSpan));
TextView view = new TextViewWithClickableSpans(mContext);
view.setText(spannableMessage);
view.setMovementMethod(LinkMovementMethod.getInstance());
ApiCompatibilityUtils.setTextAppearance(view, R.style.BlackBody);
// 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(view, paddingSize, paddingSize, paddingSize, paddingSize);
parent.addView(view);
}
private Callback<SectionInformation> createUpdateSectionCallback(@DataType final int type) { private Callback<SectionInformation> createUpdateSectionCallback(@DataType final int type) {
return new Callback<SectionInformation>() { return new Callback<SectionInformation>() {
@Override @Override
......
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