Release Kaleido 0.8.1 fixing Down from a title page's buttons
All checks were successful
Validate and publish Kaleido / android (push) Successful in 2m32s

- A row below the header (Seasons, Cast, search results) attached its
  entry focus target to its first card. Once the row was scrolled away,
  e.g. a show page's restored Seasons scroll, that card was not composed,
  so Down from the actions failed and focus stayed in the header.
- Enter at the preferred card while it is in view, otherwise at the first
  fully visible card (rowEntryIndex, with JVM tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-14 12:11:26 -07:00
parent 3e020bd7fa
commit 34f54bcc29
8 changed files with 62 additions and 10 deletions

View file

@ -1,5 +1,9 @@
# Kaleido releases # Kaleido releases
## 0.8.1
- Fix a title page where Down from the buttons did nothing, leaving you stuck at the top. This happened when the Seasons, Cast or another row below had been scrolled away from its first card, for example by reopening a show from Continue Watching. Down now moves to a card in view.
## 0.8.0 ## 0.8.0
- Replace the two countdowns at the end of an episode with one Up Next screen. When the credits start, the video shrinks into the top-left corner and keeps playing, beside the next episode's artwork, details, rating and synopsis, with the rest of the season and related shows below. Play next episode fills as it counts down, and pressing any button on the remote stops the countdown. Press Left and select the video, or press Back, to return to the credits. - Replace the two countdowns at the end of an episode with one Up Next screen. When the credits start, the video shrinks into the top-left corner and keeps playing, beside the next episode's artwork, details, rating and synopsis, with the rest of the season and related shows below. Play next episode fills as it counts down, and pressing any button on the remote stops the countdown. Press Left and select the video, or press Back, to return to the credits.

View file

@ -111,14 +111,29 @@ import androidx.compose.ui.text.input.TextFieldValue
// A reopened episode page resets its selection, but its saved scroll can still // A reopened episode page resets its selection, but its saved scroll can still
// point elsewhere. Compose the entry card before the header sends focus Down. // point elsewhere. Compose the entry card before the header sends focus Down.
LaunchedEffect(rowId){if(initialItem!=null)row.scrollToItem((initial-1).coerceAtLeast(0))} LaunchedEffect(rowId){if(initialItem!=null)row.scrollToItem((initial-1).coerceAtLeast(0))}
val entryIndex=if(entryFocus!=null)rememberRowEntry(row,entry).value else -1
Column { Column {
Box(Modifier.padding(horizontal=Cinema.gutter)){SectionHeading(title,subtitle)} Box(Modifier.padding(horizontal=Cinema.gutter)){SectionHeading(title,subtitle)}
LazyRow(state=row,contentPadding=PaddingValues(start=Cinema.gutter,end=Cinema.gutter,top=5.dp,bottom=5.dp),horizontalArrangement=Arrangement.spacedBy(if(landscape)13.dp else 12.dp),modifier=Modifier.focusRestorer(fallback=entryFocus ?: FocusRequester.Default)) { LazyRow(state=row,contentPadding=PaddingValues(start=Cinema.gutter,end=Cinema.gutter,top=5.dp,bottom=5.dp),horizontalArrangement=Arrangement.spacedBy(if(landscape)13.dp else 12.dp),modifier=Modifier.focusRestorer(fallback=entryFocus ?: FocusRequester.Default)) {
itemsIndexed(items,key={_,it->it.id}){index,item->MediaTile(vm,item,"$rowId:${item.id}",landscape,modifier=(if(index==entry&&entryFocus!=null)Modifier.focusRequester(entryFocus)else Modifier).then(if(up!=null)Modifier.focusProperties{this.up=up}else Modifier),onMove={anticipateTileMove(vm,items,index,it,0)},episodeTitle=episodeTitles,current=item.id==selectedItem,onFocused=onFocused,onClick=onClick)} itemsIndexed(items,key={_,it->it.id}){index,item->MediaTile(vm,item,"$rowId:${item.id}",landscape,modifier=(if(index==entryIndex&&entryFocus!=null)Modifier.focusRequester(entryFocus)else Modifier).then(if(up!=null)Modifier.focusProperties{this.up=up}else Modifier),onMove={anticipateTileMove(vm,items,index,it,0)},episodeTitle=episodeTitles,current=item.id==selectedItem,onFocused=onFocused,onClick=onClick)}
} }
} }
} }
/**
* The card a row is entered at from above: [preferred] while it is in view, otherwise the first
* card fully in view. A card scrolled out of a lazy row (e.g. a restored or scrolled Seasons row)
* is not composed, so an explicit focus move to its requester fails and strands focus above.
*/
internal fun rowEntryIndex(preferred:Int,visible:List<LazyListItemInfo>,viewportStart:Int):Int {
if(visible.isEmpty()||visible.any{it.index==preferred})return preferred
return (visible.firstOrNull{it.offset>=viewportStart} ?: visible.first()).index
}
/** [rowEntryIndex], updated only when a card enters or leaves the row's view. */
@Composable internal fun rememberRowEntry(row:LazyListState,preferred:Int):State<Int> =
remember(row,preferred){derivedStateOf{row.layoutInfo.let{rowEntryIndex(preferred,it.visibleItemsInfo,it.viewportStartOffset)}}}
internal fun anticipateTileMove(vm:KaleidoViewModel,items:List<Title>,index:Int,direction:Key,columns:Int) { internal fun anticipateTileMove(vm:KaleidoViewModel,items:List<Title>,index:Int,direction:Key,columns:Int) {
val target=when(direction){ val target=when(direction){
Key.DirectionLeft->if(columns==0||index%columns>0)index-1 else -1 Key.DirectionLeft->if(columns==0||index%columns>0)index-1 else -1

View file

@ -233,6 +233,7 @@ internal fun nextUp(episodes:List<Title>,watchedPercent:Int)=episodes.firstOrNul
@Composable private fun CastRail(vm:KaleidoViewModel,item:Title,actionFocus:FocusRequester,entry:FocusRequester) { @Composable private fun CastRail(vm:KaleidoViewModel,item:Title,actionFocus:FocusRequester,entry:FocusRequester) {
val initial=remember(item.id){item.castMembers.indexOfFirst{"cast:${item.id}:${it.id.ifBlank{it.name}}"==vm.focusId}.coerceAtLeast(0)} val initial=remember(item.id){item.castMembers.indexOfFirst{"cast:${item.id}:${it.id.ifBlank{it.name}}"==vm.focusId}.coerceAtLeast(0)}
val row=rememberLazyListState(initialFirstVisibleItemIndex=initial) val row=rememberLazyListState(initialFirstVisibleItemIndex=initial)
val entryIndex by rememberRowEntry(row,0)
Column { Column {
Text("Cast",color=Accent,fontSize=17.sp,fontWeight=FontWeight.SemiBold,modifier=Modifier.padding(start=Cinema.gutter,bottom=10.dp)) Text("Cast",color=Accent,fontSize=17.sp,fontWeight=FontWeight.SemiBold,modifier=Modifier.padding(start=Cinema.gutter,bottom=10.dp))
LazyRow(state=row,contentPadding=PaddingValues(horizontal=Cinema.gutter),horizontalArrangement=Arrangement.spacedBy(16.dp),modifier=Modifier.focusRestorer(fallback=entry)) { LazyRow(state=row,contentPadding=PaddingValues(horizontal=Cinema.gutter),horizontalArrangement=Arrangement.spacedBy(16.dp),modifier=Modifier.focusRestorer(fallback=entry)) {
@ -241,7 +242,7 @@ internal fun nextUp(episodes:List<Title>,watchedPercent:Int)=episodes.firstOrNul
var focused by remember{mutableStateOf(false)} var focused by remember{mutableStateOf(false)}
val requester=remember{FocusRequester()} val requester=remember{FocusRequester()}
LaunchedEffect(Unit){if(vm.focusId==key){withFrameNanos{};runCatching{requester.requestFocus()}}} LaunchedEffect(Unit){if(vm.focusId==key){withFrameNanos{};runCatching{requester.requestFocus()}}}
Column(Modifier.width(108.dp).then(if(index==0)Modifier.focusRequester(entry)else Modifier).focusRequester(requester).focusProperties{if(item.type!="collection"&&vm.children.isEmpty())up=actionFocus}.navigationSound().onFocusChanged{ Column(Modifier.width(108.dp).then(if(index==entryIndex)Modifier.focusRequester(entry)else Modifier).focusRequester(requester).focusProperties{if(item.type!="collection"&&vm.children.isEmpty())up=actionFocus}.navigationSound().onFocusChanged{
focused=it.isFocused;if(it.isFocused)vm.focusId=key focused=it.isFocused;if(it.isFocused)vm.focusId=key
}.clickable(enabled=actor.id.isNotBlank()){vm.openActor(actor)}.clearAndSetSemantics{ }.clickable(enabled=actor.id.isNotBlank()){vm.openActor(actor)}.clearAndSetSemantics{
contentDescription=listOf(actor.name,actor.role).filter{it.isNotBlank()}.joinToString(". ") contentDescription=listOf(actor.name,actor.role).filter{it.isNotBlank()}.joinToString(". ")

View file

@ -0,0 +1,32 @@
package tv.kaleido.app
import androidx.compose.foundation.lazy.LazyListItemInfo
import org.junit.Assert.assertEquals
import org.junit.Test
class RowEntryTest {
private fun card(index:Int,offset:Int)=object:LazyListItemInfo {
override val index=index
override val key:Any=index
override val offset=offset
override val size=264
}
// A 264 px card plus 24 px spacing; the row's start padding is 88 px (viewportStart -88).
private fun row(first:Int,firstOffset:Int,count:Int)=List(count){card(first+it,firstOffset+it*288)}
@Test fun keepsThePreferredCardWhileItIsInView() {
assertEquals(0,rowEntryIndex(0,row(0,0,7),-88))
assertEquals(3,rowEntryIndex(3,row(1,-100,7),-88))
}
@Test fun scrolledAwayRowEntersAtTheFirstFullyVisibleCard() {
// Seasons row restored to its end: Season 6 (index 5) is clipped, Season 7 is the first whole card.
assertEquals(6,rowEntryIndex(0,row(5,-167,7),-88))
// A card resting in the start padding is still wholly on screen.
assertEquals(4,rowEntryIndex(0,row(4,-60,7),-88))
}
@Test fun emptyLayoutKeepsThePreferredCard() {
assertEquals(2,rowEntryIndex(2,emptyList(),-88))
}
}

Binary file not shown.

View file

@ -1 +1 @@
3eaf7ed9d1c9260003993f8c06d3d35c5a9547d157693005f723c7afac743390 Kaleido.apk 2fd832eb90633d1519c15abccc122970a3c5ef51933da35634b8a5b1429d5bc3 Kaleido.apk

View file

@ -1,7 +1,7 @@
{ {
"version": "0.8.0", "version": "0.8.1",
"versionCode": 24, "versionCode": 25,
"url": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.8.0/distribution/Kaleido.apk", "url": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.8.1/distribution/Kaleido.apk",
"checksumUrl": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.8.0/distribution/Kaleido.apk.sha256", "checksumUrl": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.8.1/distribution/Kaleido.apk.sha256",
"notes": "- Replace the two countdowns at the end of an episode with one Up Next screen. When the credits start, the video shrinks into the top-left corner and keeps playing, beside the next episode's artwork, details, rating and synopsis, with the rest of the season and related shows below. Play next episode fills as it counts down, and pressing any button on the remote stops the countdown. Press Left and select the video, or press Back, to return to the credits.\n- Update Continue Watching as soon as you leave the player, including an episode you have just started.\n- Remove the label above the featured title on Home (\"Recently released\", \"Suggested for you\" and similar), as in Kaleido Desktop." "notes": "- Fix a title page where Down from the buttons did nothing, leaving you stuck at the top. This happened when the Seasons, Cast or another row below had been scrolled away from its first card, for example by reopening a show from Continue Watching. Down now moves to a card in view."
} }

View file

@ -1,2 +1,2 @@
versionName=0.8.0 versionName=0.8.1
versionCode=24 versionCode=25