+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ if (this.isFinishing()) {
+ Account current = AccountUtils.getCurrentOwnCloudAccount(this);
+ if ((mPreviousAccount == null && current != null) ||
+ (mPreviousAccount != null && !mPreviousAccount.equals(current))) {
+ /// the account set as default changed since this activity was created
+
+ // trigger synchronization
+ ContentResolver.cancelSync(null, AccountAuthenticator.AUTH_TOKEN_TYPE);
+ Bundle bundle = new Bundle();
+ bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
+ ContentResolver.requestSync(AccountUtils.getCurrentOwnCloudAccount(this), AccountAuthenticator.AUTH_TOKEN_TYPE, bundle);
+
+ // restart the main activity
+ Intent i = new Intent(this, FileDisplayActivity.class);
+ i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(i);
+ }
+ }
+ }