| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.chromoting; | 5 package org.chromium.chromoting; |
| 6 | 6 |
| 7 import android.accounts.Account; | 7 import android.accounts.Account; |
| 8 import android.accounts.AccountManager; | 8 import android.accounts.AccountManager; |
| 9 import android.accounts.AccountManagerCallback; | 9 import android.accounts.AccountManagerCallback; |
| 10 import android.accounts.AccountManagerFuture; | 10 import android.accounts.AccountManagerFuture; |
| 11 import android.accounts.AuthenticatorException; | 11 import android.accounts.AuthenticatorException; |
| 12 import android.accounts.OperationCanceledException; | 12 import android.accounts.OperationCanceledException; |
| 13 import android.annotation.TargetApi; | 13 import android.annotation.SuppressLint; |
| 14 import android.app.ActionBar; | 14 import android.app.ActionBar; |
| 15 import android.app.Activity; | 15 import android.app.Activity; |
| 16 import android.app.AlertDialog; | 16 import android.app.AlertDialog; |
| 17 import android.app.ProgressDialog; | 17 import android.app.ProgressDialog; |
| 18 import android.content.DialogInterface; | 18 import android.content.DialogInterface; |
| 19 import android.content.Intent; | 19 import android.content.Intent; |
| 20 import android.content.SharedPreferences; | 20 import android.content.SharedPreferences; |
| 21 import android.content.res.Configuration; | 21 import android.content.res.Configuration; |
| 22 import android.os.Build; | 22 import android.os.Build; |
| 23 import android.os.Bundle; | 23 import android.os.Bundle; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 * used to request the host list a second time. | 93 * used to request the host list a second time. |
| 94 */ | 94 */ |
| 95 boolean mTriedNewAuthToken; | 95 boolean mTriedNewAuthToken; |
| 96 | 96 |
| 97 /** Shows a warning explaining that a Google account is required, then close
s the activity. */ | 97 /** Shows a warning explaining that a Google account is required, then close
s the activity. */ |
| 98 private void showNoAccountsDialog() { | 98 private void showNoAccountsDialog() { |
| 99 AlertDialog.Builder builder = new AlertDialog.Builder(this); | 99 AlertDialog.Builder builder = new AlertDialog.Builder(this); |
| 100 builder.setMessage(R.string.noaccounts_message); | 100 builder.setMessage(R.string.noaccounts_message); |
| 101 builder.setPositiveButton(R.string.noaccounts_add_account, | 101 builder.setPositiveButton(R.string.noaccounts_add_account, |
| 102 new DialogInterface.OnClickListener() { | 102 new DialogInterface.OnClickListener() { |
| 103 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) | 103 @SuppressLint("InlinedApi") |
| 104 @Override | 104 @Override |
| 105 public void onClick(DialogInterface dialog, int id) { | 105 public void onClick(DialogInterface dialog, int id) { |
| 106 Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT); | 106 Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT); |
| 107 intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, | 107 intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, |
| 108 new String[] { ACCOUNT_TYPE }); | 108 new String[] { ACCOUNT_TYPE }); |
| 109 if (intent.resolveActivity(getPackageManager()) != null)
{ | 109 if (intent.resolveActivity(getPackageManager()) != null)
{ |
| 110 startActivity(intent); | 110 startActivity(intent); |
| 111 } | 111 } |
| 112 finish(); | 112 finish(); |
| 113 } | 113 } |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 // Unreachable, but required by Google Java style and findbugs. | 440 // Unreachable, but required by Google Java style and findbugs. |
| 441 assert false : "Unreached"; | 441 assert false : "Unreached"; |
| 442 } | 442 } |
| 443 | 443 |
| 444 if (dismissProgress && mProgressIndicator != null) { | 444 if (dismissProgress && mProgressIndicator != null) { |
| 445 mProgressIndicator.dismiss(); | 445 mProgressIndicator.dismiss(); |
| 446 mProgressIndicator = null; | 446 mProgressIndicator = null; |
| 447 } | 447 } |
| 448 } | 448 } |
| 449 } | 449 } |
| OLD | NEW |