From 5991ef820fc66f2ff499859f132d014491a0a4ff Mon Sep 17 00:00:00 2001 From: Kacper Ziubryniewicz Date: Sun, 22 Dec 2019 21:31:12 +0100 Subject: [PATCH] [Home/TimetableCard] Add counting in seconds. --- .../edziennik/ui/modules/home/cards/HomeTimetableCard.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTimetableCard.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTimetableCard.kt index bdb99029..5d04374d 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTimetableCard.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/home/cards/HomeTimetableCard.kt @@ -77,6 +77,9 @@ class HomeTimetableCard( private val ignoreCancelled = true + private val countInSeconds: Boolean + get() = app.config.timetable.countInSeconds + override fun bind(position: Int, holder: HomeCardAdapter.ViewHolder) { holder.root.removeAllViews() b = CardHomeTimetableBinding.inflate(LayoutInflater.from(holder.root.context)) @@ -341,7 +344,7 @@ class HomeTimetableCard( b.progress.visibility = View.GONE b.counter.visibility = View.VISIBLE val diff = counterStart - now - b.counter.text = activity.timeTill(diff.toInt(), "\n") + b.counter.text = activity.timeTill(diff.toInt(), "\n", countInSeconds) } else { // the lesson is right now @@ -350,7 +353,7 @@ class HomeTimetableCard( val lessonLength = counterEnd - counterStart val timePassed = now - counterStart val timeLeft = counterEnd - now - b.counter.text = activity.timeLeft(timeLeft.toInt(), "\n") + b.counter.text = activity.timeLeft(timeLeft.toInt(), "\n", countInSeconds) b.progress.max = lessonLength.toInt() b.progress.progress = timePassed.toInt() }