[Android] Fix file browser duplicated content issue

Nicolas Pomepuy git at videolan.org
Mon Apr 3 12:33:13 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Mar 21 14:16:40 2023 +0100| [44b7d497c5ccae38ac7036fb49c06eb78a480567] | committer: Duncan McNamara

Fix file browser duplicated content issue

It was due to loading the fragment twice in the backstack
when tapping the last breadcrumb item. As this is useless,
it's now doing nothing.
Fixes #2490

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

 .../src/org/videolan/vlc/gui/browser/PathAdapter.kt        | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/application/vlc-android/src/org/videolan/vlc/gui/browser/PathAdapter.kt b/application/vlc-android/src/org/videolan/vlc/gui/browser/PathAdapter.kt
index 35beaa2a56..383316d0dc 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/browser/PathAdapter.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/browser/PathAdapter.kt
@@ -56,12 +56,14 @@ class PathAdapter(val browser: PathAdapterListener, val media: MediaWrapper) : R
     inner class ViewHolder(val root: TextView) : RecyclerView.ViewHolder(root) {
         init {
             root.setOnClickListener {
-                browser.backTo(adapterPosition.let {
-                    when (it) {
-                        0 -> "root"
-                        else -> segments[it]
-                    }
-                })
+                absoluteAdapterPosition.let {
+                    if (it == segments.size - 1) return at setOnClickListener
+                    browser.backTo(
+                            when (it) {
+                                0 -> "root"
+                                else -> segments[it]
+                            })
+                }
             }
         }
     }



More information about the Android mailing list