[Android] Improve history items icon

Geoffrey Métais git at videolan.org
Wed Mar 20 11:35:29 CET 2019


vlc-android | branch: 3.1.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 19 17:50:38 2019 +0100| [012b5045dbc90869bb6c59f5f6df5ef9695e3431] | committer: Geoffrey Métais

Improve history items icon

> https://code.videolan.org/videolan/vlc-android/commit/012b5045dbc90869bb6c59f5f6df5ef9695e3431
---

 vlc-android/res/layout/history_item.xml                     | 3 ++-
 vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java    | 2 +-
 vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt | 3 +--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/vlc-android/res/layout/history_item.xml b/vlc-android/res/layout/history_item.xml
index c5a5d937d..b3d6973a0 100644
--- a/vlc-android/res/layout/history_item.xml
+++ b/vlc-android/res/layout/history_item.xml
@@ -37,7 +37,8 @@
             android:layout_marginStart="16dp"
             android:layout_marginTop="8dp"
             android:layout_marginBottom="8dp"
-            android:background="@{cover}"
+            android:src="@{cover}"
+            android:scaleType="centerCrop"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toTopOf="parent"
diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java b/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
index c9fe0fbf5..42521a0d4 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryAdapter.java
@@ -90,7 +90,7 @@ public class HistoryAdapter extends DiffUtilAdapter<MediaWrapper, HistoryAdapter
     @Override
     public void onBindViewHolder(ViewHolder holder, int position) {
         final MediaWrapper media = getItem(position);
-        boolean isSelected = media.hasStateFlags(MediaLibraryItem.FLAG_SELECTED);
+        final boolean isSelected = media.hasStateFlags(MediaLibraryItem.FLAG_SELECTED);
         holder.binding.setMedia(media);
         holder.binding.setCover(ImageLoaderKt.getMediaIconDrawable(holder.itemView.getContext(), media.getType()));
         holder.selectView(isSelected);
diff --git a/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt b/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
index 154baba8a..0b31508a0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
@@ -66,9 +66,8 @@ fun getAudioIconDrawable(context: Context?, type: Int): BitmapDrawable? = contex
 }
 
 fun getMediaIconDrawable(context: Context, type: Int): BitmapDrawable? = when (type) {
-    MediaWrapper.TYPE_AUDIO -> UiTools.getDefaultAudioDrawable(context)
     MediaWrapper.TYPE_VIDEO -> UiTools.getDefaultVideoDrawable(context)
-    else -> null
+    else -> UiTools.getDefaultAudioDrawable(context)
 }
 
 private var placeholderTvBg : Drawable? = null



More information about the Android mailing list