Compare commits

..

No commits in common. "24042bebbcb84b66f0d4771bcfcd369c51e90cc9" and "dedf62a19e46747b440ff759b0917d9be0e6529b" have entirely different histories.

18 changed files with 176 additions and 464 deletions

View file

@ -10,8 +10,8 @@
## UI and architecture ## UI and architecture
- **Home:** large cinematic hero with playback/information actions and integrated landscape Continue Watching. Entering the rows compacts it into a Silo-style preview of the focused card (its own image, top-right); Up/Back restores the hero. - **Home:** large cinematic hero with playback/information actions and integrated landscape Continue Watching. Do not replace it with the compact section preview.
- **Movies:** the same Silo-style preview follows focused posters; recent releases and movie recommendations lead. **TV:** episode-first layout with wider next-episode thumbnails, new seasons and new episodes. Keep these destinations' rows visibly distinct. The optional artwork colour wash is baked into the preview backdrop bitmap. - **Movies:** compact preview/backdrop follows focused posters; recent releases and movie recommendations lead. **TV:** episode-first layout with wider next-episode thumbnails, new seasons and new episodes. Keep these destinations visibly distinct.
- Both sections retain a dedicated, filtered/sorted **A–Z poster grid**. Primary tabs activate on focus. Use neutral near-black chrome, artwork-led color, restrained controls and stable card bounds. Inspect actual TV screenshots and D-pad behavior after UI changes. - Both sections retain a dedicated, filtered/sorted **A–Z poster grid**. Primary tabs activate on focus. Use neutral near-black chrome, artwork-led color, restrained controls and stable card bounds. Inspect actual TV screenshots and D-pad behavior after UI changes.
- `KaleidoViewModel.kt`: navigation, async loading and section caches. `PlexApi.kt` / `Models.kt`: Plex transport and parsing. `FocusedBrowse.kt`, `BrowseBackdrop.kt`, `BrowseScreens.kt`, `Theme.kt`: browsing/focus/design. `Playback.kt`: controller, negotiation and progress. `PlayerControls.kt` / `PlaybackExtras.kt`: controls, options and post-play. `SecureSession.kt`: Android Keystore persistence. `AppUpdater.kt`: repository updates. - `KaleidoViewModel.kt`: navigation, async loading and section caches. `PlexApi.kt` / `Models.kt`: Plex transport and parsing. `FocusedBrowse.kt`, `BrowseBackdrop.kt`, `BrowseScreens.kt`, `Theme.kt`: browsing/focus/design. `Playback.kt`: controller, negotiation and progress. `PlayerControls.kt` / `PlaybackExtras.kt`: controls, options and post-play. `SecureSession.kt`: Android Keystore persistence. `AppUpdater.kt`: repository updates.

View file

@ -1,15 +1,5 @@
# Kaleido releases # Kaleido releases
## 0.6.0
- Redesign Home after Silo. Moving into the rows compacts the hero into a preview of the focused card instead of scrolling it away: large title art, a rating badge, year, genre and runtime or time left, ratings, three lines of synopsis, cast and 4K/HDR/Atmos badges. Up or Back restores the hero.
- Show the focused card's own image in the top-right, scaled whole and fading into the page. Episodes show their own still instead of the show's artwork.
- Give Movies and TV the same preview above their rows.
- Fade between artwork, and fade and lift titles and descriptions between cards, instead of popping in. The hero's featured titles use the same transitions.
- Add Settings › Interface › Artwork colour wash (on by default), which tints the page with the focused artwork's colour.
- Redesign movie, show, season and episode pages to match: the same artwork and colour wash, title art, a facts line with rating and format badges, and a three-line synopsis. Season and episode pages follow the focused episode's still and details.
- Show title art, the rating badge and episode details in the player's controls.
## 0.5.0 ## 0.5.0
- Show the selected version's source bitrate beside Original quality in the playback quality menu. - Show the selected version's source bitrate beside Original quality in the playback quality menu.

View file

@ -4,18 +4,10 @@ import android.graphics.Bitmap
import android.graphics.Canvas import android.graphics.Canvas
import android.graphics.LinearGradient import android.graphics.LinearGradient
import android.graphics.Paint import android.graphics.Paint
import android.graphics.PorterDuff
import android.graphics.PorterDuffXfermode
import android.graphics.Rect
import android.graphics.RectF
import android.graphics.Shader import android.graphics.Shader
import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.BitmapDrawable
import android.content.Context import android.content.Context
import androidx.compose.animation.core.Animatable import androidx.compose.animation.Crossfade
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.foundation.layout.Box
import androidx.compose.ui.graphics.CompositingStrategy
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.animation.core.tween import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
@ -33,16 +25,10 @@ import coil.request.ImageRequest
import coil.size.Size import coil.size.Size
import coil.transform.Transformation import coil.transform.Transformation
/** /** Bake contrast into the cached bitmap on Coil's worker thread, not two screen-sized GPU passes per frame. */
* Bake contrast into the cached bitmap on Coil's worker thread, not two screen-sized GPU passes per frame. private class BrowseContrast(val cinematic:Boolean):Transformation {
* [header] artwork is scaled whole into the top-right of a screen-sized frame and fades into the page override val cacheKey="kaleido-browse-contrast-v2-$cinematic"
* toward its left and bottom edges, so the frame still crossfades like any other backdrop. With [wash],
* the page beneath carries the artwork's own colour, as Silo does, at no per-frame cost.
*/
private class BrowseContrast(val cinematic:Boolean,val header:Boolean,val wash:Boolean):Transformation {
override val cacheKey="kaleido-browse-contrast-v2-$cinematic"+if(header)"-header-corner4-$wash"else ""
override suspend fun transform(input:Bitmap,size:Size):Bitmap { override suspend fun transform(input:Bitmap,size:Size):Bitmap {
if(header)return headerFrame(input)
val output=input.copy(Bitmap.Config.ARGB_8888,true) val output=input.copy(Bitmap.Config.ARGB_8888,true)
val canvas=Canvas(output) val canvas=Canvas(output)
val paint=Paint(Paint.ANTI_ALIAS_FLAG) val paint=Paint(Paint.ANTI_ALIAS_FLAG)
@ -52,96 +38,26 @@ private class BrowseContrast(val cinematic:Boolean,val header:Boolean,val wash:B
canvas.drawRect(0f,0f,output.width.toFloat(),output.height.toFloat(),paint) canvas.drawRect(0f,0f,output.width.toFloat(),output.height.toFloat(),paint)
return output return output
} }
private fun headerFrame(input:Bitmap):Bitmap {
val output=Bitmap.createBitmap(960,540,Bitmap.Config.ARGB_8888)
val canvas=Canvas(output)
val width=output.width.toFloat();val height=output.height.toFloat()
canvas.drawColor(0xFF090909.toInt())
if(wash) {
// Richest behind the art (top-right), carried dimmer toward the rows (bottom-left).
val tint=ambientTint(input) and 0xFFFFFF
val paint=Paint()
paint.shader=LinearGradient(width,0f,0f,height,intArrayOf(0xFF shl 24 or tint,0x80 shl 24 or tint,0x2E shl 24 or tint),floatArrayOf(0f,.45f,1f),Shader.TileMode.CLAMP)
canvas.drawRect(0f,0f,width,height,paint)
}
// Whole pixels: a fractional edge left a faint seam beside the fade.
val art=RectF((width*(1f-HeaderArtWidth)).toInt().toFloat(),0f,width,(height*HeaderArtHeight).toInt().toFloat())
// The art gets its own layer, so its fading edges reveal the page (or wash) beneath.
val layer=canvas.saveLayer(art,null)
// Centre-crop only the small difference between the image's and the box's proportions.
val scale=maxOf(art.width()/input.width,art.height()/input.height)
val cropWidth=art.width()/scale;val cropHeight=art.height()/scale
val left=((input.width-cropWidth)/2f).toInt();val top=((input.height-cropHeight)/2f).toInt()
canvas.drawBitmap(input,Rect(left,top,left+cropWidth.toInt(),top+cropHeight.toInt()),art,Paint(Paint.FILTER_BITMAP_FLAG))
val mask=Paint().apply{xfermode=PorterDuffXfermode(PorterDuff.Mode.DST_IN)}
mask.shader=LinearGradient(art.left,0f,art.right,0f,intArrayOf(0,0x4D000000,0xFF000000.toInt()),floatArrayOf(0f,.2f,.5f),Shader.TileMode.CLAMP)
canvas.drawRect(art,mask)
mask.shader=LinearGradient(0f,art.top,0f,art.bottom,intArrayOf(0xFF000000.toInt(),0xFF000000.toInt(),0x4D000000,0),floatArrayOf(0f,.45f,.8f,1f),Shader.TileMode.CLAMP)
canvas.drawRect(art,mask)
canvas.restoreToCount(layer)
return output
}
} }
/** internal fun browseBackdropRequest(context:Context,api:PlexApi,path:String,cinematic:Boolean):ImageRequest? =
* The artwork's average colour at a fixed, low luminance (as Silo and tvOS do): bright art is dimmed
* and dark art lifted, giving a subtle, consistent tint over the near-black page.
*/
private fun ambientTint(input:Bitmap):Int {
val sample=Bitmap.createScaledBitmap(input,32,18,true)
val pixels=IntArray(sample.width*sample.height).also{sample.getPixels(it,0,sample.width,0,0,sample.width,sample.height)}
if(sample!==input)sample.recycle()
var r=0.0;var g=0.0;var b=0.0
for(pixel in pixels){r+=(pixel shr 16 and 0xFF);g+=(pixel shr 8 and 0xFF);b+=(pixel and 0xFF)}
r/=pixels.size*255.0;g/=pixels.size*255.0;b/=pixels.size*255.0
val luminance=.2126*r+.7152*g+.0722*b
val scale=when{luminance<=.001->0.0;luminance>.22->.22/luminance;else->maxOf(1.0,.22/maxOf(luminance,.05))}
fun channel(value:Double)=(value*scale*255).toInt().coerceIn(0,255)
return android.graphics.Color.rgb(channel(r),channel(g),channel(b))
}
/** The preview artwork box (Home, Movies, TV), as fractions of the screen; close to 16:9, so stills and art show whole. */
private const val HeaderArtWidth=.72f
private const val HeaderArtHeight=.78f
/** Old and new artwork overlap briefly instead of the new one popping in. */
internal const val ArtworkFadeMillis=320
internal fun browseBackdropRequest(context:Context,api:PlexApi,path:String,cinematic:Boolean,header:Boolean=false,wash:Boolean=false):ImageRequest? =
api.image(path,if(cinematic)1280 else 960,if(cinematic)720 else 540)?.let{url-> api.image(path,if(cinematic)1280 else 960,if(cinematic)720 else 540)?.let{url->
ImageRequest.Builder(context).data(url).apply{api.headers().forEach{(k,v)->addHeader(k,v)}} ImageRequest.Builder(context).data(url).apply{api.headers().forEach{(k,v)->addHeader(k,v)}}
.size(if(cinematic)1280 else 960,if(cinematic)720 else 540).allowHardware(false) .size(if(cinematic)1280 else 960,if(cinematic)720 else 540).allowHardware(false)
.transformations(BrowseContrast(cinematic,header&&!cinematic,wash)).crossfade(false).build() .transformations(BrowseContrast(cinematic)).crossfade(false).build()
} }
/** The new artwork fades in over the old one; only its layer alpha changes per frame. */ @Composable internal fun BrowseBackdrop(api:PlexApi,path:String,modifier:Modifier,cinematic:Boolean=false,animate:Boolean=false,alignment:Alignment=Alignment.Center,contentScale:ContentScale=ContentScale.Crop) {
@Composable private fun FadingArtwork(bitmap:Bitmap?,modifier:Modifier,contentScale:ContentScale,alignment:Alignment) {
val progress=remember{Animatable(1f)}
var shown by remember{mutableStateOf<Bitmap?>(null)}
var under by remember{mutableStateOf<Bitmap?>(null)}
LaunchedEffect(bitmap) {
if(bitmap==null||bitmap===shown)return@LaunchedEffect
under=shown;shown=bitmap
progress.snapTo(0f);progress.animateTo(1f,tween(ArtworkFadeMillis,easing=FastOutSlowInEasing))
under=null
}
Box(modifier) {
under?.let{Image(remember(it){it.asImageBitmap()},null,contentScale=contentScale,alignment=alignment,modifier=Modifier.fillMaxSize())}
shown?.let{Image(remember(it){it.asImageBitmap()},null,contentScale=contentScale,alignment=alignment,modifier=Modifier.fillMaxSize().graphicsLayer{
compositingStrategy=CompositingStrategy.ModulateAlpha;alpha=progress.value
})}
}
}
@Composable internal fun BrowseBackdrop(api:PlexApi,path:String,modifier:Modifier,cinematic:Boolean=false,header:Boolean=false,wash:Boolean=false,animate:Boolean=false,alignment:Alignment=Alignment.Center,contentScale:ContentScale=ContentScale.Crop) {
val context=LocalContext.current val context=LocalContext.current
var previous by remember{mutableStateOf<MemoryCache.Key?>(null)} var previous by remember{mutableStateOf<MemoryCache.Key?>(null)}
val request=remember(path,api.session?.server,cinematic,header,wash,animate){browseBackdropRequest(context,api,path,cinematic,header,wash)?.newBuilder()?.placeholderMemoryCacheKey(previous)?.build()} val request=remember(path,api.session?.server,cinematic,animate){browseBackdropRequest(context,api,path,cinematic)?.newBuilder()?.placeholderMemoryCacheKey(previous)?.build()}
if(animate) { if(animate) {
// Animate cache hits too; Coil intentionally skips its own crossfade for memory-cache results. // Animate cache hits too; Coil intentionally skips its own crossfade for memory-cache results.
val bitmap by produceState<Bitmap?>(null,request){ val bitmap by produceState<Bitmap?>(null,request){
if(request!=null){val result=context.imageLoader.execute(request);if(result is SuccessResult){previous=result.memoryCacheKey;value=(result.drawable as? BitmapDrawable)?.bitmap}} if(request!=null){val result=context.imageLoader.execute(request);if(result is SuccessResult){previous=result.memoryCacheKey;value=(result.drawable as? BitmapDrawable)?.bitmap}}
} }
FadingArtwork(bitmap,modifier,contentScale,alignment) Crossfade(bitmap,modifier=modifier,animationSpec=tween(220),label="heroArtwork"){loaded->
loaded?.let{Image(it.asImageBitmap(),null,contentScale=contentScale,alignment=alignment,modifier=Modifier.fillMaxSize())}
}
}else AsyncImage(request,contentDescription=null,modifier=modifier,contentScale=contentScale,alignment=alignment,onSuccess={previous=it.result.memoryCacheKey}) }else AsyncImage(request,contentDescription=null,modifier=modifier,contentScale=contentScale,alignment=alignment,onSuccess={previous=it.result.memoryCacheKey})
} }

View file

@ -10,16 +10,9 @@ import androidx.compose.foundation.gestures.BringIntoViewSpec
import androidx.compose.foundation.gestures.LocalBringIntoViewSpec import androidx.compose.foundation.gestures.LocalBringIntoViewSpec
import androidx.compose.foundation.gestures.animateScrollBy import androidx.compose.foundation.gestures.animateScrollBy
import androidx.compose.foundation.gestures.scrollBy import androidx.compose.foundation.gestures.scrollBy
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.FastOutSlowInEasing
import androidx.compose.animation.core.tween import androidx.compose.animation.core.tween
import androidx.compose.animation.core.Animatable
import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.graphics.CompositingStrategy
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.DpSize
import coil.imageLoader
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.withTimeoutOrNull
import androidx.compose.material3.* import androidx.compose.material3.*
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.PlayArrow import androidx.compose.material.icons.filled.PlayArrow
@ -79,7 +72,7 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
val focused=Snapshot.withoutReadObservation{vm.focusId} val focused=Snapshot.withoutReadObservation{vm.focusId}
hubs.withIndex().firstNotNullOfOrNull{(row,h)->val column=if(focused=="${h.id}:$VIEW_ALL")h.items.size else h.items.indexOfFirst{"${h.id}:${it.id}"==focused};if(column>=0)Triple(h.id,row,column)else null} hubs.withIndex().firstNotNullOfOrNull{(row,h)->val column=if(focused=="${h.id}:$VIEW_ALL")h.items.size else h.items.indexOfFirst{"${h.id}:${it.id}"==focused};if(column>=0)Triple(h.id,row,column)else null}
} }
val initialRow=restore?.second ?: 0 val initialRow=restore?.let{it.second+if(home)1 else 0} ?: 0
// Keep the hero/preview and adjacent rows prepared across vertical moves. // Keep the hero/preview and adjacent rows prepared across vertical moves.
// Without a behind window, every return discards and recomposes those cards. // Without a behind window, every return discards and recomposes those cards.
val list=rememberLazyListState(initialFirstVisibleItemIndex=initialRow, val list=rememberLazyListState(initialFirstVisibleItemIndex=initialRow,
@ -114,34 +107,24 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
var featureIndex by rememberSaveable{mutableIntStateOf(0)} var featureIndex by rememberSaveable{mutableIntStateOf(0)}
val nextFeature=features.getOrNull(featureIndex % features.size.coerceAtLeast(1)) val nextFeature=features.getOrNull(featureIndex % features.size.coerceAtLeast(1))
var selectedFeature by remember{mutableStateOf(nextFeature)} var selectedFeature by remember{mutableStateOf(nextFeature)}
val context=LocalContext.current val heroFade=remember{Animatable(1f)}
LaunchedEffect(nextFeature){ LaunchedEffect(nextFeature){
val next=nextFeature?.item if(home)nextFeature?.item?.let{vm.anticipate(it,cinematic=true)}
if(home&&next!=null)vm.anticipate(next,cinematic=true) if(home&&selectedFeature!=null&&nextFeature!=null&&selectedFeature?.item?.id!=nextFeature.item.id)heroFade.animateTo(0f,tween(100))
// Hold the copy briefly until the new artwork is decoded, so both fade together.
if(home&&next!=null&&selectedFeature!=null&&selectedFeature?.item?.id!=next.id)
browseBackdropRequest(context,vm.api,next.art.ifBlank{next.thumb},true)?.let{withTimeoutOrNull(700){context.imageLoader.execute(it)}}
selectedFeature=nextFeature selectedFeature=nextFeature
heroFade.animateTo(1f,tween(180))
} }
val feature=selectedFeature?.item val feature=selectedFeature?.item
val activeFeature=rememberUpdatedState(feature) val activeFeature=rememberUpdatedState(feature)
// Home only: the large hero while it holds focus; a compact preview of the focused card otherwise. var heroActive by remember{mutableStateOf(restore==null)}
// Read only inside effects, callbacks and layers: switching modes must not recompose the catalog.
val heroMode=remember{mutableStateOf(restore==null)}
var heroActive by heroMode
val compact=remember{Animatable(if(home&&restore==null)0f else 1f)}
LaunchedEffect(compact,home){snapshotFlow{home&&heroMode.value}.collectLatest{compact.animateTo(if(it)0f else 1f,tween(HeaderMillis,easing=FastOutSlowInEasing))}}
val firstCard=rememberUpdatedState(hubs.firstOrNull()?.items?.firstOrNull())
val preview=restingPreview(hovered,{firstCard.value}){!home||!heroMode.value}
fun anticipateCard(item:Title)=vm.anticipate(item,path=previewArt(item),header=true)
var rotating by remember{mutableStateOf(true)} var rotating by remember{mutableStateOf(true)}
LaunchedEffect(home,features,rotating,featureIndex){ LaunchedEffect(home,features,heroActive,rotating,featureIndex){
snapshotFlow{heroMode.value}.collectLatest{if(home&&it&&rotating&&features.size>1){delay(12000);featureIndex=(featureIndex+1)%features.size}} if(home&&heroActive&&rotating&&features.size>1){delay(12000);featureIndex=(featureIndex+1)%features.size}
} }
val heroFocus=remember{FocusRequester()} val heroFocus=remember{FocusRequester()}
val staging=remember{CardStaging()} val staging=remember{CardStaging()}
LaunchedEffect(staging){delay(1000);staging.entering=false} LaunchedEffect(staging){delay(1000);staging.entering=false}
suspend fun focusHero(){repeat(4){withFrameNanos{};if(runCatching{heroFocus.requestFocus()}.getOrDefault(false))return}} val rowOffset=if(home)1 else 0
suspend fun moveToRow(hubId:String,titleId:String)=coroutineScope { suspend fun moveToRow(hubId:String,titleId:String)=coroutineScope {
val row=hubs.indexOfFirst{it.id==hubId} val row=hubs.indexOfFirst{it.id==hubId}
val hub=hubs.getOrNull(row) ?: return@coroutineScope val hub=hubs.getOrNull(row) ?: return@coroutineScope
@ -149,21 +132,21 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
if(column<0)return@coroutineScope if(column<0)return@coroutineScope
val state=rowStates[hub.id] ?: return@coroutineScope val state=rowStates[hub.id] ?: return@coroutineScope
val focusKey="$hubId:$titleId" val focusKey="$hubId:$titleId"
val visible=list.layoutInfo.visibleItemsInfo.any{it.index==row}&&state.layoutInfo.visibleItemsInfo.any{it.index==column} val visible=list.layoutInfo.visibleItemsInfo.any{it.index==row+rowOffset}&&state.layoutInfo.visibleItemsInfo.any{it.index==column}
val focused=visible&&runCatching{requesters[focusKey]?.requestFocus()==true}.getOrDefault(false) val focused=visible&&runCatching{requesters[focusKey]?.requestFocus()==true}.getOrDefault(false)
val scrolling=launch{list.animateBrowseTo(row)} val scrolling=launch{list.animateBrowseTo(row+rowOffset)}
if(!state.layoutInfo.visibleItemsInfo.any{it.index==column})state.requestScrollToItem(column) if(!state.layoutInfo.visibleItemsInfo.any{it.index==column})state.requestScrollToItem(column)
if(!focused) { if(!focused) {
snapshotFlow{list.layoutInfo.visibleItemsInfo.any{it.index==row}&&state.layoutInfo.visibleItemsInfo.any{it.index==column}}.first{it} snapshotFlow{list.layoutInfo.visibleItemsInfo.any{it.index==row+rowOffset}&&state.layoutInfo.visibleItemsInfo.any{it.index==column}}.first{it}
withFrameNanos{} withFrameNanos{}
runCatching{requesters.getOrPut(focusKey){FocusRequester()}.requestFocus()} runCatching{requesters.getOrPut(focusKey){FocusRequester()}.requestFocus()}
} }
scrolling.join() scrolling.join()
} }
suspend fun moveToHero()=coroutineScope { suspend fun moveToHero()=coroutineScope {
heroActive=true
val scrolling=launch{list.animateBrowseTo(0)} val scrolling=launch{list.animateBrowseTo(0)}
focusHero();scrolling.join() snapshotFlow{list.layoutInfo.visibleItemsInfo.any{it.index==0}}.first{it}
withFrameNanos{};runCatching{heroFocus.requestFocus()};scrolling.join()
} }
LaunchedEffect(hubs) { LaunchedEffect(hubs) {
val old=previousHubs val old=previousHubs
@ -206,7 +189,7 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
hovered.value=null hovered.value=null
if(home&&feature!=null) { if(home&&feature!=null) {
vm.focusId="home-feature";heroActive=true vm.focusId="home-feature";heroActive=true
navigationJob[0]=scope.launch{list.scrollToItem(0);focusHero()} navigationJob[0]=scope.launch{list.scrollToItem(0);withFrameNanos{};runCatching{heroFocus.requestFocus()}}
}else if(!home) { }else if(!home) {
vm.focusId="discovery-entry" vm.focusId="discovery-entry"
navigationJob[0]=scope.launch{withFrameNanos{};runCatching{navigation.section.requestFocus()}} navigationJob[0]=scope.launch{withFrameNanos{};runCatching{navigation.section.requestFocus()}}
@ -217,7 +200,7 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
} }
} }
} }
LaunchedEffect(home,features.isNotEmpty()){if(home&&vm.focusId=="home-feature"){heroActive=true;list.scrollToItem(0);focusHero()}} LaunchedEffect(home,features.isNotEmpty()){if(home&&vm.focusId=="home-feature"){list.scrollToItem(0);withFrameNanos{};runCatching{heroFocus.requestFocus()}}}
DisposableEffect(navigation,list,hubs){ DisposableEffect(navigation,list,hubs){
navigation.scrolled=false navigation.scrolled=false
navigation.enter={ navigation.enter={
@ -226,8 +209,9 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
// or waiting for two lazy lists to lay out. The next Down explicitly enters row 0. // or waiting for two lazy lists to lay out. The next Down explicitly enters row 0.
if(!home)runCatching{navigation.section.requestFocus()} if(!home)runCatching{navigation.section.requestFocus()}
else { else {
if(heroActive)runCatching{heroFocus.requestFocus()} val visible=list.layoutInfo.visibleItemsInfo.any{it.index==0}
navigationJob[0]=scope.launch{moveToHero()} if(visible)runCatching{heroFocus.requestFocus()}
navigationJob[0]=scope.launch{if(visible)list.animateBrowseTo(0)else moveToHero()}
activeFeature.value?.let{vm.anticipate(it,cinematic=true)} activeFeature.value?.let{vm.anticipate(it,cinematic=true)}
} }
} }
@ -260,32 +244,8 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
val title=when(destination){"movies"->"Movies";"tv"->"TV Shows";else->"Home"} val title=when(destination){"movies"->"Movies";"tv"->"TV Shows";else->"Home"}
BoxWithConstraints(Modifier.fillMaxSize()) { BoxWithConstraints(Modifier.fillMaxSize()) {
val heroHeight=maxHeight*.80f-62.dp val heroHeight=maxHeight*.80f-62.dp
if(home)HomeBackdrop(vm.api,preview,feature,heroMode,vm.colourWash) if(home)HomeBackdrop(vm.api,hovered,feature,heroActive)
else FocusedPreviewCanvas(vm,preview,hubs.firstOrNull()?.items?.firstOrNull(),vm.colourWash) else FocusedPreviewCanvas(vm,hovered,hubs.firstOrNull()?.items?.firstOrNull(),destination)
if(home) {
val lift=with(density){HeaderLift.toPx()}
// Leaving for the rows, the hero lifts away as the preview rises in; the reverse settles it back.
HeaderLayer({compact.value},{heroMode.value},true,lift,Modifier.padding(top=62.dp).fillMaxWidth().height(heroHeight)) {
feature?.let{item->Box(Modifier.fillMaxSize()) {
Column(Modifier.align(Alignment.BottomStart).padding(start=Cinema.gutter,bottom=35.dp).width(350.dp)) {
FadingCopy(selectedFeature,{it.item.id},lift,contentAlignment=Alignment.BottomStart){HeroCopy(vm,it)}
Row(Modifier.padding(top=16.dp).onPreviewKeyEvent{event->
if(event.type==KeyEventType.KeyDown&&event.key==Key.DirectionDown){hubs.firstOrNull()?.items?.firstOrNull()?.let{anticipateCard(it)};navigationJob[0]?.cancel();navigationJob[0]=scope.launch{hubs.firstOrNull()?.let{hub->hub.items.firstOrNull()?.let{moveToRow(hub.id,it.id)}}};true}else false
}.onFocusChanged{if(it.hasFocus){heroActive=true;hovered.value=null}},horizontalArrangement=Arrangement.spacedBy(9.dp),verticalAlignment=Alignment.CenterVertically) {
ActionButton(if(item.offset>0)"Resume"else "Play",Icons.Filled.PlayArrow,primary=true,modifier=Modifier.focusRequester(heroFocus).focusProperties{up=navigation.top}.onFocusChanged{if(it.isFocused){vm.focusId="home-feature";rotating=true}}){vm.play(item)}
IconControl(Icons.Outlined.Info,"More info",modifier=Modifier.focusProperties{up=navigation.top},onFocused={rotating=false}){vm.open(item)}
if(features.size>1)IconControl(Icons.Outlined.ChevronRight,"Next featured title",modifier=Modifier.focusProperties{up=navigation.top},onFocused={rotating=false}){featureIndex=(featureIndex+1)%features.size}
}
}
Row(Modifier.align(Alignment.BottomCenter).padding(bottom=8.dp),horizontalArrangement=Arrangement.spacedBy(5.dp)) {
features.forEachIndexed{i,_->Box(Modifier.size(if(i==featureIndex)12.dp else 3.dp,3.dp).background(Accent.copy(alpha=if(i==featureIndex).9f else .35f),RoundedCornerShape(2.dp)))}
}
}}
}
HeaderLayer({compact.value},{heroMode.value},false,lift,Modifier.padding(start=Cinema.gutter,top=78.dp).height(200.dp)) {
HomePreview(vm,preview)
}
}
Column(Modifier.fillMaxSize().padding(top=62.dp)) { Column(Modifier.fillMaxSize().padding(top=62.dp)) {
if(!home) { if(!home) {
Row(Modifier.fillMaxWidth().height(39.dp).padding(horizontal=Cinema.gutter),verticalAlignment=Alignment.CenterVertically) { Row(Modifier.fillMaxWidth().height(39.dp).padding(horizontal=Cinema.gutter),verticalAlignment=Alignment.CenterVertically) {
@ -293,7 +253,7 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
if(!home) { if(!home) {
NavigationLabel("Discover",true,modifier=Modifier.focusRequester(navigation.section).focusProperties{up=navigation.top;down=navigation.entry}.onPreviewKeyEvent { NavigationLabel("Discover",true,modifier=Modifier.focusRequester(navigation.section).focusProperties{up=navigation.top;down=navigation.entry}.onPreviewKeyEvent {
if(it.type==KeyEventType.KeyDown&&it.key==Key.DirectionDown){ if(it.type==KeyEventType.KeyDown&&it.key==Key.DirectionDown){
hubs.firstOrNull()?.items?.firstOrNull()?.let{item->anticipateCard(item)} hubs.firstOrNull()?.items?.firstOrNull()?.let{item->vm.anticipate(item)}
navigationJob[0]?.cancel();navigationJob[0]=scope.launch{hubs.firstOrNull()?.let{hub->hub.items.firstOrNull()?.let{moveToRow(hub.id,it.id)}}};true navigationJob[0]?.cancel();navigationJob[0]=scope.launch{hubs.firstOrNull()?.let{hub->hub.items.firstOrNull()?.let{moveToRow(hub.id,it.id)}}};true
}else false }else false
},initialFocus=sectionEntry){} },initialFocus=sectionEntry){}
@ -312,14 +272,39 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
}){sectionMenu=true} }){sectionMenu=true}
} }
} }
Spacer(Modifier.fillMaxWidth().height(SectionPreviewSpace)) Spacer(Modifier.fillMaxWidth().height(if(destination=="movies")137.dp else 119.dp))
} }
else Spacer(Modifier.fillMaxWidth().height(HomePreviewHeight))
// The rows sit below the hero, then slide up beneath the compact preview. A layer
// offset rather than a resized list: the catalog never re-measures during the move.
val heroDrop=with(density){(heroHeight+15.dp-HomePreviewHeight).toPx()}
CompositionLocalProvider(LocalBringIntoViewSpec provides BrowseScroll) { CompositionLocalProvider(LocalBringIntoViewSpec provides BrowseScroll) {
LazyColumn(state=list,modifier=Modifier.fillMaxWidth().weight(1f).then(if(home)Modifier.graphicsLayer{translationY=heroDrop*(1f-compact.value)}else Modifier).onFocusChanged{catalogFocus=it.hasFocus},verticalArrangement=Arrangement.spacedBy(15.dp),contentPadding=PaddingValues(bottom=22.dp)) { LazyColumn(state=list,modifier=Modifier.fillMaxWidth().weight(1f).onFocusChanged{catalogFocus=it.hasFocus},verticalArrangement=Arrangement.spacedBy(15.dp),contentPadding=PaddingValues(bottom=22.dp)) {
if(home)item(key="home-feature") {
Box(Modifier.fillMaxWidth().height(heroHeight)) {
feature?.let{item->
val metadata by produceState(item,item.id){value=item;value=vm.previewDetails(item)}
Column(Modifier.align(Alignment.BottomStart).padding(start=Cinema.gutter,bottom=35.dp).width(350.dp)) {
Column(Modifier.graphicsLayer{alpha=heroFade.value}) {
Eyebrow(selectedFeature?.reason.orEmpty())
Spacer(Modifier.height(9.dp))
TitleIdentity(vm.api,item,Modifier.width(264.dp).height(80.dp))
Row(Modifier.fillMaxWidth().padding(top=8.dp,bottom=8.dp),verticalAlignment=Alignment.CenterVertically) {
Text(listOf(item.year,item.genres.firstOrNull().orEmpty(),item.contentRating).filter{it.isNotBlank()}.joinToString(" · "),color=Cinema.secondary,fontSize=10.sp,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.weight(1f,fill=false))
AudienceRatings(metadata,Modifier.padding(start=10.dp))
}
Text(item.summary,color=Cinema.secondary,fontSize=12.sp,lineHeight=18.sp,maxLines=3,overflow=TextOverflow.Ellipsis)
}
Row(Modifier.padding(top=16.dp).onPreviewKeyEvent{event->
if(event.type==KeyEventType.KeyDown&&event.key==Key.DirectionDown){hubs.firstOrNull()?.items?.firstOrNull()?.let{vm.anticipate(it,cinematic=true)};navigationJob[0]?.cancel();navigationJob[0]=scope.launch{hubs.firstOrNull()?.let{hub->hub.items.firstOrNull()?.let{moveToRow(hub.id,it.id)}}};true}else false
}.onFocusChanged{if(it.hasFocus){heroActive=true;hovered.value=null}},horizontalArrangement=Arrangement.spacedBy(9.dp),verticalAlignment=Alignment.CenterVertically) {
ActionButton(if(item.offset>0)"Resume"else "Play",Icons.Filled.PlayArrow,primary=true,modifier=Modifier.focusRequester(heroFocus).focusProperties{up=navigation.top}.onFocusChanged{if(it.isFocused){vm.focusId="home-feature";rotating=true}}){vm.play(item)}
IconControl(Icons.Outlined.Info,"More info",modifier=Modifier.focusProperties{up=navigation.top},onFocused={rotating=false}){vm.open(item)}
if(features.size>1)IconControl(Icons.Outlined.ChevronRight,"Next featured title",modifier=Modifier.focusProperties{up=navigation.top},onFocused={rotating=false}){featureIndex=(featureIndex+1)%features.size}
}
}
Row(Modifier.align(Alignment.BottomCenter).padding(bottom=8.dp),horizontalArrangement=Arrangement.spacedBy(5.dp)) {
features.forEachIndexed{i,_->Box(Modifier.size(if(i==featureIndex)12.dp else 3.dp,3.dp).background(Accent.copy(alpha=if(i==featureIndex).9f else .35f),RoundedCornerShape(2.dp)))}
}
}
}
}
itemsIndexed(hubs,key={_,h->h.id},contentType={_,h->if(h.items.firstOrNull()?.type=="episode")"episodes"else "titles"}) {row,hub-> itemsIndexed(hubs,key={_,h->h.id},contentType={_,h->if(h.items.firstOrNull()?.type=="episode")"episodes"else "titles"}) {row,hub->
val poster=hub.items.firstOrNull()?.type in listOf("movie","show","season")&&!hub.title.contains("Continue",true)&&(destination=="movies"||destination=="tv"||row==1) val poster=hub.items.firstOrNull()?.type in listOf("movie","show","season")&&!hub.title.contains("Continue",true)&&(destination=="movies"||destination=="tv"||row==1)
val wideEpisode=destination=="tv"&&!poster val wideEpisode=destination=="tv"&&!poster
@ -346,7 +331,7 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
// catalog layout between those events. Bursts keep the latest // catalog layout between those events. Bursts keep the latest
// logical column instead of dropping a move while awaiting layout. // logical column instead of dropping a move while awaiting layout.
withFrameNanos{} withFrameNanos{}
if(!rapid)hub.items.getOrNull(target)?.let{anticipateCard(it)} if(!rapid)hub.items.getOrNull(target)?.let{vm.anticipate(it,cinematic=home)}
val visible=state.layoutInfo.visibleItemsInfo.any{it.index==target} val visible=state.layoutInfo.visibleItemsInfo.any{it.index==target}
val anchor=(target-1).coerceAtLeast(0) val anchor=(target-1).coerceAtLeast(0)
if(visible&&!rapid) { if(visible&&!rapid) {
@ -364,7 +349,7 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
// A held direction snaps to the latest anchor. Repeatedly // A held direction snaps to the latest anchor. Repeatedly
// cancelling pixel animations and decoding transient backdrops // cancelling pixel animations and decoding transient backdrops
// costs more than the focus move; predict only after it settles. // costs more than the focus move; predict only after it settles.
if(rapid){delay(70);hub.items.getOrNull(target)?.let{anticipateCard(it)}} if(rapid){delay(70);hub.items.getOrNull(target)?.let{vm.anticipate(it,cinematic=home)}}
} }
} }
true true
@ -372,7 +357,7 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
if(event.key==Key.DirectionUp&&row==0) { if(event.key==Key.DirectionUp&&row==0) {
if(home)feature?.let{vm.anticipate(it,cinematic=true)} if(home)feature?.let{vm.anticipate(it,cinematic=true)}
navigationJob[0]?.cancel() navigationJob[0]?.cancel()
navigationJob[0]=scope.launch{if(home&&feature!=null)moveToHero()else{withFrameNanos{};runCatching{(if(home)navigation.top else navigation.section).requestFocus()}}} navigationJob[0]=scope.launch{if(home)moveToHero()else{withFrameNanos{};runCatching{navigation.section.requestFocus()}}}
} }
else { else {
navigationJob[0]?.cancel() navigationJob[0]?.cancel()
@ -381,7 +366,7 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
val targetHub=hubs[target] val targetHub=hubs[target]
val selectedId=columns[targetHub.id] val selectedId=columns[targetHub.id]
val col=targetHub.items.indexOfFirst{it.id==selectedId}.takeIf{it>=0} ?: 0 val col=targetHub.items.indexOfFirst{it.id==selectedId}.takeIf{it>=0} ?: 0
anticipateCard(hubs[target].items[col]) vm.anticipate(hubs[target].items[col],cinematic=home)
navigationJob[0]=scope.launch{moveToRow(targetHub.id,targetHub.items[col].id)} navigationJob[0]=scope.launch{moveToRow(targetHub.id,targetHub.items[col].id)}
} }
} }
@ -416,168 +401,35 @@ private suspend fun LazyListState.animateBrowseTo(index:Int) {
if(sectionMenu)ChoiceDialog("Libraries",sectionChoices.map{it.title},sectionChoices.indexOf(vm.section),{sectionMenu=false}){vm.chooseSection(sectionChoices[it]);sectionMenu=false} if(sectionMenu)ChoiceDialog("Libraries",sectionChoices.map{it.title},sectionChoices.indexOf(vm.section),{sectionMenu=false}){vm.chooseSection(sectionChoices[it]);sectionMenu=false}
} }
/** Home's compact header: the preview block Movies and TV show above their rows. */
/** Home's compact header (after Silo's): its height below the top bar, and its title art. */
private val HomePreviewHeight=228.dp
private val HomeLogo=DpSize(300.dp,64.dp)
/** Movies and TV use the same preview below their Discover/Library/Categories line, slightly smaller. */
private val SectionPreviewSpace=199.dp
private val SectionPreviewHeight=190.dp
private val SectionLogo=DpSize(280.dp,56.dp)
private const val HeaderMillis=380
private const val CopyMillis=380
internal val HeaderLift=12.dp
/** Focus must rest this long before the preview follows it, so a held direction doesn't replay fades. */
private const val PreviewRestMillis=110L
/** Previews show a card's own image: an episode's still, not its show's artwork. */
internal fun previewArt(item:Title)=if(item.type=="episode")item.still.ifBlank{item.thumb}.ifBlank{item.art}else item.art.ifBlank{item.thumb}
/**
* The card the preview shows: [hovered] once focus rests on it. The first card after the
* preview reappears shows at once. Inactive, it holds [idle] (the card Down enters), already
* composed under the hero, so entering the rows is only a fade.
*/
@Composable private fun restingPreview(hovered:State<Title?>,idle:()->Title?,active:()->Boolean):State<Title?> {
val rested=remember{mutableStateOf<Title?>(null)}
LaunchedEffect(hovered) {
snapshotFlow{if(active())hovered.value else idle()}.collectLatest{
if(it!=null&&rested.value!=null)delay(PreviewRestMillis)
rested.value=it
}
}
return rested
}
/**
* The hero ([hero]) or the compact preview, faded and lifted by [progress] in its own layer: one
* animation, no per-frame composition or layout. The hero is composed only while shown or leaving;
* the preview stays composed, invisible under the hero.
*/
@Composable private fun HeaderLayer(progress:()->Float,heroShown:()->Boolean,hero:Boolean,lift:Float,modifier:Modifier,content:@Composable ()->Unit) {
val composed by remember{derivedStateOf{!hero||heroShown()||progress()<1f}}
if(composed)Box(modifier.graphicsLayer{
val c=progress()
compositingStrategy=CompositingStrategy.ModulateAlpha
if(hero){alpha=(1f-c*1.6f).coerceIn(0f,1f);translationY=-lift*c}
else{alpha=((c-.3f)/.7f).coerceIn(0f,1f);translationY=lift*(1f-c)}
}){content()}
}
/**
* Swaps [item] Silo-style: the outgoing copy lifts slightly as it fades; the next rises into
* place as it fades in. Two keyed layers driven by one animation, read only while drawing.
*/
@Composable internal fun <T:Any> FadingCopy(item:T?,id:(T)->String,lift:Float,modifier:Modifier=Modifier,contentAlignment:Alignment=Alignment.TopStart,content:@Composable (T)->Unit) {
val progress=remember{Animatable(1f)}
var shown by remember{mutableStateOf(item)}
var leaving by remember{mutableStateOf<T?>(null)}
LaunchedEffect(item?.let(id)) {
val previous=shown
shown=item
if(previous==null||item==null){leaving=null;progress.snapTo(1f);return@LaunchedEffect}
if(id(previous)==id(item))return@LaunchedEffect
leaving=previous
progress.snapTo(0f)
progress.animateTo(1f,tween(CopyMillis,easing=FastOutSlowInEasing))
leaving=null
}
// The same title with fresher details updates in place.
val current=if(item!=null&&shown?.let(id)==id(item))item else shown
Box(modifier,contentAlignment=contentAlignment) {
listOfNotNull(leaving,current).forEach{entry->
val outgoing=entry===leaving
key(id(entry)) {
Box(Modifier.graphicsLayer{
val t=progress.value
compositingStrategy=CompositingStrategy.ModulateAlpha
if(outgoing){alpha=(1f-t*2.5f).coerceAtLeast(0f);translationY=-lift*.66f*t}
else{alpha=((t-.2f)/.8f).coerceIn(0f,1f);translationY=lift*(1f-t)}
}){content(entry)}
}
}
}
}
/** Focus changes invalidate this small preview scope, never the catalog hierarchy. */ /** Focus changes invalidate this small preview scope, never the catalog hierarchy. */
@Composable private fun HomeBackdrop(api:PlexApi,preview:State<Title?>,feature:Title?,heroMode:State<Boolean>,wash:Boolean) { @Composable private fun HomeBackdrop(api:PlexApi,hovered:State<Title?>,feature:Title?,heroActive:Boolean) {
val target=if(heroMode.value)feature?.let{it.art.ifBlank{it.thumb} to true}else preview.value?.let{previewArt(it) to false} var displayed by remember{mutableStateOf<Title?>(null)}
// Keep the last artwork while the preview waits for its first resting card. val current=if(heroActive)feature else hovered.value ?: feature
val last=remember{arrayOfNulls<Pair<String,Boolean>>(1)} LaunchedEffect(current){if(!heroActive)delay(90);displayed=current}
val shown=target ?: last[0] ?: feature?.let{it.art.ifBlank{it.thumb} to true} (displayed ?: feature)?.let{BrowseBackdrop(api,it.art.ifBlank{it.thumb},Modifier.fillMaxSize(),cinematic=true,animate=heroActive)}
last[0]=shown
shown?.let{(path,cinematic)->BrowseBackdrop(api,path,Modifier.fillMaxSize(),cinematic=cinematic,header=true,wash=wash,animate=true)}
} }
@Composable private fun FocusedPreviewCanvas(vm:KaleidoViewModel,preview:State<Title?>,fallback:Title?,wash:Boolean) { @Composable private fun FocusedPreviewCanvas(vm:KaleidoViewModel,hovered:State<Title?>,fallback:Title?,destination:String) {
val feature=preview.value ?: fallback var displayed by remember{mutableStateOf<Title?>(null)}
val current=hovered.value
LaunchedEffect(current){delay(120);displayed=current}
val feature=displayed ?: fallback
val metadata by produceState(feature,feature){value=feature;feature?.let{value=vm.previewDetails(it)}}
Box(Modifier.fillMaxSize()) { Box(Modifier.fillMaxSize()) {
feature?.let{BrowseBackdrop(vm.api,previewArt(it),Modifier.fillMaxSize(),header=true,wash=wash,animate=true)} feature?.let{item->
Box(Modifier.padding(start=Cinema.gutter,top=104.dp).height(SectionPreviewHeight)) { BrowseBackdrop(vm.api,item.art,Modifier.fillMaxSize())
PreviewBlock(vm,feature,SectionLogo) Column(Modifier.padding(start=Cinema.gutter,top=106.dp).width(350.dp).clearAndSetSemantics{contentDescription=listOf(item.displayTitle,metadata?.rating.orEmpty(),item.summary).filter{it.isNotBlank()}.joinToString(". ")}) {
} TitleIdentity(vm.api,item,Modifier.width(if(destination=="tv")230.dp else 260.dp).height(if(destination=="tv")43.dp else 53.dp))
} Row(Modifier.fillMaxWidth().padding(top=7.dp,bottom=5.dp),verticalAlignment=Alignment.CenterVertically) {
} Text(listOf(if(item.type=="episode")"S${item.parentIndex} · E${item.index} ${item.title}"else item.year,item.genres.firstOrNull().orEmpty(),item.contentRating).filter{it.isNotBlank()}.joinToString(" · "),fontSize=10.sp,lineHeight=14.sp,color=Cinema.secondary,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.weight(1f,fill=false))
AudienceRatings(metadata ?: item,Modifier.padding(start=10.dp))
@Composable private fun HomePreview(vm:KaleidoViewModel,preview:State<Title?>)=PreviewBlock(vm,preview.value,HomeLogo) }
Text(item.summary,color=Cinema.secondary,fontSize=11.5.sp,lineHeight=16.sp,maxLines=2,overflow=TextOverflow.Ellipsis)
/** Bottom-anchored like Silo's: a shorter synopsis leaves room above the title, not a gap above the rows. */
@Composable private fun PreviewBlock(vm:KaleidoViewModel,item:Title?,logo:DpSize) {
FadingCopy(item,{it.id},with(LocalDensity.current){HeaderLift.toPx()},Modifier.fillMaxHeight(),Alignment.BottomStart){PreviewText(vm,it,logo)}
}
/** The focused card: large title art, the facts, three lines of synopsis, then cast and format. */
@Composable private fun PreviewText(vm:KaleidoViewModel,item:Title,logo:DpSize) {
var loaded by remember{mutableStateOf(false)}
val metadata by produceState(item,item){value=vm.previewDetails(item);loaded=true}
// Cast and formats need the full details. Their rows are reserved, and fade in when they arrive.
val details=remember{Animatable(0f)}
LaunchedEffect(loaded){if(loaded)details.animateTo(1f,tween(220))}
val formats=formatLabels(metadata.media.firstOrNull())
val runtime=when{item.duration<=0->"";item.offset>0->runtimeLabel(item.duration-item.offset)+" left";else->runtimeLabel(item.duration)}
Column(Modifier.width(420.dp).clearAndSetSemantics{contentDescription=listOf(item.displayTitle,metadata.rating,item.summary).filter{it.isNotBlank()}.joinToString(". ")}) {
TitleIdentity(vm.api,item,Modifier.size(logo))
Row(Modifier.fillMaxWidth().padding(top=10.dp,bottom=7.dp).height(17.dp),verticalAlignment=Alignment.CenterVertically) {
if(item.contentRating.isNotBlank())FormatBadge(item.contentRating,Modifier.padding(end=8.dp))
Text(listOf(if(item.type=="episode")"S${item.parentIndex} · E${item.index} ${item.title}"else item.year,item.genres.firstOrNull().orEmpty(),runtime).filter{it.isNotBlank()}.joinToString(" · "),fontSize=11.sp,lineHeight=15.sp,color=Cinema.secondary,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.weight(1f,fill=false))
AudienceRatings(metadata,Modifier.padding(start=10.dp))
}
Text(item.summary,color=Cinema.secondary,fontSize=12.sp,lineHeight=17.5.sp,maxLines=3,overflow=TextOverflow.Ellipsis)
Column(Modifier.graphicsLayer{alpha=details.value}) {
Text(metadata.cast.take(3).joinToString(", "),color=Muted,fontSize=10.5.sp,lineHeight=14.sp,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.padding(top=6.dp).height(14.dp))
Row(Modifier.padding(top=8.dp).height(16.dp),horizontalArrangement=Arrangement.spacedBy(6.dp),verticalAlignment=Alignment.CenterVertically) {
formats.forEach{FormatBadge(it)}
} }
} }
} }
} }
/** Resolution, dynamic range and the best audio format, e.g. 4K · Dolby Vision · Atmos. */
internal fun formatLabels(media:Media?)=listOfNotNull(media?.resolutionLabel?.ifBlank{null},media?.dynamicRange?.ifBlank{null},media?.let{if(it.atmos)"Atmos"else it.channelLabel.ifBlank{null}})
/** A small outlined label: a content rating or a video/audio format. */
@Composable internal fun FormatBadge(label:String,modifier:Modifier=Modifier) {
Text(label.uppercase(),color=Color.White.copy(alpha=.9f),fontSize=8.5.sp,lineHeight=11.sp,fontWeight=FontWeight.SemiBold,letterSpacing=.5.sp,maxLines=1,
modifier=modifier.border(.5.dp,Color.White.copy(alpha=.3f),RoundedCornerShape(3.dp)).background(Color.White.copy(alpha=.06f),RoundedCornerShape(3.dp)).padding(horizontal=5.dp,vertical=1.5.dp))
}
internal fun runtimeLabel(ms:Long):String {val minutes=(ms/60000).coerceAtLeast(1);return if(minutes>=60)"${minutes/60}h ${minutes%60}m"else "${minutes}m"}
@Composable private fun HeroCopy(vm:KaleidoViewModel,feature:HomeFeature) {
val item=feature.item
val metadata by produceState(item,item.id){value=item;value=vm.previewDetails(item)}
Column {
Eyebrow(feature.reason)
Spacer(Modifier.height(9.dp))
TitleIdentity(vm.api,item,Modifier.width(264.dp).height(80.dp))
Row(Modifier.fillMaxWidth().padding(top=8.dp,bottom=8.dp),verticalAlignment=Alignment.CenterVertically) {
Text(listOf(item.year,item.genres.firstOrNull().orEmpty(),item.contentRating).filter{it.isNotBlank()}.joinToString(" · "),color=Cinema.secondary,fontSize=10.sp,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.weight(1f,fill=false))
AudienceRatings(metadata,Modifier.padding(start=10.dp))
}
Text(item.summary,color=Cinema.secondary,fontSize=12.sp,lineHeight=18.sp,maxLines=3,overflow=TextOverflow.Ellipsis)
}
}
/** /**
* A newly shown section composed every visible card in one 100–200 ms frame. While it is * A newly shown section composed every visible card in one 100–200 ms frame. While it is
* entering, each card first lays out at its fixed size and fills in its artwork and titles a * entering, each card first lays out at its fixed size and fills in its artwork and titles a

View file

@ -109,8 +109,6 @@ class KaleidoViewModel(app: Application): AndroidViewModel(app) {
var debugValidationFile:File?=null; private set var debugValidationFile:File?=null; private set
var watchedPercent by mutableStateOf(preferences.getInt("watchedPercent",80).coerceIn(50,100)); private set var watchedPercent by mutableStateOf(preferences.getInt("watchedPercent",80).coerceIn(50,100)); private set
var navigationSounds by mutableStateOf(preferences.getBoolean("navigationSounds",true)); private set var navigationSounds by mutableStateOf(preferences.getBoolean("navigationSounds",true)); private set
/** Tint the page behind browse previews with the focused artwork's colour. */
var colourWash by mutableStateOf(preferences.getBoolean("colourWash",true)); private set
var themeMusic by mutableStateOf(preferences.getBoolean("themeMusic",false)); private set var themeMusic by mutableStateOf(preferences.getBoolean("themeMusic",false)); private set
var themeVolume by mutableIntStateOf(preferences.getInt("themeVolume",30).coerceIn(10,100)); private set var themeVolume by mutableIntStateOf(preferences.getInt("themeVolume",30).coerceIn(10,100)); private set
var volumeBoostDb by mutableIntStateOf(preferences.getInt("volumeBoostDb",0).coerceIn(0,12)); private set var volumeBoostDb by mutableIntStateOf(preferences.getInt("volumeBoostDb",0).coerceIn(0,12)); private set
@ -264,13 +262,13 @@ class KaleidoViewModel(app: Application): AndroidViewModel(app) {
suspend fun previewDetails(item:Title):Title { suspend fun previewDetails(item:Title):Title {
return try{previews.details(item)}catch(e:CancellationException){throw e}catch(_:Exception){item} return try{previews.details(item)}catch(e:CancellationException){throw e}catch(_:Exception){item}
} }
fun anticipate(item:Title,cinematic:Boolean=false,backdrop:Boolean=true,path:String=item.art.ifBlank{item.thumb},header:Boolean=false) { fun anticipate(item:Title,cinematic:Boolean=false,backdrop:Boolean=true) {
previews.anticipate(item) previews.anticipate(item)
val wash=header&&colourWash val path=item.art.ifBlank{item.thumb}
val key=if(backdrop)"$cinematic:$header:$wash:$path"else "" val key=if(backdrop)"$cinematic:$path"else ""
if(key!=predictedArtworkKey){ if(key!=predictedArtworkKey){
predictedArtwork?.dispose();predictedArtwork=null;predictedArtworkKey=key predictedArtwork?.dispose();predictedArtwork=null;predictedArtworkKey=key
if(backdrop)browseBackdropRequest(application,api,path,cinematic,header,wash)?.let{predictedArtwork=application.imageLoader.enqueue(it.newBuilder().dispatcher(artworkPrefetchDispatcher).build())} if(backdrop)browseBackdropRequest(application,api,path,cinematic)?.let{predictedArtwork=application.imageLoader.enqueue(it.newBuilder().dispatcher(artworkPrefetchDispatcher).build())}
} }
} }
private fun cancelAnticipation(){previews.cancelPrediction();predictedArtwork?.dispose();predictedArtwork=null;predictedArtworkKey=""} private fun cancelAnticipation(){previews.cancelPrediction();predictedArtwork?.dispose();predictedArtwork=null;predictedArtworkKey=""}
@ -680,7 +678,6 @@ class KaleidoViewModel(app: Application): AndroidViewModel(app) {
fun chooseSubtitleStyle(value:SubtitleStyle){subtitleStyle=value;preferences.edit().putString("subtitleStyle",value.name).apply()} fun chooseSubtitleStyle(value:SubtitleStyle){subtitleStyle=value;preferences.edit().putString("subtitleStyle",value.name).apply()}
fun chooseWatchedPercent(value:Int){watchedPercent=value.coerceIn(50,100);preferences.edit().putInt("watchedPercent",watchedPercent).apply()} fun chooseWatchedPercent(value:Int){watchedPercent=value.coerceIn(50,100);preferences.edit().putInt("watchedPercent",watchedPercent).apply()}
fun chooseNavigationSounds(value:Boolean){navigationSounds=value;preferences.edit().putBoolean("navigationSounds",value).apply()} fun chooseNavigationSounds(value:Boolean){navigationSounds=value;preferences.edit().putBoolean("navigationSounds",value).apply()}
fun chooseColourWash(value:Boolean){colourWash=value;preferences.edit().putBoolean("colourWash",value).apply()}
fun chooseThemeMusic(value:Boolean){themeMusic=value;preferences.edit().putBoolean("themeMusic",value).apply()} fun chooseThemeMusic(value:Boolean){themeMusic=value;preferences.edit().putBoolean("themeMusic",value).apply()}
fun chooseThemeVolume(value:Int){themeVolume=value.coerceIn(10,100);preferences.edit().putInt("themeVolume",themeVolume).apply()} fun chooseThemeVolume(value:Int){themeVolume=value.coerceIn(10,100);preferences.edit().putInt("themeVolume",themeVolume).apply()}
fun chooseVolumeBoostDb(value:Int){volumeBoostDb=value.coerceIn(0,12);preferences.edit().putInt("volumeBoostDb",volumeBoostDb).apply()} fun chooseVolumeBoostDb(value:Int){volumeBoostDb=value.coerceIn(0,12);preferences.edit().putInt("volumeBoostDb",volumeBoostDb).apply()}

View file

@ -18,9 +18,6 @@ data class Media(val id: String, val container: String, val videoCodec: String,
listOf(audioCodec.uppercase(),channelLabel,if(atmos)"Atmos"else "").filter{it.isNotBlank()}.joinToString(" "), listOf(audioCodec.uppercase(),channelLabel,if(atmos)"Atmos"else "").filter{it.isNotBlank()}.joinToString(" "),
if(bitrate>0)"${(bitrate+500)/1000} Mbps"else "",if(includeSize&&size>0)fileSize(size)else "",if(parts.size>1)"${parts.size} parts"else "") if(bitrate>0)"${(bitrate+500)/1000} Mbps"else "",if(includeSize&&size>0)fileSize(size)else "",if(parts.size>1)"${parts.size} parts"else "")
.filter{it.isNotBlank()}.joinToString(" · ") .filter{it.isNotBlank()}.joinToString(" · ")
/** What the format badges leave out: codecs, audio layout and bitrate, e.g. "AV1 · EAC3 5.1 · 10 Mbps". */
val technical get()=listOf(videoCodec.uppercase(),listOf(audioCodec.uppercase(),channelLabel).filter{it.isNotBlank()}.joinToString(" "),
if(bitrate>0)"${(bitrate+500)/1000} Mbps"else "",if(parts.size>1)"${parts.size} parts"else "").filter{it.isNotBlank()}.joinToString(" · ")
} }
internal fun fileSize(bytes:Long):String = if(bytes>=1_000_000_000L)String.format(java.util.Locale.US,"%.1f GB",bytes/1e9)else "${bytes/1_000_000} MB" internal fun fileSize(bytes:Long):String = if(bytes>=1_000_000_000L)String.format(java.util.Locale.US,"%.1f GB",bytes/1e9)else "${bytes/1_000_000} MB"
data class Marker(val type: String, val start: Long, val end: Long) data class Marker(val type: String, val start: Long, val end: Long)

View file

@ -161,19 +161,11 @@ import kotlinx.coroutines.delay
if(controller.loading)CircularProgressIndicator(color=Accent,strokeWidth=2.dp,modifier=Modifier.align(Alignment.Center).size(30.dp)) if(controller.loading)CircularProgressIndicator(color=Accent,strokeWidth=2.dp,modifier=Modifier.align(Alignment.Center).size(30.dp))
QuickSkipFeedback(skipSeconds,skipPulse,!visible&&!postPlay,Modifier.align(if(skipForward)Alignment.CenterEnd else Alignment.CenterStart).padding(horizontal=32.dp)) QuickSkipFeedback(skipSeconds,skipPulse,!visible&&!postPlay,Modifier.align(if(skipForward)Alignment.CenterEnd else Alignment.CenterStart).padding(horizontal=32.dp))
AnimatedVisibility(visible=visible,enter=fadeIn(tween(190))+slideInVertically(tween(190)){it/8},exit=fadeOut(tween(190))+slideOutVertically(tween(190)){it/10},modifier=Modifier.align(Alignment.BottomCenter)) { AnimatedVisibility(visible=visible,enter=fadeIn(tween(190))+slideInVertically(tween(190)){it/8},exit=fadeOut(tween(190))+slideOutVertically(tween(190)){it/10},modifier=Modifier.align(Alignment.BottomCenter)) {
Column(Modifier.fillMaxWidth().background(Brush.verticalGradient(0f to Color.Transparent,.35f to Color.Black.copy(alpha=.5f),1f to Color.Black.copy(alpha=.85f))).padding(start=Cinema.gutter,end=Cinema.gutter,top=48.dp,bottom=16.dp)) { Column(Modifier.fillMaxWidth().background(Brush.verticalGradient(0f to Color.Transparent,.42f to Color.Black.copy(alpha=.46f),1f to Color.Black.copy(alpha=.79f))).padding(start=Cinema.gutter,end=Cinema.gutter,top=31.dp,bottom=16.dp)) {
// The title art and facts the browse previews and details use, at playback scale. Row(Modifier.fillMaxWidth().padding(bottom=7.dp),verticalAlignment=Alignment.Bottom) {
Row(Modifier.fillMaxWidth().padding(bottom=10.dp),verticalAlignment=Alignment.Bottom) { Text(item.displayTitle,color=Accent,fontSize=18.sp,lineHeight=23.sp,fontWeight=FontWeight.SemiBold,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.weight(1f))
Column(Modifier.weight(1f)) {
TitleIdentity(vm.api,item,Modifier.size(240.dp,44.dp))
Row(Modifier.padding(top=8.dp).height(17.dp),verticalAlignment=Alignment.CenterVertically) {
if(item.contentRating.isNotBlank())FormatBadge(item.contentRating,Modifier.padding(end=8.dp))
Text((if(item.type=="episode")listOf("S${item.parentIndex} · E${item.index}",item.title)else listOf(item.year,item.genres.firstOrNull().orEmpty())).filter{it.isNotBlank()}.joinToString(" · "),
color=Cinema.secondary,fontSize=11.sp,lineHeight=15.sp,maxLines=1,overflow=TextOverflow.Ellipsis)
}
}
Spacer(Modifier.width(18.dp)) Spacer(Modifier.width(18.dp))
Text(controller.qualityLabel,color=Color.White.copy(alpha=.6f),fontSize=10.sp,lineHeight=14.sp,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.widthIn(max=360.dp)) Text(if(item.type=="episode")"S${item.parentIndex} · E${item.index} ${item.title}"else controller.qualityLabel,color=Color.White.copy(alpha=.72f),fontSize=12.sp,lineHeight=16.sp,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.widthIn(max=420.dp))
} }
SeekTimeline(controller,item,Modifier.fillMaxWidth().focusRequester(timelineFocus).focusProperties{down=playFocus},::interacted) SeekTimeline(controller,item,Modifier.fillMaxWidth().focusRequester(timelineFocus).focusProperties{down=playFocus},::interacted)
Box(Modifier.fillMaxWidth().height(40.dp)) { Box(Modifier.fillMaxWidth().height(40.dp)) {

View file

@ -54,7 +54,6 @@ fun CohesiveSettingsScreen(vm: KaleidoViewModel, install: (File) -> Unit) {
val creditsFocus = remember { FocusRequester() } val creditsFocus = remember { FocusRequester() }
val subtitleStyleFocus = remember { FocusRequester() } val subtitleStyleFocus = remember { FocusRequester() }
val themeMusicFocus = remember { FocusRequester() } val themeMusicFocus = remember { FocusRequester() }
val colourWashFocus = remember { FocusRequester() }
val themeVolumeFocus = remember { FocusRequester() } val themeVolumeFocus = remember { FocusRequester() }
val volumeBoostFocus = remember { FocusRequester() } val volumeBoostFocus = remember { FocusRequester() }
@ -297,7 +296,7 @@ fun CohesiveSettingsScreen(vm: KaleidoViewModel, install: (File) -> Unit) {
} }
3 -> { 3 -> {
SettingsSectionDescription("Choose how Kaleido looks and sounds while you browse.") SettingsSectionDescription("Choose the sounds Kaleido plays while you browse.")
SettingsValueRow( SettingsValueRow(
title = "Navigation sounds", title = "Navigation sounds",
description = "Play the TV's system tap when focus moves. Follows the TV sound-effects setting.", description = "Play the TV's system tap when focus moves. Follows the TV sound-effects setting.",
@ -322,14 +321,6 @@ fun CohesiveSettingsScreen(vm: KaleidoViewModel, install: (File) -> Unit) {
leftTarget = categoryFocus[3], leftTarget = categoryFocus[3],
onClick = { dialogRestoreFocus = themeVolumeFocus; themeVolumeDialog = true } onClick = { dialogRestoreFocus = themeVolumeFocus; themeVolumeDialog = true }
) )
SettingsValueRow(
title = "Artwork colour wash",
description = "Tint the page behind Home, Movies and TV previews with the focused artwork's colour.",
value = if (vm.colourWash) "On" else "Off",
requester = colourWashFocus,
leftTarget = categoryFocus[3],
onClick = { vm.chooseColourWash(!vm.colourWash) }
)
} }
else -> { else -> {

View file

@ -81,16 +81,39 @@ import kotlinx.coroutines.launch
// An episode started from the season row gets focus back itself, once the rebuilt row composes. // An episode started from the season row gets focus back itself, once the rebuilt row composes.
LaunchedEffect(vm.playbackReturn){if(vm.playbackReturn!=seenReturn[0]){seenReturn[0]=vm.playbackReturn;if(vm.focusId.startsWith("children:${item.id}:"))return@LaunchedEffect;withFrameNanos{};list.scrollToItem(0);withFrameNanos{};runCatching{actionFocus.requestFocus()}}} LaunchedEffect(vm.playbackReturn){if(vm.playbackReturn!=seenReturn[0]){seenReturn[0]=vm.playbackReturn;if(vm.focusId.startsWith("children:${item.id}:"))return@LaunchedEffect;withFrameNanos{};list.scrollToItem(0);withFrameNanos{};runCatching{actionFocus.requestFocus()}}}
Box(Modifier.fillMaxSize().background(Ink)) { Box(Modifier.fillMaxSize().background(Ink)) {
// The browse previews' framing, so opening a title keeps its artwork in place; a season's val usesPosterHeader=item.type in listOf("show","movie")
// artwork follows the episode it shows. Scroll is read in the layer, never in composition. if(usesPosterHeader||episodic) {
BrowseBackdrop(vm.api,if(episodic)previewArt(shown)else item.art.ifBlank{item.thumb},Modifier.fillMaxSize().graphicsLayer { // Season headers are shorter than 16:9: cropping into that box cut off heads.
alpha=if(list.firstVisibleItemIndex>0)0f else (1f-list.firstVisibleItemScrollOffset/backdropFadeDistance).coerceIn(0f,1f) // Frame TV artwork against the full page, with its top edge flush to movies.
},header=true,wash=vm.colourWash,animate=true) val showArtwork=item.type=="show"||episodic
BrowseBackdrop(vm.api,item.art.ifBlank{item.thumb},Modifier.fillMaxSize().graphicsLayer {
alpha=if(list.firstVisibleItemIndex>0)0f else (1f-list.firstVisibleItemScrollOffset/backdropFadeDistance).coerceIn(0f,1f)
},cinematic=true,alignment=if(showArtwork)Alignment.TopCenter else Alignment.Center,contentScale=if(showArtwork)ContentScale.FillWidth else ContentScale.Crop)
// Keep the scene in the header; rows and captions sit on near-black. Read scroll
// in the layer so scrolling doesn't recompose the details and cast hierarchy.
Box(Modifier.fillMaxSize().background(Brush.verticalGradient(0f to Ink.copy(alpha=.4f),.35f to Ink.copy(alpha=.5f),.62f to Ink.copy(alpha=.96f),.8f to Ink)))
}
// Actions lead to the first row below them: seasons/episodes, otherwise the first cast member. // Actions lead to the first row below them: seasons/episodes, otherwise the first cast member.
val below=if(vm.children.isNotEmpty())childFocus else if(item.castMembers.isNotEmpty())castFocus else null val below=if(vm.children.isNotEmpty())childFocus else if(item.castMembers.isNotEmpty())castFocus else null
CompositionLocalProvider(LocalBringIntoViewSpec provides DetailsScroll) { CompositionLocalProvider(LocalBringIntoViewSpec provides DetailsScroll) {
LazyColumn(state=list,contentPadding=PaddingValues(bottom=30.dp),verticalArrangement=Arrangement.spacedBy(18.dp),modifier=Modifier.fillMaxSize()) { LazyColumn(state=list,contentPadding=PaddingValues(bottom=30.dp),verticalArrangement=Arrangement.spacedBy(18.dp),modifier=Modifier.fillMaxSize()) {
item(key="details-${item.id}"){DetailHeader(vm,shown,item,actionFocus,below,!restoreRow)} item(key="details-${item.id}") {
// A fixed episode header, so moving along the season row never shifts the page.
Box(Modifier.fillMaxWidth().then(if(usesPosterHeader)Modifier.heightIn(min=248.dp)else if(episodic)Modifier.height(322.dp)else Modifier.heightIn(min=286.dp))) {
if(!usesPosterHeader&&!episodic) {
Artwork(vm.api,item.art,Modifier.matchParentSize(),1920,1080)
Box(Modifier.matchParentSize().background(Brush.horizontalGradient(listOf(Ink.copy(alpha=.98f),Ink.copy(alpha=.8f),Color.Transparent))))
Box(Modifier.matchParentSize().background(Brush.verticalGradient(listOf(Color.Black.copy(alpha=.12f),Color.Transparent,Ink))))
}
IconControl(Icons.AutoMirrored.Outlined.ArrowBack,"Back",modifier=Modifier.padding(start=36.dp,top=14.dp)){vm.back()}
if(usesPosterHeader) {
Row(Modifier.fillMaxWidth().padding(start=Cinema.gutter,end=Cinema.gutter,top=56.dp),horizontalArrangement=Arrangement.spacedBy(24.dp),verticalAlignment=Alignment.Top) {
Artwork(vm.api,item.poster.ifBlank{item.thumb},Modifier.width(128.dp).height(192.dp).clip(androidx.compose.foundation.shape.RoundedCornerShape(6.dp)),384,576,animate=false,contentScale=ContentScale.Fit)
TitleInformation(vm,item,item,actionFocus,below,!restoreRow,Modifier.weight(1f))
}
}else TitleInformation(vm,shown,item,actionFocus,below,!restoreRow,Modifier.align(Alignment.CenterStart).padding(start=Cinema.gutter,end=Cinema.gutter,top=64.dp,bottom=24.dp).fillMaxWidth())
}
}
// Rebuilt after playback so the row scrolls to the episode last played. // Rebuilt after playback so the row scrolls to the episode last played.
if(vm.children.isNotEmpty())item(key="children-${item.id}-${if(episodic)vm.playbackReturn else 0}") { if(vm.children.isNotEmpty())item(key="children-${item.id}-${if(episodic)vm.playbackReturn else 0}") {
if(episodic)MediaRow(vm,if(item.type=="season")item.title else "Season ${item.parentIndex}",vm.children,"children:${item.id}",landscape=true,entryFocus=childFocus,episodeTitles=true, if(episodic)MediaRow(vm,if(item.type=="season")item.title else "Season ${item.parentIndex}",vm.children,"children:${item.id}",landscape=true,entryFocus=childFocus,episodeTitles=true,
@ -114,75 +137,41 @@ private object DetailsScroll:BringIntoViewSpec {
} }
} }
/** /** [page] is the open title; on a season or episode page, [item] is the episode it shows. */
* The header, after the browse previews: title art, facts and format, synopsis, then actions. @Composable private fun TitleInformation(vm:KaleidoViewModel,item:Title,page:Title,actionFocus:FocusRequester,below:FocusRequester?,initialFocus:Boolean,modifier:Modifier) {
* [page] is the open title; on a season or episode page, [item] is the episode it shows, and
* moving along the season row fades its copy like the previews. Fixed heights keep the rows
* below in place, and leave a show's season captions on screen.
*/
@Composable private fun DetailHeader(vm:KaleidoViewModel,item:Title,page:Title,actionFocus:FocusRequester,below:FocusRequester?,initialFocus:Boolean) {
var summaryOverflow by remember(item.id){mutableStateOf(false)}
val episodic=page.type in listOf("season","episode")
val technical=item.type in listOf("movie","episode")
val height=when{episodic->296.dp;technical->276.dp;else->250.dp}
Box(Modifier.fillMaxWidth().height(height)) {
IconControl(Icons.AutoMirrored.Outlined.ArrowBack,"Back",modifier=Modifier.padding(start=36.dp,top=14.dp)){vm.back()}
Column(Modifier.align(Alignment.BottomStart).padding(start=Cinema.gutter,end=Cinema.gutter,bottom=4.dp)) {
CompositionLocalProvider(LocalTextStyle provides LocalTextStyle.current.copy(shadow=CaptionShadow)) {
FadingCopy(item,{it.id},with(LocalDensity.current){HeaderLift.toPx()},Modifier.height(if(episodic)166.dp else 150.dp),Alignment.BottomStart) {shown->
DetailCopy(vm,shown,page){if(shown.id==item.id)summaryOverflow=it}
}
}
DetailActions(vm,item,page,actionFocus,below,initialFocus,summaryOverflow)
if(technical)item.media.getOrNull(vm.mediaIndex(item))?.let{Text(it.technical,color=Cinema.quiet,fontSize=9.5.sp,lineHeight=13.sp,maxLines=1,modifier=Modifier.padding(top=10.dp))}
}
}
}
@Composable private fun DetailCopy(vm:KaleidoViewModel,item:Title,page:Title,onOverflow:(Boolean)->Unit) {
val runtime=when{item.duration<=0->"";item.offset>0->runtimeLabel(item.duration-item.offset)+" left";else->runtimeLabel(item.duration)}
val seasons=vm.children.size.takeIf{page.id==item.id&&item.type=="show"&&it>0}?.let{if(it==1)"1 season"else "$it seasons"}.orEmpty()
val facts=when(item.type) {
"episode"->listOf("S${item.parentIndex} · E${item.index}",airDate(item.releaseDate),runtime)
"season"->listOf(item.subtitle)
"show"->listOf(item.year,item.genres.take(2).joinToString(" / "),seasons,if(item.leafCount>0)"${item.leafCount} episodes"else "")
else->listOf(item.year,item.genres.take(2).joinToString(" / "),runtime)
}
Column(Modifier.width(560.dp)) {
// Episodes name their show with its title art, then the episode itself.
if(item.type=="episode") {
TitleIdentity(vm.api,item,Modifier.size(280.dp,48.dp))
Text(item.title,color=Accent,fontSize=19.sp,lineHeight=24.sp,fontWeight=FontWeight.SemiBold,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.padding(top=8.dp))
}else TitleIdentity(vm.api,item,Modifier.size(340.dp,64.dp))
Row(Modifier.padding(top=9.dp,bottom=7.dp).height(17.dp),verticalAlignment=Alignment.CenterVertically) {
if(item.contentRating.isNotBlank())FormatBadge(item.contentRating,Modifier.padding(end=8.dp))
Text(facts.filter{it.isNotBlank()}.joinToString(" · "),color=Cinema.secondary,fontSize=11.sp,lineHeight=15.sp,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.weight(1f,fill=false))
AudienceRatings(item,Modifier.padding(start=10.dp))
formatLabels(item.media.getOrNull(vm.mediaIndex(item))).forEachIndexed{index,label->FormatBadge(label,Modifier.padding(start=if(index==0)14.dp else 6.dp))}
}
Text(item.summary,color=Cinema.secondary,fontSize=12.sp,lineHeight=17.5.sp,maxLines=3,overflow=TextOverflow.Ellipsis,onTextLayout={onOverflow(it.hasVisualOverflow)})
}
}
@Composable private fun DetailActions(vm:KaleidoViewModel,item:Title,page:Title,actionFocus:FocusRequester,below:FocusRequester?,initialFocus:Boolean,summaryOverflow:Boolean) {
val actionNavigation=Modifier.focusProperties{if(below!=null)down=below} val actionNavigation=Modifier.focusProperties{if(below!=null)down=below}
var summaryOverflow by remember(item.id){mutableStateOf(false)}
var showSynopsis by remember(item.id){mutableStateOf(false)} var showSynopsis by remember(item.id){mutableStateOf(false)}
var showVersions by remember(item.id){mutableStateOf(false)} var showVersions by remember(item.id){mutableStateOf(false)}
val media=item.media.getOrNull(vm.mediaIndex(item)) val media=item.media.getOrNull(vm.mediaIndex(item))
// Scrolls sideways only if a title has more actions than fit the page. Column(modifier) {
if(item.type!="collection")Row(Modifier.padding(top=9.dp).horizontalScroll(rememberScrollState()).padding(vertical=3.dp),horizontalArrangement=Arrangement.spacedBy(9.dp),verticalAlignment=Alignment.CenterVertically) { CompositionLocalProvider(LocalTextStyle provides LocalTextStyle.current.copy(shadow=Shadow(Color.Black.copy(alpha=.95f),Offset(0f,2f),6f))) {
ActionButton(if(item.offset>0)"Resume from ${clockTime(item.offset)}"else if(item.type=="show")"Watch next"else "Play",Icons.Filled.PlayArrow,modifier=actionNavigation.focusRequester(actionFocus),primary=true,initialFocus=initialFocus){played(vm,page);vm.play(item)} // Seasons and episodes name their show above the title.
if(item.offset>0)ActionButton("Start over",Icons.Outlined.Replay,modifier=actionNavigation){played(vm,page);vm.play(item,true)} val show=when(page.type){"episode"->page.grandparentTitle;"season"->page.parentTitle;else->""}.ifBlank{item.grandparentTitle.takeIf{item.type=="episode"}.orEmpty()}
if(page.type=="show"&&item.type=="show")ActionButton("Shuffle episodes",Icons.Outlined.Shuffle,modifier=actionNavigation){played(vm,page);vm.playShuffled(item)} if(show.isNotBlank())Text(show,color=Cinema.secondary,fontSize=12.sp,lineHeight=16.sp,fontWeight=FontWeight.Medium)
if(item.type in listOf("movie","show","season","episode")) { Text(item.title,color=Accent,fontSize=32.sp,lineHeight=36.sp,fontWeight=FontWeight.Bold,maxLines=if(page.type in listOf("season","episode"))1 else 2,overflow=TextOverflow.Ellipsis,modifier=Modifier.widthIn(max=560.dp))
val watched=item.isWatched(vm.watchedPercent) Row(Modifier.widthIn(max=620.dp).padding(top=9.dp),verticalAlignment=Alignment.CenterVertically) {
ActionButton(if(vm.markingId==item.id)"Updating…"else if(watched)"Mark unwatched"else "Mark watched",if(watched)Icons.Outlined.CheckCircle else Icons.Outlined.Check,modifier=actionNavigation){vm.mark(item)} Text(listOf(item.subtitle,airDate(item.releaseDate).takeIf{item.type=="episode"}.orEmpty(),item.contentRating).filter{it.isNotBlank()}.joinToString(" · "),color=Muted,fontSize=10.5.sp,lineHeight=16.sp,maxLines=1,overflow=TextOverflow.Ellipsis,modifier=Modifier.weight(1f,fill=false))
AudienceRatings(item,Modifier.padding(start=12.dp))
} }
item.trailer?.let{trailer->ActionButton("Trailer",Icons.Outlined.Movie,modifier=actionNavigation){vm.play(trailer)}} Text(item.summary,color=Cinema.secondary,fontSize=12.sp,lineHeight=18.sp,maxLines=3,overflow=TextOverflow.Ellipsis,onTextLayout={summaryOverflow=it.hasVisualOverflow},modifier=Modifier.widthIn(max=560.dp).padding(top=10.dp,bottom=17.dp))
// Name the version by resolution unless several share it, e.g. two 1080p encodes. }
if(item.media.size>1)ActionButton(if(item.media.map{it.resolutionLabel}.distinct().size==item.media.size&&media?.resolutionLabel?.isNotBlank()==true)"Version · ${media.resolutionLabel}" // Scrolls sideways only if a title has more actions than fit beside its poster.
else "Version ${vm.mediaIndex(item)+1} of ${item.media.size}",Icons.Outlined.Layers,modifier=actionNavigation){showVersions=true} if(item.type!="collection")Row(Modifier.horizontalScroll(rememberScrollState()).padding(vertical=3.dp),horizontalArrangement=Arrangement.spacedBy(9.dp),verticalAlignment=Alignment.CenterVertically) {
if(item.type in listOf("show","movie")&&summaryOverflow)ActionButton("Synopsis",Icons.Outlined.Description,modifier=actionNavigation){showSynopsis=true} ActionButton(if(item.offset>0)"Resume from ${clockTime(item.offset)}"else if(item.type=="show")"Watch next"else "Play",Icons.Filled.PlayArrow,modifier=actionNavigation.focusRequester(actionFocus),primary=true,initialFocus=initialFocus){played(vm,page);vm.play(item)}
if(item.offset>0)ActionButton("Start over",Icons.Outlined.Replay,modifier=actionNavigation){played(vm,page);vm.play(item,true)}
if(page.type=="show"&&item.type=="show")ActionButton("Shuffle episodes",Icons.Outlined.Shuffle,modifier=actionNavigation){played(vm,page);vm.playShuffled(item)}
if(item.type in listOf("movie","show","season","episode")) {
val watched=item.isWatched(vm.watchedPercent)
ActionButton(if(vm.markingId==item.id)"Updating…"else if(watched)"Mark unwatched"else "Mark watched",if(watched)Icons.Outlined.CheckCircle else Icons.Outlined.Check,modifier=actionNavigation){vm.mark(item)}
}
item.trailer?.let{trailer->ActionButton("Trailer",Icons.Outlined.Movie,modifier=actionNavigation){vm.play(trailer)}}
// Name the version by resolution unless several share it, e.g. two 1080p encodes.
if(item.media.size>1)ActionButton(if(item.media.map{it.resolutionLabel}.distinct().size==item.media.size&&media?.resolutionLabel?.isNotBlank()==true)"Version · ${media.resolutionLabel}"
else "Version ${vm.mediaIndex(item)+1} of ${item.media.size}",Icons.Outlined.Layers,modifier=actionNavigation){showVersions=true}
if(item.type in listOf("show","movie")&&summaryOverflow)ActionButton("Synopsis",Icons.Outlined.Description,modifier=actionNavigation){showSynopsis=true}
}
if(item.type !in listOf("show","season"))media?.let{Text(it.description(),color=Cinema.quiet,fontSize=9.5.sp,modifier=Modifier.padding(top=12.dp))}
} }
if(showSynopsis)SynopsisDialog(vm.api,item){showSynopsis=false} if(showSynopsis)SynopsisDialog(vm.api,item){showSynopsis=false}
if(showVersions)ChoiceDialog("Versions",item.media.map{it.description(includeSize=true)},vm.mediaIndex(item),{showVersions=false}){vm.chooseMedia(item,it);showVersions=false} if(showVersions)ChoiceDialog("Versions",item.media.map{it.description(includeSize=true)},vm.mediaIndex(item),{showVersions=false}){vm.chooseMedia(item,it);showVersions=false}

Binary file not shown.

View file

@ -1 +1 @@
0a695c395d56a9a84241bf4226b493ef35b227122301cfe16ead7873800ac344 Kaleido.apk 06d942779eae498db63c923746a38fd64640cbd3221953712e649fc86f9f2633 Kaleido.apk

View file

@ -1,7 +1,7 @@
{ {
"version": "0.6.0", "version": "0.5.0",
"versionCode": 20, "versionCode": 19,
"url": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.6.0/distribution/Kaleido.apk", "url": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.5.0/distribution/Kaleido.apk",
"checksumUrl": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.6.0/distribution/Kaleido.apk.sha256", "checksumUrl": "https://git.elijahkuntz.com/Elijah/Kaleido/raw/tag/v0.5.0/distribution/Kaleido.apk.sha256",
"notes": "- Redesign Home after Silo. Moving into the rows compacts the hero into a preview of the focused card instead of scrolling it away: large title art, a rating badge, year, genre and runtime or time left, ratings, three lines of synopsis, cast and 4K/HDR/Atmos badges. Up or Back restores the hero.\n- Show the focused card's own image in the top-right, scaled whole and fading into the page. Episodes show their own still instead of the show's artwork.\n- Give Movies and TV the same preview above their rows.\n- Fade between artwork, and fade and lift titles and descriptions between cards, instead of popping in. The hero's featured titles use the same transitions.\n- Add Settings \u203a Interface \u203a Artwork colour wash (on by default), which tints the page with the focused artwork's colour.\n- Redesign movie, show, season and episode pages to match: the same artwork and colour wash, title art, a facts line with rating and format badges, and a three-line synopsis. Season and episode pages follow the focused episode's still and details.\n- Show title art, the rating badge and episode details in the player's controls." "notes": "- Show the selected version's source bitrate beside Original quality in the playback quality menu.\n- Add a named Audio entry to Playback options alongside the speaker button. Preserve position, pause state and selected tracks when switching audio or rebuilding a Plex stream.\n- Add Shuffle on TV show pages. Play episodes from all seasons in repeating shuffled cycles, starting each episode from the beginning and continuing even when ordinary autoplay is off. Seasons keep their usual Play action.\n- Record sparse audio underrun and sink-error diagnostics for investigating intermittent dropouts. A short Infinity War check did not reproduce the reported stutter; a fix for that symptom is not yet confirmed."
} }

View file

@ -5,16 +5,16 @@ The interface gives artwork priority. App chrome uses neutral near-black, charco
## Layout and typography ## Layout and typography
- Horizontal safe gutter: 44 dp. Navigation: 62 dp, with centered text destinations and independent search/settings icons. - Horizontal safe gutter: 44 dp. Navigation: 62 dp, with centered text destinations and independent search/settings icons.
- Home retains a large cinematic feature: an 80 percent stage with original title artwork, synopsis, playback and information actions, with Continue Watching peeking below. Entering the rows compacts it into a Silo-style preview of the focused card instead of scrolling it away: the hero lifts and fades as the rows slide up beneath a bottom-anchored block (64 dp title art, content-rating badge, year/episode, genre, runtime or time left, ratings, three synopsis lines, three cast names and 4K/HDR/Atmos format badges). The card's own image (an episode's still, not its show's art) is scaled whole into a top-right box of 72 × 78 percent of the screen, baked off-thread to fade into the page toward its left and bottom edges. Movies and TV use the same preview (56 dp title art) beneath their Discover/Library/Categories line, with rows starting 300 dp down; their row content stays distinct. With Settings › Interface › Artwork colour wash (default On), the page beneath carries the artwork's average colour normalized to 0.22 luminance, diagonally from the top-right (full) to the bottom-left (18 percent), as Silo does. It is baked into the same cached 960 × 540 frame, so it costs nothing per frame and changes through the artwork crossfade. A 1280 × 720 frame was tried for sharper art and raised Movies' horizontal p95 from about 31 to 36 ms through larger texture uploads, so it was not kept. The preview stays composed, invisible, under the hero with the first row's first card, so entering the rows is only a fade. Up from the first row or Back restores the hero. Features interleave recently released, highly rated unwatched, and Plex-suggested movies/shows, excluding Continue Watching. They shuffle per refresh and rotate every 12 seconds while the hero is active, pausing during row browsing. - Home retains a large cinematic feature: an 80 percent stage with original title artwork, synopsis, playback and information actions. The scene continues beneath Continue Watching; entering the rail scrolls the feature away and the backdrop follows focused titles. Features interleave recently released, highly rated unwatched, and Plex-suggested movies/shows, excluding Continue Watching. They shuffle per refresh and rotate every 12 seconds while the hero is active, pausing during row browsing.
- Movies uses a compact fixed preview above poster rows, with the backdrop and synopsis following focused titles. Recently released films and movie recommendations lead. TV uses a shorter preview, larger episode thumbnails, next episodes, newly added seasons, and then new episodes and show recommendations. Redundant TV hubs are omitted when their episode lists match exactly. These are deliberately different compositions. - Movies uses a compact fixed preview above poster rows, with the backdrop and synopsis following focused titles. Recently released films and movie recommendations lead. TV uses a shorter preview, larger episode thumbnails, next episodes, newly added seasons, and then new episodes and show recommendations. Redundant TV hubs are omitted when their episode lists match exactly. These are deliberately different compositions.
- Library: title and discovery/full-library navigation share a 64 dp header. A 43 dp filter row sits immediately above the six-column poster grid. - Library: title and discovery/full-library navigation share a 64 dp header. A 43 dp filter row sits immediately above the six-column poster grid.
- Browsing card widths: landscape 214 dp, TV episodes 264 dp, posters 120 dp. Landscape artwork uses 16:9; posters use 2:3. The full grid scales six columns to available width. Captions reserve a fixed height. - Browsing card widths: landscape 214 dp, TV episodes 264 dp, posters 120 dp. Landscape artwork uses 16:9; posters use 2:3. The full grid scales six columns to available width. Captions reserve a fixed height.
- Search uses three columns of landscape results. Episodes use their actual stills, preserving their native proportions instead of cropping them into posters. - Search uses three columns of landscape results. Episodes use their actual stills, preserving their native proportions instead of cropping them into posters.
- Movie and episode information pages place a horizontal Cast row beneath the description and actions, using Plex portraits, names and character roles. TV show pages place Seasons first, then Cast, then server-provided Related shows; season pages likewise keep Episodes ahead of Cast. Missing portraits use a neutral person placeholder. Actor cards open a six-column filmography of available movies and shows across the connected server's libraries, using Plex actor identifiers and pagination. - Movie and episode information pages place a horizontal Cast row beneath the description and actions, using Plex portraits, names and character roles. TV show pages place Seasons first, then Cast, then server-provided Related shows; season pages likewise keep Episodes ahead of Cast. Missing portraits use a neutral person placeholder. Actor cards open a six-column filmography of available movies and shows across the connected server's libraries, using Plex actor identifiers and pagination.
- Movie, show, season and episode pages share the browse previews' language: the same top-right artwork frame and optional colour wash (so opening a title keeps its artwork in place), original title art (340 × 64 dp; episodes show their show's art at 280 × 48 dp above the episode name), a facts line with the content-rating badge, ratings and 4K/HDR/Atmos badges, and a three-line synopsis capped at 560 dp. A truncated movie or show synopsis offers a Synopsis action. Codec, audio layout and bitrate sit quietly beneath the actions. Season and episode pages follow the focused episode: its still crossfades and its copy fades and lifts as on the browse pages, while the actions stay in place. Fixed header heights (250 dp shows, 276 dp movies, 296 dp seasons/episodes) keep the rows still and a show's season captions on the initial screen. The Back control stays in the safe area; artwork disappears over the first 180 dp of scrolling. Soft text shadows preserve contrast. - TV show information uses a full-screen backdrop behind a fitted 128 × 192 dp poster and a top-aligned text block capped at 560 dp, matching movie details. The three-line summary offers a Synopsis action when truncated, opening the full text with D-pad scrolling. Its 248 dp minimum header keeps season artwork and captions on the initial screen at the standard TV density; longer titles can grow the header. The Back control stays in the safe area; focus only scrolls controls that are out of view. Artwork fades to near-black before the lower rows and disappears over the first 180 dp of scrolling. Soft text shadows preserve header contrast.
- Movie, episode, show and season information pages expose labelled Mark watched / Mark unwatched actions. Changes are sent to Plex and reflected in the title, descendant episodes/seasons, library cards, actor results and recommendations. An in-flight write survives navigation and prevents duplicate submissions. Partial episode-list records update watch fields without replacing full cast/detail metadata. - Movie, episode, show and season information pages expose labelled Mark watched / Mark unwatched actions. Changes are sent to Plex and reflected in the title, descendant episodes/seasons, library cards, actor results and recommendations. An in-flight write survives navigation and prevents duplicate submissions. Partial episode-list records update watch fields without replacing full cast/detail metadata.
- Settings uses a fixed category rail (Connection, Playback, Interface, Updates) beside compact value/action rows. Focus selects categories; Right enters their controls and Left returns to the rail. Neutral surfaces, white focus, existing typography and restrained motion match the browsing destinations. Existing account, quality, watched-threshold, navigation-sound and updater preferences keep their behavior. - Settings uses a fixed category rail (Connection, Playback, Interface, Updates) beside compact value/action rows. Focus selects categories; Right enters their controls and Left returns to the rail. Neutral surfaces, white focus, existing typography and restrained motion match the browsing destinations. Existing account, quality, watched-threshold, navigation-sound and updater preferences keep their behavior.
- Features use original Plex clear-logo artwork within 264 × 80 dp, falling back to title text. Library title: 29/34 sp. Discovery rail heading: 17/22 sp. Supporting information: 10/14 sp. - Features use original Plex clear-logo artwork within 264 × 80 dp, falling back to title text. Detail title: 32/36 sp. Library title: 29/34 sp. Discovery rail heading: 17/22 sp. Supporting information: 10/14 sp.
- Poster and thumbnail corners: 6 dp. Compact action corners: 5 dp. Cards have no idle border; a compact bottom-right check marks watched titles, or a number shows remaining episodes for a show/season when Plex provides counts. Unwatched movies have no badge. Resumed movies/episodes only show a check after the configured playback threshold (80 percent by default), even if Plex retains a historical watched flag. Completed titles with no resume position retain Plex's watched state. Progress uses a two-dp inset line. - Poster and thumbnail corners: 6 dp. Compact action corners: 5 dp. Cards have no idle border; a compact bottom-right check marks watched titles, or a number shows remaining episodes for a show/season when Plex provides counts. Unwatched movies have no badge. Resumed movies/episodes only show a check after the configured playback threshold (80 percent by default), even if Plex retains a historical watched flag. Completed titles with no resume position retain Plex's watched state. Progress uses a two-dp inset line.
- The abstract six-facet aperture mark is shared by the header, sign-in, app icon, TV banner, and the cold-start aperture sequence. It uses muted sea-glass and warm ivory facets around a dark center, with no letterform or sparkle. The launcher banner and app icon place it on a diagonal light, deep sea-glass at the top right through near-black to a warm tan glow at the bottom left, with a soft vignette and nothing over the aperture; `scripts/generate_brand_tiles.py` regenerates both from `brand_mark.xml`. - The abstract six-facet aperture mark is shared by the header, sign-in, app icon, TV banner, and the cold-start aperture sequence. It uses muted sea-glass and warm ivory facets around a dark center, with no letterform or sparkle. The launcher banner and app icon place it on a diagonal light, deep sea-glass at the top right through near-black to a warm tan glow at the bottom left, with a soft vignette and nothing over the aperture; `scripts/generate_brand_tiles.py` regenerates both from `brand_mark.xml`.
- Audience ratings display Rotten Tomatoes as a percentage beside its official Popcornmeter artwork, and IMDb on its native ten-point scale beside the gold IMDb logo. Both appear when Plex exposes both; TVDB is retained as a fallback when neither is available. Critic scores and unsupported providers are omitted. Stable preview focus hydrates detail metadata, where Plex exposes the full provider list. The official red Hot mark appears at 60 percent or above and the green Stale mark below 60 percent; each fits a stable, font-scaled square without recoloring or distortion. Verified Hot is not inferred from a percentage. Asset provenance is in [brand-assets.md](brand-assets.md). The IMDb vector uses the official gold primary mark and supplied clear space from the [IMDb brand toolkit](https://brand.imdb.com/imdb). - Audience ratings display Rotten Tomatoes as a percentage beside its official Popcornmeter artwork, and IMDb on its native ten-point scale beside the gold IMDb logo. Both appear when Plex exposes both; TVDB is retained as a fallback when neither is available. Critic scores and unsupported providers are omitted. Stable preview focus hydrates detail metadata, where Plex exposes the full provider list. The official red Hot mark appears at 60 percent or above and the green Stale mark below 60 percent; each fits a stable, font-scaled square without recoloring or distortion. Verified Hot is not inferred from a percentage. Asset provenance is in [brand-assets.md](brand-assets.md). The IMDb vector uses the official gold primary mark and supplied clear space from the [IMDb brand toolkit](https://brand.imdb.com/imdb).
@ -27,7 +27,7 @@ The interface gives artwork priority. App chrome uses neutral near-black, charco
- Navigation contrast comes from a gradient extending past the controls and fading to transparent. Home/Movies/TV activate on focus. Explicit row and column links prevent beyond-bounds focus searches when holding a remote direction. - Navigation contrast comes from a gradient extending past the controls and fading to transparent. Home/Movies/TV activate on focus. Explicit row and column links prevent beyond-bounds focus searches when holding a remote direction.
- A spaced D-pad move predicts the actual row/column destination before starting its scroll or focus change. The target backdrop is fetched and contrast-processed through the same Coil request/cache as the visible scene. Speculative artwork uses one low-priority worker so it cannot flood normal decode workers during a burst of input. Metadata starts in parallel; the visible preview and details page share that in-flight request. Rapid horizontal input settles to the latest target before starting speculative work. Full metadata uses a 64-item LRU with a 30-second lifetime, cleared on account/server changes and refreshed after watched updates. Neutral library/search grids prefetch metadata without fetching an unused full-screen backdrop. - A spaced D-pad move predicts the actual row/column destination before starting its scroll or focus change. The target backdrop is fetched and contrast-processed through the same Coil request/cache as the visible scene. Speculative artwork uses one low-priority worker so it cannot flood normal decode workers during a burst of input. Metadata starts in parallel; the visible preview and details page share that in-flight request. Rapid horizontal input settles to the latest target before starting speculative work. Full metadata uses a 64-item LRU with a 30-second lifetime, cleared on account/server changes and refreshed after watched updates. Neutral library/search grids prefetch metadata without fetching an unused full-screen backdrop.
- Home's vertical list prepares content within one viewport ahead and retains one viewport behind, using Compose's bounded lazy-layout cache window. This keeps the hero and nearby rows ready when moving between them, rather than repeatedly composing and measuring the exposed image cards during the animation. Movies/TV use the same window. The window only fills ahead after the list has scrolled, so once a section settles it is nudged 1 px and back, letting the next rows compose in idle frames instead of during the first move down. Card sizes, row targets and the large cinematic Home layout are unchanged. - Home's vertical list prepares content within one viewport ahead and retains one viewport behind, using Compose's bounded lazy-layout cache window. This keeps the hero and nearby rows ready when moving between them, rather than repeatedly composing and measuring the exposed image cards during the animation. Movies/TV use the same window. The window only fills ahead after the list has scrolled, so once a section settles it is nudged 1 px and back, letting the next rows compose in idle frames instead of during the first move down. Card sizes, row targets and the large cinematic Home layout are unchanged.
- Home, Movies and TV previews follow focus once it rests for 110 ms and retain previous artwork until replacement data is ready. New artwork fades in over the old for 320 ms, including cache hits; the outgoing title and synopsis lift slightly as they fade while the new ones rise 12 dp into place (380 ms). Hero recommendation changes use the same artwork and copy transitions, holding the copy up to 700 ms for the new artwork to decode. These fades, and the hero/preview exchange, are single animations read only in graphics layers, so they add no per-frame composition or layout. Contrast gradients are baked into a cached bitmap on a worker thread, reducing GPU overdraw. Rotation pauses on the information/next controls and preserves their focus. Vertical row changes animate to explicit row/column targets; page entrances fade and slide 28 dp over 280 ms, using per-draw alpha rather than an offscreen layer, and start once the new section's composition frames have passed (at most 300 ms). While a section enters, its cards lay out at their fixed size first and fill in artwork and titles three per frame under the fade, so the section's first frame stays short. Focusing a top tab lets its highlight draw before the section switches. The cold-start sequence lasts 2.9 seconds. The six exact facets begin as a closed, overlapping iris lit from behind; it holds there (at most 700 ms) until startup data has arrived and frames are steady, so cold-start hitches never interrupt the motion. The iris then twists 44° open and locks with a slight overshoot while light leaks through the six gaps, a single sheen crosses the settled mark, and the mark shrinks into a lockup scaled from the header brand as KALEIDO slides out from behind it. Once loading finishes (up to 600 ms extra) the camera flies through the aperture's dark center over 640 ms, revealing the app beneath as it settles from 114 percent scale. The completed mark itself is never redesigned. Android animation duration scale is honored, including animations off. It does not replay when returning from background. - Section previews settle for 120 ms (Home artwork for 90 ms), overlapping the navigation animation, and retain previous artwork until replacement data is ready. Contrast gradients are baked into a cached bitmap on a worker thread, reducing GPU overdraw. Hero recommendation changes crossfade the artwork over 220 ms, including cache hits, and fade the title/summary out for 100 ms and back in over 180 ms. Rotation pauses on the information/next controls and preserves their focus. Vertical row changes animate to explicit row/column targets; page entrances fade and slide 28 dp over 280 ms, using per-draw alpha rather than an offscreen layer, and start once the new section's composition frames have passed (at most 300 ms). While a section enters, its cards lay out at their fixed size first and fill in artwork and titles three per frame under the fade, so the section's first frame stays short. Focusing a top tab lets its highlight draw before the section switches. The cold-start sequence lasts 2.9 seconds. The six exact facets begin as a closed, overlapping iris lit from behind; it holds there (at most 700 ms) until startup data has arrived and frames are steady, so cold-start hitches never interrupt the motion. The iris then twists 44° open and locks with a slight overshoot while light leaks through the six gaps, a single sheen crosses the settled mark, and the mark shrinks into a lockup scaled from the header brand as KALEIDO slides out from behind it. Once loading finishes (up to 600 ms extra) the camera flies through the aperture's dark center over 640 ms, revealing the app beneath as it settles from 114 percent scale. The completed mark itself is never redesigned. Android animation duration scale is honored, including animations off. It does not replay when returning from background.
- Returning from details restores the library's mode, scroll position, and previously focused title. - Returning from details restores the library's mode, scroll position, and previously focused title.
- Entering Movies/TV from the top bar focuses the fixed Discover control immediately. Down from Discover explicitly reveals the first catalog card; focus on already-visible targets changes before scrolling. A quick tab/Down sequence queues entry for the new destination, and focused tabs never repeat their delayed initial-focus request. - Entering Movies/TV from the top bar focuses the fixed Discover control immediately. Down from Discover explicitly reveals the first catalog card; focus on already-visible targets changes before scrolling. A quick tab/Down sequence queues entry for the new destination, and focused tabs never repeat their delayed initial-focus request.
- Offscreen card navigation requests the next lazy layout instead of forcing synchronous composition between key events. Up at the top bar is consumed because there is no destination above it; it must not start a lazy-list focus search. - Offscreen card navigation requests the next lazy layout instead of forcing synchronous composition between key events. Up at the top bar is consumed because there is no destination above it; it must not start a lazy-list focus search.
@ -37,7 +37,7 @@ The interface gives artwork priority. App chrome uses neutral near-black, charco
## Player ## Player
Controls occupy a bottom gradient. The title uses the same original title art (240 × 44 dp) and rating badge/facts line as the browse and details pages, with the delivery quality quietly at the right; a slim timeline, small time labels, central transport icons, and right-aligned track icons replace the rectangular button grid. The timeline is a true D-pad focus target: Up from transport reaches it, Left/Right seek, and Down returns to Play/Pause. Holding a direction increases the seek step. Dedicated media keys remain supported. Controls occupy a shallow bottom gradient. A compact title, slim timeline, small time labels, central transport icons, and right-aligned track icons replace the rectangular button grid. The timeline is a true D-pad focus target: Up from transport reaches it, Left/Right seek, and Down returns to Play/Pause. Holding a direction increases the seek step. Dedicated media keys remain supported.
The controls fade and slide away after five seconds during playback. While they are hidden, a Left/Right tap skips 10 seconds without revealing anything (quick taps add up into one seek), and holding Left/Right reveals the focused timeline for scrubbing. OK and Down reveal them; Back hides them before exiting. Audio and subtitle panels open above their icons and restore focus when dismissed. A gear exposes quality, audio, subtitles, speed, and chapters. Quality is one list shared with Settings: Original quality (the default, direct stream of the source video), then 4K, 1080p, 720p and 480p conversions. The timeline includes buffered progress and server-generated video/chapter previews. Skip actions have opaque contrast surfaces. The controls fade and slide away after five seconds during playback. While they are hidden, a Left/Right tap skips 10 seconds without revealing anything (quick taps add up into one seek), and holding Left/Right reveals the focused timeline for scrubbing. OK and Down reveal them; Back hides them before exiting. Audio and subtitle panels open above their icons and restore focus when dismissed. A gear exposes quality, audio, subtitles, speed, and chapters. Quality is one list shared with Settings: Original quality (the default, direct stream of the source video), then 4K, 1080p, 720p and 480p conversions. The timeline includes buffered progress and server-generated video/chapter previews. Skip actions have opaque contrast surfaces.

View file

@ -223,7 +223,3 @@ The user reported severe lag while the devices still had temporary debug APKs in
The signed 0.1.10 APK uses the existing production certificate, version code 11. APK checks found neither private session data nor debug playback intent strings. Raw comparison records remain in ignored `evidence/private/release-comparison/`. The new benchmark scripts reject debuggable APKs and require `speed-profile`, so functional debug results cannot be mistaken for release performance evidence. The user explicitly authorized leaving Dolby Vision/HDR10 enabled; cleanup must not restore the earlier disabled list. The signed 0.1.10 APK uses the existing production certificate, version code 11. APK checks found neither private session data nor debug playback intent strings. Raw comparison records remain in ignored `evidence/private/release-comparison/`. The new benchmark scripts reject debuggable APKs and require `speed-profile`, so functional debug results cannot be mistaken for release performance evidence. The user explicitly authorized leaving Dolby Vision/HDR10 enabled; cleanup must not restore the earlier disabled list.
The actual non-debuggable release was also opened through Search and title details and played the 4K HEVC fixture from the beginning. Playback reached PLAYING/READY in 2.565 seconds; the recorded 30-second steady sample had zero BUFFERING transitions and one READY event. A preceding one-minute session also completed without a second READY event, but its harness incorrectly expected Home instead of the originating details page, so it is not counted as a fully completed benchmark. The corrected run returned normally and restored the exact previous resume point with the watched count unchanged. This checks real release playback, rather than ignored debug test intents. The actual non-debuggable release was also opened through Search and title details and played the 4K HEVC fixture from the beginning. Playback reached PLAYING/READY in 2.565 seconds; the recorded 30-second steady sample had zero BUFFERING transitions and one READY event. A preceding one-minute session also completed without a second READY event, but its harness incorrectly expected Home instead of the originating details page, so it is not counted as a fully completed benchmark. The corrected run returned normally and restored the exact previous resume point with the watched count unchanged. This checks real release playback, rather than ignored debug test intents.
## Silo-style browse and details redesign - 2026-10-28
Verified on the onn with the profiled release (baseline profile installed, `speed-profile` compiled). The first Home version used AnimatedVisibility/AnimatedContent and read the hero mode in the catalog's composition; `profile_home.py` failed at p95 39.9 ms, and atrace showed recomposition and layout on nearly every frame plus one 44 ms frame on entry. Driving the header, copy and artwork fades from single animations read only in graphics layers, and keeping the invisible preview composed under the hero, brought five hero → Continue Watching transitions to median 16.9 ms, p95 25.1 ms and none above 33.34 ms (the pre-redesign baseline was p95 28.6 ms). `repro_runtime.py browse` passed at Movies p95 31–34 ms; a 1280 × 720 preview frame raised it to 36 ms through larger texture uploads and was not kept. Moving along a season's episode row measured p95 32 ms. `verify_ui.py browse` (8 checks), `repro_runtime.py sections`, `verify_settings.py`, `verify_details_layout.py` and `verify_movie_details.py` passed. The last two needed their library navigation updated for the genre/sort filter row; titles shown as title art are now read from their content description. `verify_details.py` and the live playback suites were not run: they change Plex state, and `verify_details.py` still expects Mark watched directly after Watch next on shows. The player title area was observed during a brief accidental playback, which Plex did not record as progress.

View file

@ -5,15 +5,10 @@ from verify_ui import launch,key,focused,wait,focus,labels,snapshot
launch();key(22,2);focused('TV Shows');key(20);focused('Discover');key(22);focused('Library');key(23) launch();key(22,2);focused('TV Shows');key(20);focused('Discover');key(22);focused('Library');key(23)
wait(lambda r:any(x.startswith('All genres') for x in labels(r)),'Show library loaded');focused('Library');key(20) wait(lambda r:any(x.startswith('All genres') for x in labels(r)),'Show library loaded');focused('Library');key(20)
# The genre/sort filters sit between the section tabs and the grid. if '3 Body Problem' not in focus(snapshot()):key(21)
if 'All genres' in focus(snapshot()):key(20)
# The grid is entered beneath the filter that held focus; walk back to the first column.
for _ in range(6):
if '3 Body Problem' in focus(snapshot()):break
key(21)
focused('3 Body Problem');key(23);focused('Watch next') focused('3 Body Problem');key(23);focused('Watch next')
root=snapshot();screenshot('show-layout-current') root=snapshot();screenshot('show-layout-current')
title=next(n for n in root.iter('node') if '3 Body Problem' in (n.get('text'),n.get('content-desc'))) title=next(n for n in root.iter('node') if n.get('text')=='3 Body Problem')
bounds=list(map(int,re.findall(r'\d+',title.get('bounds')))) bounds=list(map(int,re.findall(r'\d+',title.get('bounds'))))
back=next((n for n in root.iter('node') if n.get('content-desc')=='Back'),None) back=next((n for n in root.iter('node') if n.get('content-desc')=='Back'),None)
print('Title bounds:',bounds,'Back visible:',back is not None,flush=True) print('Title bounds:',bounds,'Back visible:',back is not None,flush=True)

View file

@ -6,15 +6,13 @@ from verify_ui import launch,key,focused,wait,focus,labels,snapshot
launch();key(22);focused('Movies');key(20);focused('Discover');key(22);focused('Library');key(23) launch();key(22);focused('Movies');key(20);focused('Discover');key(22);focused('Library');key(23)
wait(lambda r:any(x.startswith('All genres') for x in labels(r)),'Movie library loaded') wait(lambda r:any(x.startswith('All genres') for x in labels(r)),'Movie library loaded')
key(20) key(20)
# The genre/sort filters sit between the section tabs and the grid.
if 'All genres' in focus(snapshot()):key(20)
wait(lambda r:bool(focus(r)) and focus(r) not in ('Library','Discover') and 'All genres' not in focus(r),'Movie card focus') wait(lambda r:bool(focus(r)) and focus(r) not in ('Library','Discover') and 'All genres' not in focus(r),'Movie card focus')
selected=focus(snapshot());key(23) selected=focus(snapshot());key(23)
wait(lambda r:focus(r)=='Play' or focus(r).startswith('Resume'),'Movie play action') wait(lambda r:focus(r)=='Play' or focus(r).startswith('Resume'),'Movie play action')
root=snapshot();screenshot('movie-details-0.1.11') root=snapshot();screenshot('movie-details-0.1.11')
back=next((n for n in root.iter('node') if n.get('content-desc')=='Back'),None) back=next((n for n in root.iter('node') if n.get('content-desc')=='Back'),None)
assert back is not None,'Movie Back control must be visible on entry' assert back is not None,'Movie Back control must be visible on entry'
assert any((n.get('text') or n.get('content-desc')) and (n.get('text') or n.get('content-desc')) in selected and int(re.findall(r'\d+',n.get('bounds'))[1])>=88 for n in root.iter('node')),'Movie title must remain below the safe header' assert any(n.get('text') and n.get('text') in selected and int(re.findall(r'\d+',n.get('bounds'))[1])>=88 for n in root.iter('node')),'Movie title must remain below the safe header'
print('PASS movie safe header and initial action focus',flush=True) print('PASS movie safe header and initial action focus',flush=True)
key(20) key(20)
wait(lambda r:focus(r) not in ('Play','') and not focus(r).startswith('Resume'),'Cast or related row focus') wait(lambda r:focus(r) not in ('Play','') and not focus(r).startswith('Resume'),'Cast or related row focus')

View file

@ -10,8 +10,7 @@ def key(code,count=1):
def snapshot(): def snapshot():
adb('shell','uiautomator','dump','/data/local/tmp/kaleido-window.xml') adb('shell','uiautomator','dump','/data/local/tmp/kaleido-window.xml')
return ET.fromstring(adb('shell','cat','/data/local/tmp/kaleido-window.xml')) return ET.fromstring(adb('shell','cat','/data/local/tmp/kaleido-window.xml'))
# Title art exposes its title as a content description rather than text. def labels(root):return [n.get('text','') for n in root.iter('node') if n.get('text')]
def labels(root):return [n.get('text','') for n in root.iter('node') if n.get('text')]+[n.get('content-desc') for n in root.iter('node') if n.get('content-desc') and not n.get('text')]
def focus(root): def focus(root):
n=next((n for n in root.iter('node') if n.get('focused')=='true'),None) n=next((n for n in root.iter('node') if n.get('focused')=='true'),None)
if n is None:return '' if n is None:return ''

View file

@ -1,2 +1,2 @@
versionName=0.6.0 versionName=0.5.0
versionCode=20 versionCode=19