diff --git a/app/schemas/com.nextcloud.client.database.NextcloudDatabase/85.json b/app/schemas/com.nextcloud.client.database.NextcloudDatabase/85.json index 48963b3856..5e2a33ba00 100644 --- a/app/schemas/com.nextcloud.client.database.NextcloudDatabase/85.json +++ b/app/schemas/com.nextcloud.client.database.NextcloudDatabase/85.json @@ -2,7 +2,7 @@ "formatVersion": 1, "database": { "version": 85, - "identityHash": "d1710bd13728e71a6b2c530bd1954fda", + "identityHash": "2d24b9210a36150f221156d2e8f59665", "entities": [ { "tableName": "arbitrary_data", @@ -1237,7 +1237,7 @@ }, { "tableName": "offline_operations", - "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `offline_operations_parent_oc_file_id` INTEGER, `offline_operations_path` TEXT, `offline_operations_type` TEXT, `offline_operations_file_name` TEXT, `offline_operations_created_at` INTEGER)", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`_id` INTEGER PRIMARY KEY AUTOINCREMENT, `offline_operations_parent_oc_file_id` INTEGER, `offline_operations_path` TEXT, `offline_operations_type` TEXT, `offline_operations_file_name` TEXT, `offline_operations_created_at` INTEGER, `offline_operations_modified_at` INTEGER)", "fields": [ { "fieldPath": "id", @@ -1274,6 +1274,12 @@ "columnName": "offline_operations_created_at", "affinity": "INTEGER", "notNull": false + }, + { + "fieldPath": "modifiedAt", + "columnName": "offline_operations_modified_at", + "affinity": "INTEGER", + "notNull": false } ], "primaryKey": { @@ -1289,7 +1295,7 @@ "views": [], "setupQueries": [ "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", - "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'd1710bd13728e71a6b2c530bd1954fda')" + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '2d24b9210a36150f221156d2e8f59665')" ] } } \ No newline at end of file diff --git a/app/src/main/java/com/nextcloud/client/database/entity/OfflineOperationEntity.kt b/app/src/main/java/com/nextcloud/client/database/entity/OfflineOperationEntity.kt index eeaed53cae..a698cb24e6 100644 --- a/app/src/main/java/com/nextcloud/client/database/entity/OfflineOperationEntity.kt +++ b/app/src/main/java/com/nextcloud/client/database/entity/OfflineOperationEntity.kt @@ -32,5 +32,8 @@ data class OfflineOperationEntity( var filename: String? = null, @ColumnInfo(name = ProviderTableMeta.OFFLINE_OPERATION_CREATED_AT) - var createdAt: Long? = null + var createdAt: Long? = null, + + @ColumnInfo(name = ProviderTableMeta.OFFLINE_OPERATION_MODIFIED_AT) + var modifiedAt: Long? = null ) diff --git a/app/src/main/java/com/nextcloud/client/jobs/offlineOperations/OfflineOperationsWorker.kt b/app/src/main/java/com/nextcloud/client/jobs/offlineOperations/OfflineOperationsWorker.kt index 93e6c7ae91..01dc1b6231 100644 --- a/app/src/main/java/com/nextcloud/client/jobs/offlineOperations/OfflineOperationsWorker.kt +++ b/app/src/main/java/com/nextcloud/client/jobs/offlineOperations/OfflineOperationsWorker.kt @@ -137,7 +137,7 @@ class OfflineOperationsWorker( operationType.remotePath, operationType.mimeType, "", - lastModificationDate, + operation.modifiedAt ?: lastModificationDate, operation.createdAt ?: System.currentTimeMillis(), true ) diff --git a/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java b/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java index 7cb4917e94..a2963f75cf 100644 --- a/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/app/src/main/java/com/owncloud/android/datamodel/FileDataStorageManager.java @@ -160,6 +160,7 @@ public class FileDataStorageManager { long modificationTimestamp = System.currentTimeMillis(); entity.setCreatedAt(createdAt); + entity.setModifiedAt(modificationTimestamp / 1000); entity.setFilename(new File(remotePath).getName()); String parentPath = new File(remotePath).getParent() + OCFile.PATH_SEPARATOR; @@ -188,6 +189,7 @@ public class FileDataStorageManager { long modificationTimestamp = System.currentTimeMillis(); entity.setCreatedAt(createdAt); + entity.setModifiedAt(modificationTimestamp / 1000); offlineOperationDao.insert(entity); createPendingDirectory(path, createdAt, modificationTimestamp); diff --git a/app/src/main/java/com/owncloud/android/db/ProviderMeta.java b/app/src/main/java/com/owncloud/android/db/ProviderMeta.java index 01bd681b34..36ba052e26 100644 --- a/app/src/main/java/com/owncloud/android/db/ProviderMeta.java +++ b/app/src/main/java/com/owncloud/android/db/ProviderMeta.java @@ -291,6 +291,7 @@ public class ProviderMeta { public static final String OFFLINE_OPERATION_PARENT_OC_FILE_ID = "offline_operations_parent_oc_file_id"; public static final String OFFLINE_OPERATION_TYPE = "offline_operations_type"; public static final String OFFLINE_OPERATION_PATH = "offline_operations_path"; + public static final String OFFLINE_OPERATION_MODIFIED_AT = "offline_operations_modified_at"; public static final String OFFLINE_OPERATION_CREATED_AT = "offline_operations_created_at"; public static final String OFFLINE_OPERATION_FILE_NAME = "offline_operations_file_name"; diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java index 54284aa557..e81ab6ddfb 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java @@ -89,6 +89,8 @@ import java.util.Locale; import java.util.Objects; import java.util.Set; import java.util.UUID; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import java.util.stream.Collectors; import androidx.annotation.NonNull; @@ -674,16 +676,31 @@ public class OCFileListAdapter extends RecyclerView.Adapter { OfflineOperationEntity entity = mStorageManager.offlineOperationDao.getByPath(file.getDecryptedRemotePath()); if (entity != null && entity.getType() != null && entity.getType() instanceof OfflineOperationType.CreateFile createFileOperation) { Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(createFileOperation.getLocalPath(), holder.getThumbnail().getWidth(), holder.getThumbnail().getHeight()); + if (bitmap == null) return; + Bitmap thumbnail = BitmapUtils.addColorFilter(bitmap, Color.GRAY,100); - holder.getThumbnail().setImageBitmap(thumbnail); + mainThread.post(() -> { + holder.getThumbnail().setImageBitmap(thumbnail); + }); } - } + }); + } + + public void onDestroy() { + executorService.shutdown(); } private void setColorFilterForOfflineCreateFolderOperations(ListViewHolder holder, OCFile file) { diff --git a/app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java b/app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java index f38898d8da..8922e79295 100644 --- a/app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java +++ b/app/src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java @@ -369,6 +369,10 @@ public class ExtendedListFragment extends Fragment implements public void onDestroyView() { super.onDestroyView(); binding = null; + var adapter = getRecyclerView().getAdapter(); + if (adapter instanceof OCFileListAdapter ocFileListAdapter) { + ocFileListAdapter.onDestroy(); + } } private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {