NT: convert top row to LinearLayout
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 24 Nov 2019 11:14:16 +0000 (13:14 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 24 Nov 2019 11:14:16 +0000 (13:14 +0200)
handles two-row date field better, aligning the description to the bottom

app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java
app/src/main/res/layout/new_transaction_row.xml

index e515690..57bdbfd 100644 (file)
@@ -30,7 +30,7 @@ import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import androidx.annotation.NonNull;
-import androidx.constraintlayout.widget.ConstraintLayout;
+import androidx.appcompat.widget.LinearLayoutCompat;
 import androidx.lifecycle.Observer;
 import androidx.recyclerview.widget.RecyclerView;
 
@@ -59,7 +59,7 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder
     private AutoCompleteTextView tvDescription;
     private AutoCompleteTextView tvAccount;
     private TextView tvAmount;
-    private ConstraintLayout lHead;
+    private LinearLayoutCompat lHead;
     private LinearLayout lAccount;
     private FrameLayout lPadding;
     private MobileLedgerProfile mProfile;
index 382e9eb..da1d70c 100644 (file)
@@ -23,7 +23,7 @@
     android:animateLayoutChanges="false"
     android:orientation="vertical">
 
-    <androidx.constraintlayout.widget.ConstraintLayout
+    <androidx.appcompat.widget.LinearLayoutCompat
         android:id="@+id/ntr_data"
         android:layout_width="match_parent"
         android:layout_height="wrap_content">
         <EditText
             android:id="@+id/new_transaction_date"
             android:layout_width="94dp"
-            android:layout_height="0dp"
+            android:layout_height="wrap_content"
             android:accessibilityTraversalBefore="@+id/new_transaction_description"
             android:drawableStart="@drawable/ic_event_gray_24dp"
             android:ems="10"
-            android:foregroundGravity="bottom"
-            android:gravity="bottom"
+            android:enabled="true"
+            android:focusable="false"
+            android:gravity="bottom|center"
             android:hint="@string/new_transaction_date_hint"
-            android:imeOptions="actionNext"
-            android:cursorVisible="false"
-            android:textCursorDrawable="@android:color/transparent"
-            android:inputType="date"
+            android:inputType="none"
             android:nextFocusDown="@+id/new_transaction_acc_1"
             android:nextFocusForward="@+id/new_transaction_description"
-            android:textAlignment="center"
-            android:enabled="true"
+            android:textAlignment="gravity"
+            android:textCursorDrawable="@android:color/transparent"
             app:layout_constrainedHeight="true"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintHorizontal_weight="8"
             app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent" />
+            app:layout_constraintTop_toTopOf="parent"
+            tools:ignore="TextFields" />
 
         <net.ktnx.mobileledger.ui.AutoCompleteTextViewWithClear
             android:id="@+id/new_transaction_description"
-            android:layout_width="0dp"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:layout_gravity="bottom"
             android:layout_marginStart="8dp"
             android:accessibilityTraversalAfter="@+id/new_transaction_date"
             android:ems="10"
+            android:foregroundGravity="bottom"
+            android:gravity="bottom"
             android:hint="@string/new_transaction_description_hint"
             android:imeOptions="actionNext"
             android:inputType="text"
             android:nextFocusUp="@+id/new_transaction_date"
             android:selectAllOnFocus="true"
             android:singleLine="true"
+            app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintHorizontal_weight="30"
             app:layout_constraintStart_toEndOf="@+id/new_transaction_date"
             app:layout_constraintTop_toTopOf="parent" />
-    </androidx.constraintlayout.widget.ConstraintLayout>
+    </androidx.appcompat.widget.LinearLayoutCompat>
 
     <LinearLayout
         android:id="@+id/ntr_account"