From 4537efe4abec2cd832a7f584491d230eaa4450d6 Mon Sep 17 00:00:00 2001 From: tobiasKaminsky Date: Wed, 26 May 2021 11:52:31 +0200 Subject: [PATCH] Adjust media query to be in sync with photos app/ios Signed-off-by: tobiasKaminsky --- .../lib/resources/files/NcSearchMethod.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/owncloud/android/lib/resources/files/NcSearchMethod.java b/src/main/java/com/owncloud/android/lib/resources/files/NcSearchMethod.java index 1348c3c48..dd2516d29 100644 --- a/src/main/java/com/owncloud/android/lib/resources/files/NcSearchMethod.java +++ b/src/main/java/com/owncloud/android/lib/resources/files/NcSearchMethod.java @@ -103,19 +103,25 @@ private Document createQuery(String searchQuery) { Element remoteIdElement = query.createElementNS(NAMESPACE_OC, "oc:id"); Element sizeElement = query.createElementNS(NAMESPACE_OC, "oc:size"); Element favoriteElement = query.createElementNS(NAMESPACE_OC, "oc:favorite"); + Element previewElement = query.createElementNS(NAMESPACE_OC, "nc:has-preview"); - selectPropsElement.appendChild(displayNameElement); + if (searchType != SearchRemoteOperation.SearchType.GALLERY_SEARCH) { + selectPropsElement.appendChild(displayNameElement); + selectPropsElement.appendChild(creationDate); + selectPropsElement.appendChild(quotaUsedElement); + selectPropsElement.appendChild(quotaAvailableElement); + selectPropsElement.appendChild(permissionsElement); + selectPropsElement.appendChild(sizeElement); + } + if (searchType == SearchRemoteOperation.SearchType.GALLERY_SEARCH) { + selectPropsElement.appendChild(previewElement); + } selectPropsElement.appendChild(contentTypeElement); selectPropsElement.appendChild(resourceTypeElement); selectPropsElement.appendChild(contentLengthElement); selectPropsElement.appendChild(lastModifiedElement); - selectPropsElement.appendChild(creationDate); selectPropsElement.appendChild(etagElement); - selectPropsElement.appendChild(quotaUsedElement); - selectPropsElement.appendChild(quotaAvailableElement); - selectPropsElement.appendChild(permissionsElement); selectPropsElement.appendChild(remoteIdElement); - selectPropsElement.appendChild(sizeElement); selectPropsElement.appendChild(favoriteElement); Element fromElement = query.createElementNS(DAV_NAMESPACE, "d:from"); @@ -230,7 +236,9 @@ private Document createQuery(String searchQuery) { Element orderByElement = query.createElementNS(DAV_NAMESPACE, "d:orderby"); - if (searchType == SearchRemoteOperation.SearchType.PHOTO_SEARCH || searchType == SearchRemoteOperation.SearchType.RECENTLY_MODIFIED_SEARCH) { + if (searchType == SearchRemoteOperation.SearchType.PHOTO_SEARCH || + searchType == SearchRemoteOperation.SearchType.RECENTLY_MODIFIED_SEARCH || + searchType == SearchRemoteOperation.SearchType.GALLERY_SEARCH) { Element orderElement = query.createElementNS(DAV_NAMESPACE, "d:order"); orderByElement.appendChild(orderElement); Element orderPropElement = query.createElementNS(DAV_NAMESPACE, "d:prop");