Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(336)

Unified Diff: ui/android/java/src/org/chromium/ui/autofill/CardUnmaskPrompt.java

Issue 756333003: Prompt for unmasking Wallet credit card on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile post-merge Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/android/java/src/org/chromium/ui/autofill/CardUnmaskPrompt.java
diff --git a/ui/android/java/src/org/chromium/ui/autofill/CardUnmaskPrompt.java b/ui/android/java/src/org/chromium/ui/autofill/CardUnmaskPrompt.java
new file mode 100644
index 0000000000000000000000000000000000000000..c4500d40818b257df7459b9aecc6ff065125a300
--- /dev/null
+++ b/ui/android/java/src/org/chromium/ui/autofill/CardUnmaskPrompt.java
@@ -0,0 +1,71 @@
+// Copyright 2014 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.
+
+package org.chromium.ui.autofill;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.EditText;
+
+import org.chromium.ui.R;
+
+/**
+ * A prompt that bugs users to enter their CVC when unmasking a Wallet instrument (credit card).
+ */
+public class CardUnmaskPrompt implements DialogInterface.OnClickListener,
+ DialogInterface.OnDismissListener {
+ private CardUnmaskPromptDelegate mDelegate;
+ private int mClickedButton;
+ private AlertDialog mDialog;
+
+ /**
+ * An interface to handle the interaction with an CardUnmaskPrompt object.
+ */
+ public interface CardUnmaskPromptDelegate {
+ /**
+ * Called when the dialog has been dismissed.
+ * @param userResponse The value the user entered (a CVC), or an empty string if the
+ * user canceled.
+ */
+ void dismissed(String userResponse);
+ }
+
+ public CardUnmaskPrompt(Context context, CardUnmaskPromptDelegate delegate) {
+ mDelegate = delegate;
+ mClickedButton = DialogInterface.BUTTON_NEGATIVE;
+
+ LayoutInflater inflater = LayoutInflater.from(context);
+ View v = inflater.inflate(R.layout.autofill_card_unmask_prompt, null);
+
+ mDialog = new AlertDialog.Builder(context)
+ .setTitle("Unlocking Visa - 1111")
+ .setView(v)
+ .setNegativeButton("Back", this)
+ .setPositiveButton("Rock on", this)
+ .setOnDismissListener(this).create();
+ }
+
+ public void show() {
+ mDialog.show();
+ }
+
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ mClickedButton = which;
+ }
+
+ @Override
+ public void onDismiss(DialogInterface dialog) {
+ if (mClickedButton == DialogInterface.BUTTON_POSITIVE) {
+ String response = ((EditText) mDialog.findViewById(R.id.card_unmask_input))
+ .getText().toString();
+ mDelegate.dismissed(response);
+ } else {
+ mDelegate.dismissed("");
+ }
+ }
+}
« no previous file with comments | « ui/android/java/res/layout/autofill_card_unmask_prompt.xml ('k') | ui/android/java/strings/android_ui_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698