From 749a6160d8086d8a3ac631600146e71ccf8af842 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 17 Sep 2023 15:34:32 +0200 Subject: [PATCH] fix: crash when view handler got destroyed --- .../com/github/libretube/ui/views/CustomExoPlayerView.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt index d8925f5bda..f98bf9c4f0 100644 --- a/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt +++ b/app/src/main/java/com/github/libretube/ui/views/CustomExoPlayerView.kt @@ -235,13 +235,13 @@ open class CustomExoPlayerView( } private fun enqueueHideControllerTask() { - handler.postDelayed(AUTO_HIDE_CONTROLLER_DELAY, HIDE_CONTROLLER_TOKEN) { + runnableHandler.postDelayed(AUTO_HIDE_CONTROLLER_DELAY, HIDE_CONTROLLER_TOKEN) { hideController() } } private fun cancelHideControllerTask() { - handler?.removeCallbacksAndMessages(HIDE_CONTROLLER_TOKEN) + runnableHandler.removeCallbacksAndMessages(HIDE_CONTROLLER_TOKEN) } override fun hideController() { @@ -436,7 +436,7 @@ open class CustomExoPlayerView( .setDuration((ANIMATION_DURATION * 1.5).toLong()) .withEndAction { // move the text back into the button - handler.postDelayed(100) { + runnableHandler.postDelayed(100) { textView.animate() .setDuration(ANIMATION_DURATION / 2) .translationX(0f)