ThrottleLast the notification drawer manager

This commit is contained in:
Benoit Marty 2019-07-08 11:08:23 +02:00
parent 535b41d818
commit e90aeff417

View File

@ -168,13 +168,20 @@ class NotificationDrawerManager @Inject constructor(private val context: Context




fun refreshNotificationDrawer() { fun refreshNotificationDrawer() {
backgroundHandler.post { // Implement last throttler
Timber.w("refreshNotificationDrawer()")
backgroundHandler.removeCallbacksAndMessages(null)
backgroundHandler.postDelayed(
{
refreshNotificationDrawerBg() refreshNotificationDrawerBg()
} }
, 200)
} }


@WorkerThread @WorkerThread
private fun refreshNotificationDrawerBg() { private fun refreshNotificationDrawerBg() {
Timber.w("refreshNotificationDrawerBg()")

val session = activeSessionHolder.getActiveSession() val session = activeSessionHolder.getActiveSession()
val user = session.getUser(session.sessionParams.credentials.userId) val user = session.getUser(session.sessionParams.credentials.userId)
val myUserDisplayName = user?.displayName ?: "" val myUserDisplayName = user?.displayName ?: ""