Browse Source

earlier assign account
also set account in activity for drawer background

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>

tobiasKaminsky 7 years ago
parent
commit
2e98d22771

+ 10 - 9
src/main/java/com/owncloud/android/ui/activity/NotificationsActivity.java

@@ -118,6 +118,16 @@ public class NotificationsActivity extends FileActivity {
         setContentView(R.layout.notifications_layout);
         unbinder = ButterKnife.bind(this);
 
+        String account;
+        Account currentAccount;
+        if (getIntent() != null && getIntent().getExtras() != null &&
+                (account = getIntent().getExtras().getString(NotificationJob.KEY_NOTIFICATION_ACCOUNT)) != null &&
+                (currentAccount = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext())) != null &&
+                !account.equalsIgnoreCase(currentAccount.name)) {
+            AccountUtils.setCurrentOwnCloudAccount(getApplicationContext(), account);
+            setAccount(AccountUtils.getCurrentOwnCloudAccount(this));
+        }
+
         // setup toolbar
         setupToolbar();
 
@@ -128,15 +138,6 @@ public class NotificationsActivity extends FileActivity {
         setupDrawer(R.id.nav_notifications);
         ThemeUtils.setColoredTitle(getSupportActionBar(), getString(R.string.drawer_item_notifications));
 
-        String account;
-        Account currentAccount;
-        if (getIntent() != null && getIntent().getExtras() != null &&
-                (account = getIntent().getExtras().getString(NotificationJob.KEY_NOTIFICATION_ACCOUNT)) != null &&
-                (currentAccount = AccountUtils.getCurrentOwnCloudAccount(getApplicationContext())) != null &&
-                !account.equalsIgnoreCase(currentAccount.name)) {
-            AccountUtils.setCurrentOwnCloudAccount(getApplicationContext(), account);
-        }
-
         swipeListRefreshLayout.setOnRefreshListener(() -> {
             setLoadingMessage();
             fetchAndSetData();