Updated to work with the new option in the PickSecondsDialog, the option for a during day reminder

This commit is contained in:
Acácio Correia 2021-01-30 11:23:51 +00:00
parent b2da583a33
commit 0d1e2a95da
5 changed files with 23 additions and 21 deletions

View File

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

View File

@ -67,6 +67,7 @@ class EventActivity : SimpleActivity() {
private val EVENT_CALENDAR_ID = "EVENT_CALENDAR_ID"
private val SELECT_TIME_ZONE_INTENT = 1
private var mIsAllDayEvent = false
private var mReminder1Minutes = REMINDER_OFF
private var mReminder2Minutes = REMINDER_OFF
private var mReminder3Minutes = REMINDER_OFF
@ -543,22 +544,22 @@ class EventActivity : SimpleActivity() {
}
private fun showReminder1Dialog() {
showPickSecondsDialogHelper(mReminder1Minutes) {
mReminder1Minutes = if (it <= 0) it else it / 60
showPickSecondsDialogHelper(mReminder1Minutes, showDuringDayOption = mIsAllDayEvent){
mReminder1Minutes = if (it == -1 || it == 0) it else it / 60
checkReminderTexts()
}
}
private fun showReminder2Dialog() {
showPickSecondsDialogHelper(mReminder2Minutes) {
mReminder2Minutes = if (it <= 0) it else it / 60
showPickSecondsDialogHelper(mReminder2Minutes, showDuringDayOption = mIsAllDayEvent){
mReminder2Minutes = if (it == -1 || it == 0) it else it / 60
checkReminderTexts()
}
}
private fun showReminder3Dialog() {
showPickSecondsDialogHelper(mReminder3Minutes) {
mReminder3Minutes = if (it <= 0) it else it / 60
showPickSecondsDialogHelper(mReminder3Minutes, showDuringDayOption = mIsAllDayEvent){
mReminder3Minutes = if (it == -1 || it == 0) it else it / 60
checkReminderTexts()
}
}
@ -959,6 +960,7 @@ class EventActivity : SimpleActivity() {
}
private fun toggleAllDay(isChecked: Boolean) {
mIsAllDayEvent = isChecked
hideKeyboard()
event_start_time.beGoneIf(isChecked)
event_end_time.beGoneIf(isChecked)

View File

@ -421,7 +421,7 @@ class SettingsActivity : SimpleActivity() {
settings_default_reminder_1.text = getFormattedMinutes(config.defaultReminder1)
settings_default_reminder_1_holder.setOnClickListener {
showPickSecondsDialogHelper(config.defaultReminder1) {
config.defaultReminder1 = if (it <= 0) it else it / 60
config.defaultReminder1 = if (it == -1 || it == 0) it else it / 60
settings_default_reminder_1.text = getFormattedMinutes(config.defaultReminder1)
}
}
@ -431,7 +431,7 @@ class SettingsActivity : SimpleActivity() {
settings_default_reminder_2.text = getFormattedMinutes(config.defaultReminder2)
settings_default_reminder_2_holder.setOnClickListener {
showPickSecondsDialogHelper(config.defaultReminder2) {
config.defaultReminder2 = if (it <= 0) it else it / 60
config.defaultReminder2 = if (it == -1 || it == 0) it else it / 60
settings_default_reminder_2.text = getFormattedMinutes(config.defaultReminder2)
}
}
@ -441,7 +441,7 @@ class SettingsActivity : SimpleActivity() {
settings_default_reminder_3.text = getFormattedMinutes(config.defaultReminder3)
settings_default_reminder_3_holder.setOnClickListener {
showPickSecondsDialogHelper(config.defaultReminder3) {
config.defaultReminder3 = if (it <= 0) it else it / 60
config.defaultReminder3 = if (it == -1 || it == 0) it else it / 60
settings_default_reminder_3.text = getFormattedMinutes(config.defaultReminder3)
}
}

View File

@ -21,28 +21,28 @@ class SetRemindersDialog(val activity: Activity, val callback: (reminders: Array
set_reminders_3.text = activity.getFormattedMinutes(mReminder1Minutes)
set_reminders_1.setOnClickListener {
activity.showPickSecondsDialogHelper(mReminder1Minutes) {
mReminder1Minutes = if (it <= 0) it else it / 60
activity.showPickSecondsDialogHelper(mReminder1Minutes, showDuringDayOption = true) {
mReminder1Minutes = if (it == -1 || it == 0) it else it / 60
set_reminders_1.text = activity.getFormattedMinutes(mReminder1Minutes)
if (mReminder1Minutes != -1) {
if (mReminder1Minutes != REMINDER_OFF) {
set_reminders_2.beVisible()
}
}
}
set_reminders_2.setOnClickListener {
activity.showPickSecondsDialogHelper(mReminder2Minutes) {
mReminder2Minutes = if (it <= 0) it else it / 60
activity.showPickSecondsDialogHelper(mReminder2Minutes, showDuringDayOption = true) {
mReminder2Minutes = if (it == -1 || it == 0) it else it / 60
set_reminders_2.text = activity.getFormattedMinutes(mReminder2Minutes)
if (mReminder2Minutes != -1) {
if (mReminder2Minutes != REMINDER_OFF) {
set_reminders_3.beVisible()
}
}
}
set_reminders_3.setOnClickListener {
activity.showPickSecondsDialogHelper(mReminder3Minutes) {
mReminder3Minutes = if (it <= 0) it else it / 60
activity.showPickSecondsDialogHelper(mReminder3Minutes, showDuringDayOption = true) {
mReminder3Minutes = if (it == -1 || it == 0) it else it / 60
set_reminders_3.text = activity.getFormattedMinutes(mReminder3Minutes)
}
}

View File

@ -6,7 +6,7 @@ import androidx.collection.LongSparseArray
import com.simplemobiletools.calendar.pro.extensions.*
import com.simplemobiletools.calendar.pro.models.Event
import com.simplemobiletools.calendar.pro.models.EventType
import com.simplemobiletools.commons.extensions.getChoppedList
import com.simplemobiletools.commons.helpers.CHOPPED_LIST_DEFAULT_SIZE
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
class EventsHelper(val context: Context) {
@ -146,7 +146,7 @@ class EventsHelper(val context: Context) {
return
}
ids.getChoppedList().forEach {
ids.chunked(CHOPPED_LIST_DEFAULT_SIZE).forEach {
val eventsWithImportId = eventsDB.getEventsByIdsWithImportIds(it)
eventsDB.deleteEvents(it)
@ -160,7 +160,7 @@ class EventsHelper(val context: Context) {
}
}
deleteChildEvents(it, deleteFromCalDAV)
deleteChildEvents(it as MutableList<Long>, deleteFromCalDAV)
context.updateWidgets()
}
}