mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Fix close notification
This commit is contained in:
@@ -17,7 +17,6 @@ import kotlin.collections.HashMap
|
||||
|
||||
class AttachmentFileNotificationService: LockNotificationService() {
|
||||
|
||||
// Base notification Id, not used
|
||||
override val notificationId: Int = 10000
|
||||
|
||||
private var mActionTaskBinder = ActionTaskBinder()
|
||||
@@ -55,7 +54,8 @@ class AttachmentFileNotificationService: LockNotificationService() {
|
||||
if (downloadFileUri != null
|
||||
&& intent.hasExtra(ATTACHMENT_KEY)) {
|
||||
|
||||
val nextNotificationId = (downloadFileUris.values.maxBy { it.notificationId }?.notificationId ?: notificationId) +1
|
||||
val nextNotificationId = (downloadFileUris.values.maxBy { it.notificationId }
|
||||
?.notificationId?.plus(1) ?: notificationId)
|
||||
|
||||
val entryAttachment: EntryAttachment = intent.getParcelableExtra(ATTACHMENT_KEY)
|
||||
val attachmentNotification = AttachmentNotification(nextNotificationId, entryAttachment)
|
||||
@@ -84,9 +84,11 @@ class AttachmentFileNotificationService: LockNotificationService() {
|
||||
notificationManager?.cancelAll()
|
||||
downloadFileUris.clear()
|
||||
}
|
||||
if (downloadFileUris.isEmpty()) {
|
||||
stopSelf()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return START_REDELIVER_INTENT
|
||||
}
|
||||
@@ -118,7 +120,7 @@ class AttachmentFileNotificationService: LockNotificationService() {
|
||||
Intent(this, AttachmentFileNotificationService::class.java).apply {
|
||||
// No action to delete the service
|
||||
putExtra(DOWNLOAD_FILE_URI_KEY, downloadFileUri)
|
||||
}, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
}, PendingIntent.FLAG_CANCEL_CURRENT)
|
||||
|
||||
val fileName = DocumentFile.fromSingleUri(this, downloadFileUri)?.name ?: ""
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ import com.kunzisoft.keepass.model.EntryAttachment
|
||||
import com.kunzisoft.keepass.otp.OtpElement
|
||||
import com.kunzisoft.keepass.otp.OtpType
|
||||
import java.util.*
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator
|
||||
|
||||
|
||||
class EntryContentsView @JvmOverloads constructor(context: Context,
|
||||
var attrs: AttributeSet? = null,
|
||||
@@ -127,6 +129,7 @@ class EntryContentsView @JvmOverloads constructor(context: Context,
|
||||
attachmentsListView?.apply {
|
||||
layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, true)
|
||||
adapter = attachmentsAdapter
|
||||
(itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
|
||||
}
|
||||
|
||||
creationDateView = findViewById(R.id.entry_created)
|
||||
|
||||
Reference in New Issue
Block a user