[Android] Fix thumbnails visibility in action mode

Geoffrey Métais git at videolan.org
Fri Sep 7 15:45:42 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Sep  7 15:45:24 2018 +0200| [3bc87210db0a2242a4438c0d24e7f30d9f7e0039] | committer: Geoffrey Métais

Fix thumbnails visibility in action mode

> https://code.videolan.org/videolan/vlc-android/commit/3bc87210db0a2242a4438c0d24e7f30d9f7e0039
---

 vlc-android/res/layout/video_grid_card.xml                     |  2 +-
 vlc-android/res/layout/video_list_card.xml                     | 10 ++++++++++
 .../src/org/videolan/vlc/gui/video/VideoListAdapter.java       |  9 +++++----
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/vlc-android/res/layout/video_grid_card.xml b/vlc-android/res/layout/video_grid_card.xml
index 4c575a805..3c0d23770 100644
--- a/vlc-android/res/layout/video_grid_card.xml
+++ b/vlc-android/res/layout/video_grid_card.xml
@@ -80,7 +80,7 @@
             vlc:layout_constraintTop_toTopOf="@+id/ml_item_thumbnail"
             vlc:layout_constraintBottom_toBottomOf="@+id/ml_item_thumbnail"
             vlc:layout_constraintStart_toStartOf="@+id/ml_item_thumbnail"
-            vlc:layout_constraintEnd_toEndOf="@+id/ml_item_thumbnail"/>
+            vlc:layout_constraintEnd_toEndOf="@+id/ml_item_thumbnail" />
 
         <ImageView
             android:id="@+id/ml_item_seen"
diff --git a/vlc-android/res/layout/video_list_card.xml b/vlc-android/res/layout/video_list_card.xml
index 823603139..74631574a 100644
--- a/vlc-android/res/layout/video_list_card.xml
+++ b/vlc-android/res/layout/video_list_card.xml
@@ -63,6 +63,16 @@
             vlc:media="@{media}"
             android:scaleType="centerCrop"
             android:src="@{cover}" />
+        <ImageView
+            android:id="@+id/ml_item_overlay"
+            android:layout_width="0dp"
+            android:layout_height="0dp"
+            android:scaleType="fitXY"
+            vlc:layout_constraintTop_toTopOf="@+id/ml_item_thumbnail"
+            vlc:layout_constraintBottom_toBottomOf="@+id/ml_item_thumbnail"
+            vlc:layout_constraintStart_toStartOf="@+id/ml_item_thumbnail"
+            vlc:layout_constraintEnd_toEndOf="@+id/ml_item_thumbnail"
+            android:visibility="gone" />
 
         <ImageView
             android:id="@+id/ml_item_seen"
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
index d7f5a52ff..ef91e15ed 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoListAdapter.java
@@ -104,7 +104,7 @@ public class VideoListAdapter extends DiffUtilAdapter<MediaWrapper, VideoListAda
             for (Object data : payloads) {
                 switch ((int) data) {
                     case Constants.UPDATE_THUMB:
-                        ImageLoaderKt.loadImage(holder.thumbView, media);
+                        ImageLoaderKt.loadImage(holder.overlay, media);
                         break;
                     case Constants.UPDATE_TIME:
                     case Constants.UPDATE_SEEN:
@@ -207,12 +207,12 @@ public class VideoListAdapter extends DiffUtilAdapter<MediaWrapper, VideoListAda
     }
 
     public class ViewHolder extends SelectorViewHolder<ViewDataBinding> implements View.OnFocusChangeListener {
-        private ImageView thumbView;
+        private ImageView overlay;
 
         @TargetApi(Build.VERSION_CODES.M)
         public ViewHolder(ViewDataBinding binding) {
             super(binding);
-            thumbView = itemView.findViewById(R.id.ml_item_thumbnail);
+            overlay = itemView.findViewById(R.id.ml_item_overlay);
             binding.setVariable(BR.holder, this);
             binding.setVariable(BR.cover, UiTools.Resources.DEFAULT_COVER_VIDEO_DRAWABLE);
             if (AndroidUtil.isMarshMallowOrLater) itemView.setOnContextClickListener(new View.OnContextClickListener() {
@@ -243,7 +243,8 @@ public class VideoListAdapter extends DiffUtilAdapter<MediaWrapper, VideoListAda
 
         @Override
         public void selectView(boolean selected) {
-            thumbView.setImageResource(selected ? R.drawable.ic_action_mode_select_1610 : mListMode ? 0 : R.drawable.black_gradient);
+            overlay.setImageResource(selected ? R.drawable.ic_action_mode_select_1610 : mListMode ? 0 : R.drawable.black_gradient);
+            if (mListMode) overlay.setVisibility(selected ? View.VISIBLE : View.GONE);
             super.selectView(selected);
         }
 



More information about the Android mailing list