diff --git a/presentation/src/main/java/com/whyranoid/presentation/myrun/CalendarDayBinder.kt b/presentation/src/main/java/com/whyranoid/presentation/myrun/CalendarDayBinder.kt index 2a92b87..ee2223f 100644 --- a/presentation/src/main/java/com/whyranoid/presentation/myrun/CalendarDayBinder.kt +++ b/presentation/src/main/java/com/whyranoid/presentation/myrun/CalendarDayBinder.kt @@ -9,13 +9,11 @@ import com.kizitonwose.calendarview.ui.DayBinder import com.kizitonwose.calendarview.ui.ViewContainer import com.whyranoid.presentation.R import com.whyranoid.presentation.databinding.ItemCalendarDayBinding -import java.time.LocalDate class CalendarDayBinder( private val calendarView: CalendarView, private val runningDays: List> ) : DayBinder { - private var calendar: CalendarRange = CalendarRange(null, null) class DayContainer( val binding: ItemCalendarDayBinding @@ -34,7 +32,7 @@ class CalendarDayBinder( R.color.gray ) ) - // day.day와 day.date.monthValue를 지정해서 특정 월, 일에 달렸다는 콩 표시 가능 + container.binding.root.background = null } else { container.binding.tvCalendarDay.setTextColor( ContextCompat.getColor( @@ -45,19 +43,10 @@ class CalendarDayBinder( container.binding.root.background = null } - if (isInRange(day.date)) { - container.binding.root.setBackgroundColor( - ContextCompat.getColor( - calendarView.context, - R.color.gray - ) - ) - } - runningDays.forEach { runningDay -> val (runningDayYear, runningDayMonth, runningDayDay) = runningDay.map { it.toInt() } - if (runningDayYear == day.date.year && runningDayMonth == day.date.monthValue && runningDayDay == day.day) { + if (runningDayYear == day.date.year && runningDayMonth == day.date.monthValue && runningDayDay == day.date.dayOfMonth) { container.binding.root.background = ContextCompat.getDrawable( calendarView.context, @@ -66,14 +55,4 @@ class CalendarDayBinder( } } } - - private fun isInRange(date: LocalDate): Boolean { - val (startDate, endDate) = this.calendar - return startDate == date || endDate == date || (startDate != null && endDate != null && startDate < date && date < endDate) - } } - -data class CalendarRange( - val startDate: LocalDate?, - val endDate: LocalDate? -)