mirror of
https://github.com/JustinZeus/Wholphin.git
synced 2026-07-08 23:51:21 +02:00
Fix focus on home page load defaulting to nav drawer (#68)
When the home page loaded, it would only try to focus on the "Resume" row even if there were no items in that row (so it doesn't appear). This resulted in the focus defaulting instead to the nav drawer. This PR fixes focus so it always starts with the first item in the first row of the home page.
This commit is contained in:
parent
a4dd404847
commit
1c1e64a5b9
1 changed files with 23 additions and 11 deletions
|
|
@ -82,17 +82,29 @@ class HomeViewModel
|
|||
val latest = getLatest(userDto, limit, includedIds)
|
||||
|
||||
val homeRows =
|
||||
listOf(
|
||||
buildList {
|
||||
if (resume.isNotEmpty()) {
|
||||
add(
|
||||
HomeRow(
|
||||
section = HomeSection.RESUME,
|
||||
items = resume,
|
||||
),
|
||||
)
|
||||
}
|
||||
if (nextUp.isNotEmpty()) {
|
||||
add(
|
||||
HomeRow(
|
||||
section = HomeSection.NEXT_UP,
|
||||
items = nextUp,
|
||||
),
|
||||
*latest.toTypedArray(),
|
||||
)
|
||||
}
|
||||
latest.forEach {
|
||||
if (it.items.isNotEmpty()) {
|
||||
add(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
withContext(Dispatchers.Main) {
|
||||
this@HomeViewModel.homeRows.value = homeRows
|
||||
loadingState.value = LoadingState.Success
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue