diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt index 534fb0056..678ec8b7f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/activities/WidgetMonthlyConfigureActivity.kt @@ -14,6 +14,7 @@ import android.widget.SeekBar import android.widget.TextView import com.simplemobiletools.calendar.MonthlyCalendarImpl import com.simplemobiletools.calendar.R +import com.simplemobiletools.calendar.extensions.removeUnderlineFlag import com.simplemobiletools.calendar.helpers.Config import com.simplemobiletools.calendar.helpers.LOW_ALPHA import com.simplemobiletools.calendar.helpers.MyWidgetMonthlyProvider @@ -181,11 +182,8 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar { text = day.value.toString() setTextColor(curTextColor) - if (day.hasEvent) - paintFlags = paintFlags or Paint.UNDERLINE_TEXT_FLAG - - if (day.isToday) - background = todayCircle + paintFlags = if (day.hasEvent) (paintFlags or Paint.UNDERLINE_TEXT_FLAG) else (paintFlags.removeUnderlineFlag()) + background = if (day.isToday) todayCircle else null } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Int.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Int.kt new file mode 100644 index 000000000..348b1f14e --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/extensions/Int.kt @@ -0,0 +1,8 @@ +package com.simplemobiletools.calendar.extensions + +import android.graphics.Paint + +// TODO: how to do "flags & ~Paint.UNDERLINE_TEXT_FLAG" in kotlin? +fun Int.removeUnderlineFlag(): Int { + return this - (if (this and Paint.UNDERLINE_TEXT_FLAG == Paint.UNDERLINE_TEXT_FLAG) Paint.UNDERLINE_TEXT_FLAG else 0) +} diff --git a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt index a22b4f5b2..c6d7b0689 100644 --- a/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/calendar/fragments/MonthFragment.kt @@ -18,6 +18,7 @@ import com.simplemobiletools.calendar.R import com.simplemobiletools.calendar.activities.DayActivity import com.simplemobiletools.calendar.extensions.beVisibleIf import com.simplemobiletools.calendar.extensions.getAppropriateTheme +import com.simplemobiletools.calendar.extensions.removeUnderlineFlag import com.simplemobiletools.calendar.helpers.* import com.simplemobiletools.calendar.interfaces.MonthlyCalendar import com.simplemobiletools.calendar.interfaces.NavigationListener @@ -186,11 +187,8 @@ class MonthFragment : Fragment(), MonthlyCalendar { setTextColor(curTextColor) setOnClickListener { openDay(day.code) } - if (day.hasEvent) - paintFlags = paintFlags or Paint.UNDERLINE_TEXT_FLAG - - if (day.isToday) - background = todayCircle + paintFlags = if (day.hasEvent) (paintFlags or Paint.UNDERLINE_TEXT_FLAG) else (paintFlags.removeUnderlineFlag()) + background = if (day.isToday) todayCircle else null } } } diff --git a/app/src/main/res/drawable/circle_empty.xml b/app/src/main/res/drawable/circle_empty.xml index 117f0e1cd..ee4fc0e43 100644 --- a/app/src/main/res/drawable/circle_empty.xml +++ b/app/src/main/res/drawable/circle_empty.xml @@ -1,7 +1,7 @@