diff --git a/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java index 98d03372eb1f..378fec5eb0f2 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java @@ -460,6 +460,7 @@ private void setupDrawerMenu(NavigationView navigationView) { return true; }); + User account = accountManager.getUser(); filterDrawerMenu(navigationView.getMenu(), account); } @@ -1050,6 +1051,10 @@ protected void onPostCreate(Bundle savedInstanceState) { updateQuotaLink(); } + public int getCheckedMenuItem() { + return mCheckedMenuItem; + } + @Override public void onConfigurationChanged(@NonNull Configuration newConfig) { super.onConfigurationChanged(newConfig); diff --git a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java index 434052172c38..3fc80bd01bbd 100644 --- a/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/app/src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -1162,7 +1162,12 @@ private void setDrawerAllFiles() { setDrawerMenuItemChecked(R.id.nav_on_device); setupToolbar(); } else { - setDrawerMenuItemChecked(R.id.nav_all_files); + int lastMenuItem = getCheckedMenuItem(); + if (lastMenuItem == Menu.NONE) { + lastMenuItem = R.id.nav_all_files; + } + + setDrawerMenuItemChecked(lastMenuItem); setupHomeSearchToolbarWithSortAndListButtons(); } }