]> git.ktnx.net Git - mobile-ledger.git/commitdiff
new transaction: make text input fields single-line and use 'Next' action button
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 9 Dec 2018 19:31:27 +0000 (19:31 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 9 Dec 2018 19:31:27 +0000 (19:31 +0000)
can't make it multi-line (for accounts with long names) and still
have 'Next' on the action button and not 'Enter'

app/src/main/java/net/ktnx/mobileledger/NewTransactionActivity.java
app/src/main/res/layout/content_new_transaction.xml
app/src/main/res/values-bg/strings.xml
app/src/main/res/values/strings.xml

index f41063d96034d9f754bf7dee3c090182c8d2c6b7..93e6fe8dfaa7f12888ad180370f24b5b73260595 100644 (file)
@@ -299,7 +299,9 @@ public class NewTransactionActivity extends AppCompatActivity implements TaskCal
         acc.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT, 9f));
         acc.setHint(R.string.new_transaction_account_hint);
         acc.setWidth(0);
-        acc.setImeOptions(EditorInfo.IME_ACTION_NEXT);
+        acc.setImeOptions(EditorInfo.IME_ACTION_NEXT | EditorInfo.IME_FLAG_NO_ENTER_ACTION
+                | EditorInfo.IME_FLAG_NAVIGATE_NEXT);
+        acc.setSingleLine(true);
 
         final EditText amt = new EditText(this);
         amt.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,
index 0cbfc203638fc3906b5111313eee2ef35c990c71..de29030b2934a9f610c28eca6923bf01cc98c1b0 100644 (file)
                 <EditText
                     android:id="@+id/new_transaction_date"
                     android:layout_width="94dp"
-                    android:layout_height="wrap_content"
+                    android:layout_height="0dp"
+                    android:accessibilityTraversalBefore="@+id/new_transaction_description"
                     android:ems="10"
+                    android:foregroundGravity="bottom"
+                    android:gravity="bottom"
                     android:hint="@string/new_transaction_date_hint"
                     android:imeOptions="actionNext"
                     android:inputType="date"
-                    android:accessibilityTraversalBefore="@+id/new_transaction_description"
                     android:nextFocusDown="@+id/new_transaction_acc_1"
                     android:nextFocusForward="@+id/new_transaction_description"
                     android:onClick="pickTransactionDate"
                     android:textAlignment="center"
+                    app:layout_constrainedHeight="true"
+                    app:layout_constraintBottom_toBottomOf="parent"
                     app:layout_constraintHorizontal_weight="8"
                     app:layout_constraintStart_toStartOf="parent"
                     app:layout_constraintTop_toTopOf="parent" />
                     android:ems="10"
                     android:hint="@string/new_transaction_description_hint"
                     android:imeOptions="actionNext"
-                    android:inputType="textPersonName"
                     android:nextFocusLeft="@+id/new_transaction_date"
                     android:nextFocusRight="@+id/new_transaction_acc_1"
                     android:nextFocusUp="@+id/new_transaction_date"
                     android:nextFocusDown="@+id/new_transaction_acc_1"
                     android:nextFocusForward="@+id/new_transaction_acc_1"
+                    android:singleLine="true"
                     app:layout_constraintEnd_toEndOf="parent"
                     app:layout_constraintHorizontal_weight="30"
                     app:layout_constraintStart_toEndOf="@+id/new_transaction_date"
                         android:layout_weight="9"
                         android:width="0dp"
                         android:accessibilityTraversalAfter="@+id/new_transaction_description"
-                        android:accessibilityTraversalBefore="@+id/new_transaction_amt_2"
+                        android:accessibilityTraversalBefore="@+id/new_transaction_amt_1"
                         android:hint="@string/new_transaction_account_hint"
                         android:imeOptions="actionNext"
                         android:nextFocusLeft="@+id/new_transaction_description"
                         android:nextFocusRight="@+id/new_transaction_amt_1"
                         android:nextFocusUp="@+id/new_transaction_description"
                         android:nextFocusDown="@+id/new_transaction_amt_1"
-                        android:nextFocusForward="@+id/new_transaction_amt_1" />
+                        android:nextFocusForward="@+id/new_transaction_amt_1"
+                        android:singleLine="true" />
 
                     <EditText
                         android:id="@+id/new_transaction_amt_1"
                         android:layout_gravity="bottom"
                         android:layout_weight="9"
                         android:width="0dp"
-                        android:hint="@string/new_transaction_account_hint"
-                        android:imeOptions="actionNext"
                         android:accessibilityTraversalAfter="@+id/new_transaction_amt_1"
                         android:accessibilityTraversalBefore="@+id/new_transaction_amt_2"
+                        android:hint="@string/new_transaction_account_hint"
+                        android:imeOptions="actionNext"
                         android:nextFocusLeft="@+id/new_transaction_amt_1"
                         android:nextFocusRight="@+id/new_transaction_amt_2"
                         android:nextFocusUp="@+id/new_transaction_acc_1"
                         android:nextFocusDown="@+id/new_transaction_amt_2"
-                        android:nextFocusForward="@+id/new_transaction_amt_2" />
+                        android:nextFocusForward="@+id/new_transaction_amt_2"
+                        android:singleLine="true" />
 
                     <EditText
                         android:id="@+id/new_transaction_amt_2"
index 36d45fa8ee3a15a40dfb5edd72b690f2a2d0a88e..96f08c4cb9ba5dd109fac390f1f4286feb3a25d4 100644 (file)
@@ -31,4 +31,5 @@
     <string name="err_net_error">Мрежова грешка</string>
     <string name="menu_acc_summary_show_hidden_accounts_title">Показване на скритите сметки</string>
     <string name="action_reset_new_transaction_activity_title">Отначало</string>
+    <string name="ime_action_next_title">Следващ</string>
 </resources>
\ No newline at end of file
index fcc23ecbd1e19618533081538665fce2f07f6d4f..b7501a08fc226b9da62d992aa275df577d55e184 100644 (file)
@@ -75,4 +75,5 @@
     <string name="menu_acc_summary_show_hidden_accounts_title">Show hidden accounts</string>
     <string name="err_bad_auth">Invalid username or password</string>
     <string name="action_reset_new_transaction_activity_title">Reset</string>
+    <string name="ime_action_next_title">Next</string>
 </resources>