Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight weekends in printed matter too #66

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,11 @@ class WeekFragment : Fragment(), WeeklyCalendar {
val dayLetters = res.getStringArray(labelIDs).toMutableList() as ArrayList<String>
val dayLetter = dayLetters[curDay.dayOfWeek - 1]

val textColor = if (isPrintVersion) {
resources.getColor(org.fossify.commons.R.color.theme_light_text_color)
} else if (todayCode == dayCode) {
primaryColor
} else if (highlightWeekends && isWeekend(curDay.dayOfWeek)) {
config.highlightWeekendsColor
} else {
requireContext().getProperTextColor()
val textColor = when {
!isPrintVersion && todayCode == dayCode -> primaryColor
highlightWeekends && isWeekend(curDay.dayOfWeek) -> config.highlightWeekendsColor
isPrintVersion -> resources.getColor(org.fossify.commons.R.color.theme_light_text_color)
else -> requireContext().getProperTextColor()
}

val label = WeeklyViewDayLetterBinding.inflate(layoutInflater, binding.weekLettersHolder, false).root
Expand Down
11 changes: 4 additions & 7 deletions app/src/main/kotlin/org/fossify/calendar/views/MonthView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -329,13 +329,10 @@ class MonthView(context: Context, attrs: AttributeSet, defStyle: Int) : View(con
}

private fun getTextPaint(startDay: DayMonthly): Paint {
var paintColor = textColor
if (!isPrintVersion) {
if (startDay.isToday) {
paintColor = primaryColor.getContrastColor()
} else if (highlightWeekends && startDay.isWeekend) {
paintColor = weekendsTextColor
}
var paintColor = when {
!isPrintVersion && startDay.isToday -> primaryColor.getContrastColor()
highlightWeekends && startDay.isWeekend -> weekendsTextColor
else -> textColor
}

if (!startDay.isThisMonth) {
Expand Down