Fix upload attachment

This commit is contained in:
J-Jamet
2021-08-22 12:23:35 +02:00
parent d841c25bd3
commit 5e15f82313

View File

@@ -301,8 +301,9 @@ class EntryEditFragment: DatabaseFragment() {
private fun putAttachment(attachment: EntryAttachmentState, private fun putAttachment(attachment: EntryAttachmentState,
onPreviewLoaded: ((attachment: EntryAttachmentState) -> Unit)? = null) { onPreviewLoaded: ((attachment: EntryAttachmentState) -> Unit)? = null) {
// When only one attachment is allowed // When only one attachment is allowed
if (!mAllowMultipleAttachments) { if (!mAllowMultipleAttachments
clearAttachments() && attachment.downloadState == AttachmentState.START) {
attachmentsAdapter?.clear()
} }
attachmentsContainerView.visibility = View.VISIBLE attachmentsContainerView.visibility = View.VISIBLE
attachmentsAdapter?.putItem(attachment) attachmentsAdapter?.putItem(attachment)
@@ -315,10 +316,6 @@ class EntryEditFragment: DatabaseFragment() {
attachmentsAdapter?.removeItem(attachment) attachmentsAdapter?.removeItem(attachment)
} }
private fun clearAttachments() {
attachmentsAdapter?.clear()
}
private fun getAttachmentViewPosition(attachment: EntryAttachmentState, private fun getAttachmentViewPosition(attachment: EntryAttachmentState,
position: (attachment: EntryAttachmentState, Float) -> Unit) { position: (attachment: EntryAttachmentState, Float) -> Unit) {
attachmentsListView.postDelayed({ attachmentsListView.postDelayed({