forked from github/szkolny
[Home/TimetableCard] Add counting in seconds.
This commit is contained in:
parent
d67c2a90b1
commit
5991ef820f
@ -77,6 +77,9 @@ class HomeTimetableCard(
|
|||||||
|
|
||||||
private val ignoreCancelled = true
|
private val ignoreCancelled = true
|
||||||
|
|
||||||
|
private val countInSeconds: Boolean
|
||||||
|
get() = app.config.timetable.countInSeconds
|
||||||
|
|
||||||
override fun bind(position: Int, holder: HomeCardAdapter.ViewHolder) {
|
override fun bind(position: Int, holder: HomeCardAdapter.ViewHolder) {
|
||||||
holder.root.removeAllViews()
|
holder.root.removeAllViews()
|
||||||
b = CardHomeTimetableBinding.inflate(LayoutInflater.from(holder.root.context))
|
b = CardHomeTimetableBinding.inflate(LayoutInflater.from(holder.root.context))
|
||||||
@ -341,7 +344,7 @@ class HomeTimetableCard(
|
|||||||
b.progress.visibility = View.GONE
|
b.progress.visibility = View.GONE
|
||||||
b.counter.visibility = View.VISIBLE
|
b.counter.visibility = View.VISIBLE
|
||||||
val diff = counterStart - now
|
val diff = counterStart - now
|
||||||
b.counter.text = activity.timeTill(diff.toInt(), "\n")
|
b.counter.text = activity.timeTill(diff.toInt(), "\n", countInSeconds)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// the lesson is right now
|
// the lesson is right now
|
||||||
@ -350,7 +353,7 @@ class HomeTimetableCard(
|
|||||||
val lessonLength = counterEnd - counterStart
|
val lessonLength = counterEnd - counterStart
|
||||||
val timePassed = now - counterStart
|
val timePassed = now - counterStart
|
||||||
val timeLeft = counterEnd - now
|
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.max = lessonLength.toInt()
|
||||||
b.progress.progress = timePassed.toInt()
|
b.progress.progress = timePassed.toInt()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user