[Android] Fix audio lists items layout

Geoffrey Métais git at videolan.org
Wed Sep 5 17:50:10 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Sep  5 17:43:41 2018 +0200| [47e2424db3fe36657509ac44bd0fd8babb6159a4] | committer: Geoffrey Métais

Fix audio lists items layout

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

 vlc-android/res/layout/audio_browser_item.xml | 21 ++++++++++++---------
 vlc-android/res/values/dimens.xml             |  2 +-
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/vlc-android/res/layout/audio_browser_item.xml b/vlc-android/res/layout/audio_browser_item.xml
index 41b18e4c8..955c84496 100644
--- a/vlc-android/res/layout/audio_browser_item.xml
+++ b/vlc-android/res/layout/audio_browser_item.xml
@@ -28,11 +28,11 @@
     <android.support.constraint.ConstraintLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:paddingBottom="10dp"
-        android:paddingTop="10dp"
+        android:minHeight="@dimen/audio_browser_item_size"
+        android:paddingBottom="8dp"
         android:longClickable="true"
         android:clickable="true"
-        android:focusable="@{item.getItemType() != MediaLibraryItem.TYPE_DUMMY}"
+        android:focusable="true"
         android:onClick="@{holder::onClick}"
         android:onLongClick="@{holder::onLongClick}"
         android:background="@{bgColor}" >
@@ -40,27 +40,29 @@
             android:id="@+id/section_header"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:paddingBottom="16dp"
             android:paddingStart="8dp"
+            android:paddingBottom="8dp"
             vlc:layout_constraintTop_toTopOf="parent"
             android:singleLine="true"
             android:text="@{header}"
             android:textColor="?attr/audio_browser_separator"
             android:textSize="20sp"
+            android:background="?attr/background_default"
             android:visibility="@{TextUtils.isEmpty(header) ? View.GONE : View.VISIBLE, default=gone}"/>
 
         <!-- Image loading is handled by org.videolan.vlc.gui.helpers.ImageLoader.loadImage() -->
         <ImageView
             android:id="@+id/media_cover"
-            android:layout_width="@dimen/audio_browser_item_size"
             android:layout_height="@dimen/audio_browser_item_size"
-            vlc:layout_constraintTop_toBottomOf="@+id/section_header"
+            android:layout_width="0dp"
+            vlc:layout_constraintDimensionRatio="1"
+            vlc:layout_constraintTop_toTopOf="@+id/title"
             vlc:layout_constraintStart_toStartOf="parent"
             vlc:layout_constraintBottom_toBottomOf="parent"
             android:layout_gravity="center"
             vlc:media="@{item}"
             android:background="@{cover}"
-            android:visibility="@{(item.getItemType() & (MediaLibraryItem.TYPE_ALBUM|MediaLibraryItem.TYPE_ARTIST|MediaLibraryItem.TYPE_MEDIA)) != 0 ? View.VISIBLE : View.GONE}"/>
+            android:visibility="@{(item.getItemType() & (MediaLibraryItem.TYPE_ALBUM|MediaLibraryItem.TYPE_ARTIST|MediaLibraryItem.TYPE_MEDIA)) != 0 ? View.VISIBLE : View.GONE, default=gone}"/>
 
 
         <!-- TextView must be set to singleLine
@@ -70,10 +72,11 @@
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             vlc:layout_constraintVertical_chainStyle="packed"
-            vlc:layout_constraintTop_toTopOf="@+id/media_cover"
+            vlc:layout_constraintTop_toBottomOf="@+id/section_header"
             vlc:layout_constraintStart_toEndOf="@+id/media_cover"
             vlc:layout_constraintEnd_toStartOf="@+id/item_more"
             vlc:layout_constraintBottom_toTopOf="@+id/subtitle"
+            android:layout_marginTop="8dp"
             android:layout_marginStart="@dimen/default_margin"
             android:layout_marginLeft="@dimen/default_margin"
             android:gravity="center_vertical"
@@ -98,7 +101,7 @@
             android:layout_width="wrap_content"
             android:layout_height="0dp"
             vlc:layout_constraintEnd_toEndOf="parent"
-            vlc:layout_constraintTop_toTopOf="@+id/media_cover"
+            vlc:layout_constraintTop_toTopOf="@+id/title"
             vlc:layout_constraintBottom_toBottomOf="parent"
             android:scaleType="center"
             android:src="@drawable/ic_more"
diff --git a/vlc-android/res/values/dimens.xml b/vlc-android/res/values/dimens.xml
index 57c16381c..9e2bf9320 100644
--- a/vlc-android/res/values/dimens.xml
+++ b/vlc-android/res/values/dimens.xml
@@ -1,7 +1,7 @@
 <resources>
     <dimen name="shadow_width">6px</dimen>
     <dimen name="widget_margin">0dp</dimen>
-    <dimen name="audio_browser_item_size">50dp</dimen>
+    <dimen name="audio_browser_item_size">48dp</dimen>
     <dimen name="directory_browser_item_size">40dp</dimen>
     <dimen name="listview_bottom_padding">10dp</dimen>
     <dimen name="listview_side_padding">5dp</dimen>



More information about the Android mailing list