adjustment to events list view for events lasting over midnight

This commit is contained in:
tibbi 2016-11-03 20:54:01 +01:00
parent c826ef12ac
commit 792f972c96
2 changed files with 9 additions and 2 deletions

View File

@ -14,7 +14,7 @@ import com.simplemobiletools.calendar.models.ListItem
import com.simplemobiletools.calendar.models.ListSection
import kotlinx.android.synthetic.main.event_item.view.*
class EventsListAdapter(context: Context, val mEvents: List<ListItem>) : BaseAdapter() {
class EventsListAdapter(val context: Context, val mEvents: List<ListItem>) : BaseAdapter() {
val ITEM_EVENT = 0
val ITEM_HEADER = 1
@ -63,6 +63,12 @@ class EventsListAdapter(context: Context, val mEvents: List<ListItem>) : BaseAda
} else {
end?.text = Formatter.getTime(item.endTS)
end?.visibility = View.VISIBLE
val startCode = Formatter.getDayCodeFromTS(item.startTS)
val endCode = Formatter.getDayCodeFromTS(item.endTS)
if (startCode != endCode) {
end?.append(" (${Formatter.getEventDate(context, endCode)})")
}
}
val currTextColor = if (item.startTS <= mNow) mOrangeColor else mGreyColor

View File

@ -7,6 +7,7 @@
android:background="@drawable/event_item_background"
android:paddingBottom="@dimen/event_padding"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/small_padding">
<TextView
@ -40,7 +41,7 @@
android:layout_height="wrap_content"
android:layout_below="@+id/event_item_title"
android:layout_marginLeft="@dimen/activity_margin"
android:layout_toRightOf="@+id/event_item_start"
android:layout_toRightOf="@+id/event_item_end"
android:alpha=".4"
android:maxLines="1"
android:text="Event description"