[Android] Update extension items layout

Geoffrey Métais git at videolan.org
Fri Sep 1 17:40:03 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Sep  1 17:38:01 2017 +0200| [29e7bab3d7af3088e28714993db29e29a75be147] | committer: Geoffrey Métais

Update extension items layout

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

 vlc-android/res/layout/extension_item_view.xml | 73 +++++++++++++++++---------
 1 file changed, 48 insertions(+), 25 deletions(-)

diff --git a/vlc-android/res/layout/extension_item_view.xml b/vlc-android/res/layout/extension_item_view.xml
index 6a4010365..350700149 100644
--- a/vlc-android/res/layout/extension_item_view.xml
+++ b/vlc-android/res/layout/extension_item_view.xml
@@ -1,8 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <layout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
     xmlns:vlc="http://schemas.android.com/apk/res-auto" >
     <data>
         <import type="android.view.View"/>
+        <import type="android.text.TextUtils"/>
         <variable
             name="holder"
             type="org.videolan.vlc.gui.browser.ExtensionAdapter.ViewHolder"/>
@@ -14,29 +16,32 @@
             type="android.graphics.drawable.BitmapDrawable"/>
     </data>
 
-    <RelativeLayout
+    <android.support.constraint.ConstraintLayout
         android:layout_width="match_parent"
         android:layout_height="60dp"
         android:layout_margin="5dp"
         android:clickable="true"
+        android:onLongClick="@{holder::onLongClick}"
         android:onClick="@{holder::onClick}" >
+
         <ImageView
             android:id="@+id/extension_image"
-            android:layout_width="wrap_content"
-            android:layout_height="60dp"
-            android:layout_alignParentLeft="true"
-            android:layout_marginRight="5dp"
-            android:src="@{image}" />
+            android:layout_width="64dp"
+            android:layout_height="64dp"
+            vlc:imageUri="@{item.imageUri}"
+            vlc:layout_constraintEnd_toStartOf="@id/title"
+            vlc:layout_constraintBottom_toBottomOf="parent"
+            vlc:layout_constraintStart_toStartOf="parent"
+            vlc:layout_constraintTop_toTopOf="parent"
+            android:layout_marginEnd="8dp"
+            android:layout_marginRight="8dp"
+            android:visibility="@{item.imageUri == null || TextUtils.isEmpty(item.imageUri.toString()) ? View.GONE : View.VISIBLE}"
+            tools:src="@drawable/icon"/>
 
         <TextView
             android:id="@+id/title"
-            android:layout_width="match_parent"
-            android:layout_height="30dp"
-            android:layout_alignParentTop="true"
-            android:layout_toRightOf="@+id/extension_image"
-            android:layout_toLeftOf="@+id/item_more"
-            android:layout_above="@+id/author"
-            android:layout_marginBottom="1dp"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
             android:gravity="bottom"
             android:text="@{item.title}"
             android:fontFamily="sans-serif-light"
@@ -44,28 +49,46 @@
             android:textSize="16sp"
             android:ellipsize="marquee"
             android:marqueeRepeatLimit="marquee_forever"
-            android:singleLine="true" />
+            android:singleLine="true"
+            vlc:layout_constraintEnd_toStartOf="@+id/item_more"
+            vlc:layout_constraintStart_toEndOf="@id/extension_image"
+            vlc:layout_constraintTop_toTopOf="parent"
+            vlc:layout_constraintBottom_toTopOf="@+id/author"
+            vlc:layout_constraintVertical_chainStyle="packed"
+            tools:text="Title"
+            tools:targetApi="jelly_bean"/>
 
         <TextView
             android:id="@+id/author"
-            android:layout_width="match_parent"
-            android:layout_height="30dp"
-            android:layout_alignParentBottom="true"
-            android:layout_toRightOf="@+id/extension_image"
-            android:layout_toLeftOf="@+id/item_more"
-            android:layout_marginTop="1dp"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
             android:gravity="top"
             android:text="@{item.subTitle}"
             android:fontFamily="sans-serif-light"
             android:textColor="?attr/list_subtitle"
             android:ellipsize="marquee"
-            android:maxLines="1" />
+            android:maxLines="1"
+            android:layout_marginTop="2dp"
+            vlc:layout_constraintEnd_toStartOf="@id/item_more"
+            vlc:layout_constraintTop_toBottomOf="@+id/title"
+            vlc:layout_constraintStart_toEndOf="@id/extension_image"
+            vlc:layout_constraintBottom_toBottomOf="parent"
+            android:visibility="@{TextUtils.isEmpty(item.subTitle) ? View.GONE : View.VISIBLE}"
+            tools:text="Author"
+            tools:targetApi="jelly_bean" />
+
         <ImageView
             android:id="@+id/item_more"
             android:layout_width="wrap_content"
-            android:layout_height="match_parent"
-            android:layout_alignParentRight="true"
+            android:layout_height="wrap_content"
             android:src="@drawable/ic_more"
-            android:visibility="@{item.type !=  0 ? View.VISIBLE : View.GONE}"/>
-    </RelativeLayout>
+            android:visibility="@{item.type !=  0 ? View.VISIBLE : View.GONE}"
+            android:layout_marginEnd="1dp"
+            vlc:layout_constraintRight_toRightOf="parent"
+            vlc:layout_constraintTop_toTopOf="parent"
+            vlc:layout_constraintBottom_toBottomOf="parent"
+            android:layout_marginRight="1dp"
+            tools:src="@drawable/ic_more"
+            android:onClick="@{holder::onMoreClick}" />
+    </android.support.constraint.ConstraintLayout>
 </layout>



More information about the Android mailing list