[Android] Fix cover display in Android TV file browsing

Nicolas Pomepuy git at videolan.org
Wed Feb 9 14:56:38 UTC 2022


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Jan 18 10:15:48 2022 +0100| [e3e139c5cf6a2ddcc82523593fd7decad0b80f88] | committer: Nicolas Pomepuy

Fix cover display in Android TV file browsing

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

 .../television/src/main/res/layout/media_browser_tv_item.xml | 12 ++++++------
 .../src/main/res/layout/media_browser_tv_item_list.xml       |  2 +-
 .../src/org/videolan/vlc/gui/helpers/ImageLoader.kt          |  3 +--
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/application/television/src/main/res/layout/media_browser_tv_item.xml b/application/television/src/main/res/layout/media_browser_tv_item.xml
index a43596217..94bdadb25 100644
--- a/application/television/src/main/res/layout/media_browser_tv_item.xml
+++ b/application/television/src/main/res/layout/media_browser_tv_item.xml
@@ -84,20 +84,20 @@
 
         <org.videolan.vlc.gui.view.FadableImageView
                 android:id="@+id/media_cover"
-                android:layout_width="match_parent"
+                android:layout_width="0dp"
                 android:layout_height="0dp"
                 android:layout_gravity="center"
                 android:background="@color/lb_details_overview_bg_color"
-                tools:srcCompat="@drawable/ic_album_big"
-                vlc:constraintRatio="@{isSquare}"
-                android:src="@{cover}"
                 android:scaleType="@{scaleType}"
+                android:src="@{cover}"
+                vlc:constraintRatio="@{isSquare}"
+                tools:srcCompat="@drawable/ic_album_big"
+                vlc:imageWidth="@{imageWidth}"
                 vlc:layout_constraintEnd_toEndOf="parent"
                 vlc:layout_constraintStart_toStartOf="parent"
                 vlc:layout_constraintTop_toTopOf="parent"
-                vlc:imageWidth="@{imageWidth}"
                 vlc:media="@{item}"
-                vlc:tv="@{true}"/>
+                vlc:tv="@{true}" />
 
         <View
                 android:id="@+id/network_off_overlay"
diff --git a/application/television/src/main/res/layout/media_browser_tv_item_list.xml b/application/television/src/main/res/layout/media_browser_tv_item_list.xml
index 2f61bf447..01a2b2be7 100644
--- a/application/television/src/main/res/layout/media_browser_tv_item_list.xml
+++ b/application/television/src/main/res/layout/media_browser_tv_item_list.xml
@@ -120,8 +120,8 @@
                 android:background="@color/lb_details_overview_bg_color"
                 android:scaleType="@{scaleType}"
                 android:src="@{cover}"
-                vlc:imageWidth="@{imageWidth}"
                 tools:srcCompat="@drawable/ic_album_big"
+                vlc:imageWidth="@{imageWidth}"
                 vlc:layout_constraintBottom_toBottomOf="parent"
                 vlc:layout_constraintDimensionRatio="1"
                 vlc:layout_constraintStart_toStartOf="parent"
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt b/application/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
index 42eb0caac..ac397a040 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/helpers/ImageLoader.kt
@@ -354,7 +354,6 @@ fun constraintRatio(v: View, isSquare: Boolean, imageWidth: Int = -2) {
         val constraintSet = ConstraintSet()
         constraintSet.clone(constraintLayout)
         constraintSet.setDimensionRatio(v.id, if (isSquare) "1" else "16:10")
-        constraintLayout.setConstraintSet(constraintSet)
-
+        constraintSet.applyTo(constraintLayout)
     }
 }
\ No newline at end of file



More information about the Android mailing list