]> git.ktnx.net Git - mobile-ledger.git/commitdiff
fix currency selector layout with long list of currencies
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 23 Dec 2020 20:51:02 +0000 (20:51 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Wed, 23 Dec 2020 20:55:07 +0000 (20:55 +0000)
app/src/main/res/layout/fragment_currency_selector_list.xml

index 7fd49aa2baec810b548bf170436d991ba2cfaeb5..a44f0ec1c4d730902bcc7175a09a807269445e06 100644 (file)
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:minWidth="60dp"
     android:animateLayoutChanges="true"
+    android:minWidth="60dp"
+    android:padding="@dimen/text_margin"
     app:layout_constraintWidth_min="60dp"
-    android:padding="@dimen/text_margin">
+    >
 
     <com.google.android.material.textview.MaterialTextView
         android:id="@+id/label"
         android:layout_marginBottom="@dimen/text_margin"
         android:text="@string/choose_currency_label"
         android:textSize="18sp"
+        app:layout_constraintBottom_toTopOf="@id/list"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
+        app:layout_constraintTop_toTopOf="parent"
+        />
 
     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/list"
         android:name="net.ktnx.mobileledger.ui.CurrencySelectorFragment"
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
+        android:layout_height="200dp"
+        android:minHeight="100dp"
         android:layout_marginLeft="@dimen/activity_horizontal_margin"
         android:layout_marginRight="@dimen/activity_horizontal_margin"
         app:layoutManager="LinearLayoutManager"
@@ -49,7 +53,8 @@
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@id/label"
         tools:context="net.ktnx.mobileledger.ui.CurrencySelectorFragment"
-        tools:listitem="@layout/fragment_currency_selector">
+        tools:listitem="@layout/fragment_currency_selector"
+        >
 
     </androidx.recyclerview.widget.RecyclerView>
 
         android:layout_height="wrap_content"
         android:layout_marginLeft="@dimen/activity_horizontal_margin"
         android:layout_marginRight="@dimen/activity_horizontal_margin"
-        app:layout_constraintTop_toBottomOf="@id/list"
         app:layout_constraintBottom_toTopOf="@id/params_panel"
         app:layout_constraintEnd_toEndOf="parent"
-        app:layout_constraintStart_toStartOf="parent">
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/list"
+        >
 
         <TextView
             android:id="@+id/btn_add_new"
             style="@style/Widget.MaterialComponents.Button.TextButton"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="@string/add_button"
             android:layout_margin="@dimen/text_margin"
+            android:text="@string/add_button"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toEndOf="@id/btn_no_currency"
-            app:layout_constraintTop_toTopOf="parent" />
+            app:layout_constraintTop_toTopOf="parent"
+            />
         <TextView
+            android:id="@+id/btn_no_currency"
+            style="@style/Widget.MaterialComponents.Button.TextButton"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:id="@+id/btn_no_currency"
+            android:layout_margin="@dimen/text_margin"
             android:text="@string/btn_no_currency"
-            style="@style/Widget.MaterialComponents.Button.TextButton"
             app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintEnd_toStartOf="@id/btn_add_new"
-            android:layout_margin="@dimen/text_margin"/>
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
+            />
 
         <EditText
             android:id="@+id/new_currency_name"
             android:visibility="invisible"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
+            app:layout_constraintTop_toTopOf="parent"
+            android:autofillHints="currency"
+            />
 
         <TextView
             android:id="@+id/btn_add_currency"
             android:text="@string/add_button"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintTop_toBottomOf="@id/new_currency_name" />
+            app:layout_constraintTop_toBottomOf="@id/new_currency_name"
+            />
     </androidx.constraintlayout.widget.ConstraintLayout>
 
     <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/params_panel"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:id="@+id/params_panel"
-        app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintTop_toBottomOf="@id/new_currency_panel">
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toBottomOf="@id/new_currency_panel"
+        >
 
         <RadioGroup
             android:id="@+id/position_radio_group"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
+            android:layout_marginBottom="@dimen/text_margin"
             android:orientation="horizontal"
             app:layout_constraintBottom_toTopOf="@id/currency_gap"
-            android:layout_marginBottom="@dimen/text_margin"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent"
             >
 
             <RadioButton
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
-                android:text="@string/currency_position_left" />
+                android:text="@string/currency_position_left"
+                />
 
             <RadioButton
                 android:id="@+id/currency_position_right"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_weight="1"
-                android:text="@string/currency_position_right" />
+                android:text="@string/currency_position_right"
+                />
         </RadioGroup>
 
-        <Switch
+        <com.google.android.material.switchmaterial.SwitchMaterial
             android:id="@+id/currency_gap"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/currency_has_gap"
-            app:layout_constraintTop_toBottomOf="@id/position_radio_group"
-            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintBottom_toBottomOf="parent"/>
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toBottomOf="@id/position_radio_group"
+            />
 
     </androidx.constraintlayout.widget.ConstraintLayout>