show if an event lasts multiple days
This commit is contained in:
parent
9702c155ad
commit
a28e45d5b4
|
@ -134,8 +134,16 @@ class EventListAdapter(
|
|||
event_item_holder.background.applyColorFilter(textColor)
|
||||
event_item_title.text = listEvent.title
|
||||
event_item_time.text = if (listEvent.isAllDay) allDayString else Formatter.getTimeFromTS(context, listEvent.startTS)
|
||||
if (listEvent.startTS != listEvent.endTS && !listEvent.isAllDay) {
|
||||
event_item_time.text = "${event_item_time.text} - ${Formatter.getTimeFromTS(context, listEvent.endTS)}"
|
||||
if (listEvent.startTS != listEvent.endTS) {
|
||||
if (!listEvent.isAllDay) {
|
||||
event_item_time.text = "${event_item_time.text} - ${Formatter.getTimeFromTS(context, listEvent.endTS)}"
|
||||
}
|
||||
|
||||
val startCode = Formatter.getDayCodeFromTS(listEvent.startTS)
|
||||
val endCode = Formatter.getDayCodeFromTS(listEvent.endTS)
|
||||
if (startCode != endCode) {
|
||||
event_item_time.text = "${event_item_time.text} (${Formatter.getDateDayTitle(endCode)})"
|
||||
}
|
||||
}
|
||||
|
||||
event_item_description.text = if (replaceDescription) listEvent.location else listEvent.description
|
||||
|
|
|
@ -62,7 +62,17 @@ class EventListWidgetAdapter(val context: Context) : RemoteViewsService.RemoteVi
|
|||
setBackgroundColor(R.id.event_item_color_bar, item.color)
|
||||
setText(R.id.event_item_title, item.title)
|
||||
|
||||
val timeText = if (item.isAllDay) allDayString else Formatter.getTimeFromTS(context, item.startTS)
|
||||
var timeText = if (item.isAllDay) allDayString else Formatter.getTimeFromTS(context, item.startTS)
|
||||
if (!item.isAllDay) {
|
||||
timeText += " - ${Formatter.getTimeFromTS(context, item.endTS)}"
|
||||
}
|
||||
|
||||
val startCode = Formatter.getDayCodeFromTS(item.startTS)
|
||||
val endCode = Formatter.getDayCodeFromTS(item.endTS)
|
||||
if (startCode != endCode) {
|
||||
timeText += " (${Formatter.getDateDayTitle(endCode)})"
|
||||
}
|
||||
|
||||
setText(R.id.event_item_time, timeText)
|
||||
|
||||
// we cannot change the event_item_color_bar rules dynamically, so do it like this
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
android:id="@+id/event_item_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/medium_margin"
|
||||
android:layout_marginStart="@dimen/small_margin"
|
||||
android:layout_marginTop="@dimen/small_margin"
|
||||
android:layout_marginEnd="@dimen/medium_margin"
|
||||
android:layout_marginEnd="@dimen/small_margin"
|
||||
android:layout_marginBottom="@dimen/medium_margin"
|
||||
android:background="@drawable/section_holder_stroke"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
|
@ -41,7 +41,10 @@
|
|||
android:layout_below="@+id/event_item_title"
|
||||
android:layout_alignStart="@+id/event_item_title"
|
||||
android:alpha="0.8"
|
||||
android:ellipsize="end"
|
||||
android:lineSpacingExtra="2dp"
|
||||
android:maxLines="2"
|
||||
android:paddingEnd="@dimen/small_margin"
|
||||
android:textSize="@dimen/normal_text_size"
|
||||
tools:text="13:00" />
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/widget_event_new_event"
|
||||
android:clipToPadding="false"
|
||||
android:paddingStart="@dimen/medium_margin"
|
||||
android:paddingBottom="@dimen/small_margin" />
|
||||
|
||||
<TextView
|
||||
|
|
Loading…
Reference in New Issue