add newly created event types to quick filtering
This commit is contained in:
parent
27e917c807
commit
2d6d675758
|
@ -16,8 +16,9 @@ class EditEventTypeDialog(val activity: Activity, var eventType: EventType? = nu
|
||||||
var isNewEvent = eventType == null
|
var isNewEvent = eventType == null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (eventType == null)
|
if (eventType == null) {
|
||||||
eventType = EventType(null, "", activity.config.primaryColor)
|
eventType = EventType(null, "", activity.config.primaryColor)
|
||||||
|
}
|
||||||
|
|
||||||
val view = activity.layoutInflater.inflate(R.layout.dialog_event_type, null).apply {
|
val view = activity.layoutInflater.inflate(R.layout.dialog_event_type, null).apply {
|
||||||
setupColor(type_color)
|
setupColor(type_color)
|
||||||
|
|
|
@ -75,6 +75,12 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
get() = prefs.getStringSet(QUICK_FILTER_EVENT_TYPES, HashSet<String>())!!
|
get() = prefs.getStringSet(QUICK_FILTER_EVENT_TYPES, HashSet<String>())!!
|
||||||
set(quickFilterEventTypes) = prefs.edit().remove(QUICK_FILTER_EVENT_TYPES).putStringSet(QUICK_FILTER_EVENT_TYPES, quickFilterEventTypes).apply()
|
set(quickFilterEventTypes) = prefs.edit().remove(QUICK_FILTER_EVENT_TYPES).putStringSet(QUICK_FILTER_EVENT_TYPES, quickFilterEventTypes).apply()
|
||||||
|
|
||||||
|
fun addQuickFilterEventType(type: String) {
|
||||||
|
val currQuickFilterEventTypes = HashSet<String>(quickFilterEventTypes)
|
||||||
|
currQuickFilterEventTypes.add(type)
|
||||||
|
quickFilterEventTypes = currQuickFilterEventTypes
|
||||||
|
}
|
||||||
|
|
||||||
var listWidgetViewToOpen: Int
|
var listWidgetViewToOpen: Int
|
||||||
get() = prefs.getInt(LIST_WIDGET_VIEW_TO_OPEN, DAILY_VIEW)
|
get() = prefs.getInt(LIST_WIDGET_VIEW_TO_OPEN, DAILY_VIEW)
|
||||||
set(viewToOpenFromListWidget) = prefs.edit().putInt(LIST_WIDGET_VIEW_TO_OPEN, viewToOpenFromListWidget).apply()
|
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)
|
get() = prefs.getBoolean(DIM_PAST_EVENTS, true)
|
||||||
set(dimPastEvents) = prefs.edit().putBoolean(DIM_PAST_EVENTS, dimPastEvents).apply()
|
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<Int>
|
fun getSyncedCalendarIdsAsList() =
|
||||||
|
caldavSyncedCalendarIds.split(",").filter { it.trim().isNotEmpty() }.map { Integer.parseInt(it) }.toMutableList() as ArrayList<Int>
|
||||||
|
|
||||||
fun getDisplayEventTypessAsList() = displayEventTypes.map { it.toLong() }.toMutableList() as ArrayList<Long>
|
fun getDisplayEventTypessAsList() = displayEventTypes.map { it.toLong() }.toMutableList() as ArrayList<Long>
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,10 @@ class EventsHelper(val context: Context) {
|
||||||
val newId = eventTypesDB.insertOrUpdate(eventType)
|
val newId = eventTypesDB.insertOrUpdate(eventType)
|
||||||
if (eventType.id == null) {
|
if (eventType.id == null) {
|
||||||
config.addDisplayEventType(newId.toString())
|
config.addDisplayEventType(newId.toString())
|
||||||
|
|
||||||
|
if (config.quickFilterEventTypes.isNotEmpty()) {
|
||||||
|
config.addQuickFilterEventType(newId.toString())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return newId
|
return newId
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue