Эх сурвалжийг харах

Add hidden field

Signed-off-by: alperozturk <alper_ozturk@proton.me>
alperozturk 1 жил өмнө
parent
commit
739a6ccf4b

+ 2 - 0
app/src/main/java/com/nextcloud/client/database/entity/FileEntity.kt

@@ -79,6 +79,8 @@ data class FileEntity(
     @ColumnInfo(name = ProviderTableMeta.FILE_FAVORITE)
     val favorite: Int?,
     @ColumnInfo(name = ProviderTableMeta.FILE_IS_ENCRYPTED)
+    val hidden: Int?,
+    @ColumnInfo(name = ProviderTableMeta.FILE_HIDDEN)
     val isEncrypted: Int?,
     @ColumnInfo(name = ProviderTableMeta.FILE_ETAG_IN_CONFLICT)
     val etagInConflict: String?,

+ 3 - 0
app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java

@@ -463,6 +463,7 @@ public class FileDataStorageManager {
         cv.put(ProviderTableMeta.FILE_REMOTE_ID, fileOrFolder.getRemoteId());
         cv.put(ProviderTableMeta.FILE_LOCAL_ID, fileOrFolder.getLocalId());
         cv.put(ProviderTableMeta.FILE_FAVORITE, fileOrFolder.isFavorite());
+        cv.put(ProviderTableMeta.FILE_HIDDEN, fileOrFolder.getHidden());
         cv.put(ProviderTableMeta.FILE_UNREAD_COMMENTS_COUNT, fileOrFolder.getUnreadCommentsCount());
         cv.put(ProviderTableMeta.FILE_OWNER_ID, fileOrFolder.getOwnerId());
         cv.put(ProviderTableMeta.FILE_OWNER_DISPLAY_NAME, fileOrFolder.getOwnerDisplayName());
@@ -502,6 +503,7 @@ public class FileDataStorageManager {
         cv.put(ProviderTableMeta.FILE_LOCKED, file.isLocked());
         final FileLockType lockType = file.getLockType();
         cv.put(ProviderTableMeta.FILE_LOCK_TYPE, lockType != null ? lockType.getValue() : -1);
+        cv.put(ProviderTableMeta.FILE_HIDDEN, file.getHidden());
         cv.put(ProviderTableMeta.FILE_LOCK_OWNER, file.getLockOwnerId());
         cv.put(ProviderTableMeta.FILE_LOCK_OWNER_DISPLAY_NAME, file.getLockOwnerDisplayName());
         cv.put(ProviderTableMeta.FILE_LOCK_OWNER_EDITOR, file.getLockOwnerEditor());
@@ -918,6 +920,7 @@ public class FileDataStorageManager {
         ocFile.setDownloading(nullToZero(fileEntity.isDownloading()) == 1);
         ocFile.setEtagInConflict(fileEntity.getEtagInConflict());
         ocFile.setFavorite(nullToZero(fileEntity.getFavorite()) == 1);
+        ocFile.setHidden(nullToZero(fileEntity.getHidden()) == 1);
         ocFile.setEncrypted(nullToZero(fileEntity.isEncrypted()) == 1);
 //        if (ocFile.isEncrypted()) {
 //            ocFile.setFileName(cursor.getString(cursor.getColumnIndexOrThrow(ProviderTableMeta.FILE_NAME)));

+ 12 - 6
app/src/main/java/com/owncloud/android/datamodel/OCFile.java

@@ -97,6 +97,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
     private String etagInConflict; // Only saves file etag in the server, when there is a conflict
     private boolean sharedWithSharee;
     private boolean favorite;
+    private boolean hidden;
     private boolean encrypted;
     private WebdavEntry.MountType mountType;
     private int unreadCommentsCount;
@@ -184,6 +185,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
         etagInConflict = source.readString();
         sharedWithSharee = source.readInt() == 1;
         favorite = source.readInt() == 1;
+        hidden = source.readInt() == 1;
         encrypted = source.readInt() == 1;
         ownerId = source.readString();
         ownerDisplayName = source.readString();
@@ -228,6 +230,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
         dest.writeString(etagInConflict);
         dest.writeInt(sharedWithSharee ? 1 : 0);
         dest.writeInt(favorite ? 1 : 0);
+        dest.writeInt(hidden ? 1 : 0);
         dest.writeInt(encrypted ? 1 : 0);
         dest.writeString(ownerId);
         dest.writeString(ownerDisplayName);
@@ -505,12 +508,6 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
         }
     }
 
-    public void setRemotePathV2(String name) {
-        this.remotePath = name;
-        this.decryptedRemotePath = name;
-        localUri = getStorageUri();
-    }
-
     /**
      * Used internally. Reset all file properties
      */
@@ -539,6 +536,7 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
         etagInConflict = null;
         sharedWithSharee = false;
         favorite = false;
+        hidden = false;
         encrypted = false;
         mountType = WebdavEntry.MountType.INTERNAL;
         richWorkspace = "";
@@ -806,6 +804,10 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
         return this.favorite;
     }
 
+    public boolean getHidden() {
+        return this.hidden;
+    }
+
     public boolean isEncrypted() {
         return this.encrypted;
     }
@@ -918,6 +920,10 @@ public class OCFile implements Parcelable, Comparable<OCFile>, ServerFileInterfa
         this.favorite = favorite;
     }
 
+    public void setHidden(boolean hidden) {
+        this.hidden = hidden;
+    }
+
     public void setEncrypted(boolean encrypted) {
         this.encrypted = encrypted;
     }

+ 3 - 1
app/src/main/java/com/owncloud/android/db/ProviderMeta.java

@@ -35,7 +35,7 @@ import java.util.List;
  */
 public class ProviderMeta {
     public static final String DB_NAME = "filelist";
-    public static final int DB_VERSION = 74;
+    public static final int DB_VERSION = 75;
 
     private ProviderMeta() {
         // No instance
@@ -107,6 +107,7 @@ public class ProviderMeta {
         public static final String FILE_IS_DOWNLOADING = "is_downloading";
         public static final String FILE_ETAG_IN_CONFLICT = "etag_in_conflict";
         public static final String FILE_FAVORITE = "favorite";
+        public static final String FILE_HIDDEN = "hidden";
         public static final String FILE_IS_ENCRYPTED = "is_encrypted";
         public static final String FILE_MOUNT_TYPE = "mount_type";
         public static final String FILE_HAS_PREVIEW = "has_preview";
@@ -157,6 +158,7 @@ public class ProviderMeta {
                 FILE_IS_DOWNLOADING,
                 FILE_ETAG_IN_CONFLICT,
                 FILE_FAVORITE,
+                FILE_HIDDEN,
                 FILE_IS_ENCRYPTED,
                 FILE_MOUNT_TYPE,
                 FILE_HAS_PREVIEW,

+ 4 - 2
app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java

@@ -682,8 +682,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
         @NonNull User account,
         @NonNull OCFile directory,
         @NonNull FileDataStorageManager updatedStorageManager,
-        boolean onlyOnDevice, @NonNull String limitToMimeType
-                             ) {
+        boolean onlyOnDevice, @NonNull String limitToMimeType) {
         this.onlyOnDevice = onlyOnDevice;
 
         if (!updatedStorageManager.equals(mStorageManager)) {
@@ -702,6 +701,9 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
             }
             sortOrder = preferences.getSortOrderByFolder(directory);
             mFiles = sortOrder.sortCloudFiles(mFiles);
+            mFiles.forEach(file -> {
+                Log_OC.d("","isHidden:" + file.getHidden());
+            });
             mergeOCFilesForLivePhoto();
             mFilesAll.clear();
             mFilesAll.addAll(mFiles);