mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-06-05 21:59:17 +02:00
add a dialog asking if all occurrences of repeating event should be edited
This commit is contained in:
@@ -10,10 +10,7 @@ import android.view.Menu
|
|||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import com.simplemobiletools.calendar.R
|
import com.simplemobiletools.calendar.R
|
||||||
import com.simplemobiletools.calendar.dialogs.DeleteEventDialog
|
import com.simplemobiletools.calendar.dialogs.*
|
||||||
import com.simplemobiletools.calendar.dialogs.RepeatLimitTypePickerDialog
|
|
||||||
import com.simplemobiletools.calendar.dialogs.RepeatRuleWeeklyDialog
|
|
||||||
import com.simplemobiletools.calendar.dialogs.SelectEventTypeDialog
|
|
||||||
import com.simplemobiletools.calendar.extensions.*
|
import com.simplemobiletools.calendar.extensions.*
|
||||||
import com.simplemobiletools.calendar.helpers.*
|
import com.simplemobiletools.calendar.helpers.*
|
||||||
import com.simplemobiletools.calendar.helpers.Formatter
|
import com.simplemobiletools.calendar.helpers.Formatter
|
||||||
@@ -459,7 +456,17 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
|
|||||||
if (mEvent.id == 0) {
|
if (mEvent.id == 0) {
|
||||||
dbHelper.insert(mEvent)
|
dbHelper.insert(mEvent)
|
||||||
} else {
|
} else {
|
||||||
|
if (mRepeatInterval > 0) {
|
||||||
|
EditRepeatingEventDialog(this) {
|
||||||
|
if (it) {
|
||||||
dbHelper.update(mEvent)
|
dbHelper.update(mEvent)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dbHelper.update(mEvent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,31 @@
|
|||||||
|
package com.simplemobiletools.calendar.dialogs
|
||||||
|
|
||||||
|
import android.support.v7.app.AlertDialog
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.view.WindowManager
|
||||||
|
import com.simplemobiletools.calendar.R
|
||||||
|
import com.simplemobiletools.calendar.activities.SimpleActivity
|
||||||
|
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||||
|
import kotlinx.android.synthetic.main.dialog_edit_repeating_event.view.*
|
||||||
|
|
||||||
|
class EditRepeatingEventDialog(val activity: SimpleActivity, val callback: (allOccurrences: Boolean) -> Unit) : AlertDialog.Builder(activity) {
|
||||||
|
var dialog: AlertDialog
|
||||||
|
|
||||||
|
init {
|
||||||
|
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_all_occurrences.setOnClickListener { sendResult(true) }
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog = AlertDialog.Builder(activity)
|
||||||
|
.create().apply {
|
||||||
|
activity.setupDialogStuff(view, this)
|
||||||
|
window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun sendResult(allOccurrences: Boolean) {
|
||||||
|
callback(allOccurrences)
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
}
|
@@ -13,6 +13,7 @@ import java.io.File
|
|||||||
|
|
||||||
class ExportEventsDialog(val activity: SimpleActivity, val path: String, val callback: (exportPastEvents: Boolean, file: File, eventTypes: HashSet<String>) -> Unit)
|
class ExportEventsDialog(val activity: SimpleActivity, val path: String, val callback: (exportPastEvents: Boolean, file: File, eventTypes: HashSet<String>) -> Unit)
|
||||||
: AlertDialog.Builder(activity) {
|
: AlertDialog.Builder(activity) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val view = (activity.layoutInflater.inflate(R.layout.dialog_export_events, null) as ViewGroup).apply {
|
val view = (activity.layoutInflater.inflate(R.layout.dialog_export_events, null) as ViewGroup).apply {
|
||||||
export_events_folder.text = activity.humanizePath(path)
|
export_events_folder.text = activity.humanizePath(path)
|
||||||
|
42
app/src/main/res/layout/dialog_edit_repeating_event.xml
Normal file
42
app/src/main/res/layout/dialog_edit_repeating_event.xml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/edit_repeating_event_holder"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="@dimen/big_margin"
|
||||||
|
android:paddingRight="@dimen/big_margin"
|
||||||
|
android:paddingTop="@dimen/big_margin">
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyTextView
|
||||||
|
android:id="@+id/edit_repeating_event_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/activity_margin"
|
||||||
|
android:text="@string/event_is_repeatable"/>
|
||||||
|
|
||||||
|
<RadioGroup
|
||||||
|
android:id="@+id/edit_repeating_event_radiogroup"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/activity_margin">
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||||
|
android:id="@+id/edit_repeating_event_one_only"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="@dimen/activity_margin"
|
||||||
|
android:paddingTop="@dimen/activity_margin"
|
||||||
|
android:text="@string/update_one_only"/>
|
||||||
|
|
||||||
|
<com.simplemobiletools.commons.views.MyCompatRadioButton
|
||||||
|
android:id="@+id/edit_repeating_event_all_occurrences"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingBottom="@dimen/activity_margin"
|
||||||
|
android:paddingTop="@dimen/activity_margin"
|
||||||
|
android:text="@string/update_all_occurrences"/>
|
||||||
|
|
||||||
|
</RadioGroup>
|
||||||
|
</LinearLayout>
|
Reference in New Issue
Block a user