From: masensio Date: Fri, 18 Oct 2013 10:32:22 +0000 (+0200) Subject: Merge branch 'setup_multiaccount' into setup_app_name X-Git-Tag: oc-android-1.5.5~159^2~8 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/31f6e61f894efd0867d1a34c8d3cb53d7bb5fc4a?ds=sidebyside;hp=-c Merge branch 'setup_multiaccount' into setup_app_name Conflicts: res/values/setup.xml src/com/owncloud/android/authentication/AccountAuthenticator.java --- 31f6e61f894efd0867d1a34c8d3cb53d7bb5fc4a diff --combined res/values/setup.xml index 2c73d269,8f18d6bd..ecf3afe6 --- a/res/values/setup.xml +++ b/res/values/setup.xml @@@ -1,15 -1,5 +1,15 @@@ + + ownCloud + owncloud + org.owncloud + owncloud.db + ownCloud + + Owncloud_ + + true @@@ -17,9 -7,7 +17,12 @@@ off off + + #F7F7F7 + #1D2D44 + #1D2D44 + + + true + diff --combined res/values/strings.xml index a27ee047,4d3e5fdd..eb5174d8 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@@ -1,6 -1,7 +1,6 @@@ - ownCloud Password: Username: Login @@@ -216,6 -217,7 +216,7 @@@ Connecting to authentication server… Follow instructions above to get authenticated The server does not support this authentication method + This version of ownCloud doesn\'t support multiaccount Application terminated unexpectedly. Would you like to submit a crash report? Send report diff --combined src/com/owncloud/android/authentication/AccountAuthenticator.java index 5d798917,2a43dab8..c9da67bc --- a/src/com/owncloud/android/authentication/AccountAuthenticator.java +++ b/src/com/owncloud/android/authentication/AccountAuthenticator.java @@@ -22,9 -22,12 +22,15 @@@ import android.accounts.* import android.content.Context; import android.content.Intent; import android.os.Bundle; + import android.os.Handler; + import android.widget.Toast; + import com.owncloud.android.Log_OC; +import com.owncloud.android.MainApp; + + import com.owncloud.android.R; + ++ /** * Authenticator for ownCloud accounts. * @@@ -41,15 -44,14 +47,15 @@@ public class AccountAuthenticator exten * Is used by android system to assign accounts to authenticators. Should be * used by application and all extensions. */ - public static final String ACCOUNT_TYPE = "owncloud"; - public static final String AUTHORITY = "org.owncloud"; - public static final String AUTH_TOKEN_TYPE = "org.owncloud"; - public static final String AUTH_TOKEN_TYPE_PASSWORD = "owncloud.password"; - public static final String AUTH_TOKEN_TYPE_ACCESS_TOKEN = "owncloud.oauth2.access_token"; - public static final String AUTH_TOKEN_TYPE_REFRESH_TOKEN = "owncloud.oauth2.refresh_token"; - public static final String AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE = "owncloud.saml.web_sso.session_cookie"; - + /* These constants are now in MainApp + public static final String ACCOUNT_TYPE = "owncloud"; + public static final String AUTHORITY = "org.owncloud"; + public static final String AUTH_TOKEN_TYPE = "org.owncloud"; + public static final String AUTH_TOKEN_TYPE_PASSWORD = "owncloud.password"; + public static final String AUTH_TOKEN_TYPE_ACCESS_TOKEN = "owncloud.oauth2.access_token"; + public static final String AUTH_TOKEN_TYPE_REFRESH_TOKEN = "owncloud.oauth2.refresh_token"; + public static final String AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE = "owncloud.saml.web_sso.session_cookie"; + */ public static final String KEY_AUTH_TOKEN_TYPE = "authTokenType"; public static final String KEY_REQUIRED_FEATURES = "requiredFeatures"; public static final String KEY_LOGIN_OPTIONS = "loginOptions"; @@@ -86,10 -88,13 +92,13 @@@ private static final String TAG = AccountAuthenticator.class.getSimpleName(); private Context mContext; + + private Handler mHandler; public AccountAuthenticator(Context context) { super(context); mContext = context; + mHandler = new Handler(); } /** @@@ -102,25 -107,49 +111,49 @@@ throws NetworkErrorException { Log_OC.i(TAG, "Adding account with type " + accountType + " and auth token " + authTokenType); - try { - validateAccountType(accountType); - } catch (AuthenticatorException e) { - Log_OC.e(TAG, "Failed to validate account type " + accountType + ": " - + e.getMessage()); - e.printStackTrace(); - return e.getFailureBundle(); - } - final Intent intent = new Intent(mContext, AuthenticatorActivity.class); - intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); - intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType); - intent.putExtra(KEY_REQUIRED_FEATURES, requiredFeatures); - intent.putExtra(KEY_LOGIN_OPTIONS, options); - intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_CREATE); - - setIntentFlags(intent); final Bundle bundle = new Bundle(); - bundle.putParcelable(AccountManager.KEY_INTENT, intent); + + AccountManager accountManager = AccountManager.get(mContext); - Account[] accounts = accountManager.getAccountsByType(ACCOUNT_TYPE); ++ Account[] accounts = accountManager.getAccountsByType(MainApp.getAccountType()); + + if (mContext.getResources().getBoolean(R.bool.multiaccount_support) || accounts.length < 1) { + try { + validateAccountType(accountType); + } catch (AuthenticatorException e) { + Log_OC.e(TAG, "Failed to validate account type " + accountType + ": " + + e.getMessage()); + e.printStackTrace(); + return e.getFailureBundle(); + } + + final Intent intent = new Intent(mContext, AuthenticatorActivity.class); + intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); + intent.putExtra(KEY_AUTH_TOKEN_TYPE, authTokenType); + intent.putExtra(KEY_REQUIRED_FEATURES, requiredFeatures); + intent.putExtra(KEY_LOGIN_OPTIONS, options); + intent.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_CREATE); + + setIntentFlags(intent); + + bundle.putParcelable(AccountManager.KEY_INTENT, intent); + + } else { + + // Return an error + bundle.putInt(AccountManager.KEY_ERROR_CODE, AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION); + bundle.putString(AccountManager.KEY_ERROR_MESSAGE, mContext.getString(R.string.auth_unsupported_multiaccount)); + + mHandler.post(new Runnable() { + + @Override + public void run() { + Toast.makeText(mContext, R.string.auth_unsupported_multiaccount, Toast.LENGTH_SHORT).show(); + } + }); + + } + return bundle; } @@@ -178,7 -207,7 +211,7 @@@ /// check if required token is stored final AccountManager am = AccountManager.get(mContext); String accessToken; - if (authTokenType.equals(AUTH_TOKEN_TYPE_PASSWORD)) { + if (authTokenType.equals(MainApp.getAuthTokenTypePass())) { accessToken = am.getPassword(account); } else { accessToken = am.peekAuthToken(account, authTokenType); @@@ -186,7 -215,7 +219,7 @@@ if (accessToken != null) { final Bundle result = new Bundle(); result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name); - result.putString(AccountManager.KEY_ACCOUNT_TYPE, ACCOUNT_TYPE); + result.putString(AccountManager.KEY_ACCOUNT_TYPE, MainApp.getAccountType()); result.putString(AccountManager.KEY_AUTHTOKEN, accessToken); return result; } @@@ -251,18 -280,18 +284,18 @@@ private void validateAccountType(String type) throws UnsupportedAccountTypeException { - if (!type.equals(ACCOUNT_TYPE)) { + if (!type.equals(MainApp.getAccountType())) { throw new UnsupportedAccountTypeException(); } } private void validateAuthTokenType(String authTokenType) throws UnsupportedAuthTokenTypeException { - if (!authTokenType.equals(AUTH_TOKEN_TYPE) && - !authTokenType.equals(AUTH_TOKEN_TYPE_PASSWORD) && - !authTokenType.equals(AUTH_TOKEN_TYPE_ACCESS_TOKEN) && - !authTokenType.equals(AUTH_TOKEN_TYPE_REFRESH_TOKEN) && - !authTokenType.equals(AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE)) { + if (!authTokenType.equals(MainApp.getAuthTokenType()) && + !authTokenType.equals(MainApp.getAuthTokenTypePass()) && + !authTokenType.equals(MainApp.getAuthTokenTypeAccessToken()) && + !authTokenType.equals(MainApp.getAuthTokenTypeRefreshToken()) && + !authTokenType.equals(MainApp.getAuthTokenTypeSamlSessionCookie())) { throw new UnsupportedAuthTokenTypeException(); } } diff --combined src/com/owncloud/android/authentication/AuthenticatorActivity.java index 0b722c8c,283dfe1f..53f18bb4 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@@ -49,10 -49,10 +49,11 @@@ import android.widget.CheckBox import android.widget.EditText; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; + import android.widget.Toast; import com.actionbarsherlock.app.SherlockDialogFragment; import com.owncloud.android.Log_OC; +import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.authentication.SsoWebViewClient.SsoWebViewClientListener; import com.owncloud.android.network.OwnCloudClientUtils; @@@ -273,7 -273,7 +274,7 @@@ implements OnRemoteOperationListener, mAccount = savedInstanceState.getParcelable(KEY_ACCOUNT); mAuthTokenType = savedInstanceState.getString(AccountAuthenticator.KEY_AUTH_TOKEN_TYPE); if (mAuthTokenType == null) { - mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_PASSWORD; + mAuthTokenType = MainApp.getAuthTokenTypePass(); } @@@ -311,7 -311,7 +312,7 @@@ if (mServerIsChecked && !mServerIsValid && refreshButtonEnabled) showRefreshButton(); mOkButton.setEnabled(mServerIsValid); // state not automatically recovered in configuration changes - if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType) || + if (MainApp.getAuthTokenTypeSamlSessionCookie().equals(mAuthTokenType) || !AUTH_OPTIONAL.equals(getString(R.string.auth_method_oauth2))) { mOAuth2Check.setVisibility(View.GONE); } @@@ -363,7 -363,7 +364,7 @@@ @Override public boolean onTouch(View view, MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { - if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType) && + if (MainApp.getAuthTokenTypeSamlSessionCookie().equals(mAuthTokenType) && mHostUrlInput.hasFocus()) { checkOcServer(); } @@@ -396,11 -396,11 +397,11 @@@ samlWebSsoRequired = AUTH_ON.equals(getString(R.string.auth_method_saml_web_sso)); } if (oAuthRequired) { - mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN; + mAuthTokenType = MainApp.getAuthTokenTypeAccessToken(); } else if (samlWebSsoRequired) { - mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE; + mAuthTokenType = MainApp.getAuthTokenTypeSamlSessionCookie(); } else { - mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_PASSWORD; + mAuthTokenType = MainApp.getAuthTokenTypePass(); } } @@@ -409,7 -409,7 +410,7 @@@ mUsernameInput.setText(userName); } - mOAuth2Check.setChecked(AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN.equals(mAuthTokenType)); + mOAuth2Check.setChecked(MainApp.getAuthTokenTypeAccessToken().equals(mAuthTokenType)); } @@@ -482,10 -482,10 +483,10 @@@ protected void onResume() { super.onResume(); if (mAction == ACTION_UPDATE_TOKEN && mJustCreated && getIntent().getBooleanExtra(EXTRA_ENFORCED_UPDATE, false)) { - if (AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN.equals(mAuthTokenType)) { + if (MainApp.getAuthTokenTypeAccessToken().equals(mAuthTokenType)) { //Toast.makeText(this, R.string.auth_expired_oauth_token_toast, Toast.LENGTH_LONG).show(); showAuthMessage(getString(R.string.auth_expired_oauth_token_toast)); - } else if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType)) { + } else if (MainApp.getAuthTokenTypeSamlSessionCookie().equals(mAuthTokenType)) { //Toast.makeText(this, R.string.auth_expired_saml_sso_token_toast, Toast.LENGTH_LONG).show(); showAuthMessage(getString(R.string.auth_expired_saml_sso_token_toast)); } else { @@@ -685,9 -685,9 +686,9 @@@ return; } - if (AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN.equals(mAuthTokenType)) { + if (MainApp.getAuthTokenTypeAccessToken().equals(mAuthTokenType)) { startOauthorization(); - } else if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType)) { + } else if (MainApp.getAuthTokenTypeSamlSessionCookie().equals(mAuthTokenType)) { startSamlBasedFederatedSingleSignOnAuthorization(); } else { checkBasicAuthorization(); @@@ -781,7 -781,7 +782,7 @@@ onGetOAuthAccessTokenFinish((OAuth2GetAccessToken)operation, result); } else if (operation instanceof ExistenceCheckOperation) { - if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType)) { + if (MainApp.getAuthTokenTypeSamlSessionCookie().equals(mAuthTokenType)) { onSamlBasedFederatedSingleSignOnAuthorizationStart(operation, result); } else { @@@ -1166,12 -1166,12 +1167,12 @@@ response.putString(AccountManager.KEY_ACCOUNT_NAME, mAccount.name); response.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccount.type); - if (AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN.equals(mAuthTokenType)) { + if (MainApp.getAuthTokenTypeAccessToken().equals(mAuthTokenType)) { response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken); // the next line is necessary; by now, notifications are calling directly to the AuthenticatorActivity to update, without AccountManager intervention mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken); - } else if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType)) { + } else if (MainApp.getAuthTokenTypeSamlSessionCookie().equals(mAuthTokenType)) { String username = getUserNameForSamlSso(); if (!mUsernameInput.getText().toString().equals(username)) { // fail - not a new account, but an existing one; disallow @@@ -1206,8 -1206,8 +1207,8 @@@ */ private boolean createAccount() { /// create and save new ownCloud account - boolean isOAuth = AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN.equals(mAuthTokenType); - boolean isSaml = AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType); + boolean isOAuth = MainApp.getAuthTokenTypeAccessToken().equals(mAuthTokenType); + boolean isSaml = MainApp.getAuthTokenTypeSamlSessionCookie().equals(mAuthTokenType); Uri uri = Uri.parse(mHostBaseUrl); String username = mUsernameInput.getText().toString().trim(); @@@ -1221,7 -1221,7 +1222,7 @@@ if (uri.getPort() >= 0) { accountName += ":" + uri.getPort(); } - mAccount = new Account(accountName, AccountAuthenticator.ACCOUNT_TYPE); + mAccount = new Account(accountName, MainApp.getAccountType()); if (AccountUtils.exists(mAccount, getApplicationContext())) { // fail - not a new account, but an existing one; disallow RemoteOperationResult result = new RemoteOperationResult(ResultCode.ACCOUNT_NOT_NEW); @@@ -1250,10 -1250,10 +1251,10 @@@ /// prepare result to return to the Authenticator // TODO check again what the Authenticator makes with it; probably has the same effect as addAccountExplicitly, but it's not well done final Intent intent = new Intent(); - intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, AccountAuthenticator.ACCOUNT_TYPE); + intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, MainApp.getAccountType()); intent.putExtra(AccountManager.KEY_ACCOUNT_NAME, mAccount.name); /*if (!isOAuth) - intent.putExtra(AccountManager.KEY_AUTHTOKEN, AccountAuthenticator.ACCOUNT_TYPE); */ + intent.putExtra(AccountManager.KEY_AUTHTOKEN, MainApp.getAccountType()); */ intent.putExtra(AccountManager.KEY_USERDATA, username); if (isOAuth || isSaml) { mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken); @@@ -1273,11 -1273,11 +1274,11 @@@ /// immediately request for the synchronization of the new account Bundle bundle = new Bundle(); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); - ContentResolver.requestSync(mAccount, AccountAuthenticator.AUTHORITY, bundle); + ContentResolver.requestSync(mAccount, MainApp.getAuthTokenType(), bundle); syncAccount(); // Bundle bundle = new Bundle(); // bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); -// ContentResolver.requestSync(mAccount, AccountAuthenticator.AUTHORITY, bundle); +// ContentResolver.requestSync(mAccount, MainApp.getAuthTokenType(), bundle); return true; } } @@@ -1484,9 -1484,9 +1485,9 @@@ public void onCheckClick(View view) { CheckBox oAuth2Check = (CheckBox)view; if (oAuth2Check.isChecked()) { - mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN; + mAuthTokenType = MainApp.getAuthTokenTypeAccessToken(); } else { - mAuthTokenType = AccountAuthenticator.AUTH_TOKEN_TYPE_PASSWORD; + mAuthTokenType = MainApp.getAuthTokenTypePass(); } adaptViewAccordingToAuthenticationMethod(); } @@@ -1497,14 -1497,14 +1498,14 @@@ * the current authorization method. */ private void adaptViewAccordingToAuthenticationMethod () { - if (AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN.equals(mAuthTokenType)) { + if (MainApp.getAuthTokenTypeAccessToken().equals(mAuthTokenType)) { // OAuth 2 authorization mOAuthAuthEndpointText.setVisibility(View.VISIBLE); mOAuthTokenEndpointText.setVisibility(View.VISIBLE); mUsernameInput.setVisibility(View.GONE); mPasswordInput.setVisibility(View.GONE); - } else if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType)) { + } else if (MainApp.getAuthTokenTypeSamlSessionCookie().equals(mAuthTokenType)) { // SAML-based web Single Sign On mOAuthAuthEndpointText.setVisibility(View.GONE); mOAuthTokenEndpointText.setVisibility(View.GONE); @@@ -1550,7 -1550,7 +1551,7 @@@ } } else if (actionId == EditorInfo.IME_ACTION_NEXT && inputField != null && inputField.equals(mHostUrlInput)) { - if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType)) { + if (MainApp.getAuthTokenTypeSamlSessionCookie().equals(mAuthTokenType)) { checkOcServer(); } } @@@ -1651,12 -1651,12 +1652,12 @@@ /// immediately request for the synchronization of the new account Bundle bundle = new Bundle(); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); - ContentResolver.requestSync(mAccount, AccountAuthenticator.AUTHORITY, bundle); + ContentResolver.requestSync(mAccount, MainApp.getAuthTokenType(), bundle); } @Override public boolean onTouchEvent(MotionEvent event) { - if (AccountAuthenticator.AUTH_TOKEN_TYPE_SAML_WEB_SSO_SESSION_COOKIE.equals(mAuthTokenType) && + if (MainApp.getAuthTokenTypeSamlSessionCookie().equals(mAuthTokenType) && mHostUrlInput.hasFocus() && event.getAction() == MotionEvent.ACTION_DOWN) { checkOcServer(); } diff --combined src/com/owncloud/android/ui/activity/AccountSelectActivity.java index a98c38e7,4e81bb18..f5d06dcb --- a/src/com/owncloud/android/ui/activity/AccountSelectActivity.java +++ b/src/com/owncloud/android/ui/activity/AccountSelectActivity.java @@@ -51,7 -51,6 +51,7 @@@ import com.owncloud.android.authenticat import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.Log_OC; +import com.owncloud.android.MainApp; import com.owncloud.android.R; @@@ -96,10 -95,10 +96,10 @@@ public class AccountSelectActivity exte /// the account set as default changed since this activity was created // trigger synchronization - ContentResolver.cancelSync(null, AccountAuthenticator.AUTHORITY); + ContentResolver.cancelSync(null, MainApp.getAuthTokenType()); Bundle bundle = new Bundle(); bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); - ContentResolver.requestSync(AccountUtils.getCurrentOwnCloudAccount(this), AccountAuthenticator.AUTHORITY, bundle); + ContentResolver.requestSync(AccountUtils.getCurrentOwnCloudAccount(this), MainApp.getAuthTokenType(), bundle); // restart the main activity Intent i = new Intent(this, FileDisplayActivity.class); @@@ -111,8 -110,11 +111,11 @@@ @Override public boolean onCreateOptionsMenu(Menu menu) { - MenuInflater inflater = getSherlock().getMenuInflater(); - inflater.inflate(R.menu.account_picker, menu); + // Show Create Account if Multiaccount is enabled + if (getResources().getBoolean(R.bool.multiaccount_support)) { + MenuInflater inflater = getSherlock().getMenuInflater(); + inflater.inflate(R.menu.account_picker, menu); + } return true; } @@@ -137,17 -139,16 +140,16 @@@ /*Intent intent = new Intent( android.provider.Settings.ACTION_ADD_ACCOUNT); intent.putExtra("authorities", - new String[] { AccountAuthenticator.AUTHORITY }); + new String[] { MainApp.getAuthTokenType() }); startActivity(intent);*/ AccountManager am = AccountManager.get(getApplicationContext()); - am.addAccount(AccountAuthenticator.ACCOUNT_TYPE, + am.addAccount(MainApp.getAccountType(), null, null, null, this, null, null); - return true; } return false; @@@ -175,7 -176,7 +177,7 @@@ String accountName = map.get("NAME"); AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE); - Account accounts[] = am.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE); + Account accounts[] = am.getAccountsByType(MainApp.getAccountType()); for (Account a : accounts) { if (a.name.equals(accountName)) { if (item.getItemId() == R.id.change_password) { @@@ -196,7 -197,7 +198,7 @@@ private void populateAccountList() { AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE); Account accounts[] = am - .getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE); + .getAccountsByType(MainApp.getAccountType()); LinkedList> ll = new LinkedList>(); for (Account a : accounts) { HashMap h = new HashMap(); @@@ -212,6 -213,7 +214,7 @@@ android.R.layout.simple_list_item_single_choice, new String[] { "NAME" }, new int[] { android.R.id.text1 })); registerForContextMenu(getListView()); + } @Override @@@ -221,7 -223,7 +224,7 @@@ String accountName = ""; if (a == null) { Account[] accounts = AccountManager.get(this) - .getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE); + .getAccountsByType(MainApp.getAccountType()); if (accounts.length != 0) accountName = accounts[0].name; AccountUtils.setCurrentOwnCloudAccount(this, accountName);