| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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.chrome.browser.signin; | |
| 6 | |
| 7 import android.app.Dialog; | |
| 8 import android.app.DialogFragment; | |
| 9 import android.content.DialogInterface; | |
| 10 import android.os.Bundle; | |
| 11 import android.support.v7.app.AlertDialog; | |
| 12 | |
| 13 import org.chromium.chrome.R; | |
| 14 | |
| 15 /** | |
| 16 * Fragment that allows user to add their Google account. | |
| 17 */ | |
| 18 public class AddGoogleAccountDialogFragment extends DialogFragment implements | |
| 19 DialogInterface.OnClickListener { | |
| 20 | |
| 21 /** | |
| 22 * Listener for new account additions. | |
| 23 */ | |
| 24 public interface AddGoogleAccountListener { | |
| 25 /** | |
| 26 * Called when the user chooses to add an account to their device. | |
| 27 */ | |
| 28 public void onAddAccountClicked(); | |
| 29 } | |
| 30 | |
| 31 private AddGoogleAccountListener mListener; | |
| 32 | |
| 33 @Override | |
| 34 public Dialog onCreateDialog(Bundle savedInstanceState) { | |
| 35 return new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme) | |
| 36 .setTitle(R.string.add_account_title) | |
| 37 .setPositiveButton(R.string.add_account_continue, this) | |
| 38 .setNegativeButton(R.string.cancel, null) | |
| 39 .setMessage(R.string.add_account_message) | |
| 40 .create(); | |
| 41 } | |
| 42 | |
| 43 @Override | |
| 44 public void onClick(DialogInterface dialog, int which) { | |
| 45 if (which == AlertDialog.BUTTON_POSITIVE) { | |
| 46 if (mListener != null) mListener.onAddAccountClicked(); | |
| 47 } | |
| 48 } | |
| 49 | |
| 50 /** | |
| 51 * @param listener Listener that should be notified when user chooses to add
an account. | |
| 52 */ | |
| 53 public void setListener(AddGoogleAccountListener listener) { | |
| 54 mListener = listener; | |
| 55 } | |
| 56 } | |
| OLD | NEW |