fix #672, make sure we show the 2 line event entry if description is filled

This commit is contained in:
tibbi 2018-10-23 23:14:01 +02:00
parent 3114e0bb6e
commit df944a961f
3 changed files with 10 additions and 4 deletions

View File

@ -74,7 +74,9 @@ class DayEventsAdapter(activity: SimpleActivity, val events: ArrayList<Event>, r
override fun getItemViewType(position: Int): Int { override fun getItemViewType(position: Int): Int {
val event = events[position] val event = events[position]
val detailField = if (replaceDescriptionWithLocation) event.location else event.description val detailField = if (replaceDescriptionWithLocation) event.location else event.description
return if (event.startTS == event.endTS && detailField.isEmpty()) { return if (detailField.isNotEmpty()) {
ITEM_EVENT
} else if (event.startTS == event.endTS) {
ITEM_EVENT_SIMPLE ITEM_EVENT_SIMPLE
} else if (event.getIsAllDay()) { } else if (event.getIsAllDay()) {
val startCode = Formatter.getDayCodeFromTS(event.startTS) val startCode = Formatter.getDayCodeFromTS(event.startTS)

View File

@ -100,7 +100,9 @@ class EventListAdapter(activity: SimpleActivity, var listItems: ArrayList<ListIt
override fun getItemViewType(position: Int) = if (listItems[position] is ListEvent) { override fun getItemViewType(position: Int) = if (listItems[position] is ListEvent) {
val event = listItems[position] as ListEvent val event = listItems[position] as ListEvent
val detailField = if (replaceDescription) event.location else event.description val detailField = if (replaceDescription) event.location else event.description
if (event.startTS == event.endTS && detailField.isEmpty()) { if (detailField.isNotEmpty()) {
ITEM_EVENT
} else if (event.startTS == event.endTS) {
ITEM_EVENT_SIMPLE ITEM_EVENT_SIMPLE
} else if (event.isAllDay) { } else if (event.isAllDay) {
val startCode = Formatter.getDayCodeFromTS(event.startTS) val startCode = Formatter.getDayCodeFromTS(event.startTS)

View File

@ -52,9 +52,11 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
return remoteView return remoteView
} }
fun getItemViewLayout(event: ListEvent): Int { private fun getItemViewLayout(event: ListEvent): Int {
val detailField = if (replaceDescription) event.location else event.description val detailField = if (replaceDescription) event.location else event.description
return if (event.startTS == event.endTS && detailField.isEmpty()) { return if (detailField.isNotEmpty()) {
R.layout.event_list_item_widget
} else if (event.startTS == event.endTS) {
R.layout.event_list_item_widget_simple R.layout.event_list_item_widget_simple
} else if (event.isAllDay) { } else if (event.isAllDay) {
val startCode = Formatter.getDayCodeFromTS(event.startTS) val startCode = Formatter.getDayCodeFromTS(event.startTS)