[Android] Fix ActionMode invalidation in onLongClick callbacks

Simon Marquis git at videolan.org
Mon Sep 26 08:13:21 UTC 2022


vlc-android | branch: 3.5.x | Simon Marquis <contact at simon-marquis.fr> | Sun Sep 25 15:52:24 2022 +0200| [4926f30bbfd714ddfb18a7036abdd9046c2b1496] | committer: Nicolas Pomepuy

Fix ActionMode invalidation in onLongClick callbacks


(cherry picked from commit 7775dd49761f4c75ca7589e36e65527f8bf60bf8)

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

 .../vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt     | 2 +-
 .../vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt | 2 +-
 .../vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

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 09d934756..6945fb4b3 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/HeaderMediaListActivity.kt
@@ -278,7 +278,7 @@ open class HeaderMediaListActivity : AudioPlayerContainerActivity(), IEventsHand
 
     override fun onLongClick(v: View, position: Int, item: MediaLibraryItem): Boolean {
         audioBrowserAdapter.multiSelectHelper.toggleSelection(position, true)
-        if (actionMode == null) startActionMode()
+        if (actionMode == null) startActionMode() else invalidateActionMode()
         return true
     }
 
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
index 36383671b..f5e30a3db 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
@@ -549,7 +549,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
                 mediaWrapper.type == MediaWrapper.TYPE_VIDEO ||
                 mediaWrapper.type == MediaWrapper.TYPE_DIR) {
             adapter.multiSelectHelper.toggleSelection(position)
-            if (actionMode == null) startActionMode()
+            if (actionMode == null) startActionMode() else invalidateActionMode()
         } else onCtxClick(v, position, item)
         return true
     }
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt
index 38a957064..417a7ef76 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/MainBrowserFragment.kt
@@ -358,7 +358,7 @@ class MainBrowserFragment : BaseFragment(), View.OnClickListener, CtxActionRecei
                 if (!checkAdapterForActionMode()) return false
                 val adapter = requireAdapter()
                 adapter.multiSelectHelper.toggleSelection(position)
-                if (actionMode == null) startActionMode()
+                if (actionMode == null) startActionMode() else invalidateActionMode()
             } else onCtxClick(v, position, item)
             return true
         }



More information about the Android mailing list