diff --git a/app/src/main/java/org/tasks/dialogs/DateTimePicker.kt b/app/src/main/java/org/tasks/dialogs/DateTimePicker.kt index d04083bf8..21c456c70 100644 --- a/app/src/main/java/org/tasks/dialogs/DateTimePicker.kt +++ b/app/src/main/java/org/tasks/dialogs/DateTimePicker.kt @@ -3,6 +3,7 @@ package org.tasks.dialogs import android.app.Activity import android.app.Activity.RESULT_OK import android.app.Dialog +import android.content.DialogInterface import android.content.Intent import android.os.Bundle import android.view.Gravity @@ -100,7 +101,7 @@ class DateTimePicker : InjectingBottomSheetDialogFragment() { binding.calendarView.firstDayOfWeek = firstDayOfWeek } } - val timestamp = savedInstanceState?.getLong(EXTRA_SELECTED, -1) + val timestamp = savedInstanceState?.getLong(EXTRA_SELECTED) ?: arguments!!.getLong(EXTRA_TIMESTAMP) selected = if (timestamp > 0) DateTime(timestamp) else null @@ -226,6 +227,8 @@ class DateTimePicker : InjectingBottomSheetDialogFragment() { dismiss() } + override fun onCancel(dialog: DialogInterface) = sendSelected() + override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState)