[Android] Prevent clicks on missing folders

Nicolas Pomepuy git at videolan.org
Mon May 15 12:09:55 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Mar 15 15:26:46 2023 +0100| [45d5be2172c48025ce2baea195a430afa0ae3fb2] | committer: Nicolas Pomepuy

Prevent clicks on missing folders

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

 .../vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt     | 1 +
 application/vlc-android/src/org/videolan/vlc/util/Browserutils.kt       | 2 ++
 2 files changed, 3 insertions(+)

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 2bd4424ee1..b74fc8c12e 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
@@ -623,6 +623,7 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
                 }
             }
             is Folder -> {
+                if (item.mMrl.isMissing()) return
                 if (actionMode != null) {
                     multiSelectHelper.toggleSelection(position)
                     invalidateActionMode()
diff --git a/application/vlc-android/src/org/videolan/vlc/util/Browserutils.kt b/application/vlc-android/src/org/videolan/vlc/util/Browserutils.kt
index 066573abf2..3385767c6a 100644
--- a/application/vlc-android/src/org/videolan/vlc/util/Browserutils.kt
+++ b/application/vlc-android/src/org/videolan/vlc/util/Browserutils.kt
@@ -61,6 +61,8 @@ fun String?.isSchemeFD() = this == "fd"
 
 fun String?.isSchemeDistant() = !this.isSchemeFile()
 
+fun String.isMissing() = this == "missing://"
+
 fun convertFavorites(browserFavs: List<BrowserFav>?) = browserFavs?.filter {
     it.uri.scheme != "file" || File(it.uri.path).exists()
 }?.map { (uri, _, title, iconUrl) ->



More information about the Android mailing list