diff options
author | John Reck <jreck@google.com> | 2011-03-14 16:28:56 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-03-14 16:28:56 -0700 |
commit | f94df7eb15fcbca9e47d5163f087fa1425c4511d (patch) | |
tree | 281b6b66cee3378c9f430b1acf6254aa146472b0 /src/com/android/browser/DeviceAccountLogin.java | |
parent | ac7538e0a49911b926eeebb811f61c6996c68ae3 (diff) | |
download | packages_apps_Browser-f94df7eb15fcbca9e47d5163f087fa1425c4511d.zip packages_apps_Browser-f94df7eb15fcbca9e47d5163f087fa1425c4511d.tar.gz packages_apps_Browser-f94df7eb15fcbca9e47d5163f087fa1425c4511d.tar.bz2 |
Switch account spinner to dropdown and holo style
Bug: 4093519
Change-Id: I0ac4670b325557616c24f024d86a85cf2e1ff141
Diffstat (limited to 'src/com/android/browser/DeviceAccountLogin.java')
-rw-r--r-- | src/com/android/browser/DeviceAccountLogin.java | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/src/com/android/browser/DeviceAccountLogin.java b/src/com/android/browser/DeviceAccountLogin.java index 50b8c97..818e076 100644 --- a/src/com/android/browser/DeviceAccountLogin.java +++ b/src/com/android/browser/DeviceAccountLogin.java @@ -21,22 +21,18 @@ import android.accounts.AccountManager; import android.accounts.AccountManagerCallback; import android.accounts.AccountManagerFuture; import android.app.Activity; -import android.app.AlertDialog; -import android.content.DialogInterface; import android.os.Bundle; import android.webkit.WebView; -import android.webkit.WebViewClient; public class DeviceAccountLogin implements - AccountManagerCallback<Bundle>, DialogInterface.OnClickListener { + AccountManagerCallback<Bundle> { private final Activity mActivity; private final WebView mWebView; private final Tab mTab; private final WebViewController mWebViewController; private final AccountManager mAccountManager; - private Account[] mAccounts; - private int mCurrentAccount; + Account[] mAccounts; private AutoLoginCallback mCallback; private String mAuthToken; @@ -48,7 +44,6 @@ public class DeviceAccountLogin implements public static final int PROCESSING = 2; public interface AutoLoginCallback { - public void setAccount(String account); public void loginFailed(); } @@ -129,37 +124,19 @@ public class DeviceAccountLogin implements mTab.setDeviceAccountLogin(null); } - public void login(AutoLoginCallback cb) { + public void login(int accountIndex, AutoLoginCallback cb) { mState = PROCESSING; mCallback = cb; mAccountManager.getAuthToken( - mAccounts[mCurrentAccount], mAuthToken, null, + mAccounts[accountIndex], mAuthToken, null, mActivity, this, null); } - public void chooseAccount(AutoLoginCallback cb) { - mCallback = cb; - CharSequence[] names = new CharSequence[mAccounts.length]; - int i = 0; - for (Account a : mAccounts) { - names[i++] = a.name; + public String[] getAccountNames() { + String[] names = new String[mAccounts.length]; + for (int i = 0; i < mAccounts.length; i++) { + names[i] = mAccounts[i].name; } - new AlertDialog.Builder(mActivity) - .setTitle(R.string.pref_autologin_title) - .setSingleChoiceItems(names, mCurrentAccount, this) - .setCancelable(true) - .show(); - } - - public String getCurrentAccount() { - return mAccounts[mCurrentAccount].name; - } - - @Override - public void onClick(DialogInterface d, int which) { - assert mCallback != null; - mCallback.setAccount(mAccounts[which].name); - mCurrentAccount = which; - d.dismiss(); + return names; } } |