Skip to content

Commit 3f6df43

Browse files
feat: pick (absolute) date/time for reminders
ref: #214
1 parent 757730c commit 3f6df43

3 files changed

Lines changed: 43 additions & 12 deletions

File tree

app/src/main/kotlin/org/fossify/calendar/activities/EventActivity.kt

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -844,22 +844,37 @@ class EventActivity : SimpleActivity() {
844844
}
845845

846846
private fun showReminder1Dialog() {
847-
showPickSecondsDialogHelper(mReminder1Minutes, showDuringDayOption = mIsAllDayEvent) {
848-
mReminder1Minutes = if (it == -1 || it == 0) it else it / 60
847+
showPickSecondsDialogHelper(
848+
curMinutes = mReminder1Minutes,
849+
showDuringDayOption = mIsAllDayEvent,
850+
showAbsoluteDateTimeOption = true,
851+
eventStartTS = mEvent.startTS
852+
) { seconds ->
853+
mReminder1Minutes = if (seconds == -1 || seconds == 0) seconds else seconds / 60
849854
checkReminderTexts()
850855
}
851856
}
852857

853858
private fun showReminder2Dialog() {
854-
showPickSecondsDialogHelper(mReminder2Minutes, showDuringDayOption = mIsAllDayEvent) {
855-
mReminder2Minutes = if (it == -1 || it == 0) it else it / 60
859+
showPickSecondsDialogHelper(
860+
curMinutes = mReminder2Minutes,
861+
showDuringDayOption = mIsAllDayEvent,
862+
showAbsoluteDateTimeOption = true,
863+
eventStartTS = mEvent.startTS
864+
) { seconds ->
865+
mReminder2Minutes = if (seconds == -1 || seconds == 0) seconds else seconds / 60
856866
checkReminderTexts()
857867
}
858868
}
859869

860870
private fun showReminder3Dialog() {
861-
showPickSecondsDialogHelper(mReminder3Minutes, showDuringDayOption = mIsAllDayEvent) {
862-
mReminder3Minutes = if (it == -1 || it == 0) it else it / 60
871+
showPickSecondsDialogHelper(
872+
curMinutes = mReminder3Minutes,
873+
showDuringDayOption = mIsAllDayEvent,
874+
showAbsoluteDateTimeOption = true,
875+
eventStartTS = mEvent.startTS
876+
) { seconds ->
877+
mReminder3Minutes = if (seconds == -1 || seconds == 0) seconds else seconds / 60
863878
checkReminderTexts()
864879
}
865880
}

app/src/main/kotlin/org/fossify/calendar/activities/TaskActivity.kt

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -885,22 +885,37 @@ class TaskActivity : SimpleActivity() {
885885
}
886886

887887
private fun showReminder1Dialog() {
888-
showPickSecondsDialogHelper(mReminder1Minutes, showDuringDayOption = mIsAllDayTask) {
889-
mReminder1Minutes = if (it == -1 || it == 0) it else it / 60
888+
showPickSecondsDialogHelper(
889+
curMinutes = mReminder1Minutes,
890+
showDuringDayOption = mIsAllDayTask,
891+
showAbsoluteDateTimeOption = true,
892+
eventStartTS = mTask.startTS
893+
) { seconds ->
894+
mReminder1Minutes = if (seconds == -1 || seconds == 0) seconds else seconds / 60
890895
updateReminderTexts()
891896
}
892897
}
893898

894899
private fun showReminder2Dialog() {
895-
showPickSecondsDialogHelper(mReminder2Minutes, showDuringDayOption = mIsAllDayTask) {
896-
mReminder2Minutes = if (it == -1 || it == 0) it else it / 60
900+
showPickSecondsDialogHelper(
901+
curMinutes = mReminder2Minutes,
902+
showDuringDayOption = mIsAllDayTask,
903+
showAbsoluteDateTimeOption = true,
904+
eventStartTS = mTask.startTS
905+
) { seconds ->
906+
mReminder2Minutes = if (seconds == -1 || seconds == 0) seconds else seconds / 60
897907
updateReminderTexts()
898908
}
899909
}
900910

901911
private fun showReminder3Dialog() {
902-
showPickSecondsDialogHelper(mReminder3Minutes, showDuringDayOption = mIsAllDayTask) {
903-
mReminder3Minutes = if (it == -1 || it == 0) it else it / 60
912+
showPickSecondsDialogHelper(
913+
curMinutes = mReminder3Minutes,
914+
showDuringDayOption = mIsAllDayTask,
915+
showAbsoluteDateTimeOption = true,
916+
eventStartTS = mTask.startTS
917+
) { seconds ->
918+
mReminder3Minutes = if (seconds == -1 || seconds == 0) seconds else seconds / 60
904919
updateReminderTexts()
905920
}
906921
}

app/src/main/kotlin/org/fossify/calendar/helpers/Constants.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const val LAST_VIEW = 6
5353
const val MONTHLY_DAILY_VIEW = 7
5454

5555
const val REMINDER_OFF = -1
56+
const val REMINDER_USE_ABSOLUTE = -2
5657
const val REMINDER_DEFAULT_VALUE = "$REMINDER_OFF,$REMINDER_OFF,$REMINDER_OFF"
5758

5859
const val OTHER_EVENT = 0

0 commit comments

Comments
 (0)