diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/EditEventTypeDialog.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/EditEventTypeDialog.kt index f0de7addf..4e4c5224b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/EditEventTypeDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/dialogs/EditEventTypeDialog.kt @@ -16,8 +16,9 @@ class EditEventTypeDialog(val activity: Activity, var eventType: EventType? = nu var isNewEvent = eventType == null init { - if (eventType == null) + if (eventType == null) { eventType = EventType(null, "", activity.config.primaryColor) + } val view = activity.layoutInflater.inflate(R.layout.dialog_event_type, null).apply { setupColor(type_color) diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt index 1238b0741..e7602b384 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/Config.kt @@ -75,6 +75,12 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getStringSet(QUICK_FILTER_EVENT_TYPES, HashSet())!! set(quickFilterEventTypes) = prefs.edit().remove(QUICK_FILTER_EVENT_TYPES).putStringSet(QUICK_FILTER_EVENT_TYPES, quickFilterEventTypes).apply() + fun addQuickFilterEventType(type: String) { + val currQuickFilterEventTypes = HashSet(quickFilterEventTypes) + currQuickFilterEventTypes.add(type) + quickFilterEventTypes = currQuickFilterEventTypes + } + var listWidgetViewToOpen: Int get() = prefs.getInt(LIST_WIDGET_VIEW_TO_OPEN, DAILY_VIEW) set(viewToOpenFromListWidget) = prefs.edit().putInt(LIST_WIDGET_VIEW_TO_OPEN, viewToOpenFromListWidget).apply() @@ -118,7 +124,8 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(DIM_PAST_EVENTS, true) set(dimPastEvents) = prefs.edit().putBoolean(DIM_PAST_EVENTS, dimPastEvents).apply() - fun getSyncedCalendarIdsAsList() = caldavSyncedCalendarIds.split(",").filter { it.trim().isNotEmpty() }.map { Integer.parseInt(it) }.toMutableList() as ArrayList + fun getSyncedCalendarIdsAsList() = + caldavSyncedCalendarIds.split(",").filter { it.trim().isNotEmpty() }.map { Integer.parseInt(it) }.toMutableList() as ArrayList fun getDisplayEventTypessAsList() = displayEventTypes.map { it.toLong() }.toMutableList() as ArrayList diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt index dcf5b1875..7ab6d8ba7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/pro/helpers/EventsHelper.kt @@ -55,6 +55,10 @@ class EventsHelper(val context: Context) { val newId = eventTypesDB.insertOrUpdate(eventType) if (eventType.id == null) { config.addDisplayEventType(newId.toString()) + + if (config.quickFilterEventTypes.isNotEmpty()) { + config.addQuickFilterEventType(newId.toString()) + } } return newId }