summaryrefslogtreecommitdiff
path: root/libs/documents/src/main/java/org
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2024-11-09 18:42:20 +0100
committerJoel Klinghed <the_jk@spawned.biz>2024-11-09 18:42:20 +0100
commit78219cc5219b364b17df48bd20e636bcfec39cc4 (patch)
tree487a195193729158abbfe8533490cf24021ef376 /libs/documents/src/main/java/org
parentd274ffe5ec33c285034bdae64b532f2a470b9407 (diff)
documents: Add single merge tests local <-> documents
Fixed DocumentFile#equals. DelayedDocumentFile was equal DocumentFile but DocumentFile wasn't equal to DelayedDocumentFile.
Diffstat (limited to 'libs/documents/src/main/java/org')
-rw-r--r--libs/documents/src/main/java/org/the_jk/cleversync/io/documents/DocumentFile.kt18
1 files changed, 16 insertions, 2 deletions
diff --git a/libs/documents/src/main/java/org/the_jk/cleversync/io/documents/DocumentFile.kt b/libs/documents/src/main/java/org/the_jk/cleversync/io/documents/DocumentFile.kt
index 768b679..31aeb7f 100644
--- a/libs/documents/src/main/java/org/the_jk/cleversync/io/documents/DocumentFile.kt
+++ b/libs/documents/src/main/java/org/the_jk/cleversync/io/documents/DocumentFile.kt
@@ -40,8 +40,22 @@ internal class DocumentFile(
}
}
- override fun equals(other: Any?) = other is DocumentFile &&
- DocumentsContract.getDocumentId(other.documentUri) == DocumentsContract.getDocumentId(documentUri)
+ override fun equals(other: Any?): Boolean {
+ return when (other) {
+ is DocumentFile -> {
+ DocumentsContract.getDocumentId(other.documentUri) ==
+ DocumentsContract.getDocumentId(documentUri)
+ }
+
+ is DelayedCreationDocumentFile -> {
+ other == this
+ }
+
+ else -> {
+ false
+ }
+ }
+ }
override fun hashCode() = DocumentsContract.getDocumentId(documentUri).hashCode()
override fun toString() = DocumentsContract.getDocumentId(documentUri) ?: "null"
}