From: Damyan Ivanov Date: Sun, 9 Dec 2018 12:45:02 +0000 (+0000) Subject: when a date is picked, focus the transaction description X-Git-Tag: v0.3~276 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=462f54a048214767800a0366f7cad95b6e52c4f0;p=mobile-ledger.git when a date is picked, focus the transaction description --- diff --git a/app/src/main/java/net/ktnx/mobileledger/DatePickerFragment.java b/app/src/main/java/net/ktnx/mobileledger/DatePickerFragment.java index 5dbd2794..a30913c0 100644 --- a/app/src/main/java/net/ktnx/mobileledger/DatePickerFragment.java +++ b/app/src/main/java/net/ktnx/mobileledger/DatePickerFragment.java @@ -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(); } }