/** Flag to signal that the activity will is finishing to enforce the creation of an ownCloud {@link Account} */
private boolean mRedirectingToSetupAccount = false;
+ /** Flag to signal when the value of mAccount was set */
+ private boolean mAccountWasSet;
+
+ /** Flag to signal when the value of mAccount was restored from a saved state */
+ private boolean mAccountWasRestored;
+
/**
* Loads the cownCloud {@link Account} and main {@link OCFile} to be handled by the instance of
mFile = getIntent().getParcelableExtra(FileActivity.EXTRA_FILE);
}
+ Account oldAccount = mAccount;
grantValidAccount();
if (mAccount != null) {
- onAccountSet(savedInstanceState != null);
+ mAccountWasSet = true;
+ mAccountWasRestored = (savedInstanceState != null && mAccount.equals(oldAccount));
+ } else {
+ mAccountWasSet = false;
+ mAccountWasRestored = false;
}
}
Account oldAccount = mAccount;
grantValidAccount();
if (mAccount != null && !mAccount.equals(oldAccount)) {
- onAccountSet(false);
+ mAccountWasSet = true;
+ mAccountWasRestored = false;
+ } else {
+ mAccountWasSet = false;
+ mAccountWasRestored = false;
}
}
+
-
/**
* Validates the ownCloud {@link Account} associated to the Activity any time it is restarted.
*
}
+ @Override
+ protected void onStart() {
+ // maybe better in onPostCreate() ?
+ super.onStart();
+ if (mAccountWasSet) {
+ onAccountSet(mAccountWasRestored);
+ }
+ }
+
+
/**
* Launches the account creation activity. To use when no ownCloud account is available
*/
FileActivity.this.onAccountSet(false);
}
} catch (OperationCanceledException e) {
- Log_OC.e(TAG, "Account creation canceled");
+ Log_OC.d(TAG, "Account creation canceled");
} catch (Exception e) {
Log_OC.e(TAG, "Account creation finished in exception: ", e);
Log_OC.e(TAG, "Account creation callback with null bundle");
}
if (mAccount == null) {
- finish();
+ moveTaskToBack(true);
}
}