diff --git a/app/src/main/java/com/amaze/filemanager/adapters/data/CompressedObjectParcelable.java b/app/src/main/java/com/amaze/filemanager/adapters/data/CompressedObjectParcelable.java index f37b761bde..2e23acde59 100644 --- a/app/src/main/java/com/amaze/filemanager/adapters/data/CompressedObjectParcelable.java +++ b/app/src/main/java/com/amaze/filemanager/adapters/data/CompressedObjectParcelable.java @@ -152,4 +152,12 @@ public boolean equals(Object obj) { && size == otherObj.size; } else return false; } + @Override + public int hashCode() { + int result = (directory ? 1 : 0); + result = 31 * result + type; + result = 31 * result + name.hashCode(); + result = 31 * result + (int) (size ^ (size >>> 32)); + return result; + } } diff --git a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/compress/CompressedHelperCallable.kt b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/compress/CompressedHelperCallable.kt index 88e72fd6fd..d23d50ccad 100644 --- a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/compress/CompressedHelperCallable.kt +++ b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/compress/CompressedHelperCallable.kt @@ -23,6 +23,8 @@ package com.amaze.filemanager.asynchronous.asynctasks.compress import androidx.annotation.WorkerThread import com.amaze.filemanager.adapters.data.CompressedObjectParcelable import org.apache.commons.compress.archivers.ArchiveException +import org.slf4j.Logger +import org.slf4j.LoggerFactory import java.util.* import java.util.concurrent.Callable @@ -31,6 +33,8 @@ abstract class CompressedHelperCallable internal constructor( ) : Callable> { + protected val logger: Logger = LoggerFactory.getLogger(javaClass) + @WorkerThread @Throws(ArchiveException::class) override fun call(): ArrayList { diff --git a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/compress/SevenZipHelperCallable.kt b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/compress/SevenZipHelperCallable.kt index 4b5fc19f41..93f2804d96 100644 --- a/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/compress/SevenZipHelperCallable.kt +++ b/app/src/main/java/com/amaze/filemanager/asynchronous/asynctasks/compress/SevenZipHelperCallable.kt @@ -20,7 +20,6 @@ package com.amaze.filemanager.asynchronous.asynctasks.compress -import android.util.Log import com.amaze.filemanager.adapters.data.CompressedObjectParcelable import com.amaze.filemanager.fileoperations.filesystem.compressed.ArchivePasswordCache import com.amaze.filemanager.filesystem.compressed.CompressedHelper @@ -29,7 +28,6 @@ import org.apache.commons.compress.PasswordRequiredException import org.apache.commons.compress.archivers.ArchiveException import java.io.File import java.io.IOException -import java.lang.UnsupportedOperationException class SevenZipHelperCallable( private val filePath: String, @@ -62,22 +60,20 @@ class SevenZipHelperCallable( == relativePath ) if (isInBaseDir || isInRelativeDir) { - elements.add( - CompressedObjectParcelable( - entry.name, - try { - entry.lastModifiedDate.time - } catch (e: UnsupportedOperationException) { - Log.w( - javaClass.simpleName, - "Unable to get modified date for 7zip file" - ) - 0L - }, - entry.size, - entry.isDirectory - ) + val p = CompressedObjectParcelable( + entry.name, + try { + entry.lastModifiedDate.time + } catch (e: UnsupportedOperationException) { + logger.warn("Unable to get modified date for 7zip file", e) + 0L + }, + entry.size, + entry.isDirectory, ) + if (!elements.contains(p)) { + elements.add(p) + } } } } catch (e: PasswordRequiredException) { diff --git a/app/src/main/java/com/amaze/filemanager/filesystem/files/FileUtils.java b/app/src/main/java/com/amaze/filemanager/filesystem/files/FileUtils.java index a2658016d8..5dff098eb3 100644 --- a/app/src/main/java/com/amaze/filemanager/filesystem/files/FileUtils.java +++ b/app/src/main/java/com/amaze/filemanager/filesystem/files/FileUtils.java @@ -31,7 +31,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Locale; -import java.util.concurrent.Callable; import java.util.concurrent.atomic.AtomicLong; import org.slf4j.Logger;