Skip to content
Snippets Groups Projects
Unverified Commit bcf0f9f1 authored by Alex Paulescu's avatar Alex Paulescu Committed by GitHub
Browse files

Disabled dates which exceed 21 days in the past (EXPOSUREAPP-3191) (#1385)


* Disabled dates which exceed 21 days in the past

* Fixed issue with detekt

* Fixed codesmell

Co-authored-by: default avatarharambasicluka <64483219+harambasicluka@users.noreply.github.com>
Co-authored-by: default avatarRalf Gehrer <ralfgehrer@users.noreply.github.com>
parent 55b1f968
No related branches found
No related tags found
No related merge requests found
...@@ -38,8 +38,8 @@ class CalendarDayViewHolder(v: View) : RecyclerView.ViewHolder(v) { ...@@ -38,8 +38,8 @@ class CalendarDayViewHolder(v: View) : RecyclerView.ViewHolder(v) {
// Set day content description for talk back // Set day content description for talk back
textView.contentDescription = day.date.toString(talkBackDateFormat) textView.contentDescription = day.date.toString(talkBackDateFormat)
// If date is after today - then disable click listener // If date is after today or exceeds 21 days in the past- then disable click listener
if (!day.date.isAfter(today)) { if (!day.date.isAfter(today) && !day.date.isBefore(today.minusDays(ONSET_PERIOD))) {
textView.setOnClickListener { clickListener(day) } textView.setOnClickListener { clickListener(day) }
} }
...@@ -55,8 +55,8 @@ class CalendarDayViewHolder(v: View) : RecyclerView.ViewHolder(v) { ...@@ -55,8 +55,8 @@ class CalendarDayViewHolder(v: View) : RecyclerView.ViewHolder(v) {
textView.setBackgroundResource(R.drawable.calendar_today_back) textView.setBackgroundResource(R.drawable.calendar_today_back)
textView.setTextColor(ContextCompat.getColor(context, R.color.colorCalendarTodayText)) textView.setTextColor(ContextCompat.getColor(context, R.color.colorCalendarTodayText))
} }
// Future // Future & past exceeding 21 days
day.date.isAfter(today) -> { day.date.isAfter(today) || day.date.isBefore(today.minusDays(ONSET_PERIOD)) -> {
textView.setBackgroundResource(0) textView.setBackgroundResource(0)
textView.setTextColor(ContextCompat.getColor(context, R.color.colorTextPrimary3)) textView.setTextColor(ContextCompat.getColor(context, R.color.colorTextPrimary3))
} }
...@@ -67,4 +67,9 @@ class CalendarDayViewHolder(v: View) : RecyclerView.ViewHolder(v) { ...@@ -67,4 +67,9 @@ class CalendarDayViewHolder(v: View) : RecyclerView.ViewHolder(v) {
} }
} }
} }
companion object {
// Max number of days for the onset of symptoms to be calculated
private const val ONSET_PERIOD = 21
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment