prevent Event Type remove animation if it wasnt deleted
This commit is contained in:
parent
9e7d99b822
commit
fff3f05a99
|
@ -54,9 +54,12 @@ class ManageEventTypesActivity : SimpleActivity(), DeleteEventTypesListener {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun deleteEventTypes(eventTypes: ArrayList<EventType>, deleteEvents: Boolean) {
|
override fun deleteEventTypes(eventTypes: ArrayList<EventType>, deleteEvents: Boolean): Boolean {
|
||||||
if (eventTypes.any { it.caldavCalendarId != 0 }) {
|
if (eventTypes.any { it.caldavCalendarId != 0 }) {
|
||||||
toast(R.string.unsync_caldav_calendar)
|
toast(R.string.unsync_caldav_calendar)
|
||||||
|
if (eventTypes.size == 1) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbHelper.deleteEventTypes(eventTypes, deleteEvents) {
|
dbHelper.deleteEventTypes(eventTypes, deleteEvents) {
|
||||||
|
@ -64,5 +67,6 @@ class ManageEventTypesActivity : SimpleActivity(), DeleteEventTypesListener {
|
||||||
toast(R.string.unknown_error_occurred)
|
toast(R.string.unknown_error_occurred)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,8 @@ class ManageEventTypesAdapter(activity: SimpleActivity, val eventTypes: ArrayLis
|
||||||
}
|
}
|
||||||
|
|
||||||
eventTypes.removeAll(eventTypesToDelete)
|
eventTypes.removeAll(eventTypesToDelete)
|
||||||
listener?.deleteEventTypes(eventTypesToDelete, deleteEvents)
|
if (listener?.deleteEventTypes(eventTypesToDelete, deleteEvents) == true) {
|
||||||
removeSelectedItems()
|
removeSelectedItems()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -4,5 +4,5 @@ import com.simplemobiletools.calendar.models.EventType
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
interface DeleteEventTypesListener {
|
interface DeleteEventTypesListener {
|
||||||
fun deleteEventTypes(eventTypes: ArrayList<EventType>, deleteEvents: Boolean)
|
fun deleteEventTypes(eventTypes: ArrayList<EventType>, deleteEvents: Boolean): Boolean
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue