[Home/Timetable] Add click listener to timetable card.

This commit is contained in:
Kacper Ziubryniewicz 2019-11-26 22:56:43 +01:00
parent ca3b6d0705
commit 6d8960f089

View File

@ -4,6 +4,7 @@
package pl.szczodrzynski.edziennik.ui.modules.home.cards
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -48,6 +49,7 @@ class HomeTimetableCard(
private lateinit var b: CardHomeTimetableBinding
private val today = Date.getToday()
private var timetableDate: Date = Date.getToday()
private val searchEnd = today.clone().stepForward(0, 0, 7)
private var allLessons = listOf<LessonFull>()
@ -89,6 +91,12 @@ class HomeTimetableCard(
allLessons = it
update()
})
b.root.setOnClickListener {
activity.loadTarget(MainActivity.DRAWER_ITEM_TIMETABLE, Bundle().apply {
putString("timetableDate", timetableDate.stringY_m_d)
})
}
}
private fun update() { launch {
@ -122,7 +130,8 @@ class HomeTimetableCard(
}
timetableDate
}
val timetableDate = deferred.await()
timetableDate = deferred.await()
val isToday = today == timetableDate