From be0881935486eb76b016295506be2bf7b7995dda Mon Sep 17 00:00:00 2001 From: Pinghao Wu Date: Sun, 27 Oct 2024 00:04:48 +0800 Subject: [PATCH] CephFSDocumentsProvider: icon for symlink-to-dir based on material symbols drive file move, with color from pixel --- .../java/org/safcephfs/CephFSDocumentsProvider.java | 7 ++++++- src/main/res/drawable/ic_symlink_to_dir.xml | 10 ++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/main/res/drawable/ic_symlink_to_dir.xml diff --git a/src/main/java/org/safcephfs/CephFSDocumentsProvider.java b/src/main/java/org/safcephfs/CephFSDocumentsProvider.java index 9f82e51..8d3c3ed 100644 --- a/src/main/java/org/safcephfs/CephFSDocumentsProvider.java +++ b/src/main/java/org/safcephfs/CephFSDocumentsProvider.java @@ -270,7 +270,8 @@ public class CephFSDocumentsProvider extends DocumentsProvider { row.add(Document.COLUMN_SIZE, cs.size); row.add(Document.COLUMN_LAST_MODIFIED, cs.m_time); - if (cs.isSymlink()) { + var wasSymlink = cs.isSymlink(); + if (wasSymlink) { executor.executeWithUnchecked(cm -> { try { cm.stat(dir + displayName, cs); @@ -299,6 +300,10 @@ public class CephFSDocumentsProvider extends DocumentsProvider { if (mayRead(cs)) { flags |= Document.FLAG_SUPPORTS_METADATA; } + if (wasSymlink) { + // DocumentsUI grid view is hard-coded to system folder icon + row.add(Document.COLUMN_ICON, R.drawable.ic_symlink_to_dir); + } } else if (cs.isFile()) { if ((MetadataReader.isSupportedMimeType(mimeType) || MediaMetadataReader.isSupportedMimeType(mimeType)) && diff --git a/src/main/res/drawable/ic_symlink_to_dir.xml b/src/main/res/drawable/ic_symlink_to_dir.xml new file mode 100644 index 0000000..ec5061f --- /dev/null +++ b/src/main/res/drawable/ic_symlink_to_dir.xml @@ -0,0 +1,10 @@ + + + -- 2.45.2