[Android] Proper fix for the ConstraintLayout issues

Nicolas Pomepuy git at videolan.org
Thu Apr 22 07:38:12 UTC 2021


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Apr 22 09:31:02 2021 +0200| [9527b98e71c3cd576bfd0c7b2cdca28109c18ab7] | committer: Nicolas Pomepuy

Proper fix for the ConstraintLayout issues

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

 application/vlc-android/res/layout/audio_browser_item.xml | 1 +
 application/vlc-android/res/layout/playlist_item.xml      | 5 +++--
 build.gradle                                              | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/application/vlc-android/res/layout/audio_browser_item.xml b/application/vlc-android/res/layout/audio_browser_item.xml
index c198f814c..956cfab13 100644
--- a/application/vlc-android/res/layout/audio_browser_item.xml
+++ b/application/vlc-android/res/layout/audio_browser_item.xml
@@ -38,6 +38,7 @@
             android:background="@{bgColor}"
             android:clickable="true"
             android:focusable="true"
+            vlc:layout_optimizationLevel="cache_measures"
             android:longClickable="true"
             android:foreground="?attr/selectableItemBackground"
             android:minHeight="@dimen/audio_browser_item_size"
diff --git a/application/vlc-android/res/layout/playlist_item.xml b/application/vlc-android/res/layout/playlist_item.xml
index a58f973f8..2b2305667 100644
--- a/application/vlc-android/res/layout/playlist_item.xml
+++ b/application/vlc-android/res/layout/playlist_item.xml
@@ -35,7 +35,8 @@
 
     <androidx.constraintlayout.widget.ConstraintLayout
             android:layout_width="match_parent"
-            android:layout_height="wrap_content">
+            android:layout_height="wrap_content"
+            app:layout_optimizationLevel="cache_measures">
 
         <View
                 android:layout_width="0dp"
@@ -60,7 +61,7 @@
 
 
         <ImageView
-                android:layout_width="40dp"
+                android:layout_width="0dp"
                 android:layout_height="40dp"
                 android:id="@+id/coverImage"
                 android:layout_weight="1"
diff --git a/build.gradle b/build.gradle
index 46970e7a6..8ef0b90bb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -58,6 +58,7 @@ ext {
     //fixme : When we update this dep, please verify of this issue is fixed: https://github.com/material-components/material-components-android/issues/1086
     // if so, revert application/vlc-android/res/values[-v21]/styles.xml -> AppModalStyle
     androidxMaterialVersion = '1.3.0'
+    //fixme: when updating to 2.1.x+, we should remove the 'layout_optimizationLevel' attribute we added in some layouts as a workaround for this issue: https://issuetracker.google.com/issues/170313444
     constraintLayoutVersion = '2.0.4'
     viewPager2Version = "1.0.0"
     archVersion = '2.1.0'



More information about the Android mailing list