ignoring duplicated state updates

This commit is contained in:
Adam Brown 2021-11-25 14:49:31 +00:00
parent 9e9116df2f
commit 034725ef91

View file

@ -75,11 +75,14 @@ class RoomDetailActivity :
}
}
private var lastKnownPlayingOrRecordingState: Boolean? = null
private val playbackActivityListener = VoiceMessagePlaybackTracker.ActivityListener { isPlayingOrRecording ->
if (lastKnownPlayingOrRecordingState == isPlayingOrRecording) return@ActivityListener
when (isPlayingOrRecording) {
true -> keepScreenOn()
false -> endKeepScreenOn()
}
lastKnownPlayingOrRecordingState = isPlayingOrRecording
}
override fun getCoordinatorLayout() = views.coordinatorLayout