From 390b87042627d74bbe1e88dc2776f8c8e7764236 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Fri, 10 Apr 2020 08:36:15 -0500 Subject: [PATCH] Accept time change in onCancel --- app/src/main/java/org/tasks/dialogs/DateTimePicker.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)