Add type parameter to calendar list
This commit is contained in:
parent
d263f8cbbc
commit
bf29ce6f08
@ -1,5 +1,7 @@
|
|||||||
package de.mm20.launcher2.plugin.contracts
|
package de.mm20.launcher2.plugin.contracts
|
||||||
|
|
||||||
|
import de.mm20.launcher2.search.calendar.CalendarListType
|
||||||
|
|
||||||
abstract class CalendarPluginContract {
|
abstract class CalendarPluginContract {
|
||||||
object EventColumns : Columns() {
|
object EventColumns : Columns() {
|
||||||
/**
|
/**
|
||||||
@ -68,6 +70,7 @@ abstract class CalendarPluginContract {
|
|||||||
val Name = column<String>("name")
|
val Name = column<String>("name")
|
||||||
val Color = column<Int>("color")
|
val Color = column<Int>("color")
|
||||||
val AccountName = column<String>("account_name")
|
val AccountName = column<String>("account_name")
|
||||||
|
val ContentTypes = column<List<CalendarListType>>("content_types")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
package de.mm20.launcher2.search.calendar
|
||||||
|
|
||||||
|
enum class CalendarListType {
|
||||||
|
Calendar,
|
||||||
|
Tasks,
|
||||||
|
}
|
||||||
@ -71,10 +71,3 @@ internal data class AndroidCalendarEvent(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class CalendarList(
|
|
||||||
val id: String,
|
|
||||||
val name: String,
|
|
||||||
val owner: String?,
|
|
||||||
val color: Int,
|
|
||||||
val providerId: String,
|
|
||||||
)
|
|
||||||
@ -0,0 +1,12 @@
|
|||||||
|
package de.mm20.launcher2.calendar.providers
|
||||||
|
|
||||||
|
import de.mm20.launcher2.search.calendar.CalendarListType
|
||||||
|
|
||||||
|
data class CalendarList(
|
||||||
|
val id: String,
|
||||||
|
val name: String,
|
||||||
|
val owner: String?,
|
||||||
|
val color: Int,
|
||||||
|
val types: List<CalendarListType>,
|
||||||
|
val providerId: String,
|
||||||
|
)
|
||||||
@ -174,6 +174,7 @@ class PluginCalendarProvider(
|
|||||||
color = cursor[CalendarListColumns.Color] ?: 0,
|
color = cursor[CalendarListColumns.Color] ?: 0,
|
||||||
name = cursor[CalendarListColumns.Name] ?: continue,
|
name = cursor[CalendarListColumns.Name] ?: continue,
|
||||||
owner = cursor[CalendarListColumns.AccountName],
|
owner = cursor[CalendarListColumns.AccountName],
|
||||||
|
types = cursor[CalendarListColumns.ContentTypes] ?: continue,
|
||||||
providerId = pluginAuthority,
|
providerId = pluginAuthority,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,8 +1,31 @@
|
|||||||
package de.mm20.launcher2.sdk.calendar
|
package de.mm20.launcher2.sdk.calendar
|
||||||
|
|
||||||
|
import de.mm20.launcher2.search.calendar.CalendarListType
|
||||||
|
|
||||||
data class CalendarList(
|
data class CalendarList(
|
||||||
|
/**
|
||||||
|
* A unique identifier for this list.
|
||||||
|
*/
|
||||||
val id: String,
|
val id: String,
|
||||||
|
/**
|
||||||
|
* The display name of this list.
|
||||||
|
*/
|
||||||
val name: String,
|
val name: String,
|
||||||
|
/**
|
||||||
|
* The main content type of this list. This has mainly cosmetic purposes (labels, icons).
|
||||||
|
* It doesn't need to be 100% accurate since the actual type is determined on a per-item basis.
|
||||||
|
* However, the launcher will hide some settings if it doesn't find any lists that would be
|
||||||
|
* affected by them.
|
||||||
|
*/
|
||||||
|
val contentTypes: List<CalendarListType>,
|
||||||
|
/**
|
||||||
|
* The owner account of this list.
|
||||||
|
*/
|
||||||
val accountName: String? = null,
|
val accountName: String? = null,
|
||||||
|
/**
|
||||||
|
* The color of this list, in 0xFFAARRGGBB format.
|
||||||
|
* If null, the launcher will use a default theme color.
|
||||||
|
* The color is corrected to match the launcher's theme (i.e. for dark mode).
|
||||||
|
*/
|
||||||
val color: Int? = null,
|
val color: Int? = null,
|
||||||
)
|
)
|
||||||
@ -105,6 +105,7 @@ abstract class CalendarProvider(
|
|||||||
put(CalendarListColumns.Name, it.name)
|
put(CalendarListColumns.Name, it.name)
|
||||||
put(CalendarListColumns.Color, it.color)
|
put(CalendarListColumns.Color, it.color)
|
||||||
put(CalendarListColumns.AccountName, it.accountName)
|
put(CalendarListColumns.AccountName, it.accountName)
|
||||||
|
put(CalendarListColumns.ContentTypes, it.contentTypes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user