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