Thanks for all of your suggestions from utilizing the alphas to assist deliver Compose for TV to the steady launch! It’s terrific that you simply’ve been utilizing Compose in your TV apps — then you definately’ve seen how Compose is the easiest way to construct person interfaces throughout all kind components in Android and the way it simplifies and accelerates app improvement with customization and styling via a contemporary, declarative syntax in Kotlin.
Maybe you’ve seen that we’ve shifted a number of issues round when Compose for TV graduated out of alpha. Learn on to discover ways to migrate your code with these modifications.
Compose for TV consists of two AndroidX Jetpack libraries:
androidx.television.material3
is now steady in model 1.0.0androidx.television.basis
stays in alpha
Now that Compose for TV has graduated from alpha, we’ve promoted tv-material
to steady and moved the scrollable containers in tv-foundation
to the place they belong: in compose-foundation
itself. The newest alpha model of the tv-foundation
library merely marks these elements as deprecated. TvImeOptions continues to reside in tv-foundation
.
Primarily based on developer suggestions, we’ve modified varied APIs, which implies some issues have been renamed, moved, or eliminated utterly. Whereas the great record is documented within the library launch notes, listed here are the first modifications that will help you migrate.
APIs which were renamed
NonInteractiveSurfaceDefaults
andNonInteractiveSurfaceColors
have been renamed toSurfaceDefaults
andSurfaceColors
.StandardCardLayout
andWideCardLayout
have been renamed toStandardCardContainer
andWideCardContainer
.CardDefaults.ContainerGradient
has been renamed toCardDefaults.ScrimBrush
.
APIs which have modified
ListItem
parameters have been rearranged and renamed to require offeringheadlineContent
.TvLazyRow
,TvLazyColumn
,TvLazyHorizontalGrid
andTvLazyVerticalGrid
have been eliminated as a result of their performance has been included into the scrollable containers in compose-foundation model 1.7.0-beta02.
The supporting lessonsTvLazyListState
andTvGridCells
along with the strategiesrememberTvLazyListState
andrememberTvLazyGridState
have additionally been changed with the Compose basis variations.
You may migrate by merely eradicating the tv-foundation dependency; you’ll find all the things you want inandroidx.compose.basis.lazy
by merely swapping all of your composables with the non-TV counterpart; for instance changingTvLazy*
withLazy*
andrememberTvLazy*State
withrememberLazy*State
.
APIs which were eliminated
CardContainerDefaults.ImageCard
has been eliminated; you should utilize a Card and comprise a picture inside it as demonstrated in JetStream’s MovieCard.ListItemDefaults.ListItemShape
,ListItemDefaults.FocusedDisabledBorder
&ListItemDefaults.SelectedContainerColorOpacity
at the moment are non-public as they aren’t defaults for the ListItem composable.ImmersiveList
has been eliminated as a result of limitations within the selection within the knowledge sorts that characterize content material. As a substitute, you may create an immersive record with only a few traces of code (a whole snippet is on the market within the immersive record pattern):
- With the migration of
TvLazy*
toLazy*
, scrollable containers now not assist thepivotOffset
parameter. In case your utility makes use of pivot offsets, You’ll need to outline aBringIntoViewSpec
object implementing the pivot offset, and go it to Lazy* withLocalBringIntoViewSpec
.
See thePositionFocusedItemInLazyLayout
snippet for a generic resolution that enables specifying the offset ratio.