forked from github/szkolny
[Home/Timetable] Add click listener to timetable card.
This commit is contained in:
parent
ca3b6d0705
commit
6d8960f089
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
package pl.szczodrzynski.edziennik.ui.modules.home.cards
|
package pl.szczodrzynski.edziennik.ui.modules.home.cards
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@ -48,6 +49,7 @@ class HomeTimetableCard(
|
|||||||
private lateinit var b: CardHomeTimetableBinding
|
private lateinit var b: CardHomeTimetableBinding
|
||||||
|
|
||||||
private val today = Date.getToday()
|
private val today = Date.getToday()
|
||||||
|
private var timetableDate: Date = Date.getToday()
|
||||||
private val searchEnd = today.clone().stepForward(0, 0, 7)
|
private val searchEnd = today.clone().stepForward(0, 0, 7)
|
||||||
|
|
||||||
private var allLessons = listOf<LessonFull>()
|
private var allLessons = listOf<LessonFull>()
|
||||||
@ -89,6 +91,12 @@ class HomeTimetableCard(
|
|||||||
allLessons = it
|
allLessons = it
|
||||||
update()
|
update()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
b.root.setOnClickListener {
|
||||||
|
activity.loadTarget(MainActivity.DRAWER_ITEM_TIMETABLE, Bundle().apply {
|
||||||
|
putString("timetableDate", timetableDate.stringY_m_d)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun update() { launch {
|
private fun update() { launch {
|
||||||
@ -122,7 +130,8 @@ class HomeTimetableCard(
|
|||||||
}
|
}
|
||||||
timetableDate
|
timetableDate
|
||||||
}
|
}
|
||||||
val timetableDate = deferred.await()
|
|
||||||
|
timetableDate = deferred.await()
|
||||||
|
|
||||||
val isToday = today == timetableDate
|
val isToday = today == timetableDate
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user