mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-11-30 13:52:58 -08:00
Refactoring code
This commit is contained in:
1 parent
a793b0bb42
commit
9cf59b8d73
4 files changed
+4
-17
No files matched your search
@@ -214,7 +214,7 @@ class EntryActivity : LockingActivity() {
|
||||
registerProgressTask()
|
||||
onActionTaskListener = object : AttachmentFileNotificationService.ActionTaskListener {
|
||||
override fun onAttachmentAction(fileUri: Uri, entryAttachmentState: EntryAttachmentState) {
|
||||
entryContentsView?.updateAttachmentDownloadProgress(entryAttachmentState)
|
||||
entryContentsView?.putAttachment(entryAttachmentState)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,14 +311,11 @@ class EntryEditActivity : LockingActivity(),
|
||||
mAttachmentFileBinderManager?.removeAttachmentAction(entryAttachmentState)
|
||||
}
|
||||
AttachmentState.ERROR -> {
|
||||
// TODO error
|
||||
mDatabase?.removeAttachmentIfNotUsed(entryAttachmentState.entryAttachment)
|
||||
mAttachmentFileBinderManager?.removeAttachmentAction(entryAttachmentState)
|
||||
entryEditContentsView?.removeAttachment(entryAttachmentState)
|
||||
}
|
||||
else -> {
|
||||
// TODO progress
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,16 +110,6 @@ class EntryAttachmentsItemsAdapter(context: Context)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateProgress(entryAttachment: EntryAttachmentState) {
|
||||
val indexEntryAttachment = itemsList.indexOfLast { current ->
|
||||
current.entryAttachment == entryAttachment.entryAttachment
|
||||
}
|
||||
if (indexEntryAttachment != -1) {
|
||||
itemsList[indexEntryAttachment] = entryAttachment
|
||||
notifyItemChanged(indexEntryAttachment)
|
||||
}
|
||||
}
|
||||
|
||||
class EntryBinariesViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
|
||||
var binaryFileTitle: TextView = itemView.findViewById(R.id.item_attachment_title)
|
||||
|
||||
@@ -327,8 +327,8 @@ class EntryContentsView @JvmOverloads constructor(context: Context,
|
||||
}
|
||||
}
|
||||
|
||||
fun updateAttachmentDownloadProgress(attachmentToDownload: EntryAttachmentState) {
|
||||
attachmentsAdapter.updateProgress(attachmentToDownload)
|
||||
fun putAttachment(attachmentToDownload: EntryAttachmentState) {
|
||||
attachmentsAdapter.putItem(attachmentToDownload)
|
||||
}
|
||||
|
||||
/* -------------
|
||||
|
||||
Reference in new issue
Block a user