Browse Source

removed outdated search enums
changed photos -> media

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

tobiasKaminsky 4 years ago
parent
commit
56776c915b

BIN
src/androidTest/assets/videoFile.mp4


+ 80 - 3
src/androidTest/java/com/owncloud/android/datamodel/FileDataStorageManagerTest.java

@@ -47,6 +47,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
+import static com.owncloud.android.lib.resources.files.SearchRemoteOperation.SearchType.GALLERY_SEARCH;
 import static com.owncloud.android.lib.resources.files.SearchRemoteOperation.SearchType.PHOTO_SEARCH;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
@@ -60,7 +61,7 @@ abstract public class FileDataStorageManagerTest extends AbstractOnServerIT {
     public void before() {
         // make sure everything is removed
         sut.deleteAllFiles();
-        sut.deleteVirtuals(VirtualFolderType.PHOTOS);
+        sut.deleteVirtuals(VirtualFolderType.GALLERY);
 
         assertEquals(0, sut.getAllFiles().size());
     }
@@ -70,7 +71,7 @@ abstract public class FileDataStorageManagerTest extends AbstractOnServerIT {
         super.after();
 
         sut.deleteAllFiles();
-        sut.deleteVirtuals(VirtualFolderType.PHOTOS);
+        sut.deleteVirtuals(VirtualFolderType.GALLERY);
     }
 
     @Test
@@ -147,7 +148,7 @@ abstract public class FileDataStorageManagerTest extends AbstractOnServerIT {
     @Test
     public void testPhotoSearch() throws IOException {
         String remotePath = "/imageFile.png";
-        VirtualFolderType virtualType = VirtualFolderType.PHOTOS;
+        VirtualFolderType virtualType = VirtualFolderType.GALLERY;
 
         assertEquals(0, sut.getFolderContent(sut.getFileByPath("/"), false).size());
         assertEquals(1, sut.getAllFiles().size());
@@ -207,6 +208,82 @@ abstract public class FileDataStorageManagerTest extends AbstractOnServerIT {
                      sut.getFolderContent(sut.getFileByPath("/"), false).get(0));
     }
 
+    /**
+     * This test creates an image and a video, does a gallery search (now returned image and video is not yet in file
+     * hierarchy), then root folder is refreshed and it is verified that the same image file is used in database
+     */
+    @Test
+    public void testGallerySearch() throws IOException {
+        String remotePath = "/imageFile.png";
+        VirtualFolderType virtualType = VirtualFolderType.GALLERY;
+
+        assertEquals(0, sut.getFolderContent(sut.getFileByPath("/"), false).size());
+        assertEquals(1, sut.getAllFiles().size());
+
+        File imageFile = getFile("imageFile.png");
+        assertTrue(new UploadFileRemoteOperation(imageFile.getAbsolutePath(),
+                                                 remotePath,
+                                                 "image/png",
+                                                 String.valueOf(System.currentTimeMillis() / 1000))
+                       .execute(client).isSuccess());
+
+        assertNull(sut.getFileByPath(remotePath));
+
+        File videoFile = getFile("videoFile.mp4");
+        assertTrue(new UploadFileRemoteOperation(videoFile.getAbsolutePath(),
+                                                 remotePath,
+                                                 "video/mpeg",
+                                                 String.valueOf(System.currentTimeMillis() / 1000))
+                       .execute(client).isSuccess());
+
+        assertNull(sut.getFileByPath(remotePath));
+
+        // search
+        SearchRemoteOperation searchRemoteOperation = new SearchRemoteOperation("",
+                                                                                GALLERY_SEARCH,
+                                                                                false);
+
+        RemoteOperationResult searchResult = searchRemoteOperation.execute(client);
+        TestCase.assertTrue(searchResult.isSuccess());
+        TestCase.assertEquals(1, searchResult.getData().size());
+
+        OCFile ocFile = FileStorageUtils.fillOCFile((RemoteFile) searchResult.getData().get(0));
+        sut.saveFile(ocFile);
+
+        List<ContentValues> contentValues = new ArrayList<>();
+        ContentValues cv = new ContentValues();
+        cv.put(ProviderMeta.ProviderTableMeta.VIRTUAL_TYPE, virtualType.toString());
+        cv.put(ProviderMeta.ProviderTableMeta.VIRTUAL_OCFILE_ID, ocFile.getFileId());
+
+        contentValues.add(cv);
+
+        sut.saveVirtuals(contentValues);
+
+        assertEquals(remotePath, ocFile.getRemotePath());
+
+        assertEquals(0, sut.getFolderContent(sut.getFileByPath("/"), false).size());
+
+        assertEquals(2, sut.getVirtualFolderContent(virtualType, false).size());
+        assertEquals(3, sut.getAllFiles().size());
+
+        // update root
+        assertTrue(new RefreshFolderOperation(sut.getFileByPath("/"),
+                                              System.currentTimeMillis() / 1000,
+                                              false,
+                                              false,
+                                              sut,
+                                              account,
+                                              targetContext).execute(client).isSuccess());
+
+
+        assertEquals(1, sut.getFolderContent(sut.getFileByPath("/"), false).size());
+        assertEquals(2, sut.getVirtualFolderContent(virtualType, false).size());
+        assertEquals(3, sut.getAllFiles().size());
+
+        assertEquals(sut.getVirtualFolderContent(virtualType, false).get(0),
+                     sut.getFolderContent(sut.getFileByPath("/"), false).get(0));
+    }
+
     @Test
     public void testSaveNewFile() {
         assertTrue(new CreateFolderRemoteOperation("/1/1/", true).execute(client).isSuccess());

+ 2 - 2
src/main/java/com/nextcloud/client/di/ComponentsModule.java

@@ -74,9 +74,9 @@ import com.owncloud.android.ui.fragment.ExtendedListFragment;
 import com.owncloud.android.ui.fragment.FileDetailActivitiesFragment;
 import com.owncloud.android.ui.fragment.FileDetailFragment;
 import com.owncloud.android.ui.fragment.FileDetailSharingFragment;
+import com.owncloud.android.ui.fragment.GalleryFragment;
 import com.owncloud.android.ui.fragment.LocalFileListFragment;
 import com.owncloud.android.ui.fragment.OCFileListFragment;
-import com.owncloud.android.ui.fragment.PhotoFragment;
 import com.owncloud.android.ui.fragment.contactsbackup.ContactListFragment;
 import com.owncloud.android.ui.fragment.contactsbackup.ContactsBackupFragment;
 import com.owncloud.android.ui.preview.PreviewImageActivity;
@@ -181,7 +181,7 @@ abstract class ComponentsModule {
     abstract PreviewTextStringFragment previewTextStringFragment();
 
     @ContributesAndroidInjector
-    abstract PhotoFragment photoFragment();
+    abstract GalleryFragment photoFragment();
 
     @ContributesAndroidInjector
     abstract MultipleAccountsDialog multipleAccountsDialog();

+ 1 - 1
src/main/java/com/owncloud/android/datamodel/VirtualFolderType.java

@@ -25,5 +25,5 @@ package com.owncloud.android.datamodel;
  * Type for virtual folders
  */
 public enum VirtualFolderType {
-    FAVORITE, PHOTOS, NONE
+    FAVORITE, GALLERY, NONE
 }

+ 4 - 4
src/main/java/com/owncloud/android/ui/activity/DrawerActivity.java

@@ -81,8 +81,8 @@ import com.owncloud.android.ui.events.AccountRemovedEvent;
 import com.owncloud.android.ui.events.ChangeMenuEvent;
 import com.owncloud.android.ui.events.DummyDrawerEvent;
 import com.owncloud.android.ui.events.SearchEvent;
+import com.owncloud.android.ui.fragment.GalleryFragment;
 import com.owncloud.android.ui.fragment.OCFileListFragment;
-import com.owncloud.android.ui.fragment.PhotoFragment;
 import com.owncloud.android.ui.preview.PreviewTextStringFragment;
 import com.owncloud.android.ui.trashbin.TrashbinActivity;
 import com.owncloud.android.utils.DisplayUtils;
@@ -331,7 +331,7 @@ public abstract class DrawerActivity extends ToolbarActivity
         switch (menuItem.getItemId()) {
             case R.id.nav_all_files:
                 if (this instanceof FileDisplayActivity &&
-                    !(((FileDisplayActivity) this).getLeftFragment() instanceof PhotoFragment) &&
+                    !(((FileDisplayActivity) this).getLeftFragment() instanceof GalleryFragment) &&
                     !(((FileDisplayActivity) this).getLeftFragment() instanceof PreviewTextStringFragment)) {
                     showFiles(false);
                     ((FileDisplayActivity) this).browseToRoot();
@@ -348,7 +348,7 @@ public abstract class DrawerActivity extends ToolbarActivity
                 handleSearchEvents(new SearchEvent("", SearchRemoteOperation.SearchType.FAVORITE_SEARCH),
                                    menuItem.getItemId());
                 break;
-            case R.id.nav_photos:
+            case R.id.nav_gallery:
                 startPhotoSearch(menuItem);
                 break;
             case R.id.nav_on_device:
@@ -454,7 +454,7 @@ public abstract class DrawerActivity extends ToolbarActivity
 
     private void handleSearchEvents(SearchEvent searchEvent, int menuItemId) {
         if (this instanceof FileDisplayActivity) {
-            if (((FileDisplayActivity) this).getListOfFilesFragment() instanceof PhotoFragment) {
+            if (((FileDisplayActivity) this).getListOfFilesFragment() instanceof GalleryFragment) {
                 Intent intent = new Intent(getApplicationContext(), FileDisplayActivity.class);
                 intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                 intent.setAction(Intent.ACTION_SEARCH);

+ 5 - 5
src/main/java/com/owncloud/android/ui/activity/FileDisplayActivity.java

@@ -96,8 +96,8 @@ import com.owncloud.android.ui.events.TokenPushEvent;
 import com.owncloud.android.ui.fragment.ExtendedListFragment;
 import com.owncloud.android.ui.fragment.FileDetailFragment;
 import com.owncloud.android.ui.fragment.FileFragment;
+import com.owncloud.android.ui.fragment.GalleryFragment;
 import com.owncloud.android.ui.fragment.OCFileListFragment;
-import com.owncloud.android.ui.fragment.PhotoFragment;
 import com.owncloud.android.ui.fragment.TaskRetainerFragment;
 import com.owncloud.android.ui.helpers.FileOperationsHelper;
 import com.owncloud.android.ui.helpers.UriUploader;
@@ -498,7 +498,7 @@ public class FileDisplayActivity extends FileActivity
                     if (SearchRemoteOperation.SearchType.PHOTO_SEARCH.equals(searchEvent.searchType)) {
                         Log_OC.d(this, "Switch to photo search fragment");
 
-                        PhotoFragment photoFragment = new PhotoFragment(true);
+                        GalleryFragment photoFragment = new GalleryFragment(true);
                         Bundle bundle = new Bundle();
                         bundle.putParcelable(OCFileListFragment.SEARCH_EVENT, Parcels.wrap(searchEvent));
                         photoFragment.setArguments(bundle);
@@ -1182,8 +1182,8 @@ public class FileDisplayActivity extends FileActivity
             setDrawerMenuItemChecked(menuItemId);
         }
 
-        if (ocFileListFragment instanceof PhotoFragment) {
-            updateActionBarTitleAndHomeButtonByString(getString(R.string.drawer_item_photos));
+        if (ocFileListFragment instanceof GalleryFragment) {
+            updateActionBarTitleAndHomeButtonByString(getString(R.string.drawer_item_gallery));
         }
 
         Log_OC.v(TAG, "onResume() end");
@@ -2329,7 +2329,7 @@ public class FileDisplayActivity extends FileActivity
         if (SearchRemoteOperation.SearchType.PHOTO_SEARCH == event.searchType) {
             Log_OC.d(this, "Switch to photo search fragment");
 
-            fragment = new PhotoFragment(true);
+            fragment = new GalleryFragment(true);
             FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
             transaction.replace(R.id.left_fragment_container, fragment, TAG_LIST_OF_FILES);
             transaction.commit();

+ 11 - 13
src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java

@@ -983,8 +983,8 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
                 case FAVORITE_SEARCH:
                     type = VirtualFolderType.FAVORITE;
                     break;
-                case PHOTO_SEARCH:
-                    type = VirtualFolderType.PHOTOS;
+                case GALLERY_SEARCH:
+                    type = VirtualFolderType.GALLERY;
                     break;
                 default:
                     type = VirtualFolderType.NONE;
@@ -1003,10 +1003,8 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
             }
         }
 
-        if (searchType != ExtendedListFragment.SearchType.PHOTO_SEARCH &&
-                searchType != ExtendedListFragment.SearchType.PHOTOS_SEARCH_FILTER &&
-                searchType != ExtendedListFragment.SearchType.RECENTLY_MODIFIED_SEARCH &&
-                searchType != ExtendedListFragment.SearchType.RECENTLY_MODIFIED_SEARCH_FILTER) {
+        if (searchType != ExtendedListFragment.SearchType.GALLERY_SEARCH &&
+            searchType != ExtendedListFragment.SearchType.RECENTLY_MODIFIED_SEARCH) {
             FileSortOrder sortOrder = preferences.getSortOrderByFolder(folder);
             mFiles = sortOrder.sortCloudFiles(mFiles);
         } else {
@@ -1066,15 +1064,15 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
 
     private void parseVirtuals(List<Object> objects, ExtendedListFragment.SearchType searchType) {
         VirtualFolderType type;
-        boolean onlyImages = false;
+        boolean onlyMedia = false;
 
         switch (searchType) {
             case FAVORITE_SEARCH:
                 type = VirtualFolderType.FAVORITE;
                 break;
-            case PHOTO_SEARCH:
-                type = VirtualFolderType.PHOTOS;
-                onlyImages = true;
+            case GALLERY_SEARCH:
+                type = VirtualFolderType.GALLERY;
+                onlyMedia = true;
 
                 int lastPosition = objects.size() - 1;
 
@@ -1098,7 +1096,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
             FileStorageUtils.searchForLocalFileInDefaultPath(ocFile, user.toPlatformAccount());
 
             try {
-                if (ExtendedListFragment.SearchType.PHOTO_SEARCH == searchType) {
+                if (ExtendedListFragment.SearchType.GALLERY_SEARCH == searchType) {
                     mStorageManager.saveFile(ocFile);
                 } else {
 
@@ -1118,7 +1116,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
                     }
                 }
 
-                if (!onlyImages || MimeTypeUtil.isImage(ocFile)) {
+                if (!onlyMedia || MimeTypeUtil.isImage(ocFile) || MimeTypeUtil.isVideo(ocFile)) {
                     mFiles.add(ocFile);
                 }
 
@@ -1139,7 +1137,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
     public void showVirtuals(VirtualFolderType type, boolean onlyImages, FileDataStorageManager storageManager) {
         mFiles = storageManager.getVirtualFolderContent(type, onlyImages);
 
-        if (VirtualFolderType.PHOTOS == type) {
+        if (VirtualFolderType.GALLERY == type) {
             mFiles = FileStorageUtils.sortOcFolderDescDateModifiedWithoutFavoritesFirst(mFiles);
         }
 

+ 13 - 13
src/main/java/com/owncloud/android/ui/asynctasks/PhotoSearchTask.java → src/main/java/com/owncloud/android/ui/asynctasks/GallerySearchTask.java

@@ -30,24 +30,24 @@ import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.lib.resources.files.SearchRemoteOperation;
 import com.owncloud.android.ui.adapter.OCFileListAdapter;
 import com.owncloud.android.ui.fragment.ExtendedListFragment;
-import com.owncloud.android.ui.fragment.PhotoFragment;
+import com.owncloud.android.ui.fragment.GalleryFragment;
 
 import java.lang.ref.WeakReference;
 
-public class PhotoSearchTask extends AsyncTask<Void, Void, RemoteOperationResult> {
+public class GallerySearchTask extends AsyncTask<Void, Void, RemoteOperationResult> {
 
     private int columnCount;
     private User user;
-    private WeakReference<PhotoFragment> photoFragmentWeakReference;
+    private WeakReference<GalleryFragment> photoFragmentWeakReference;
     private SearchRemoteOperation searchRemoteOperation;
     private FileDataStorageManager storageManager;
     private int limit;
 
-    public PhotoSearchTask(int columnsCount,
-                           PhotoFragment photoFragment,
-                           User user,
-                           SearchRemoteOperation searchRemoteOperation,
-                           FileDataStorageManager storageManager) {
+    public GallerySearchTask(int columnsCount,
+                             GalleryFragment photoFragment,
+                             User user,
+                             SearchRemoteOperation searchRemoteOperation,
+                             FileDataStorageManager storageManager) {
         this.columnCount = columnsCount;
         this.user = user;
         this.photoFragmentWeakReference = new WeakReference<>(photoFragment);
@@ -62,7 +62,7 @@ public class PhotoSearchTask extends AsyncTask<Void, Void, RemoteOperationResult
         if (photoFragmentWeakReference.get() == null) {
             return;
         }
-        PhotoFragment photoFragment = photoFragmentWeakReference.get();
+        GalleryFragment photoFragment = photoFragmentWeakReference.get();
         photoFragment.setPhotoSearchQueryRunning(true);
     }
 
@@ -71,7 +71,7 @@ public class PhotoSearchTask extends AsyncTask<Void, Void, RemoteOperationResult
         if (photoFragmentWeakReference.get() == null) {
             return new RemoteOperationResult(new Exception("Photo fragment is null"));
         }
-        PhotoFragment photoFragment = photoFragmentWeakReference.get();
+        GalleryFragment photoFragment = photoFragmentWeakReference.get();
         OCFileListAdapter adapter = photoFragment.getAdapter();
 
         if (isCancelled()) {
@@ -98,7 +98,7 @@ public class PhotoSearchTask extends AsyncTask<Void, Void, RemoteOperationResult
     @Override
     protected void onPostExecute(RemoteOperationResult result) {
         if (photoFragmentWeakReference.get() != null) {
-            PhotoFragment photoFragment = photoFragmentWeakReference.get();
+            GalleryFragment photoFragment = photoFragmentWeakReference.get();
 
             if (result.isSuccess() && result.getData() != null && !isCancelled()) {
                 if (result.getData() == null || result.getData().size() == 0) {
@@ -112,7 +112,7 @@ public class PhotoSearchTask extends AsyncTask<Void, Void, RemoteOperationResult
                     }
 
                     adapter.setData(result.getData(),
-                                    ExtendedListFragment.SearchType.PHOTO_SEARCH,
+                                    ExtendedListFragment.SearchType.GALLERY_SEARCH,
                                     storageManager,
                                     null,
                                     false);
@@ -124,7 +124,7 @@ public class PhotoSearchTask extends AsyncTask<Void, Void, RemoteOperationResult
             photoFragment.setLoading(false);
 
             if (!result.isSuccess() && !isCancelled()) {
-                photoFragment.setEmptyListMessage(ExtendedListFragment.SearchType.PHOTO_SEARCH);
+                photoFragment.setEmptyListMessage(ExtendedListFragment.SearchType.GALLERY_SEARCH);
             }
 
             photoFragment.setPhotoSearchQueryRunning(false);

+ 1 - 35
src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java

@@ -147,15 +147,9 @@ public class ExtendedListFragment extends Fragment implements
         REGULAR_FILTER,
         FILE_SEARCH,
         FAVORITE_SEARCH,
-        FAVORITE_SEARCH_FILTER,
-        VIDEO_SEARCH,
-        VIDEO_SEARCH_FILTER,
-        PHOTO_SEARCH,
-        PHOTOS_SEARCH_FILTER,
+        GALLERY_SEARCH,
         RECENTLY_MODIFIED_SEARCH,
-        RECENTLY_MODIFIED_SEARCH_FILTER,
         RECENTLY_ADDED_SEARCH,
-        RECENTLY_ADDED_SEARCH_FILTER,
         // not a real filter, but nevertheless
         SHARED_FILTER
     }
@@ -652,14 +646,6 @@ public class ExtendedListFragment extends Fragment implements
                     setMessageForEmptyList(R.string.file_list_empty_favorite_headline,
                                            R.string.file_list_empty_favorites_filter_list,
                                            R.drawable.ic_star_light_yellow);
-                } else if (searchType == SearchType.VIDEO_SEARCH) {
-                    setMessageForEmptyList(R.string.file_list_empty_headline_server_search_videos,
-                                           R.string.file_list_empty_text_videos,
-                                           R.drawable.ic_list_empty_video);
-                } else if (searchType == SearchType.PHOTO_SEARCH) {
-                    setMessageForEmptyList(R.string.file_list_empty_headline_server_search_photos,
-                                           R.string.file_list_empty_text_photos,
-                                           R.drawable.ic_list_empty_image);
                 } else if (searchType == SearchType.RECENTLY_MODIFIED_SEARCH) {
                     setMessageForEmptyList(R.string.file_list_empty_headline_server_search,
                                            R.string.file_list_empty_recently_modified,
@@ -672,26 +658,6 @@ public class ExtendedListFragment extends Fragment implements
                     setMessageForEmptyList(R.string.file_list_empty_headline_search,
                                            R.string.file_list_empty_search,
                                            R.drawable.ic_search_light_grey);
-                } else if (searchType == SearchType.FAVORITE_SEARCH_FILTER) {
-                    setMessageForEmptyList(R.string.file_list_empty_headline_server_search,
-                                           R.string.file_list_empty_favorites_filter,
-                                           R.drawable.ic_star_light_yellow);
-                } else if (searchType == SearchType.VIDEO_SEARCH_FILTER) {
-                    setMessageForEmptyList(R.string.file_list_empty_headline_server_search_videos,
-                                           R.string.file_list_empty_text_videos_filter,
-                                           R.drawable.ic_list_empty_video);
-                } else if (searchType == SearchType.PHOTOS_SEARCH_FILTER) {
-                    setMessageForEmptyList(R.string.file_list_empty_headline_server_search_photos,
-                                           R.string.file_list_empty_text_photos_filter,
-                                           R.drawable.ic_list_empty_image);
-                } else if (searchType == SearchType.RECENTLY_MODIFIED_SEARCH_FILTER) {
-                    setMessageForEmptyList(R.string.file_list_empty_headline_server_search,
-                                           R.string.file_list_empty_recently_modified_filter,
-                                           R.drawable.ic_list_empty_recent);
-                } else if (searchType == SearchType.RECENTLY_ADDED_SEARCH_FILTER) {
-                    setMessageForEmptyList(R.string.file_list_empty_headline_server_search,
-                                           R.string.file_list_empty_recently_added_filter,
-                                           R.drawable.ic_list_empty_recent);
                 } else if (searchType == SearchType.SHARED_FILTER) {
                     setMessageForEmptyList(R.string.file_list_empty_shared_headline,
                                            R.string.file_list_empty_shared,

+ 14 - 14
src/main/java/com/owncloud/android/ui/fragment/PhotoFragment.java → src/main/java/com/owncloud/android/ui/fragment/GalleryFragment.java

@@ -30,7 +30,7 @@ import android.view.ViewGroup;
 import com.owncloud.android.datamodel.VirtualFolderType;
 import com.owncloud.android.lib.common.utils.Log_OC;
 import com.owncloud.android.lib.resources.files.SearchRemoteOperation;
-import com.owncloud.android.ui.asynctasks.PhotoSearchTask;
+import com.owncloud.android.ui.asynctasks.GallerySearchTask;
 import com.owncloud.android.ui.events.ChangeMenuEvent;
 import com.owncloud.android.ui.events.SearchEvent;
 
@@ -44,7 +44,7 @@ import androidx.recyclerview.widget.RecyclerView;
  * A Fragment that lists all files and folders in a given path. TODO refactor to get rid of direct dependency on
  * FileDisplayActivity
  */
-public class PhotoFragment extends OCFileListFragment {
+public class GalleryFragment extends OCFileListFragment {
     private static final int MAX_ITEMS_PER_ROW = 10;
     private boolean photoSearchQueryRunning = false;
     private boolean photoSearchNoNew = false;
@@ -53,11 +53,11 @@ public class PhotoFragment extends OCFileListFragment {
     private SearchEvent searchEvent;
     private boolean refresh;
 
-    public PhotoFragment() {
+    public GalleryFragment() {
         this.refresh = false;
     }
 
-    public PhotoFragment(boolean refresh) {
+    public GalleryFragment(boolean refresh) {
         this.refresh = refresh;
     }
 
@@ -65,7 +65,7 @@ public class PhotoFragment extends OCFileListFragment {
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        searchEvent = new SearchEvent("image/%", SearchRemoteOperation.SearchType.PHOTO_SEARCH);
+        searchEvent = new SearchEvent("", SearchRemoteOperation.SearchType.GALLERY_SEARCH);
 
         searchRemoteOperation = new SearchRemoteOperation(searchEvent.getSearchQuery(),
                                                           searchEvent.getSearchType(),
@@ -95,7 +95,7 @@ public class PhotoFragment extends OCFileListFragment {
             }
         });
 
-        Log_OC.i(this, "onCreateView() in PhotoFragment end");
+        Log_OC.i(this, "onCreateView() in GalleryFragment end");
         return v;
     }
 
@@ -103,7 +103,7 @@ public class PhotoFragment extends OCFileListFragment {
     public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
 
-        currentSearchType = SearchType.PHOTO_SEARCH;
+        currentSearchType = SearchType.GALLERY_SEARCH;
 
         switchToGridView();
 
@@ -135,14 +135,14 @@ public class PhotoFragment extends OCFileListFragment {
             System.currentTimeMillis() - preferences.getPhotoSearchTimestamp() >= 30 * 1000) {
             mAdapter.setData(
                 new ArrayList<>(),
-                SearchType.PHOTO_SEARCH,
+                SearchType.GALLERY_SEARCH,
                 mContainerActivity.getStorageManager(),
                 mFile,
                 true);
 
             refresh = false;
         } else {
-            mAdapter.showVirtuals(VirtualFolderType.PHOTOS, true, mContainerActivity.getStorageManager());
+            mAdapter.showVirtuals(VirtualFolderType.GALLERY, true, mContainerActivity.getStorageManager());
             preferences.setPhotoSearchTimestamp(System.currentTimeMillis());
 
             return;
@@ -155,11 +155,11 @@ public class PhotoFragment extends OCFileListFragment {
 
     private void searchAndDisplay() {
         if (!photoSearchQueryRunning && !photoSearchNoNew) {
-            photoSearchTask = new PhotoSearchTask(getColumnsCount(),
-                                                  this,
-                                                  accountManager.getUser(),
-                                                  searchRemoteOperation,
-                                                  mContainerActivity.getStorageManager())
+            photoSearchTask = new GallerySearchTask(getColumnsCount(),
+                                                    this,
+                                                    accountManager.getUser(),
+                                                    searchRemoteOperation,
+                                                    mContainerActivity.getStorageManager())
                 .execute();
         }
     }

+ 4 - 4
src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java

@@ -981,8 +981,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
                                 case FAVORITE_SEARCH:
                                     type = VirtualFolderType.FAVORITE;
                                     break;
-                                case PHOTO_SEARCH:
-                                    type = VirtualFolderType.PHOTOS;
+                                case GALLERY_SEARCH:
+                                    type = VirtualFolderType.GALLERY;
                                     break;
                                 default:
                                     type = VirtualFolderType.NONE;
@@ -1410,8 +1410,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
                 case FAVORITE_SEARCH:
                     setTitle(R.string.drawer_item_favorites);
                     break;
-                case VIDEO_SEARCH:
-                    setTitle(R.string.drawer_item_videos);
+                case GALLERY_SEARCH:
+                    setTitle(R.string.drawer_item_gallery);
                     break;
                 case RECENTLY_ADDED_SEARCH:
                     setTitle(R.string.drawer_item_recently_added);

+ 1 - 1
src/main/java/com/owncloud/android/ui/preview/PreviewImagePagerAdapter.java

@@ -118,7 +118,7 @@ public class PreviewImagePagerAdapter extends FragmentStatePagerAdapter {
         mStorageManager = storageManager;
         mImageFiles = mStorageManager.getVirtualFolderContent(type, true);
 
-        if (type == VirtualFolderType.PHOTOS) {
+        if (type == VirtualFolderType.GALLERY) {
             mImageFiles = FileStorageUtils.sortOcFolderDescDateModifiedWithoutFavoritesFirst(mImageFiles);
         }
 

+ 1 - 1
src/main/java/com/owncloud/android/utils/DrawerMenuUtil.java

@@ -43,7 +43,7 @@ public final class DrawerMenuUtil {
                                              User user,
                                              Resources resources) {
         if (user.isAnonymous()) {
-            filterMenuItems(menu, R.id.nav_photos, R.id.nav_favorites, R.id.nav_videos);
+            filterMenuItems(menu, R.id.nav_gallery, R.id.nav_favorites, R.id.nav_videos);
         }
 
         if (!resources.getBoolean(R.bool.recently_added_enabled)) {

+ 0 - 25
src/main/res/drawable/ic_list_empty_image.xml

@@ -1,25 +0,0 @@
-<!--
-  Nextcloud Android client application
-
-  Copyright (C) 2020 Nextcloud.
-
-  This program is free software; you can redistribute it and/or
-  modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-  License as published by the Free Software Foundation; either
-  version 3 of the License, or any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-
-  You should have received a copy of the GNU Affero General Public
-  License along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-  Icon provided by Android Material Library in Apache License 2.0
--->
-<vector android:height="72dp" android:tint="#626364"
-    android:viewportHeight="24.0" android:viewportWidth="24.0"
-    android:width="72dp" xmlns:android="http://schemas.android.com/apk/res/android">
-    <path android:fillColor="#FF000000" android:pathData="M21,19V5c0,-1.1 -0.9,-2 -2,-2H5c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2zM8.5,13.5l2.5,3.01L14.5,12l4.5,6H5l3.5,-4.5z"/>
-</vector>

+ 0 - 25
src/main/res/drawable/ic_list_empty_video.xml

@@ -1,25 +0,0 @@
-<!--
-  Nextcloud Android client application
-
-  Copyright (C) 2020 Nextcloud.
-
-  This program is free software; you can redistribute it and/or
-  modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
-  License as published by the Free Software Foundation; either
-  version 3 of the License, or any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU AFFERO GENERAL PUBLIC LICENSE for more details.
-
-  You should have received a copy of the GNU Affero General Public
-  License along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-  Icon provided by Android Material Library in Apache License 2.0
--->
-<vector android:height="72dp" android:tint="#626364"
-    android:viewportHeight="24.0" android:viewportWidth="24.0"
-    android:width="72dp" xmlns:android="http://schemas.android.com/apk/res/android">
-    <path android:fillColor="#FF000000" android:pathData="M21,3L3,3c-1.11,0 -2,0.89 -2,2v12c0,1.1 0.89,2 2,2h5v2h8v-2h5c1.1,0 1.99,-0.9 1.99,-2L23,5c0,-1.11 -0.9,-2 -2,-2zM21,17L3,17L3,5h18v12zM16,11l-7,4L9,7z"/>
-</vector>

+ 2 - 2
src/main/res/menu/partial_drawer_entries.xml

@@ -40,9 +40,9 @@
             android:orderInCategory="0"
             android:title="@string/drawer_item_favorites"/>
         <item
-            android:id="@+id/nav_photos"
+            android:id="@+id/nav_gallery"
             android:icon="@drawable/nav_photos"
-            android:title="@string/drawer_item_photos" />
+            android:title="@string/drawer_item_gallery" />
         <item
             android:id="@+id/nav_videos"
             android:icon="@drawable/nav_videos"

+ 1 - 10
src/main/res/values/strings.xml

@@ -21,7 +21,6 @@
     <string name="drawer_item_all_files">All files</string>
     <string name="drawer_item_home">Home</string>
     <string name="drawer_item_favorites">Favorites</string>
-    <string name="drawer_item_photos">Photos</string>
     <string name="drawer_item_on_device">On device</string>
     <string name="drawer_item_recently_added">Recently added</string>
     <string name="drawer_item_recently_modified">Recently modified</string>
@@ -90,7 +89,6 @@
     <string name="file_list_empty">Upload some content or sync with your devices.</string>
     <string name="file_list_empty_on_device">Downloaded files and folders will show up here.</string>
     <string name="file_list_empty_favorites_filter_list">Files and folders you mark as favorites will show up here.</string>
-    <string name="file_list_empty_favorites_filter">Your search returned no favorited files.</string>
     <string name="file_list_loading">Loading…</string>
     <string name="file_list_no_app_for_file_type">No app set up to handle this file type.</string>
     <string name="local_file_list_empty">There are no files in this folder.</string>
@@ -100,17 +98,9 @@
     <string name="file_list_empty_favorite_headline">Nothing favorited yet</string>
     <string name="file_list_empty_shared_headline">Nothing shared yet</string>
     <string name="file_list_empty_shared">Files and folders you share will show up here.</string>
-    <string name="file_list_empty_headline_server_search_videos">No videos</string>
-    <string name="file_list_empty_headline_server_search_photos">No photos</string>
     <string name="file_list_empty_search">Maybe it is in a different folder?</string>
     <string name="file_list_empty_recently_modified">Found no files modified within the last 7 days</string>
-    <string name="file_list_empty_recently_modified_filter">No files modified the last 7 days.</string>
     <string name="file_list_empty_recently_added">Found no recently added files</string>
-    <string name="file_list_empty_recently_added_filter">No recently added files.</string>
-    <string name="file_list_empty_text_photos">Upload some photos or activate auto upload.</string>
-    <string name="file_list_empty_text_photos_filter">No photos.</string>
-    <string name="file_list_empty_text_videos">Upload some videos or activate auto upload.</string>
-    <string name="file_list_empty_text_videos_filter">No videos.</string>
     <string name="trashbin_empty_headline">No deleted files</string>
     <string name="trashbin_empty_message">You will be able to recover deleted files from here.</string>
     <string name="upload_list_empty_headline">No uploads available</string>
@@ -955,4 +945,5 @@
     <string name="oneHour">1 hour</string>
     <string name="fourHours">4 hours</string>
     <string name="thisWeek">This week</string>
+    <string name="drawer_item_gallery">Media</string>
 </resources>