Add option to update this and future occurrences
This commit is contained in:
parent
566039fa1c
commit
18c98171bb
|
@ -1135,25 +1135,41 @@ class EventActivity : SimpleActivity() {
|
||||||
|
|
||||||
private fun showEditRepeatingEventDialog() {
|
private fun showEditRepeatingEventDialog() {
|
||||||
EditRepeatingEventDialog(this) {
|
EditRepeatingEventDialog(this) {
|
||||||
if (it) {
|
when (it) {
|
||||||
ensureBackgroundThread {
|
0 -> {
|
||||||
eventsHelper.updateEvent(mEvent, true, true) {
|
ensureBackgroundThread {
|
||||||
finish()
|
eventsHelper.addEventRepetitionException(mEvent.id!!, mEventOccurrenceTS, true)
|
||||||
|
mEvent.apply {
|
||||||
|
parentId = id!!.toLong()
|
||||||
|
id = null
|
||||||
|
repeatRule = 0
|
||||||
|
repeatInterval = 0
|
||||||
|
repeatLimit = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
eventsHelper.insertEvent(mEvent, true, true) {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
1 -> {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
eventsHelper.addEventRepetitionException(mEvent.id!!, mEventOccurrenceTS, true)
|
eventsHelper.addEventRepeatLimit(mEvent.id!!, mEventOccurrenceTS)
|
||||||
mEvent.apply {
|
mEvent.apply {
|
||||||
parentId = id!!.toLong()
|
id = null
|
||||||
id = null
|
}
|
||||||
repeatRule = 0
|
eventsHelper.insertEvent(mEvent, true, true) {
|
||||||
repeatInterval = 0
|
finish()
|
||||||
repeatLimit = 0
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
eventsHelper.insertEvent(mEvent, true, true) {
|
2 -> {
|
||||||
finish()
|
ensureBackgroundThread {
|
||||||
|
eventsHelper.addEventRepeatLimit(mEvent.id!!, mEventOccurrenceTS)
|
||||||
|
eventsHelper.updateEvent(mEvent, true, true) {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,14 @@ import com.simplemobiletools.commons.extensions.hideKeyboard
|
||||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||||
import kotlinx.android.synthetic.main.dialog_edit_repeating_event.view.*
|
import kotlinx.android.synthetic.main.dialog_edit_repeating_event.view.*
|
||||||
|
|
||||||
class EditRepeatingEventDialog(val activity: SimpleActivity, val callback: (allOccurrences: Boolean) -> Unit) {
|
class EditRepeatingEventDialog(val activity: SimpleActivity, val callback: (allOccurrences: Int) -> Unit) {
|
||||||
var dialog: AlertDialog
|
var dialog: AlertDialog
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val view = (activity.layoutInflater.inflate(R.layout.dialog_edit_repeating_event, null) as ViewGroup).apply {
|
val view = (activity.layoutInflater.inflate(R.layout.dialog_edit_repeating_event, null) as ViewGroup).apply {
|
||||||
edit_repeating_event_one_only.setOnClickListener { sendResult(false) }
|
edit_repeating_event_one_only.setOnClickListener { sendResult(0) }
|
||||||
edit_repeating_event_all_occurrences.setOnClickListener { sendResult(true) }
|
edit_repeating_event_this_and_future_occurences.setOnClickListener { sendResult(1)}
|
||||||
|
edit_repeating_event_all_occurrences.setOnClickListener { sendResult(2) }
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog = AlertDialog.Builder(activity)
|
dialog = AlertDialog.Builder(activity)
|
||||||
|
@ -25,7 +26,7 @@ class EditRepeatingEventDialog(val activity: SimpleActivity, val callback: (allO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun sendResult(allOccurrences: Boolean) {
|
private fun sendResult(allOccurrences: Int) {
|
||||||
callback(allOccurrences)
|
callback(allOccurrences)
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,14 @@
|
||||||
android:paddingTop="@dimen/activity_margin"
|
android:paddingTop="@dimen/activity_margin"
|
||||||
android:text="@string/update_one_only"/>
|
android:text="@string/update_one_only"/>
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||||
|
android:id="@+id/edit_repeating_event_this_and_future_occurences"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="@dimen/activity_margin"
|
||||||
|
android:paddingBottom="@dimen/activity_margin"
|
||||||
|
android:text="@string/update_this_and_future_occurrences" />
|
||||||
|
|
||||||
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||||
android:id="@+id/edit_repeating_event_all_occurrences"
|
android:id="@+id/edit_repeating_event_all_occurrences"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<string name="app_name">Simple Calendar</string>
|
<string name="app_name">Simple Calendar</string>
|
||||||
<string name="app_launcher_name">Calendar</string>
|
<string name="app_launcher_name">Calendar</string>
|
||||||
<string name="change_view">Change view</string>
|
<string name="change_view">Change view</string>
|
||||||
|
@ -51,6 +51,7 @@
|
||||||
<string name="delete_future_occurrences">Delete this and all future occurrences</string>
|
<string name="delete_future_occurrences">Delete this and all future occurrences</string>
|
||||||
<string name="delete_all_occurrences">Delete all occurrences</string>
|
<string name="delete_all_occurrences">Delete all occurrences</string>
|
||||||
<string name="update_one_only">Update the selected occurrence only</string>
|
<string name="update_one_only">Update the selected occurrence only</string>
|
||||||
|
<string name="update_this_and_future_occurrences">Update this and all future occurrences</string>
|
||||||
<string name="update_all_occurrences">Update all occurrences</string>
|
<string name="update_all_occurrences">Update all occurrences</string>
|
||||||
<string name="repeat_till_date">Repeat till a date</string>
|
<string name="repeat_till_date">Repeat till a date</string>
|
||||||
<string name="stop_repeating_after_x">Stop repeating after x occurrences</string>
|
<string name="stop_repeating_after_x">Stop repeating after x occurrences</string>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#Mon Nov 02 19:09:05 CET 2020
|
#Mon Mar 15 09:51:01 EDT 2021
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
|
||||||
|
|
Loading…
Reference in New Issue