[Android] Get rid of the AudioPlayerContainerActivity handler

Nicolas Pomepuy git at videolan.org
Tue Jul 25 14:57:29 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Jul 21 08:03:57 2023 +0200| [6de64ae686ab10f8833153b4b2b5b6c865409678] | committer: Duncan McNamara

Get rid of the AudioPlayerContainerActivity handler

> https://code.videolan.org/videolan/vlc-android/commit/6de64ae686ab10f8833153b4b2b5b6c865409678
---

 .../src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt           | 3 ---
 application/vlc-android/src/org/videolan/vlc/gui/ContentActivity.kt    | 2 +-
 .../vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt    | 2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
index 89d135965b..f68e695b63 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/AudioPlayerContainerActivity.kt
@@ -26,8 +26,6 @@ package org.videolan.vlc.gui
 import android.annotation.SuppressLint
 import android.media.AudioManager
 import android.os.Bundle
-import android.os.Handler
-import android.os.Looper
 import android.view.*
 import android.widget.FrameLayout
 import android.widget.ProgressBar
@@ -117,7 +115,6 @@ open class AudioPlayerContainerActivity : BaseActivity(), KeycodeListener, Sched
     var bottomInset = 0
 
     lateinit var scheduler: LifecycleAwareScheduler
-    protected val handler: Handler = Handler(Looper.getMainLooper())
 
     private var topInset: Int = 0
 
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/ContentActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/ContentActivity.kt
index 773db56498..51cd8e237e 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/ContentActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/ContentActivity.kt
@@ -89,7 +89,7 @@ open class ContentActivity : AudioPlayerContainerActivity(), SearchView.OnQueryT
             searchView.setOnQueryTextListener(this)
             val query = filterable?.getFilterQuery()
             if (!query.isNullOrEmpty()) {
-                handler.post {
+                searchView.post {
                     searchItem.expandActionView()
                     searchView.clearFocus()
                     UiTools.setKeyboardVisibility(searchView, false)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
index a249d86da3..3923553b5e 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
@@ -252,7 +252,7 @@ open class HeaderMediaListActivity : AudioPlayerContainerActivity(), IEventsHand
         searchView.setOnQueryTextListener(this)
         val query = getFilterQuery()
         if (!query.isNullOrEmpty()) {
-            handler.post {
+            searchView.post {
                 searchItem.expandActionView()
                 searchView.clearFocus()
                 UiTools.setKeyboardVisibility(searchView, false)



More information about the Android mailing list