X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/8aa0060f4ae74e0218484c3a271ecb01463397e1..9593b580b72aaec969689eb4ca7197f8da736ab8:/src/com/owncloud/android/ui/activity/FileActivity.java diff --git a/src/com/owncloud/android/ui/activity/FileActivity.java b/src/com/owncloud/android/ui/activity/FileActivity.java index 43e11b13..50b41751 100644 --- a/src/com/owncloud/android/ui/activity/FileActivity.java +++ b/src/com/owncloud/android/ui/activity/FileActivity.java @@ -151,6 +151,8 @@ public class FileActivity extends SherlockFragmentActivity 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(); @@ -167,7 +169,16 @@ public class FileActivity extends SherlockFragmentActivity } - + @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 @@ -177,8 +188,7 @@ public class FileActivity extends SherlockFragmentActivity 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(); } @@ -188,36 +198,29 @@ public class FileActivity extends SherlockFragmentActivity @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"); }