diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/binary/BinaryByte.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/binary/BinaryByte.kt index bf1447a7e..afe2e5337 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/binary/BinaryByte.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/binary/BinaryByte.kt @@ -96,10 +96,6 @@ class BinaryByte : BinaryData { } } - override fun dataExists(binaryCache: BinaryCache): Boolean { - return getByteArray(binaryCache).isNotEmpty() - } - @Throws(IOException::class) override fun clear(binaryCache: BinaryCache) { binaryCache.removeByteArray(mDataByteId) diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/binary/BinaryData.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/binary/BinaryData.kt index c9ffccae9..83779ccb4 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/binary/BinaryData.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/binary/BinaryData.kt @@ -96,7 +96,7 @@ abstract class BinaryData : Parcelable { abstract fun decompress(binaryCache: BinaryCache) @Throws(IOException::class) - open fun dataExists(binaryCache: BinaryCache): Boolean { + fun dataExists(): Boolean { return mLength > 0 } diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/binary/BinaryFile.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/binary/BinaryFile.kt index ddba0e3ec..829b5b679 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/binary/BinaryFile.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/binary/BinaryFile.kt @@ -142,10 +142,6 @@ class BinaryFile : BinaryData { } } - override fun dataExists(binaryCache: BinaryCache): Boolean { - return mDataFile != null && super.dataExists(binaryCache) - } - override fun clear(binaryCache: BinaryCache) { if (mDataFile != null && !mDataFile!!.delete()) throw IOException("Unable to delete temp file " + mDataFile!!.absolutePath) diff --git a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutputKDBX.kt b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutputKDBX.kt index d52e9d67d..8eb57e0c7 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutputKDBX.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/file/output/DatabaseOutputKDBX.kt @@ -695,7 +695,7 @@ class DatabaseOutputKDBX(private val mDatabaseKDBX: DatabaseKDBX, var firstElement = true val binaryCache = mDatabaseKDBX.binaryCache mDatabaseKDBX.iconsManager.doForEachCustomIcon { iconCustom, binary -> - if (binary.dataExists(binaryCache)) { + if (binary.dataExists()) { // Write the parent tag if (firstElement) { xml.startTag(null, DatabaseKDBXXML.ElemCustomIcons) diff --git a/app/src/main/java/com/kunzisoft/keepass/icons/IconDrawableFactory.kt b/app/src/main/java/com/kunzisoft/keepass/icons/IconDrawableFactory.kt index 20784ba21..05bd9bd34 100644 --- a/app/src/main/java/com/kunzisoft/keepass/icons/IconDrawableFactory.kt +++ b/app/src/main/java/com/kunzisoft/keepass/icons/IconDrawableFactory.kt @@ -70,7 +70,7 @@ class IconDrawableFactory(private val retrieveBinaryCache : () -> BinaryCache?, val icon = iconDraw.getIconImageToDraw() val customIconBinary = retrieveCustomIconBinary(icon.custom.uuid) val binaryCache = retrieveBinaryCache() - if (binaryCache != null && customIconBinary != null && customIconBinary.dataExists(binaryCache)) { + if (binaryCache != null && customIconBinary != null && customIconBinary.dataExists()) { getIconDrawable(context.resources, icon.custom, customIconBinary)?.let { return SuperDrawable(it) } @@ -216,9 +216,8 @@ class IconDrawableFactory(private val retrieveBinaryCache : () -> BinaryCache?, private fun addToCustomCache(resources: Resources, iconDraw: IconImageDraw) { val icon = iconDraw.getIconImageToDraw() val customIconBinary = retrieveCustomIconBinary(icon.custom.uuid) - val binaryCache = retrieveBinaryCache() - if (customIconBinary != null && binaryCache != null - && customIconBinary.dataExists(binaryCache) + if (customIconBinary != null + && customIconBinary.dataExists() && !customIconMap.containsKey(icon.custom.uuid)) getIconDrawable(resources, icon.custom, customIconBinary) }