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 89e37d07a5..be27a05a27 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 @@ -442,6 +442,7 @@ public abstract class DrawerActivity extends ToolbarActivity ((FileDisplayActivity) this).browseToRoot(); EventBus.getDefault().post(new ChangeMenuEvent()); } else { + MainApp.showOnlyFilesOnDevice(false); Intent intent = new Intent(getApplicationContext(), FileDisplayActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.setAction(FileDisplayActivity.ALL_FILES); @@ -478,8 +479,7 @@ public abstract class DrawerActivity extends ToolbarActivity } else if (itemId == R.id.nav_shared) { startSharedSearch(menuItem); } else if (itemId == R.id.nav_recently_modified) { - handleSearchEvents(new SearchEvent("", SearchRemoteOperation.SearchType.RECENTLY_MODIFIED_SEARCH), - menuItem.getItemId()); + startRecentlyModifiedSearch(menuItem); } else { if (menuItem.getItemId() >= MENU_ITEM_EXTERNAL_LINK && menuItem.getItemId() <= MENU_ITEM_EXTERNAL_LINK + 100) { @@ -531,6 +531,13 @@ public abstract class DrawerActivity extends ToolbarActivity launchActivityForSearch(searchEvent, menuItem.getItemId()); } + private void startRecentlyModifiedSearch(MenuItem menuItem) { + SearchEvent searchEvent = new SearchEvent("", SearchRemoteOperation.SearchType.RECENTLY_MODIFIED_SEARCH); + MainApp.showOnlyFilesOnDevice(false); + + launchActivityForSearch(searchEvent, menuItem.getItemId()); + } + private void startPhotoSearch(MenuItem menuItem) { SearchEvent searchEvent = new SearchEvent("image/%", SearchRemoteOperation.SearchType.PHOTO_SEARCH); MainApp.showOnlyFilesOnDevice(false); @@ -1066,6 +1073,7 @@ public abstract class DrawerActivity extends ToolbarActivity MainApp.showOnlyFilesOnDevice(onDeviceOnly); Intent fileDisplayActivity = new Intent(getApplicationContext(), FileDisplayActivity.class); fileDisplayActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + fileDisplayActivity.setAction(FileDisplayActivity.ALL_FILES); startActivity(fileDisplayActivity); } 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 08f86c3500..22b3b91b6f 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 @@ -1498,7 +1498,6 @@ public class FileDisplayActivity extends FileActivity public void browseToRoot() { OCFileListFragment listOfFiles = getListOfFilesFragment(); if (listOfFiles != null) { // should never be null, indeed - MainApp.showOnlyFilesOnDevice(false); OCFile root = getStorageManager().getFileByPath(OCFile.ROOT_PATH); listOfFiles.listDirectory(root, MainApp.isOnlyOnDevice(), false); setFile(listOfFiles.getCurrentFile());