X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/5f2820355d53973f8c577516533fca069464a58b..1551a5280afc682baf84582c150b3a9a4e47f219:/src/com/owncloud/android/authentication/AuthenticatorActivity.java diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index d5ba29fa..e7b33979 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -206,7 +206,16 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity protected void onCreate(Bundle savedInstanceState) { //Log_OC.wtf(TAG, "onCreate init"); super.onCreate(savedInstanceState); + + // Workaround, for fixing a problem with Android Library Suppor v7 19 //getWindow().requestFeature(Window.FEATURE_NO_TITLE); + if (getSupportActionBar() != null) { + getSupportActionBar().hide(); + + getSupportActionBar().setDisplayHomeAsUpEnabled(false); + getSupportActionBar().setDisplayShowHomeEnabled(false); + getSupportActionBar().setDisplayShowTitleEnabled(false); + } mIsFirstAuthAttempt = true; @@ -787,7 +796,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity Intent getServerInfoIntent = new Intent(); getServerInfoIntent.setAction(OperationsService.ACTION_GET_SERVER_INFO); getServerInfoIntent.putExtra( - OperationsService.EXTRA_SERVER_URL, + OperationsService.EXTRA_SERVER_URL, normalizeUrlSuffix(uri) ); if (mOperationsServiceBinder != null) { @@ -1002,7 +1011,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity if ( mAction == ACTION_CREATE) { mUsernameInput.setText(username); - success = createAccount(); + success = createAccount(result); } else { if (!mUsernameInput.getText().toString().equals(username)) { @@ -1106,7 +1115,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity url = "http://" + url; } } - + url = normalizeUrlSuffix(url); } return (url != null ? url : ""); @@ -1356,8 +1365,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity Log_OC.d(TAG, "Successful access - time to save the account"); boolean success = false; + if (mAction == ACTION_CREATE) { - success = createAccount(); + success = createAccount(result); } else { try { @@ -1425,7 +1435,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity response.putString(AccountManager.KEY_ACCOUNT_TYPE, mAccount.type); if (AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType()). - equals(mAuthTokenType)) { + equals(mAuthTokenType)) { response.putString(AccountManager.KEY_AUTHTOKEN, mAuthToken); // the next line is necessary, notifications are calling directly to the // AuthenticatorActivity to update, without AccountManager intervention @@ -1455,13 +1465,18 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity * * TODO Decide how to name the OAuth accounts */ - private boolean createAccount() { + private boolean createAccount(RemoteOperationResult authResult) { /// create and save new ownCloud account boolean isOAuth = AccountTypeUtils. getAuthTokenTypeAccessToken(MainApp.getAccountType()).equals(mAuthTokenType); boolean isSaml = AccountTypeUtils. getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType()).equals(mAuthTokenType); + String lastPermanentLocation = authResult.getLastPermanentLocation(); + if (lastPermanentLocation != null) { + mServerInfo.mBaseUrl = AccountUtils.trimWebdavSuffix(lastPermanentLocation); + } + Uri uri = Uri.parse(mServerInfo.mBaseUrl); String username = mUsernameInput.getText().toString().trim(); if (isOAuth) { @@ -1519,7 +1534,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity /// add user data to the new account; TODO probably can be done in the last parameter // addAccountExplicitly, or in KEY_USERDATA mAccountMgr.setUserData( - mAccount, Constants.KEY_OC_VERSION, mServerInfo.mVersion.getVersion() + mAccount, Constants.KEY_OC_VERSION, mServerInfo.mVersion.getVersion() ); mAccountMgr.setUserData( mAccount, Constants.KEY_OC_BASE_URL, mServerInfo.mBaseUrl @@ -1898,5 +1913,4 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity mIsFirstAuthAttempt = true; } - }