Skip to content

Commit 22c63c6

Browse files
authored
feat: gray out only month date but not events itself (#807)
Refs: #808
1 parent 5c3c0ba commit 22c63c6

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Changed
9+
- Events shown in adjacent months are no longer dimmed ([#808])
810

911
## [1.6.2] - 2025-10-09
1012
### Changed
@@ -153,6 +155,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
153155
[#729]: https://github.com/FossifyOrg/Calendar/issues/729
154156
[#732]: https://github.com/FossifyOrg/Calendar/issues/732
155157
[#761]: https://github.com/FossifyOrg/Calendar/issues/761
158+
[#808]: https://github.com/FossifyOrg/Calendar/issues/808
156159

157160
[Unreleased]: https://github.com/FossifyOrg/Calendar/compare/1.6.2...HEAD
158161
[1.6.2]: https://github.com/FossifyOrg/Calendar/compare/1.6.1...1.6.2

app/src/main/kotlin/org/fossify/calendar/helpers/MyWidgetMonthlyProvider.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
139139
day.dayEvents.forEach {
140140
val backgroundColor = it.color
141141
var eventTextColor = backgroundColor.getContrastColor()
142-
143-
if (it.isTask() && it.isTaskCompleted() && dimCompletedTasks || !day.isThisMonth || (dimPastEvents && it.isPastEvent && !it.isTask())) {
142+
val shouldDim = (it.isTask() && it.isTaskCompleted() && dimCompletedTasks)
143+
|| (dimPastEvents && it.isPastEvent && !it.isTask())
144+
if (shouldDim) {
144145
eventTextColor = eventTextColor.adjustAlpha(MEDIUM_ALPHA)
145146
}
146147

app/src/main/kotlin/org/fossify/calendar/views/MonthView.kt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,10 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
361361
}
362362
}
363363

364-
val startDayIndex = days[event.originalStartDayIndex]
365-
val endDayIndex = days[min(event.startDayIndex + event.daysCnt - 1, 41)]
366364
bgRectF.set(bgLeft, bgTop, bgRight, bgBottom)
367-
canvas.drawRoundRect(bgRectF, BG_CORNER_RADIUS, BG_CORNER_RADIUS, getEventBackgroundColor(event, startDayIndex, endDayIndex))
365+
canvas.drawRoundRect(bgRectF, BG_CORNER_RADIUS, BG_CORNER_RADIUS, getEventBackgroundColor(event))
368366

369-
val specificEventTitlePaint = getEventTitlePaint(event, startDayIndex, endDayIndex)
367+
val specificEventTitlePaint = getEventTitlePaint(event)
370368
var taskIconWidth = 0
371369
if (event.isTask) {
372370
val taskIcon = resources.getColoredDrawableWithColor(R.drawable.ic_task_vector, specificEventTitlePaint.color).mutate()
@@ -408,12 +406,11 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
408406
return curPaint
409407
}
410408

411-
private fun getEventBackgroundColor(event: MonthViewEvent, startDay: DayMonthly, endDay: DayMonthly): Paint {
409+
private fun getEventBackgroundColor(event: MonthViewEvent): Paint {
412410
var paintColor = event.color
413411

414412
val adjustAlpha = when {
415413
event.isTask -> dimCompletedTasks && event.isTaskCompleted
416-
!startDay.isThisMonth && !endDay.isThisMonth -> true
417414
else -> dimPastEvents && event.isPastEvent && !isPrintVersion
418415
}
419416

@@ -424,11 +421,10 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
424421
return getColoredPaint(paintColor)
425422
}
426423

427-
private fun getEventTitlePaint(event: MonthViewEvent, startDay: DayMonthly, endDay: DayMonthly): Paint {
424+
private fun getEventTitlePaint(event: MonthViewEvent): Paint {
428425
var paintColor = event.color.getContrastColor()
429426
val adjustAlpha = when {
430427
event.isTask -> dimCompletedTasks && event.isTaskCompleted
431-
!startDay.isThisMonth && !endDay.isThisMonth -> true
432428
else -> dimPastEvents && event.isPastEvent && !isPrintVersion
433429
}
434430

0 commit comments

Comments
 (0)