use the actual event type colors at weekly view
This commit is contained in:
parent
58e1a4e88d
commit
5babf8acd2
2 changed files with 8 additions and 2 deletions
|
@ -6,6 +6,7 @@ import android.content.pm.PackageManager
|
|||
import android.os.Bundle
|
||||
import android.support.v4.app.ActivityCompat
|
||||
import android.support.v4.view.ViewPager
|
||||
import android.util.SparseIntArray
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.widget.TextView
|
||||
|
@ -51,6 +52,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||
|
||||
companion object {
|
||||
var mWeekScrollY = 0
|
||||
var eventTypeColors = SparseIntArray(3)
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
@ -66,6 +68,10 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||
if (mStoredTextColor != config.textColor || mStoredBackgroundColor != config.backgroundColor || mStoredPrimaryColor != config.primaryColor)
|
||||
updateViewPager()
|
||||
|
||||
DBHelper.newInstance(applicationContext).getEventTypes {
|
||||
eventTypeColors.clear()
|
||||
it.map { eventTypeColors.put(it.id, it.color) }
|
||||
}
|
||||
mStoredTextColor = config.textColor
|
||||
mStoredPrimaryColor = config.primaryColor
|
||||
mStoredBackgroundColor = config.backgroundColor
|
||||
|
|
|
@ -234,7 +234,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
val duration = endDateTime.minuteOfDay - startMinutes
|
||||
|
||||
(inflater.inflate(R.layout.week_event_marker, null, false) as TextView).apply {
|
||||
background = ColorDrawable(primaryColor)
|
||||
background = ColorDrawable(MainActivity.eventTypeColors.get(event.eventType, primaryColor))
|
||||
text = event.title
|
||||
activity.runOnUiThread {
|
||||
layout.addView(this)
|
||||
|
@ -295,7 +295,7 @@ class WeekFragment : Fragment(), WeeklyCalendar {
|
|||
|
||||
private fun addAllDayEvent(event: Event) {
|
||||
(inflater.inflate(R.layout.week_all_day_event_marker, null, false) as TextView).apply {
|
||||
background = ColorDrawable(primaryColor)
|
||||
background = ColorDrawable(MainActivity.eventTypeColors.get(event.eventType, primaryColor))
|
||||
text = event.title
|
||||
|
||||
val startDateTime = Formatter.getDateTimeFromTS(event.startTS)
|
||||
|
|
Loading…
Reference in a new issue