mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-03-03 02:47:44 +01:00
fix #1273, highlight weekends on the monthly widget too
This commit is contained in:
parent
d4fc30f3e9
commit
c45a063369
@ -116,10 +116,18 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
||||
}
|
||||
}
|
||||
|
||||
val weakTextColor = textColor.adjustAlpha(MEDIUM_ALPHA)
|
||||
for (i in 0 until len) {
|
||||
val day = days[i]
|
||||
val currTextColor = if (day.isThisMonth) textColor else weakTextColor
|
||||
|
||||
val redTextColor = context.resources.getColor(R.color.red_text)
|
||||
val dayTextColor = if (context.config.highlightWeekends && day.isWeekend) {
|
||||
redTextColor
|
||||
} else {
|
||||
textColor
|
||||
}
|
||||
|
||||
val weakTextColor = dayTextColor.adjustAlpha(MEDIUM_ALPHA)
|
||||
val currTextColor = if (day.isThisMonth) dayTextColor else weakTextColor
|
||||
val id = res.getIdentifier("day_$i", "id", packageName)
|
||||
views.removeAllViews(id)
|
||||
addDayNumber(context, views, day, currTextColor, id)
|
||||
@ -214,13 +222,22 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
||||
}
|
||||
|
||||
private fun updateDayLabels(context: Context, views: RemoteViews, resources: Resources, textColor: Int) {
|
||||
val sundayFirst = context.config.isSundayFirst
|
||||
val config = context.config
|
||||
val sundayFirst = config.isSundayFirst
|
||||
val smallerFontSize = context.getWidgetFontSize()
|
||||
val packageName = context.packageName
|
||||
val letters = context.resources.getStringArray(R.array.week_day_letters)
|
||||
val redTextColor = resources.getColor(R.color.red_text)
|
||||
|
||||
for (i in 0..6) {
|
||||
val id = resources.getIdentifier("label_$i", "id", packageName)
|
||||
views.setTextColor(id, textColor)
|
||||
val dayTextColor = if (config.highlightWeekends && isWeekend(i, sundayFirst)) {
|
||||
redTextColor
|
||||
} else {
|
||||
textColor
|
||||
}
|
||||
|
||||
views.setTextColor(id, dayTextColor)
|
||||
views.setTextSize(id, smallerFontSize)
|
||||
|
||||
var index = i
|
||||
|
Loading…
x
Reference in New Issue
Block a user