diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt index 152d9c5b2a..ab30036da3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/notifications/NotificationStore.kt @@ -14,6 +14,7 @@ import androidx.core.app.NotificationCompat import androidx.recyclerview.widget.RecyclerView import info.nightscout.androidaps.R import info.nightscout.androidaps.databinding.OverviewNotificationItemBinding +import info.nightscout.androidaps.events.EventRefreshOverview import info.nightscout.androidaps.interfaces.IconsProvider import info.nightscout.androidaps.interfaces.NotificationHolder import info.nightscout.androidaps.logging.AAPSLogger @@ -150,7 +151,8 @@ class NotificationStore @Inject constructor( } } - inner class NotificationRecyclerViewAdapter internal constructor(private val notificationsList: List) : RecyclerView.Adapter() { + inner class NotificationRecyclerViewAdapter internal constructor(private val notificationsList: List) : + RecyclerView.Adapter() { override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): NotificationsViewHolder = NotificationsViewHolder(LayoutInflater.from(viewGroup.context).inflate(R.layout.overview_notification_item, viewGroup, false)) @@ -182,9 +184,9 @@ class NotificationStore @Inject constructor( init { binding.dismiss.setOnClickListener { val notification = it.tag as Notification - rxBus.send(EventDismissNotification(notification.id)) notification.contextForAction = itemView.context notification.action?.run() + if (remove(notification.id)) rxBus.send(EventRefreshOverview("NotificationCleared")) } } }