mirror of
https://github.com/nextcloud/android.git
synced 2024-11-21 20:55:31 +03:00
Fixes
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
be309d53cc
commit
775b1f6975
7 changed files with 41 additions and 8 deletions
|
@ -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')"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -137,7 +137,7 @@ class OfflineOperationsWorker(
|
|||
operationType.remotePath,
|
||||
operationType.mimeType,
|
||||
"",
|
||||
lastModificationDate,
|
||||
operation.modifiedAt ?: lastModificationDate,
|
||||
operation.createdAt ?: System.currentTimeMillis(),
|
||||
true
|
||||
)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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<RecyclerView.ViewHol
|
|||
}
|
||||
}
|
||||
|
||||
private final ExecutorService executorService = Executors.newCachedThreadPool();
|
||||
private final Handler mainThread = new Handler(Looper.getMainLooper());
|
||||
|
||||
private void setColorFilterForOfflineCreateFileOperations(ListViewHolder holder, OCFile file) {
|
||||
if (file.isOfflineOperation()) {
|
||||
if (!file.isOfflineOperation()) {
|
||||
return;
|
||||
}
|
||||
|
||||
executorService.execute(() -> {
|
||||
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) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue