[Android] Fix fastcroller crash in the file picker

Nicolas Pomepuy git at videolan.org
Tue Jul 11 12:46:16 UTC 2023


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Jul 11 09:18:21 2023 +0200| [89d0956815f7423ad7995b00c84a5b99a6798692] | committer: Duncan McNamara

Fix fastcroller crash in the file picker

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

 application/vlc-android/res/values/styles.xml                       | 5 +++++
 .../src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt         | 6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/res/values/styles.xml b/application/vlc-android/res/values/styles.xml
index 104f421a12..6030d862ec 100644
--- a/application/vlc-android/res/values/styles.xml
+++ b/application/vlc-android/res/values/styles.xml
@@ -125,6 +125,8 @@
         <item name="android:windowBackground">@color/grey900</item>
         <item name="android:textViewStyle">@style/VLC.TextView</item>
         <item name="empty_title">@color/grey300</item>
+        <item name="fast_scroller_bubble">@drawable/fastscroller_bubble</item>
+        <item name="fast_scroller_handle">@drawable/fastscroller_handle</item>
     </style>
 
     <style name="Theme.VLC.PickerDialog.Light.7" parent="Theme.MaterialComponents.Dialog">
@@ -144,6 +146,9 @@
         <item name="android:windowBackground">@color/grey200</item>
         <item name="android:textViewStyle">@style/VLC.TextView</item>
         <item name="empty_title">@color/grey850</item>
+
+        <item name="fast_scroller_bubble">@drawable/fastscroller_bubble</item>
+        <item name="fast_scroller_handle">@drawable/fastscroller_handle</item>
     </style>
 
     <style name="Theme.VLC.SendCrashDialog" parent="Theme.MaterialComponents.Dialog">
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 ee2a0c8e0e..19d46bc7ba 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
@@ -183,8 +183,10 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
             swipeRefreshLayout.isRefreshing = loading
             updateEmptyView()
         }
-        binding.browserFastScroller.attachToCoordinator(view.rootView.findViewById<View>(R.id.appbar) as AppBarLayout, view.rootView.findViewById<View>(R.id.coordinator) as CoordinatorLayout, view.rootView.findViewById<View>(R.id.fab) as FloatingActionButton)
-        binding.browserFastScroller.setRecyclerView(binding.networkList, viewModel.provider)
+        (view.rootView.findViewById<View?>(R.id.appbar) as? AppBarLayout)?.let {
+            binding.browserFastScroller.attachToCoordinator(it, view.rootView.findViewById<View>(R.id.coordinator) as CoordinatorLayout, view.rootView.findViewById<View>(R.id.fab) as FloatingActionButton)
+            binding.browserFastScroller.setRecyclerView(binding.networkList, viewModel.provider)
+        }
     }
 
     override fun sortBy(sort: Int) {



More information about the Android mailing list