[Android] Hide video progress when history is off

Nicolas Pomepuy git at videolan.org
Tue Jan 30 15:10:29 UTC 2024


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Fri Jan 26 08:35:28 2024 +0100| [11f4f1184cb3eae404ac7e3000df4f5cfd31c63b] | committer: Nicolas Pomepuy

Hide video progress when history is off

Fixes #3020

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

 application/vlc-android/res/layout/video_grid_card.xml              | 6 +++++-
 application/vlc-android/res/layout/video_list_card.xml              | 6 +++++-
 .../vlc-android/src/org/videolan/vlc/gui/video/VideoGridFragment.kt | 2 +-
 .../vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.kt  | 3 ++-
 4 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/application/vlc-android/res/layout/video_grid_card.xml b/application/vlc-android/res/layout/video_grid_card.xml
index 3804c77e40..246430c4e5 100644
--- a/application/vlc-android/res/layout/video_grid_card.xml
+++ b/application/vlc-android/res/layout/video_grid_card.xml
@@ -37,6 +37,10 @@
             name="showProgress"
             type="boolean" />
 
+        <variable
+            name="showItemProgress"
+            type="boolean" />
+
         <variable
                 name="inSelection"
                 type="boolean" />
@@ -302,7 +306,7 @@
                         android:progress="@{progress}"
                         android:progressDrawable="@drawable/gridview_progressbar"
                         android:secondaryProgress="0"
-                        android:visibility="@{progress == 0 ? View.GONE : View.VISIBLE}"
+                        android:visibility="@{progress == 0 || !showItemProgress ? View.GONE : View.VISIBLE}"
                         vlc:layout_constraintBottom_toBottomOf="parent"
                         vlc:layout_constraintEnd_toEndOf="parent"
                         vlc:layout_constraintStart_toStartOf="parent" />
diff --git a/application/vlc-android/res/layout/video_list_card.xml b/application/vlc-android/res/layout/video_list_card.xml
index 586a43f9ec..ba625d97ee 100644
--- a/application/vlc-android/res/layout/video_list_card.xml
+++ b/application/vlc-android/res/layout/video_list_card.xml
@@ -38,6 +38,10 @@
                 name="showProgress"
                 type="boolean" />
 
+        <variable
+                name="showItemProgress"
+                type="boolean" />
+
         <variable
                 name="inSelection"
                 type="boolean" />
@@ -223,7 +227,7 @@
                         android:progress="@{progress}"
                         android:progressDrawable="?attr/gridview_progressbar"
                         android:secondaryProgress="0"
-                        android:visibility="@{max == 0 ? View.INVISIBLE : View.VISIBLE}"
+                        android:visibility="@{progress == 0 || !showItemProgress ? View.GONE : View.VISIBLE}"
                         vlc:layout_constraintBottom_toBottomOf="@+id/ml_item_thumbnail"
                         vlc:layout_constraintEnd_toEndOf="@+id/ml_item_thumbnail"
                         vlc:layout_constraintStart_toStartOf="@+id/ml_item_thumbnail" />
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 f7b8a7c8fb..971c4ac678 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
@@ -106,7 +106,7 @@ class VideoGridFragment : MediaBrowserFragment<VideosViewModel>(), SwipeRefreshL
         if (!::settings.isInitialized) settings = Settings.getInstance(requireContext())
         if (!::videoListAdapter.isInitialized) {
             val seenMarkVisible = settings.getBoolean("media_seen", true)
-            videoListAdapter = VideoListAdapter(seenMarkVisible).apply { stateRestorationPolicy = RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY }
+            videoListAdapter = VideoListAdapter(seenMarkVisible, !Settings.getInstance(requireActivity()).getBoolean(PLAYBACK_HISTORY, true)).apply { stateRestorationPolicy = RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY }
             dataObserver = videoListAdapter.onAnyChange {
                 updateEmptyView()
                 if (::binding.isInitialized) binding.fastScroller.setRecyclerView(binding.videoGrid, viewModel.provider)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.kt b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.kt
index 6e0c092616..8f1561ac85 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.kt
@@ -54,7 +54,7 @@ import org.videolan.vlc.viewmodels.mobile.VideoGroupingType
 
 private const val TAG = "VLC/VideoListAdapter"
 
-class VideoListAdapter(private var isSeenMediaMarkerVisible: Boolean
+class VideoListAdapter(private var isSeenMediaMarkerVisible: Boolean, private var hideProgress:Boolean
 ) : PagedListAdapter<MediaLibraryItem, VideoListAdapter.ViewHolder>(VideoItemDiffCallback), FastScroller.SeparatedAdapter,
         MultiSelectAdapter<MediaLibraryItem>, IEventsSource<VideoAction> by EventsSource() {
 
@@ -94,6 +94,7 @@ class VideoListAdapter(private var isSeenMediaMarkerVisible: Boolean
         item.let {
             holder.binding.setVariable(BR.isFavorite, it.isFavorite)
             holder.binding.setVariable(BR.showProgress, item.artworkMrl.isNullOrBlank())
+            holder.binding.setVariable(BR.showItemProgress, !hideProgress)
         }
     }
 



More information about the Android mailing list