diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt index cc00ff4b4..44a7e245d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/EventActivity.kt @@ -1356,7 +1356,7 @@ class EventActivity : SimpleActivity() { EditRepeatingEventDialog(this) { hideKeyboard() when (it) { - 0 -> { + EDIT_SELECTED_OCCURRENCE -> { ensureBackgroundThread { eventsHelper.addEventRepetitionException(mEvent.id!!, mEventOccurrenceTS, true) mEvent.apply { @@ -1372,8 +1372,7 @@ class EventActivity : SimpleActivity() { } } } - - 1 -> { + EDIT_FUTURE_OCCURRENCES -> { ensureBackgroundThread { eventsHelper.addEventRepeatLimit(mEvent.id!!, mEventOccurrenceTS) mEvent.apply { @@ -1385,8 +1384,7 @@ class EventActivity : SimpleActivity() { } } } - - 2 -> { + EDIT_ALL_OCCURRENCES -> { ensureBackgroundThread { eventsHelper.addEventRepeatLimit(mEvent.id!!, mEventOccurrenceTS) eventsHelper.updateEvent(mEvent, updateAtCalDAV = true, showToasts = true) { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/TaskActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/TaskActivity.kt index 02652bbb2..9dc569daf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/TaskActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/activities/TaskActivity.kt @@ -472,7 +472,7 @@ class TaskActivity : SimpleActivity() { EditRepeatingEventDialog(this, isTask = true) { hideKeyboard() when (it) { - 0 -> { + EDIT_SELECTED_OCCURRENCE -> { ensureBackgroundThread { eventsHelper.addEventRepetitionException(mTask.id!!, mTaskOccurrenceTS, addToCalDAV = false) mTask.apply { @@ -488,7 +488,7 @@ class TaskActivity : SimpleActivity() { } } } - 1 -> { + EDIT_FUTURE_OCCURRENCES -> { ensureBackgroundThread { eventsHelper.addEventRepeatLimit(mTask.id!!, mTaskOccurrenceTS) mTask.apply { @@ -500,7 +500,7 @@ class TaskActivity : SimpleActivity() { } } } - 2 -> { + EDIT_ALL_OCCURRENCES -> { ensureBackgroundThread { eventsHelper.addEventRepeatLimit(mTask.id!!, mTaskOccurrenceTS) eventsHelper.updateEvent(mTask, updateAtCalDAV = false, showToasts = true) { diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/EditRepeatingEventDialog.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/EditRepeatingEventDialog.kt index 974859cff..5627e539e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/EditRepeatingEventDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/EditRepeatingEventDialog.kt @@ -4,6 +4,9 @@ import android.view.ViewGroup import androidx.appcompat.app.AlertDialog import com.simplemobiletools.calendar.pro.R import com.simplemobiletools.calendar.pro.activities.SimpleActivity +import com.simplemobiletools.calendar.pro.helpers.EDIT_ALL_OCCURRENCES +import com.simplemobiletools.calendar.pro.helpers.EDIT_FUTURE_OCCURRENCES +import com.simplemobiletools.calendar.pro.helpers.EDIT_SELECTED_OCCURRENCE import com.simplemobiletools.commons.extensions.getAlertDialogBuilder import com.simplemobiletools.commons.extensions.hideKeyboard import com.simplemobiletools.commons.extensions.setupDialogStuff @@ -14,9 +17,9 @@ class EditRepeatingEventDialog(val activity: SimpleActivity, val isTask: Boolean init { val view = (activity.layoutInflater.inflate(R.layout.dialog_edit_repeating_event, null) as ViewGroup).apply { - edit_repeating_event_one_only.setOnClickListener { sendResult(0) } - edit_repeating_event_this_and_future_occurences.setOnClickListener { sendResult(1) } - edit_repeating_event_all_occurrences.setOnClickListener { sendResult(2) } + edit_repeating_event_one_only.setOnClickListener { sendResult(EDIT_SELECTED_OCCURRENCE) } + edit_repeating_event_this_and_future_occurences.setOnClickListener { sendResult(EDIT_FUTURE_OCCURRENCES) } + edit_repeating_event_all_occurrences.setOnClickListener { sendResult(EDIT_ALL_OCCURRENCES) } if (isTask) { edit_repeating_event_title.setText(R.string.task_is_repeatable) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt index bba9a7c61..c0ea15719 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/CalDAVHelper.kt @@ -502,7 +502,6 @@ class CalDAVHelper(val context: Context) { put(Events.ORIGINAL_ID, event.getCalDAVEventId()) put(Events.EVENT_TIMEZONE, TimeZone.getDefault().id.toString()) put(Events.ORIGINAL_INSTANCE_TIME, occurrenceTS * 1000L) - put(Events.EXDATE, Formatter.getDayCodeFromTS(occurrenceTS)) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt index b3581a4c0..255a2f165 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Constants.kt @@ -232,6 +232,10 @@ const val DELETE_SELECTED_OCCURRENCE = 0 const val DELETE_FUTURE_OCCURRENCES = 1 const val DELETE_ALL_OCCURRENCES = 2 +const val EDIT_SELECTED_OCCURRENCE = 0 +const val EDIT_FUTURE_OCCURRENCES = 1 +const val EDIT_ALL_OCCURRENCES = 2 + const val REMINDER_NOTIFICATION = 0 const val REMINDER_EMAIL = 1