Skip to content

Commit

Permalink
save read history
Browse files Browse the repository at this point in the history
  • Loading branch information
rlam20 committed Jul 2, 2024
1 parent 7379633 commit 61e74ea
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.ole.planet.myplanet.ui.dashboard.notification

import android.content.Context
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -74,8 +73,12 @@ class AdapterNotification(

private fun markAsRead(notificationId: Int) {
sharedPrefs.edit().putBoolean("notification_$notificationId", true).apply()
notificationList.removeAll { it.id == notificationId }
notifyDataSetChanged()

val position = notificationList.indexOfFirst { it.id == notificationId }
if (position != -1) {
notificationList.removeAt(position)
notifyItemRemoved(position)
}
}

fun markAllAsRead() {
Expand Down

0 comments on commit 61e74ea

Please sign in to comment.