]> git.ktnx.net Git - mobile-ledger.git/commitdiff
when a date is picked, focus the transaction description
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 9 Dec 2018 12:45:02 +0000 (12:45 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 9 Dec 2018 12:45:02 +0000 (12:45 +0000)
app/src/main/java/net/ktnx/mobileledger/DatePickerFragment.java

index 5dbd2794651f61fee2489fc577016a896f518760..a30913c091220e69ab1bb7578c8f50e7a66f2fcf 100644 (file)
@@ -7,6 +7,7 @@ import android.os.Build;
 import android.os.Bundle;
 import android.support.annotation.NonNull;
 import android.support.v7.app.AppCompatDialogFragment;
+import android.util.Log;
 import android.widget.DatePicker;
 import android.widget.TextView;
 
@@ -47,7 +48,6 @@ implements DatePickerDialog.OnDateSetListener, DatePicker.OnDateChangedListener
         }
 
         DatePickerDialog dpd =  new DatePickerDialog(Objects.requireNonNull(getActivity()), this, year, month, day);
-
         // quicker date selection available in API 26
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
             DatePicker dp = dpd.getDatePicker();
@@ -68,6 +68,10 @@ implements DatePickerDialog.OnDateSetListener, DatePicker.OnDateChangedListener
         else {
             date.setText(String.format(Locale.US, "%d/%d", month+1, day));
         }
+
+        TextView description = Objects.requireNonNull(getActivity())
+                .findViewById(R.id.new_transaction_description);
+        description.requestFocus();
     }
 
     @Override
@@ -82,6 +86,10 @@ implements DatePickerDialog.OnDateSetListener, DatePicker.OnDateChangedListener
             date.setText(String.format(Locale.US, "%d/%d", monthOfYear+1, dayOfMonth));
         }
 
+        TextView description = Objects.requireNonNull(getActivity())
+                .findViewById(R.id.new_transaction_description);
+        description.requestFocus();
+
         this.dismiss();
     }
 }