home: Back opens the sidebar from a list view (#26)
Reaching the sidebar used to mean scrolling all the way left to the first card. Back from any list view now opens it directly; from the open sidebar on Home a double Back still exits, and Esc (keyboard/scrcpy) mirrors the same model.
This commit is contained in:
parent
6307addfb8
commit
349c1aa447
1 changed files with 19 additions and 13 deletions
|
|
@ -114,19 +114,15 @@ fun HomeScreen(viewModel: AppViewModel = androidx.lifecycle.viewmodel.compose.vi
|
|||
}
|
||||
}
|
||||
|
||||
// BACK order (TV standard): player (own handler) → drawer close → channel
|
||||
// drilldown → non-Home destination → Home; from Home: double-press exits.
|
||||
// BACK order (issue #26): the sidebar is the root of a list view, reached
|
||||
// with one BACK press instead of scrolling all the way left.
|
||||
// player → its own handler
|
||||
// drawer open, Home → double-press exits (the sidebar is the root)
|
||||
// drawer open, else → close the drawer
|
||||
// channel drilldown → back up to the list that opened it
|
||||
// any list view → open the sidebar
|
||||
BackHandler(enabled = drawerOpen && playingVideo == null) {
|
||||
dismissDrawer()
|
||||
}
|
||||
BackHandler(enabled = !drawerOpen && playingVideo == null && channelDetails != null) {
|
||||
channelDetails = null
|
||||
}
|
||||
BackHandler(enabled = !drawerOpen && playingVideo == null && channelDetails == null) {
|
||||
if (destination != Destination.Home) {
|
||||
channelDetails = null
|
||||
destination = Destination.Home
|
||||
} else {
|
||||
if (destination == Destination.Home && channelDetails == null) {
|
||||
val now = System.currentTimeMillis()
|
||||
if (now - lastBackAt < 2500) {
|
||||
(context as? android.app.Activity)?.finish()
|
||||
|
|
@ -134,8 +130,16 @@ fun HomeScreen(viewModel: AppViewModel = androidx.lifecycle.viewmodel.compose.vi
|
|||
}
|
||||
lastBackAt = now
|
||||
android.widget.Toast.makeText(context, "Press BACK again to exit", android.widget.Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
dismissDrawer()
|
||||
}
|
||||
}
|
||||
BackHandler(enabled = !drawerOpen && playingVideo == null && channelDetails != null) {
|
||||
channelDetails = null
|
||||
}
|
||||
BackHandler(enabled = !drawerOpen && playingVideo == null && channelDetails == null) {
|
||||
drawerOpen = true
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
|
|
@ -151,7 +155,9 @@ fun HomeScreen(viewModel: AppViewModel = androidx.lifecycle.viewmodel.compose.vi
|
|||
when {
|
||||
drawerOpen -> { dismissDrawer(); true }
|
||||
channelDetails != null -> { channelDetails = null; true }
|
||||
else -> false
|
||||
// Mirror the D-pad BACK model (issue #26): Esc opens the
|
||||
// sidebar from a top-level list view too.
|
||||
else -> { drawerOpen = true; true }
|
||||
}
|
||||
} else false
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue