Merge branch 'develop' into loging_different_servers_same_pattern
authorDavid A. Velasco <dvelasco@solidgear.es>
Wed, 22 Apr 2015 07:35:37 +0000 (09:35 +0200)
committerDavid A. Velasco <dvelasco@solidgear.es>
Wed, 22 Apr 2015 07:35:37 +0000 (09:35 +0200)
Conflicts SOLVED in:
src/com/owncloud/android/ui/activity/FileActivity.java

1  2 
src/com/owncloud/android/ui/activity/FileActivity.java

@@@ -151,8 -151,6 +151,8 @@@ public class FileActivity extends Sherl
              mFromNotification = getIntent().getBooleanExtra(FileActivity.EXTRA_FROM_NOTIFICATION, false);
          }
  
 +        AccountUtils.updateAccountVersion(this); // best place, before any access to AccountManager or database
 +
          setAccount(account, savedInstanceState != null);
          
          mOperationsServiceConnection = new OperationsServiceConnection();
  
      }
  
 -
+     @Override
+     protected void onNewIntent (Intent intent) {
+         Log_OC.v(TAG, "onNewIntent() start");
+         Account current = AccountUtils.getCurrentOwnCloudAccount(this);
+         if (current != null && mAccount != null && !mAccount.name.equals(current.name)) {
+             mAccount = current;
+         }
+         Log_OC.v(TAG, "onNewIntent() stop");
+     }
      /**
       *  Since ownCloud {@link Account}s can be managed from the system setting menu, 
       *  the existence of the {@link Account} associated to the instance must be checked 
       */
      @Override
      protected void onRestart() {
+         Log_OC.v(TAG, "onRestart() start");
          super.onRestart();
-         boolean validAccount = (mAccount != null && AccountUtils.setCurrentOwnCloudAccount(getApplicationContext(), mAccount.name));
+         boolean validAccount = (mAccount != null && AccountUtils.exists(mAccount, this));
          if (!validAccount) {
              swapToDefaultAccount();
          }
+         Log_OC.v(TAG, "onRestart() end");
      }
  
      
      @Override 
      protected void onStart() {
+         Log_OC.v(TAG, "onStart() start");
          super.onStart();
  
          if (mAccountWasSet) {
              onAccountSet(mAccountWasRestored);
          }
+         Log_OC.v(TAG, "onStart() end");
      }
      
      @Override
      protected void onResume() {
+         Log_OC.v(TAG, "onResume() start");
          super.onResume();
          
          if (mOperationsServiceBinder != null) {
              doOnResumeAndBound();
          }
+         Log_OC.v(TAG, "onResume() end");
      }
      
      @Override
      protected void onPause()  {
-         
+         Log_OC.v(TAG, "onPause() start");
          if (mOperationsServiceBinder != null) {
              mOperationsServiceBinder.removeOperationListener(this);
          }
          
          super.onPause();
+         Log_OC.v(TAG, "onPause() end");
      }
      
      
      @Override
      protected void onDestroy() {
+         Log_OC.v(TAG, "onDestroy() start");
          if (mOperationsServiceConnection != null) {
              unbindService(mOperationsServiceConnection);
              mOperationsServiceBinder = null;
          }
  
          super.onDestroy();
+         Log_OC.v(TAG, "onDestroy() end");
      }
      
      
       */
      protected void setAccount(Account account, boolean savedAccount) {
          Account oldAccount = mAccount;
-         boolean validAccount = (account != null && AccountUtils.setCurrentOwnCloudAccount(getApplicationContext(), account.name));
+         boolean validAccount =
+                 (account != null && AccountUtils.setCurrentOwnCloudAccount(getApplicationContext(), account.name));
          if (validAccount) {
              mAccount = account;
              mAccountWasSet = true;
          } 
      }
  
-     private void onSynchronizeFolderOperationFinish(SynchronizeFolderOperation operation, RemoteOperationResult result) {
+     private void onSynchronizeFolderOperationFinish(
+             SynchronizeFolderOperation operation, RemoteOperationResult result
+     ) {
          if (!result.isSuccess() && result.getCode() != ResultCode.CANCELLED){
              Toast t = Toast.makeText(this, ErrorMessageAdapter.getErrorCauseMessage(result, operation, getResources()),
                      Toast.LENGTH_LONG);