mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-04-24 06:47:27 +02:00
Pass along task completion state in simple event lists
This commit is contained in:
parent
b46514ea52
commit
cfa095e16d
@ -191,27 +191,27 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
|
|||||||
context.eventsHelper.getEventsSync(fromTS, toTS, applyTypeFilter = true) {
|
context.eventsHelper.getEventsSync(fromTS, toTS, applyTypeFilter = true) {
|
||||||
val listItems = ArrayList<ListItem>(it.size)
|
val listItems = ArrayList<ListItem>(it.size)
|
||||||
val replaceDescription = context.config.replaceDescription
|
val replaceDescription = context.config.replaceDescription
|
||||||
val sorted = it.sortedWith(compareBy<Event> {
|
val sorted = it.sortedWith(compareBy<Event> { event ->
|
||||||
if (it.getIsAllDay()) {
|
if (event.getIsAllDay()) {
|
||||||
Formatter.getDayStartTS(Formatter.getDayCodeFromTS(it.startTS)) - 1
|
Formatter.getDayStartTS(Formatter.getDayCodeFromTS(event.startTS)) - 1
|
||||||
} else {
|
} else {
|
||||||
it.startTS
|
event.startTS
|
||||||
}
|
}
|
||||||
}.thenBy {
|
}.thenBy { event ->
|
||||||
if (it.getIsAllDay()) {
|
if (event.getIsAllDay()) {
|
||||||
Formatter.getDayEndTS(Formatter.getDayCodeFromTS(it.endTS))
|
Formatter.getDayEndTS(Formatter.getDayCodeFromTS(event.endTS))
|
||||||
} else {
|
} else {
|
||||||
it.endTS
|
event.endTS
|
||||||
}
|
}
|
||||||
}.thenBy { it.title }.thenBy { if (replaceDescription) it.location else it.description })
|
}.thenBy { event -> event.title }.thenBy { event -> if (replaceDescription) event.location else event.description })
|
||||||
|
|
||||||
var prevCode = ""
|
var prevCode = ""
|
||||||
var prevMonthLabel = ""
|
var prevMonthLabel = ""
|
||||||
val now = getNowSeconds()
|
val now = getNowSeconds()
|
||||||
val today = Formatter.getDayTitle(context, Formatter.getDayCodeFromTS(now))
|
val today = Formatter.getDayTitle(context, Formatter.getDayCodeFromTS(now))
|
||||||
|
|
||||||
sorted.forEach {
|
sorted.forEach { event ->
|
||||||
val code = Formatter.getDayCodeFromTS(it.startTS)
|
val code = Formatter.getDayCodeFromTS(event.startTS)
|
||||||
val monthLabel = Formatter.getLongMonthYear(context, code)
|
val monthLabel = Formatter.getLongMonthYear(context, code)
|
||||||
if (monthLabel != prevMonthLabel) {
|
if (monthLabel != prevMonthLabel) {
|
||||||
val listSectionMonth = ListSectionMonth(monthLabel)
|
val listSectionMonth = ListSectionMonth(monthLabel)
|
||||||
@ -222,24 +222,24 @@ class EventListWidgetAdapter(val context: Context, val intent: Intent) : RemoteV
|
|||||||
if (code != prevCode) {
|
if (code != prevCode) {
|
||||||
val day = Formatter.getDateDayTitle(code)
|
val day = Formatter.getDateDayTitle(code)
|
||||||
val isToday = day == today
|
val isToday = day == today
|
||||||
val listSection = ListSectionDay(day, code, isToday, !isToday && it.startTS < now)
|
val listSection = ListSectionDay(day, code, isToday, !isToday && event.startTS < now)
|
||||||
listItems.add(listSection)
|
listItems.add(listSection)
|
||||||
prevCode = code
|
prevCode = code
|
||||||
}
|
}
|
||||||
|
|
||||||
val listEvent = ListEvent(
|
val listEvent = ListEvent(
|
||||||
it.id!!,
|
event.id!!,
|
||||||
it.startTS,
|
event.startTS,
|
||||||
it.endTS,
|
event.endTS,
|
||||||
it.title,
|
event.title,
|
||||||
it.description,
|
event.description,
|
||||||
it.getIsAllDay(),
|
event.getIsAllDay(),
|
||||||
it.color,
|
event.color,
|
||||||
it.location,
|
event.location,
|
||||||
it.isPastEvent,
|
event.isPastEvent,
|
||||||
it.repeatInterval > 0,
|
event.repeatInterval > 0,
|
||||||
it.isTask(),
|
event.isTask(),
|
||||||
it.isTaskCompleted()
|
event.isTaskCompleted()
|
||||||
)
|
)
|
||||||
listItems.add(listEvent)
|
listItems.add(listEvent)
|
||||||
}
|
}
|
||||||
|
@ -637,6 +637,7 @@ fun Context.editEvent(event: ListEvent) {
|
|||||||
Intent(this, getActivityToOpen(event.isTask)).apply {
|
Intent(this, getActivityToOpen(event.isTask)).apply {
|
||||||
putExtra(EVENT_ID, event.id)
|
putExtra(EVENT_ID, event.id)
|
||||||
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
|
putExtra(EVENT_OCCURRENCE_TS, event.startTS)
|
||||||
|
putExtra(IS_TASK_COMPLETED, event.isTaskCompleted)
|
||||||
startActivity(this)
|
startActivity(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user