OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.signin; | 5 package org.chromium.chrome.browser.signin; |
6 | 6 |
7 import android.app.Dialog; | 7 import android.app.Dialog; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.DialogInterface; | 9 import android.content.DialogInterface; |
10 import android.support.v7.app.AlertDialog; | 10 import android.support.v7.app.AlertDialog; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 mContext = context; | 53 mContext = context; |
54 } | 54 } |
55 | 55 |
56 /** | 56 /** |
57 * Shows progress dialog. Will dismiss other dialogs shown, if any. | 57 * Shows progress dialog. Will dismiss other dialogs shown, if any. |
58 * | 58 * |
59 * @param listener The {@link ProgressDialogListener} that will be notified
about user actions. | 59 * @param listener The {@link ProgressDialogListener} that will be notified
about user actions. |
60 */ | 60 */ |
61 public void showFetchManagementPolicyProgressDialog(final ProgressDialogList
ener listener) { | 61 public void showFetchManagementPolicyProgressDialog(final ProgressDialogList
ener listener) { |
62 dismissAllDialogs(); | 62 dismissAllDialogs(); |
63 mProgressDialog = new AlertDialog.Builder(mContext, R.style.AlertDialogT
heme) | 63 mProgressDialog = new AlertDialog.Builder(mContext, R.style.SigninAlertD
ialogTheme) |
64 .setView(R.layout.signin_progress_bar_dialog) | 64 .setView(R.layout.signin_progress_bar_dialog) |
65 .setNegativeButton(R.string.cancel, | 65 .setNegativeButton(R.string.cancel, |
66 new DialogInterface.OnClickListener()
{ | 66 new DialogInterface.OnClickListener()
{ |
67 @Override | 67 @Override |
68 public void onClick(DialogInterfac
e dialog, int i) { | 68 public void onClick(DialogInterfac
e dialog, int i) { |
69 dialog.cancel(); | 69 dialog.cancel(); |
70 } | 70 } |
71 }) | 71 }) |
72 .setOnCancelListener(new DialogInterface.OnCan
celListener() { | 72 .setOnCancelListener(new DialogInterface.OnCan
celListener() { |
73 @Override | 73 @Override |
74 public void onCancel(DialogInterface dialo
g) { | 74 public void onCancel(DialogInterface dialo
g) { |
75 listener.onCancel(); | 75 listener.onCancel(); |
76 } | 76 } |
77 }) | 77 }) |
78 .create(); | 78 .create(); |
79 mProgressDialog.show(); | 79 mProgressDialog.show(); |
80 } | 80 } |
81 | 81 |
82 /** | 82 /** |
83 * Shows timeout dialog. Will dismiss other dialogs shown, if any. | 83 * Shows timeout dialog. Will dismiss other dialogs shown, if any. |
84 * | 84 * |
85 * @param listener The {@link TimeoutDialogListener} that will be notified a
bout user actions. | 85 * @param listener The {@link TimeoutDialogListener} that will be notified a
bout user actions. |
86 */ | 86 */ |
87 public void showFetchManagementPolicyTimeoutDialog(final TimeoutDialogListen
er listener) { | 87 public void showFetchManagementPolicyTimeoutDialog(final TimeoutDialogListen
er listener) { |
88 dismissAllDialogs(); | 88 dismissAllDialogs(); |
89 mTimeoutAlertDialog = | 89 mTimeoutAlertDialog = |
90 new AlertDialog.Builder(mContext, R.style.AlertDialogTheme) | 90 new AlertDialog.Builder(mContext, R.style.SigninAlertDialogTheme
) |
91 .setTitle(R.string.sign_in_timeout_title) | 91 .setTitle(R.string.sign_in_timeout_title) |
92 .setMessage(R.string.sign_in_timeout_message) | 92 .setMessage(R.string.sign_in_timeout_message) |
93 .setNegativeButton(R.string.cancel, | 93 .setNegativeButton(R.string.cancel, |
94 new DialogInterface.OnClickListener() { | 94 new DialogInterface.OnClickListener() { |
95 @Override | 95 @Override |
96 public void onClick(DialogInterface dialog,
int which) { | 96 public void onClick(DialogInterface dialog,
int which) { |
97 dialog.cancel(); | 97 dialog.cancel(); |
98 } | 98 } |
99 }) | 99 }) |
100 .setPositiveButton(R.string.retry, | 100 .setPositiveButton(R.string.retry, |
(...skipping 17 matching lines...) Expand all Loading... |
118 * Dismisses all dialogs. | 118 * Dismisses all dialogs. |
119 */ | 119 */ |
120 public void dismissAllDialogs() { | 120 public void dismissAllDialogs() { |
121 if (mProgressDialog != null) mProgressDialog.dismiss(); | 121 if (mProgressDialog != null) mProgressDialog.dismiss(); |
122 mProgressDialog = null; | 122 mProgressDialog = null; |
123 | 123 |
124 if (mTimeoutAlertDialog != null) mTimeoutAlertDialog.dismiss(); | 124 if (mTimeoutAlertDialog != null) mTimeoutAlertDialog.dismiss(); |
125 mTimeoutAlertDialog = null; | 125 mTimeoutAlertDialog = null; |
126 } | 126 } |
127 } | 127 } |
OLD | NEW |