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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.ui.autofill;
6
7 import android.app.AlertDialog;
8 import android.content.Context;
9 import android.content.DialogInterface;
10 import android.view.LayoutInflater;
11 import android.view.View;
12 import android.widget.EditText;
13
14 import org.chromium.ui.R;
15
16 /**
17 * A prompt that bugs users to enter their CVC when unmasking a Wallet instrumen t (credit card).
18 */
19 public class CardUnmaskPrompt implements DialogInterface.OnClickListener,
20 DialogInterface.OnDismissListener {
21 private CardUnmaskPromptDelegate mDelegate;
22 private int mClickedButton;
23 private AlertDialog mDialog;
24
25 /**
26 * An interface to handle the interaction with an CardUnmaskPrompt object.
27 */
28 public interface CardUnmaskPromptDelegate {
29 /**
30 * Called when the dialog has been dismissed.
31 * @param userResponse The value the user entered (a CVC), or an empty s tring if the
32 * user canceled.
33 */
34 void dismissed(String userResponse);
35 }
36
37 public CardUnmaskPrompt(Context context, CardUnmaskPromptDelegate delegate) {
38 mDelegate = delegate;
39 mClickedButton = DialogInterface.BUTTON_NEGATIVE;
40
41 LayoutInflater inflater = LayoutInflater.from(context);
42 View v = inflater.inflate(R.layout.autofill_card_unmask_prompt, null);
43
44 mDialog = new AlertDialog.Builder(context)
45 .setTitle("Unlocking Visa - 1111")
46 .setView(v)
47 .setNegativeButton("Back", this)
48 .setPositiveButton("Rock on", this)
49 .setOnDismissListener(this).create();
50 }
51
52 public void show() {
53 mDialog.show();
54 }
55
56 @Override
57 public void onClick(DialogInterface dialog, int which) {
58 mClickedButton = which;
59 }
60
61 @Override
62 public void onDismiss(DialogInterface dialog) {
63 if (mClickedButton == DialogInterface.BUTTON_POSITIVE) {
64 String response = ((EditText) mDialog.findViewById(R.id.card_unmask_ input))
65 .getText().toString();
66 mDelegate.dismissed(response);
67 } else {
68 mDelegate.dismissed("");
69 }
70 }
71 }
OLDNEW
« 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