[Android] Improve dialog layouts

Geoffrey Métais git at videolan.org
Mon Oct 22 10:23:19 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Oct 22 10:20:30 2018 +0200| [fdf29c8405046865a926684b04db226fd1081359] | committer: Geoffrey Métais

Improve dialog layouts

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

 vlc-android/res/layout/vlc_login_dialog.xml    | 20 ++++++++++----------
 vlc-android/res/layout/vlc_progress_dialog.xml | 15 ++++++++++-----
 vlc-android/res/layout/vlc_question_dialog.xml | 20 +++++++++++++-------
 3 files changed, 33 insertions(+), 22 deletions(-)

diff --git a/vlc-android/res/layout/vlc_login_dialog.xml b/vlc-android/res/layout/vlc_login_dialog.xml
index 2e2ed33b2..a88522052 100644
--- a/vlc-android/res/layout/vlc_login_dialog.xml
+++ b/vlc-android/res/layout/vlc_login_dialog.xml
@@ -13,7 +13,7 @@
         <RelativeLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:padding="10dp">
+            android:padding="8dp">
 
             <TextView
                 android:id="@+id/text"
@@ -21,19 +21,19 @@
                 android:layout_height="wrap_content"
                 android:minWidth="600dip"
                 android:layout_alignParentTop="true"
-                android:layout_margin="10dp"
+                android:layout_margin="8dp"
                 android:text="@{dialog.text}"/>
             <com.google.android.material.textfield.TextInputLayout
                 android:id="@+id/login_container"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_below="@+id/text"
-                android:layout_margin="10dp" >
+                android:layout_margin="8dp" >
                 <EditText
                     android:id="@+id/login"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:minWidth="200dp"
+                    android:minWidth="192dp"
                     android:hint="@string/login"
                     android:text="@{dialog.getDefaultUsername()}"
                     android:inputType="textNoSuggestions"
@@ -44,7 +44,7 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_below="@+id/login_container"
-                android:layout_margin="10dp" >
+                android:layout_margin="8dp" >
                 <EditText
                     android:id="@+id/password"
                     android:layout_width="match_parent"
@@ -60,8 +60,8 @@
                 android:layout_height="wrap_content"
                 android:layout_below="@+id/password_container"
                 android:text="@string/store_password"
-                android:layout_alignParentLeft="true"
-                android:layout_margin="5dp"
+                android:layout_alignParentStart="true"
+                android:layout_margin="4dp"
                 android:checked="@{handler.store()}"
                 android:visibility="@{dialog.asksStore() ? View.VISIBLE : View.GONE}"/>
             <TextView
@@ -69,7 +69,7 @@
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_below="@+id/store"
-                android:layout_margin="10dp"
+                android:layout_margin="8dp"
                 android:text="@string/encryption_warning"
                 android:visibility="@{dialog.asksStore() && !AndroidUtil.isMarshMallowOrLater ? View.VISIBLE : View.GONE}" />
             <Button
@@ -77,7 +77,6 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_below="@+id/warning"
-                android:layout_toLeftOf="@+id/action"
                 android:layout_toStartOf="@+id/action"
                 android:focusable="true"
                 android:text="@android:string/cancel"
@@ -88,8 +87,9 @@
                 android:id="@+id/action"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_alignParentRight="true"
                 android:layout_alignParentEnd="true"
+                android:layout_marginStart="@dimen/default_margin"
+                android:layout_marginEnd="8dp"
                 android:focusable="true"
                 android:layout_below="@+id/warning"
                 android:text="@android:string/ok"
diff --git a/vlc-android/res/layout/vlc_progress_dialog.xml b/vlc-android/res/layout/vlc_progress_dialog.xml
index 6f09a3621..f9cf6f7a5 100644
--- a/vlc-android/res/layout/vlc_progress_dialog.xml
+++ b/vlc-android/res/layout/vlc_progress_dialog.xml
@@ -7,11 +7,13 @@
         <variable name="dialog" type="org.videolan.libvlc.Dialog.ProgressDialog"/>
         <variable name="handler" type="org.videolan.vlc.gui.dialogs.VlcProgressDialog"/>
     </data>
-    <ScrollView>
+    <ScrollView
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
         <RelativeLayout
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:padding="10dp">
+            android:layout_height="wrap_content"
+            android:padding="8dp">
 
             <TextView
                 android:id="@+id/text"
@@ -19,11 +21,12 @@
                 android:layout_height="wrap_content"
                 android:layout_alignParentTop="true"
                 android:text="@{dialog.text}"
-                android:layout_margin="10dp" />
+                android:layout_margin="8dp" />
             <androidx.core.widget.ContentLoadingProgressBar
                 android:id="@+id/progress"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
+                android:layout_below="@+id/text"
                 android:max="100"
                 android:indeterminate="@{dialog.isIndeterminate()}"/>
             <Button
@@ -32,11 +35,13 @@
                 android:layout_height="wrap_content"
                 android:layout_below="@+id/progress"
                 android:text="@android:string/cancel"
-                android:layout_alignParentRight="true"
+                android:layout_alignParentEnd="true"
+                android:layout_marginEnd="8dp"
                 android:onClick="@{handler::onCancel}"
                 tools:targetApi="11"
                 style="?android:attr/borderlessButtonStyle"
                 android:visibility="@{TextUtils.isEmpty(dialog.cancelText) ? View.GONE : View.VISIBLE}"/>
+                tools:visibility="visible"/>
         </RelativeLayout>
     </ScrollView>
 </layout>
diff --git a/vlc-android/res/layout/vlc_question_dialog.xml b/vlc-android/res/layout/vlc_question_dialog.xml
index caf6998e0..e9bac06f8 100644
--- a/vlc-android/res/layout/vlc_question_dialog.xml
+++ b/vlc-android/res/layout/vlc_question_dialog.xml
@@ -7,11 +7,13 @@
         <variable name="dialog" type="org.videolan.libvlc.Dialog.QuestionDialog"/>
         <variable name="handler" type="org.videolan.vlc.gui.dialogs.VlcQuestionDialog"/>
     </data>
-    <ScrollView>
+    <ScrollView
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
         <RelativeLayout
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:padding="10dp">
+            android:layout_height="wrap_content"
+            android:padding="8dp">
 
             <TextView
                 android:id="@+id/text"
@@ -19,14 +21,15 @@
                 android:layout_height="wrap_content"
                 android:layout_alignParentTop="true"
                 android:text="@{dialog.text}"
-                android:layout_margin="10dp" />
+                android:layout_margin="8dp" />
             <Button
                 android:id="@+id/cancel"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_below="@+id/text"
                 android:text="@{TextUtils.isEmpty(dialog.cancelText) ? @android:string/cancel : dialog.cancelText}"
-                android:layout_toLeftOf="@+id/action2"
+                android:layout_toStartOf="@+id/action2"
+                android:layout_marginStart="@dimen/default_margin"
                 android:onClick="@{handler::onCancel}"
                 tools:targetApi="11"
                 style="?android:attr/borderlessButtonStyle" />
@@ -35,7 +38,8 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_below="@+id/text"
-                android:layout_toLeftOf="@+id/action1"
+                android:layout_toStartOf="@+id/action1"
+                android:layout_marginStart="@dimen/default_margin"
                 android:text="@{dialog.action2Text}"
                 android:visibility="@{TextUtils.isEmpty(dialog.action2Text) ? View.GONE : View.VISIBLE}"
                 android:onClick="@{handler::onAction2}"
@@ -45,7 +49,9 @@
                 android:id="@+id/action1"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_alignParentRight="true"
+                android:layout_alignParentEnd="true"
+                android:layout_marginStart="@dimen/default_margin"
+                android:layout_marginEnd="8dp"
                 android:layout_below="@+id/text"
                 android:text="@{dialog.action1Text}"
                 android:visibility="@{TextUtils.isEmpty(dialog.action1Text) ? View.GONE : View.VISIBLE}"



More information about the Android mailing list