Keep Library tab focus within its section
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m13s
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m13s
Right from the Library tab had nothing beside it, so focus searched upward into the top bar and opened Home. In the A–Z view it now moves to the genre/watch/sort row (and Left returns), the end of that row stops, and the Discover view's Library tab no longer leaves the section. The tab is now labelled "Library". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4c56eb3755
commit
0f926c0435
2 changed files with 9 additions and 5 deletions
|
|
@ -112,24 +112,27 @@ private fun anticipateTileMove(vm:KaleidoViewModel,items:List<Title>,index:Int,d
|
|||
var sortMenu by remember{mutableStateOf(false)}
|
||||
var genreMenu by remember{mutableStateOf(false)}
|
||||
var sectionMenu by remember{mutableStateOf(false)}
|
||||
// Without explicit links, Right from Library searches upward and lands on (and opens) Home.
|
||||
val libraryFocus=remember{FocusRequester()};val filterFocus=remember{FocusRequester()}
|
||||
val filters=vm.section!=null||vm.busy
|
||||
Column(Modifier.fillMaxSize()) {
|
||||
Row(Modifier.fillMaxWidth().height(64.dp).padding(horizontal=Cinema.gutter),verticalAlignment=Alignment.CenterVertically) {
|
||||
Text(name,color=Accent,fontSize=29.sp,lineHeight=34.sp,fontWeight=FontWeight.SemiBold,letterSpacing=(-.8).sp)
|
||||
Spacer(Modifier.width(21.dp))
|
||||
NavigationLabel("Discover",!vm.allTitles){vm.setAll(false)}
|
||||
NavigationLabel("Library · A–Z",vm.allTitles,initialFocus=vm.focusId=="library-entry"){vm.setAll(true)}
|
||||
NavigationLabel("Library",vm.allTitles,modifier=Modifier.focusRequester(libraryFocus).focusProperties{right=if(filters)filterFocus else FocusRequester.Cancel},initialFocus=vm.focusId=="library-entry"){vm.setAll(true)}
|
||||
Spacer(Modifier.weight(1f))
|
||||
if(vm.sections.count{it.type==vm.section?.type}>1)TvButton(vm.section?.title ?: "Library"){sectionMenu=true}
|
||||
else if(!vm.allTitles)Text("${vm.total} titles",color=Muted,fontSize=11.sp,lineHeight=16.sp)
|
||||
}
|
||||
if(vm.section==null&&!vm.busy)EmptyState("No $name library","This server has no matching library.")
|
||||
if(!filters)EmptyState("No $name library","This server has no matching library.")
|
||||
else {
|
||||
Row(Modifier.fillMaxWidth().height(43.dp).padding(horizontal=Cinema.gutter),verticalAlignment=Alignment.CenterVertically,horizontalArrangement=Arrangement.spacedBy(8.dp)) {
|
||||
Text("${vm.total} titles",color=Muted,fontSize=11.sp,lineHeight=16.sp)
|
||||
Spacer(Modifier.weight(1f))
|
||||
TvButton((if(vm.genre.isBlank())"All genres"else vm.genres.firstOrNull{it.first==vm.genre}?.second ?: "Genre")+" ⌄"){genreMenu=true}
|
||||
TvButton((if(vm.genre.isBlank())"All genres"else vm.genres.firstOrNull{it.first==vm.genre}?.second ?: "Genre")+" ⌄",Modifier.focusRequester(filterFocus).focusProperties{left=libraryFocus}){genreMenu=true}
|
||||
TvButton(if(vm.unwatched)"Unwatched ✓"else "Unwatched",selected=vm.unwatched){vm.filter(unwatchedValue=!vm.unwatched)}
|
||||
TvButton((sortLabels.firstOrNull{it.first==vm.sort}?.second ?: "Title: A–Z")+" ⌄"){sortMenu=true}
|
||||
TvButton((sortLabels.firstOrNull{it.first==vm.sort}?.second ?: "Title: A–Z")+" ⌄",Modifier.focusProperties{right=FocusRequester.Cancel}){sortMenu=true}
|
||||
}
|
||||
val grid=rememberLazyGridState()
|
||||
LaunchedEffect(grid,vm.library.size,vm.total){snapshotFlow{grid.layoutInfo.visibleItemsInfo.lastOrNull()?.index ?: 0}.collect{if(it>=vm.library.size-18&&vm.library.isNotEmpty())vm.more()}}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,8 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
|
|||
Text(title,color=Accent,fontSize=19.sp,fontWeight=FontWeight.SemiBold,modifier=Modifier.padding(end=20.dp))
|
||||
if(!home) {
|
||||
NavigationLabel("Discover",true,modifier=Modifier.focusRequester(navigation.section).focusProperties{up=navigation.top;down=navigation.entry},initialFocus=sectionEntry){}
|
||||
NavigationLabel("Library · A–Z",false,modifier=Modifier.focusProperties{up=navigation.top;down=navigation.entry}){vm.setAll(true)}
|
||||
// Nothing sits right of Library; an unbounded search would open Home from the top bar.
|
||||
NavigationLabel("Library",false,modifier=Modifier.focusProperties{up=navigation.top;down=navigation.entry;right=FocusRequester.Cancel}){vm.setAll(true)}
|
||||
}
|
||||
}
|
||||
Spacer(Modifier.fillMaxWidth().height(if(destination=="movies")137.dp else 119.dp))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue