[Android] Hide the keyboard when the user starts the action mode while searching

Nicolas Pomepuy git at videolan.org
Mon May 9 11:39:03 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri May  6 13:54:08 2022 +0200| [da3f21261200c1bed2cdc346c46b962145ffcb26] | committer: Duncan McNamara

Hide the keyboard when the user starts the action mode while searching

Fixes #2488

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

 .../vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt  | 6 +++++-
 .../vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt b/application/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt
index 829bedabf..3dc92e795 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/audio/BaseAudioBrowser.kt
@@ -41,7 +41,9 @@ import androidx.recyclerview.widget.LinearLayoutManager
 import androidx.recyclerview.widget.RecyclerView
 import androidx.viewpager.widget.ViewPager
 import com.google.android.material.tabs.TabLayout
-import kotlinx.coroutines.*
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
 import org.videolan.medialibrary.interfaces.media.MediaWrapper
 import org.videolan.medialibrary.media.MediaLibraryItem
 import org.videolan.resources.*
@@ -55,6 +57,7 @@ import org.videolan.vlc.gui.dialogs.SavePlaylistDialog
 import org.videolan.vlc.gui.dialogs.showContext
 import org.videolan.vlc.gui.helpers.AudioUtil.setRingtone
 import org.videolan.vlc.gui.helpers.INavigator
+import org.videolan.vlc.gui.helpers.UiTools
 import org.videolan.vlc.gui.helpers.UiTools.addToPlaylist
 import org.videolan.vlc.gui.helpers.UiTools.createShortcut
 import org.videolan.vlc.gui.helpers.fillActionMode
@@ -349,6 +352,7 @@ abstract class BaseAudioBrowser<T : MedialibraryViewModel> : MediaBrowserFragmen
 
     override fun onLongClick(v: View, position: Int, item: MediaLibraryItem): Boolean {
         getCurrentAdapter()?.multiSelectHelper?.toggleSelection(position, true)
+        if (actionMode == null && inSearchMode()) UiTools.setKeyboardVisibility(v, false)
         if (actionMode == null) startActionMode() else invalidateActionMode()
         return true
     }
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
index e198dce9e..859e26afd 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt
@@ -555,6 +555,7 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
     }
 
     private fun onLongClick(position: Int) {
+        if (actionMode == null && inSearchMode()) UiTools.setKeyboardVisibility(binding.root, false)
         multiSelectHelper.toggleSelection(position, true)
         if (actionMode == null) startActionMode() else invalidateActionMode()
     }



More information about the Android mailing list