Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 41696836 authored by Andy Scherzinger's avatar Andy Scherzinger Committed by GitHub
Browse files

Merge pull request #194 from nextcloud/hasPreviewProperty

Add has-preview property
parents 6e339dec 4939f4da
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ public class WebdavEntry {
    public static final String EXTENDED_PROPERTY_OWNER_ID = "owner-id";
    public static final String EXTENDED_PROPERTY_OWNER_DISPLAY_NAME = "owner-display-name";
    public static final String EXTENDED_PROPERTY_UNREAD_COMMENTS = "comments-unread";
    public static final String EXTENDED_PROPERTY_HAS_PREVIEW = "has-preview";
    public static final String TRASHBIN_FILENAME = "trashbin-filename";
    public static final String TRASHBIN_ORIGINAL_LOCATION = "trashbin-original-location";
    public static final String TRASHBIN_DELETION_TIME = "trashbin-deletion-time";
@@ -85,6 +86,7 @@ public class WebdavEntry {
    private String ownerId;
    private String ownerDisplayName;
    private int unreadCommentsCount;
    private boolean hasPreview;

    public enum MountType {INTERNAL, EXTERNAL}

@@ -272,6 +274,14 @@ public class WebdavEntry {
                unreadCommentsCount = 0;
            }

            // NC has preview property <nc-has-preview>
            prop = propSet.get(EXTENDED_PROPERTY_HAS_PREVIEW, ncNamespace);
            if (prop != null) {
                hasPreview = Boolean.valueOf(prop.getValue().toString());
            } else {
                hasPreview = true;
            }
            
            // NC trashbin-original-location <nc:trashbin-original-location>
            prop = propSet.get(TRASHBIN_ORIGINAL_LOCATION, ncNamespace);
            if (prop != null) {
@@ -398,6 +408,14 @@ public class WebdavEntry {
        return unreadCommentsCount;
    }

    public boolean hasPreview() {
        return hasPreview;
    }

    public void setHasPreview(boolean hasPreview) {
        this.hasPreview = hasPreview;
    }

    private void resetData() {
        name = uri = contentType = permissions = null;
        remoteId = null;
@@ -406,5 +424,6 @@ public class WebdavEntry {
        quotaUsedBytes = null;
        quotaAvailableBytes = null;
        favorite = false;
        hasPreview = false;
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ public class WebdavUtils {
        propSet.add(WebdavEntry.EXTENDED_PROPERTY_OWNER_ID, ocNamespace);
        propSet.add(WebdavEntry.EXTENDED_PROPERTY_OWNER_DISPLAY_NAME, ocNamespace);
        propSet.add(WebdavEntry.EXTENDED_PROPERTY_UNREAD_COMMENTS, ocNamespace);
        propSet.add(WebdavEntry.EXTENDED_PROPERTY_HAS_PREVIEW, ncNamespace);

        return propSet;
    }
@@ -131,6 +132,7 @@ public class WebdavUtils {
        propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_REMOTE_ID, Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
        propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE, Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
        propSet.add(WebdavEntry.EXTENDED_PROPERTY_FAVORITE, Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
        propSet.add(WebdavEntry.EXTENDED_PROPERTY_HAS_PREVIEW, Namespace.getNamespace(WebdavEntry.NAMESPACE_NC));

        return propSet;
    }
+1 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ public class WebDavFileUtils {
        file.setRemoteId(we.remoteId());
        file.setSize(we.size());
        file.setFavorite(we.isFavorite());
        file.setHasPreview(we.hasPreview());
        return file;
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -176,6 +176,7 @@ public class ReadRemoteFolderOperation extends RemoteOperation {
        file.setOwnerId(we.getOwnerId());
        file.setOwnerDisplayName(we.getOwnerDisplayName());
        file.setUnreadCommentsCount(we.getUnreadCommentsCount());
        file.setHasPreview(we.hasPreview());
        
        return file;
    }
+11 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ public class RemoteFile implements Parcelable, Serializable {
    private String ownerId;
    private String ownerDisplayName;
    private int unreadCommentsCount;
    private boolean hasPreview;

    /**
     * Getters and Setters.
@@ -183,6 +184,14 @@ public class RemoteFile implements Parcelable, Serializable {
        return unreadCommentsCount;
    }

    public boolean hasPreview() {
        return hasPreview;
    }

    public void setHasPreview(boolean hasPreview) {
        this.hasPreview = hasPreview;
    }

    public RemoteFile() {
        resetData();
    }
@@ -278,6 +287,7 @@ public class RemoteFile implements Parcelable, Serializable {
        mMountType = (WebdavEntry.MountType) source.readSerializable();
        ownerId = source.readString();
        ownerDisplayName = source.readString();
        hasPreview = Boolean.parseBoolean(source.readString());
    }

    @Override
@@ -301,5 +311,6 @@ public class RemoteFile implements Parcelable, Serializable {
        dest.writeSerializable(mMountType);
        dest.writeString(ownerId);
        dest.writeString(ownerDisplayName);
        dest.writeString(Boolean.toString(hasPreview));
    }
}