mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2024-12-27 16:53:28 +01:00
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
|
||||
}
|
||||
|
||||
override fun deleteEventTypes(eventTypes: ArrayList<EventType>, deleteEvents: Boolean) {
|
||||
override fun deleteEventTypes(eventTypes: ArrayList<EventType>, deleteEvents: Boolean): Boolean {
|
||||
if (eventTypes.any { it.caldavCalendarId != 0 }) {
|
||||
toast(R.string.unsync_caldav_calendar)
|
||||
if (eventTypes.size == 1) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
dbHelper.deleteEventTypes(eventTypes, deleteEvents) {
|
||||
@ -64,5 +67,6 @@ class ManageEventTypesActivity : SimpleActivity(), DeleteEventTypesListener {
|
||||
toast(R.string.unknown_error_occurred)
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,8 @@ class ManageEventTypesAdapter(activity: SimpleActivity, val eventTypes: ArrayLis
|
||||
}
|
||||
|
||||
eventTypes.removeAll(eventTypesToDelete)
|
||||
listener?.deleteEventTypes(eventTypesToDelete, deleteEvents)
|
||||
removeSelectedItems()
|
||||
if (listener?.deleteEventTypes(eventTypesToDelete, deleteEvents) == true) {
|
||||
removeSelectedItems()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,5 +4,5 @@ import com.simplemobiletools.calendar.models.EventType
|
||||
import java.util.*
|
||||
|
||||
interface DeleteEventTypesListener {
|
||||
fun deleteEventTypes(eventTypes: ArrayList<EventType>, deleteEvents: Boolean)
|
||||
fun deleteEventTypes(eventTypes: ArrayList<EventType>, deleteEvents: Boolean): Boolean
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user