[Android] Browser: set dedicated imageview for cover

Geoffrey Métais git at videolan.org
Fri Jun 29 18:27:36 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jun 29 18:26:32 2018 +0200| [041ae455a5fa21ac1670367e1737441636d08b12] | committer: Geoffrey Métais

Browser: set dedicated imageview for cover

Fix #184

> https://code.videolan.org/videolan/vlc-android/commit/041ae455a5fa21ac1670367e1737441636d08b12
---

 vlc-android/res/layout/browser_item.xml | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/vlc-android/res/layout/browser_item.xml b/vlc-android/res/layout/browser_item.xml
index 6586bd99b..95284fc19 100644
--- a/vlc-android/res/layout/browser_item.xml
+++ b/vlc-android/res/layout/browser_item.xml
@@ -54,21 +54,31 @@
             android:visibility="@{item.getItemType() == MediaLibraryItem.TYPE_STORAGE ? View.VISIBLE : View.GONE, default=gone}" />
 
         <!-- Image downloading is handled by org.videolan.vlc.gui.helpers.ImageLoader.loadImage() -->
-        <TextView
-            android:id="@+id/dvi_icon"
+        <ImageView
+            android:id="@+id/item_icon"
             android:layout_width="48dp"
             android:layout_height="48dp"
-            android:background="@{cover}"
+            android:src="@{cover}"
+            android:scaleType="centerCrop"
             android:contentDescription="@string/cover_art"
-            android:gravity="center"
-            android:text="@{protocol}"
-            android:textColor="@color/whitetransparent"
-            android:textSize="11sp"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintStart_toEndOf="@+id/browser_checkbox"
             app:layout_constraintTop_toTopOf="parent"
             app:media="@{item}"
             android:visibility="@{item.getItemType() == MediaLibraryItem.TYPE_STORAGE ? View.GONE : View.VISIBLE}" />
+        <TextView
+            android:id="@+id/dvi_icon"
+            android:layout_width="0dp"
+            android:layout_height="0dp"
+            android:gravity="center"
+            android:text="@{protocol}"
+            android:textColor="@color/whitetransparent"
+            android:textSize="11sp"
+            app:layout_constraintBottom_toBottomOf="@+id/item_icon"
+            app:layout_constraintStart_toStartOf="@+id/item_icon"
+            app:layout_constraintEnd_toEndOf="@+id/item_icon"
+            app:layout_constraintTop_toTopOf="@+id/item_icon"
+            android:visibility="@{ TextUtils.isEmpty(protocol) ? View.GONE : View.VISIBLE, default=gone}" />
 
         <TextView
             android:id="@+id/title"
@@ -78,7 +88,7 @@
             android:layout_marginLeft="@dimen/default_margin"
             android:layout_marginStart="@dimen/default_margin"
             app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintStart_toEndOf="@+id/dvi_icon"
+            app:layout_constraintStart_toEndOf="@+id/item_icon"
             app:layout_constraintVertical_chainStyle="packed"
             app:layout_constraintEnd_toStartOf="@+id/item_more"
             app:layout_constraintBottom_toTopOf="@+id/text"



More information about the Android mailing list