adding an extra check to avoid setting during day reminders to non-all-day events

This commit is contained in:
tibbi 2021-02-12 16:11:53 +01:00
parent ac336b64d1
commit effbe4d330
4 changed files with 20 additions and 6 deletions

View File

@ -17,7 +17,7 @@ insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
continuation_indent_size = 8
continuation_indent_size = 4
[*.xml]
continuation_indent_size = 4

View File

@ -64,7 +64,7 @@ android {
}
dependencies {
implementation 'com.simplemobiletools:commons:5.33.20'
implementation 'com.simplemobiletools:commons:5.33.26'
implementation 'joda-time:joda-time:2.10.1'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

View File

@ -544,21 +544,21 @@ class EventActivity : SimpleActivity() {
}
private fun showReminder1Dialog() {
showPickSecondsDialogHelper(mReminder1Minutes, showDuringDayOption = mIsAllDayEvent){
showPickSecondsDialogHelper(mReminder1Minutes, showDuringDayOption = mIsAllDayEvent) {
mReminder1Minutes = if (it == -1 || it == 0) it else it / 60
checkReminderTexts()
}
}
private fun showReminder2Dialog() {
showPickSecondsDialogHelper(mReminder2Minutes, showDuringDayOption = mIsAllDayEvent){
showPickSecondsDialogHelper(mReminder2Minutes, showDuringDayOption = mIsAllDayEvent) {
mReminder2Minutes = if (it == -1 || it == 0) it else it / 60
checkReminderTexts()
}
}
private fun showReminder3Dialog() {
showPickSecondsDialogHelper(mReminder3Minutes, showDuringDayOption = mIsAllDayEvent){
showPickSecondsDialogHelper(mReminder3Minutes, showDuringDayOption = mIsAllDayEvent) {
mReminder3Minutes = if (it == -1 || it == 0) it else it / 60
checkReminderTexts()
}
@ -1060,6 +1060,20 @@ class EventActivity : SimpleActivity() {
}
val reminders = getReminders()
if (!event_all_day.isChecked) {
if (reminders.getOrNull(2)?.minutes ?: 0 < -1) {
reminders.removeAt(2)
}
if (reminders.getOrNull(1)?.minutes ?: 0 < -1) {
reminders.removeAt(1)
}
if (reminders.getOrNull(0)?.minutes ?: 0 < -1) {
reminders.removeAt(0)
}
}
val reminder1 = reminders.getOrNull(0) ?: Reminder(REMINDER_OFF, REMINDER_NOTIFICATION)
val reminder2 = reminders.getOrNull(1) ?: Reminder(REMINDER_OFF, REMINDER_NOTIFICATION)
val reminder3 = reminders.getOrNull(2) ?: Reminder(REMINDER_OFF, REMINDER_NOTIFICATION)

View File

@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.4.21'
ext.kotlin_version = '1.4.30'
repositories {
google()