update text colors depending on the event state
This commit is contained in:
parent
8003febf23
commit
53792443d1
|
@ -38,6 +38,7 @@ class EventListAdapter(val activity: SimpleActivity, val mItems: List<ListItem>,
|
||||||
var mNow = (System.currentTimeMillis() / 1000).toInt()
|
var mNow = (System.currentTimeMillis() / 1000).toInt()
|
||||||
var primaryColor = 0
|
var primaryColor = 0
|
||||||
var textColor = 0
|
var textColor = 0
|
||||||
|
var redTextColor = 0
|
||||||
var todayDate = ""
|
var todayDate = ""
|
||||||
var allDayString = ""
|
var allDayString = ""
|
||||||
|
|
||||||
|
@ -58,6 +59,7 @@ class EventListAdapter(val activity: SimpleActivity, val mItems: List<ListItem>,
|
||||||
allDayString = res.getString(R.string.all_day)
|
allDayString = res.getString(R.string.all_day)
|
||||||
topDivider = res.getDrawable(R.drawable.divider_width)
|
topDivider = res.getDrawable(R.drawable.divider_width)
|
||||||
textColor = activity.config.textColor
|
textColor = activity.config.textColor
|
||||||
|
redTextColor = res.getColor(R.color.red_text)
|
||||||
primaryColor = activity.config.primaryColor
|
primaryColor = activity.config.primaryColor
|
||||||
val mTodayCode = Formatter.getDayCodeFromTS(mNow)
|
val mTodayCode = Formatter.getDayCodeFromTS(mNow)
|
||||||
todayDate = Formatter.getDayTitle(activity, mTodayCode)
|
todayDate = Formatter.getDayTitle(activity, mTodayCode)
|
||||||
|
@ -168,11 +170,19 @@ class EventListAdapter(val activity: SimpleActivity, val mItems: List<ListItem>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val currTextColor = if (item.startTS <= mNow) primaryColor else textColor
|
var startTextColor = textColor
|
||||||
event_item_start.setTextColor(currTextColor)
|
var endTextColor = textColor
|
||||||
event_item_end.setTextColor(currTextColor)
|
if (item.startTS <= mNow && item.endTS <= mNow) {
|
||||||
event_item_title.setTextColor(currTextColor)
|
startTextColor = redTextColor
|
||||||
event_item_description.setTextColor(currTextColor)
|
endTextColor = redTextColor
|
||||||
|
} else if (item.startTS <= mNow && item.endTS >= mNow) {
|
||||||
|
startTextColor = primaryColor
|
||||||
|
}
|
||||||
|
|
||||||
|
event_item_start.setTextColor(startTextColor)
|
||||||
|
event_item_end.setTextColor(endTextColor)
|
||||||
|
event_item_title.setTextColor(startTextColor)
|
||||||
|
event_item_description.setTextColor(startTextColor)
|
||||||
|
|
||||||
setOnClickListener { viewClicked(multiSelector, listItem, pos) }
|
setOnClickListener { viewClicked(multiSelector, listItem, pos) }
|
||||||
setOnLongClickListener {
|
setOnLongClickListener {
|
||||||
|
|
Loading…
Reference in New Issue