mark days with events with underlining, today with a circle

This commit is contained in:
tibbi 2017-01-03 23:15:24 +01:00
parent f08bafc0ee
commit 17ae73da68
1 changed files with 10 additions and 6 deletions

View File

@ -2,6 +2,7 @@ package com.simplemobiletools.calendar.fragments
import android.content.Intent import android.content.Intent
import android.content.res.Resources import android.content.res.Resources
import android.graphics.Paint
import android.graphics.PorterDuff import android.graphics.PorterDuff
import android.os.Bundle import android.os.Bundle
import android.support.v4.app.Fragment import android.support.v4.app.Fragment
@ -180,22 +181,25 @@ class MonthFragment : Fragment(), MonthlyCalendar {
} }
val eventBackground = resources.getDrawable(R.drawable.circle_empty) val eventBackground = resources.getDrawable(R.drawable.circle_empty)
eventBackground.setColorFilter(mTextColor.adjustAlpha(LOW_ALPHA), PorterDuff.Mode.SRC_IN) eventBackground.setColorFilter(mTextColor.adjustAlpha(HIGH_ALPHA), PorterDuff.Mode.SRC_IN)
for (i in 0..len - 1) { for (i in 0..len - 1) {
val day = days[i] val day = days[i]
var curTextSize = mDayTextSize var curTextColor = mWeakTextColor
if (day.isToday) { if (day.isThisMonth) {
curTextSize = mTodayTextSize curTextColor = mTextColor
} }
(mHolder.findViewById(mRes.getIdentifier("day_$i", "id", mPackageName)) as TextView).apply { (mHolder.findViewById(mRes.getIdentifier("day_$i", "id", mPackageName)) as TextView).apply {
text = day.value.toString() text = day.value.toString()
setTextColor(mTextColor) setTextColor(curTextColor)
textSize = curTextSize
setOnClickListener { openDay(day.code) } setOnClickListener { openDay(day.code) }
if (day.hasEvent) if (day.hasEvent)
paintFlags = paintFlags or Paint.UNDERLINE_TEXT_FLAG
if (day.isToday)
background = eventBackground background = eventBackground
} }
} }