diff --git a/app/src/main/java/org/tasks/dialogs/DateTimePicker.kt b/app/src/main/java/org/tasks/dialogs/DateTimePicker.kt index a8a0658c3..f08a55edd 100644 --- a/app/src/main/java/org/tasks/dialogs/DateTimePicker.kt +++ b/app/src/main/java/org/tasks/dialogs/DateTimePicker.kt @@ -272,11 +272,15 @@ class DateTimePicker : InjectingBottomSheetDialogFragment() { if (resultCode == RESULT_OK) { val timestamp = data!!.getLongExtra(MyTimePickerDialog.EXTRA_TIMESTAMP, today.millis) returnSelectedTime(newDateTime(timestamp).millisOfDay + 1000) + } else { + refreshButtons() } } else if (requestCode == REQUEST_DATE) { if (resultCode == RESULT_OK) { val timestamp = data!!.getLongExtra(MyDatePickerDialog.EXTRA_TIMESTAMP, today.millis) returnDate(timestamp) + } else { + refreshButtons() } } else { super.onActivityResult(requestCode, resultCode, data) diff --git a/app/src/main/java/org/tasks/dialogs/MyDatePickerDialog.java b/app/src/main/java/org/tasks/dialogs/MyDatePickerDialog.java index 90e2878c0..9ac28e786 100644 --- a/app/src/main/java/org/tasks/dialogs/MyDatePickerDialog.java +++ b/app/src/main/java/org/tasks/dialogs/MyDatePickerDialog.java @@ -1,5 +1,6 @@ package org.tasks.dialogs; +import static android.app.Activity.RESULT_CANCELED; import static android.app.Activity.RESULT_OK; import static org.tasks.time.DateTimeUtils.currentTimeMillis; @@ -73,6 +74,8 @@ public class MyDatePickerDialog extends DatePickerDialog implements OnDateSetLis if (getTargetFragment() == null) { callback.onDatePicked(dialog, NO_DATE); + } else { + getTargetFragment().onActivityResult(getTargetRequestCode(), RESULT_CANCELED, null); } } diff --git a/app/src/main/java/org/tasks/dialogs/MyTimePickerDialog.java b/app/src/main/java/org/tasks/dialogs/MyTimePickerDialog.java index 5d22b75e6..602d34b5e 100644 --- a/app/src/main/java/org/tasks/dialogs/MyTimePickerDialog.java +++ b/app/src/main/java/org/tasks/dialogs/MyTimePickerDialog.java @@ -1,5 +1,6 @@ package org.tasks.dialogs; +import static android.app.Activity.RESULT_CANCELED; import static android.app.Activity.RESULT_OK; import static org.tasks.date.DateTimeUtils.newDateTime; import static org.tasks.time.DateTimeUtils.currentTimeMillis; @@ -71,6 +72,8 @@ public class MyTimePickerDialog extends TimePickerDialog implements OnTimeSetLis if (getTargetFragment() == null) { callback.onTimePicked(NO_TIME); + } else { + getTargetFragment().onActivityResult(getTargetRequestCode(), RESULT_CANCELED, null); } }