Refresh buttons after canceled pick date/time

pull/996/head
Alex Baker 5 years ago
parent 8e9fe10705
commit dd5b15a56d

@ -272,11 +272,15 @@ class DateTimePicker : InjectingBottomSheetDialogFragment() {
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
val timestamp = data!!.getLongExtra(MyTimePickerDialog.EXTRA_TIMESTAMP, today.millis) val timestamp = data!!.getLongExtra(MyTimePickerDialog.EXTRA_TIMESTAMP, today.millis)
returnSelectedTime(newDateTime(timestamp).millisOfDay + 1000) returnSelectedTime(newDateTime(timestamp).millisOfDay + 1000)
} else {
refreshButtons()
} }
} else if (requestCode == REQUEST_DATE) { } else if (requestCode == REQUEST_DATE) {
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
val timestamp = data!!.getLongExtra(MyDatePickerDialog.EXTRA_TIMESTAMP, today.millis) val timestamp = data!!.getLongExtra(MyDatePickerDialog.EXTRA_TIMESTAMP, today.millis)
returnDate(timestamp) returnDate(timestamp)
} else {
refreshButtons()
} }
} else { } else {
super.onActivityResult(requestCode, resultCode, data) super.onActivityResult(requestCode, resultCode, data)

@ -1,5 +1,6 @@
package org.tasks.dialogs; package org.tasks.dialogs;
import static android.app.Activity.RESULT_CANCELED;
import static android.app.Activity.RESULT_OK; import static android.app.Activity.RESULT_OK;
import static org.tasks.time.DateTimeUtils.currentTimeMillis; import static org.tasks.time.DateTimeUtils.currentTimeMillis;
@ -73,6 +74,8 @@ public class MyDatePickerDialog extends DatePickerDialog implements OnDateSetLis
if (getTargetFragment() == null) { if (getTargetFragment() == null) {
callback.onDatePicked(dialog, NO_DATE); callback.onDatePicked(dialog, NO_DATE);
} else {
getTargetFragment().onActivityResult(getTargetRequestCode(), RESULT_CANCELED, null);
} }
} }

@ -1,5 +1,6 @@
package org.tasks.dialogs; package org.tasks.dialogs;
import static android.app.Activity.RESULT_CANCELED;
import static android.app.Activity.RESULT_OK; import static android.app.Activity.RESULT_OK;
import static org.tasks.date.DateTimeUtils.newDateTime; import static org.tasks.date.DateTimeUtils.newDateTime;
import static org.tasks.time.DateTimeUtils.currentTimeMillis; import static org.tasks.time.DateTimeUtils.currentTimeMillis;
@ -71,6 +72,8 @@ public class MyTimePickerDialog extends TimePickerDialog implements OnTimeSetLis
if (getTargetFragment() == null) { if (getTargetFragment() == null) {
callback.onTimePicked(NO_TIME); callback.onTimePicked(NO_TIME);
} else {
getTargetFragment().onActivityResult(getTargetRequestCode(), RESULT_CANCELED, null);
} }
} }

Loading…
Cancel
Save