SlideShare a Scribd company logo
Kicking Back with Compose
for Android TV
Joe Birch @HiThereJoe
Android @ Bu
ff
er
Running @ Droid.Academy
👋
What we’ll learn
📺 Foundations of Android TV
📺 Layout Composables for Android TV
📺 Material Composables for Android TV
📺 Sharing composables across TV and Mobile
150 million
monthly active devices
running Android TV
(smart TVs and chromecast devices)
Android TV
Navigation
Focus
Immersive
Compose, as you know it
implementation 'androidx.tv:tv-foundation:1.0.0-alpha07'
implementation ‘androidx.tv:tv-material:1.0.0-alpha07'
Lazy Layouts
TV Lazy Row
@Composable
fun TvLazyRow(
modifier: Modifier = Modifier,
state: TvLazyListState = rememberTvLazyListState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
horizontalArrangement: Arrangement.Horizontal =
if (!reverseLayout) Arrangement.Start else Arrangement.End,
verticalAlignment: Alignment.Vertical = Alignment.Top,
userScrollEnabled: Boolean = true,
pivotOffsets: PivotOffsets = PivotOffsets(),
content: TvLazyListScope.() -> Unit
)
TvLazyRow(
contentPadding = PaddingValues(16.dp),
horizontalArrangement = Arrangement.spacedBy(18.dp)
) {
items(data) { cardItem ->
...
}
}
📺 Display horizontally scrolling content
📺 Use to display content in feeds
📺 In most cases, prioritise Row over Column for
content browsing
TV Lazy Row
📺 Display horizontally scrolling content
📺 Use to display content in feeds
📺 In most cases, prioritise Row over Column for
content browsing
TV Lazy Row
📺 Display horizontally scrolling content
📺 Use to display content in feeds
📺 In most cases, prioritise Row over Column for
content browsing
TV Lazy Row
TV Lazy Column
@Composable
fun TvLazyColumn(
modifier: Modifier = Modifier,
state: TvLazyListState = rememberTvLazyListState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
verticalArrangement: Arrangement.Vertical =
if (!reverseLayout) Arrangement.Top else Arrangement.Bottom,
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
userScrollEnabled: Boolean = true,
pivotOffsets: PivotOffsets = PivotOffsets(),
content: TvLazyListScope.() -> Unit
)
TvLazyColumn(
contentPadding = PaddingValues(16.dp),
verticalArrangement = Arrangement.spacedBy(18.dp)
) {
items(data) { cardItem ->
...
}
}
TV Lazy or Lazy 🤔
@Composable
fun TvLazyColumn(
modifier: Modifier = Modifier,
state: TvLazyListState = rememberTvLazyListState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
verticalArrangement: Arrangement.Vertical = …,
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
userScrollEnabled: Boolean = true,
pivotOffsets: PivotOffsets = PivotOffsets(),
content: TvLazyListScope.() -> Unit
)
@Composable
fun LazyColumn(
modifier: Modifier = Modifier,
state: LazyListState = rememberLazyListState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
verticalArrangement: Arrangement.Vertical = …,
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
userScrollEnabled: Boolean = true,
content: LazyListScope.() -> Unit
)
@Composable
fun TvLazyColumn(
modifier: Modifier = Modifier,
state: TvLazyListState = rememberTvLazyListState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
verticalArrangement: Arrangement.Vertical = …,
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
userScrollEnabled: Boolean = true,
pivotOffsets: PivotOffsets = PivotOffsets(),
content: TvLazyListScope.() -> Unit
)
@Composable
fun LazyColumn(
modifier: Modifier = Modifier,
state: LazyListState = rememberLazyListState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
verticalArrangement: Arrangement.Vertical = …,
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
userScrollEnabled: Boolean = true,
content: LazyListScope.() -> Unit
)
@Composable
fun TvLazyColumn(
modifier: Modifier = Modifier,
state: TvLazyListState = rememberTvLazyListState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
verticalArrangement: Arrangement.Vertical = …,
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
userScrollEnabled: Boolean = true,
pivotOffsets: PivotOffsets = PivotOffsets(),
content: TvLazyListScope.() -> Unit
)
@Composable
fun LazyColumn(
modifier: Modifier = Modifier,
state: LazyListState = rememberLazyListState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
verticalArrangement: Arrangement.Vertical = …,
horizontalAlignment: Alignment.Horizontal = Alignment.Start,
flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(),
userScrollEnabled: Boolean = true,
content: LazyListScope.() -> Unit
)
Lazy Row
TV Lazy Row
Lazy Row
TV Lazy Row
📺 Use TV Lazy over Lazy layouts to ensure TV specific
behaviours are automatically applied
📺 Familiar API for composing child items
📺 Enforce TV composable properties and scope
TV Lazy Layouts
📺 Use TV Lazy over Lazy layouts to ensure TV specific
behaviours are automatically applied
📺 Familiar API for composing child items
📺 Enforce TV composable properties and scope
TV Lazy Layouts
📺 Use TV Lazy over Lazy layouts to ensure TV specific
behaviours are automatically applied
📺 Familiar API for composing child items
📺 Enforce TV composable properties and scope
TV Lazy Layouts
Lazy Grids
@Composable
fun TvLazyVerticalGrid(
columns: TvGridCells,
modifier: Modifier = Modifier,
state: TvLazyGridState = rememberTvLazyGridState(),
contentPadding: PaddingValues = PaddingValues(0.dp),
reverseLayout: Boolean = false,
verticalArrangement: Arrangement.Vertical =
if (!reverseLayout) Arrangement.Top else Arrangement.Bottom,
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,
userScrollEnabled: Boolean = true,
pivotOffsets: PivotOffsets = PivotOffsets(),
content: TvLazyGridScope.() -> Unit
)
TvLazyVerticalGrid(
columns = TvGridCells.Fixed(6),
verticalArrangement = Arrangement.spacedBy(16.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp),
contentPadding = PaddingValues(16.dp)
) {
items(items) {
…
}
}
TvLazyVerticalGrid(
columns = TvGridCells.Fixed(6),
verticalArrangement = Arrangement.spacedBy(16.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp),
contentPadding = PaddingValues(16.dp)
)
TvLazyVerticalGrid(
columns = TvGridCells.Adaptive(120.dp),
verticalArrangement = Arrangement.spacedBy(16.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp),
contentPadding = PaddingValues(16.dp)
)
TvLazyHorizontalGrid(
Rows = TvGridCells.Fixed(3),
verticalArrangement = Arrangement.spacedBy(16.dp),
horizontalArrangement = Arrangement.spacedBy(16.dp),
contentPadding = PaddingValues(16.dp)
) {
…
}
📺 Display large collections of related content
📺 Use tabs to offer content filtering
📺 Use adaptive cell sizing to scale based on available
space
TV Grids
📺 Display large collections of related content
📺 Use tabs to offer content filtering
📺 Use adaptive cell sizing to scale based on available
space
TV Grids
📺 Display large collections of related content
📺 Use tabs to offer content filtering
📺 Use adaptive cell sizing to scale based on available
space
TV Grids
Carousels
@Composable
fun Carousel(
itemCount: Int,
modifier: Modifier = Modifier,
carouselState: CarouselState = remember { CarouselState() },
autoScrollDurationMillis: Long = CarouselDefaults.TimeToDisplayItemMillis,
contentTransformStartToEnd: ContentTransform = CarouselDefaults.contentTransform,
contentTransformEndToStart: ContentTransform = CarouselDefaults.contentTransform,
carouselIndicator:
@Composable BoxScope.() -> Unit = {
…
},
content: @Composable AnimatedContentScope.(index: Int) -> Unit
)
@Composable
fun Carousel(
itemCount: Int,
modifier: Modifier = Modifier,
carouselState: CarouselState = remember { CarouselState() },
autoScrollDurationMillis: Long = CarouselDefaults.TimeToDisplayItemMillis,
contentTransformStartToEnd: ContentTransform = CarouselDefaults.contentTransform,
contentTransformEndToStart: ContentTransform = CarouselDefaults.contentTransform,
carouselIndicator:
@Composable BoxScope.() -> Unit = {
CarouselDefaults.IndicatorRow(
itemCount = itemCount,
activeItemIndex = carouselState.activeItemIndex,
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(16.dp),
)
},
content: @Composable AnimatedContentScope.(index: Int) -> Unit
)
@Composable
fun Carousel(
itemCount: Int,
modifier: Modifier = Modifier,
carouselState: CarouselState = remember { CarouselState() },
autoScrollDurationMillis: Long = CarouselDefaults.TimeToDisplayItemMillis,
contentTransformStartToEnd: ContentTransform = CarouselDefaults.contentTransform,
contentTransformEndToStart: ContentTransform = CarouselDefaults.contentTransform,
carouselIndicator:
@Composable BoxScope.() -> Unit = {
CarouselDefaults.IndicatorRow(
itemCount = itemCount,
activeItemIndex = carouselState.activeItemIndex,
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(16.dp),
)
},
content: @Composable AnimatedContentScope.(index: Int) -> Unit
)
@Composable
fun Carousel(
itemCount: Int,
modifier: Modifier = Modifier,
carouselState: CarouselState = remember { CarouselState() },
autoScrollDurationMillis: Long = CarouselDefaults.TimeToDisplayItemMillis,
contentTransformStartToEnd: ContentTransform = CarouselDefaults.contentTransform,
contentTransformEndToStart: ContentTransform = CarouselDefaults.contentTransform,
carouselIndicator:
@Composable BoxScope.() -> Unit = {
CarouselDefaults.IndicatorRow(
itemCount = itemCount,
activeItemIndex = carouselState.activeItemIndex,
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(16.dp),
)
},
content: @Composable AnimatedContentScope.(index: Int) -> Unit
)
@Composable
fun Carousel(
itemCount: Int,
modifier: Modifier = Modifier,
carouselState: CarouselState = remember { CarouselState() },
autoScrollDurationMillis: Long = CarouselDefaults.TimeToDisplayItemMillis,
contentTransformStartToEnd: ContentTransform = CarouselDefaults.contentTransform,
contentTransformEndToStart: ContentTransform = CarouselDefaults.contentTransform,
carouselIndicator:
@Composable BoxScope.() -> Unit = {
CarouselDefaults.IndicatorRow(
itemCount = itemCount,
activeItemIndex = carouselState.activeItemIndex,
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(16.dp),
)
},
content: @Composable AnimatedContentScope.(index: Int) -> Unit
)
Carousel(
itemCount = backgrounds.size,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 100.dp, vertical = 80.dp)
.height(280.dp)
.border(1.dp, Color.LightGray, RoundedCornerShape(16.dp))
) { itemIndex ->
…
}
📺 Highlight featured content
📺 Always provide a way to access the content
📺 Not a replacement for content feeds
Carousel
📺 Highlight featured content
📺 Always provide a way to access the content
📺 Not a replacement for content feeds
Carousel
📺 Highlight featured content
📺 Always provide a way to access the content
📺 Not a replacement for content feeds
Carousel
Immersive Lists
@Composable
fun ImmersiveList(
background:
@Composable ImmersiveListBackgroundScope.(index: Int, listHasFocus: Boolean) -> Unit,
modifier: Modifier = Modifier,
listAlignment: Alignment = Alignment.BottomEnd,
list: @Composable ImmersiveListScope.() -> Unit,
)
ImmersiveList(
modifier = Modifier
.height(immersiveListHeight + cardHeight / 2)
.fillMaxWidth(),
background = { index, _ ->
…
}
) {
}
ImmersiveList(
modifier = Modifier
.height(immersiveListHeight + cardHeight / 2)
.fillMaxWidth(),
background = { index, _ ->
…
}
) {
TvLazyRow {
backgrounds.forEachIndexed { index, backgroundColor ->
item {
Box(
modifier = Modifier
…
.immersiveListItem(index)
)
}
}
}
}
ImmersiveList(
modifier = Modifier
.height(immersiveListHeight + cardHeight / 2)
.fillMaxWidth(),
background = { index, _ ->
…
}
) {
TvLazyRow {
backgrounds.forEachIndexed { index, backgroundColor ->
item {
Box(
modifier = Modifier
…
.immersiveListItem(index)
)
}
}
}
}
📺 Give immersive focus to a selected item
📺 Show more information for content
📺 Greater efficiency for the user
Immersive List
📺 Give immersive focus to a selected item
📺 Show more information for content
📺 Greater efficiency for the user
Immersive List
📺 Give immersive focus to a selected item
📺 Show more information for content
📺 Greater efficiency for the user
Immersive List
Navigation
Navigation Drawer
@Composable
fun NavigationDrawer(
drawerContent: @Composable (DrawerValue) -> Unit,
modifier: Modifier = Modifier,
drawerState: DrawerState = rememberDrawerState(DrawerValue.Closed),
content: @Composable () -> Unit
)
Modal Navigation Drawer
@Composable
fun ModalNavigationDrawer(
drawerContent: @Composable (DrawerValue) -> Unit,
modifier: Modifier = Modifier,
drawerState: DrawerState = rememberDrawerState(DrawerValue.Closed),
scrimColor: Color = LocalColorScheme.current.scrim.copy(alpha = 0.5f),
content: @Composable () -> Unit
)
Tabs
@Composable
fun TabRow(
selectedTabIndex: Int,
modifier: Modifier = Modifier,
containerColor: Color = TabRowDefaults.ContainerColor,
contentColor: Color = TabRowDefaults.contentColor(),
separator: @Composable () -> Unit = { TabRowDefaults.TabSeparator() },
indicator: @Composable …,
tabs: @Composable () -> Unit
)
@Composable
fun Tab(
selected: Boolean,
onFocus: () -> Unit,
modifier: Modifier = Modifier,
onClick: () -> Unit = { },
enabled: Boolean = true,
colors: TabColors = TabDefaults.pillIndicatorTabColors(),
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
content: @Composable RowScope.() -> Unit
)
val tabs = listOf("View All", "Action", "Sci-Fi", "Drama", "Thriller")
var selectedTabIndex by remember { mutableIntStateOf(0) }
TabRow(
selectedTabIndex = selectedTabIndex
) {
tabs.forEachIndexed { index, tab ->
Tab(
selected = selectedTabIndex == index,
onFocus = {
selectedTabIndex = index
},
) {
Text(…)
}
}
}
Material Components
Card
@Composable
fun WideCardLayout(
imageCard: @Composable (interactionSource: MutableInteractionSource) -> Unit,
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
subtitle: @Composable () -> Unit = {},
description: @Composable () -> Unit = {},
contentColor: CardLayoutColors = CardLayoutDefaults.contentColor(),
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
)
@Composable
fun StandardCardLayout(
imageCard: @Composable (interactionSource: MutableInteractionSource) -> Unit,
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
subtitle: @Composable () -> Unit = {},
description: @Composable () -> Unit = {},
contentColor: CardLayoutColors = CardLayoutDefaults.contentColor(),
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
)
@Composable
fun ClassicCard(
onClick: () -> Unit,
image: @Composable BoxScope.() -> Unit,
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
onLongClick: (() -> Unit)? = null,
subtitle: @Composable () -> Unit = {},
description: @Composable () -> Unit = {},
shape: CardShape = CardDefaults.shape(),
colors: CardColors = CardDefaults.colors(),
scale: CardScale = CardDefaults.scale(),
border: CardBorder = CardDefaults.border(),
glow: CardGlow = CardDefaults.glow(),
contentPadding: PaddingValues = PaddingValues(),
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
)
@Composable
fun WideClassicCard(
onClick: () -> Unit,
image: @Composable BoxScope.() -> Unit,
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
onLongClick: (() -> Unit)? = null,
subtitle: @Composable () -> Unit = {},
description: @Composable () -> Unit = {},
shape: CardShape = CardDefaults.shape(),
colors: CardColors = CardDefaults.colors(),
scale: CardScale = CardDefaults.scale(),
border: CardBorder = CardDefaults.border(),
glow: CardGlow = CardDefaults.glow(),
contentPadding: PaddingValues = PaddingValues(),
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }
)
Surface
@Composable
fun Surface(
checked: Boolean,
onCheckedChange: (Boolean) -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
onLongClick: (() -> Unit)? = null,
tonalElevation: Dp = Elevation.Level0,
shape: ToggleableSurfaceShape = ToggleableSurfaceDefaults.shape(),
colors: ToggleableSurfaceColors = ToggleableSurfaceDefaults.colors(),
scale: ToggleableSurfaceScale = ToggleableSurfaceDefaults.scale(),
border: ToggleableSurfaceBorder = ToggleableSurfaceDefaults.border(),
glow: ToggleableSurfaceGlow = ToggleableSurfaceDefaults.glow(),
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
content: @Composable (BoxScope.() -> Unit)
)
@Composable
fun Surface(
checked: Boolean,
onCheckedChange: (Boolean) -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
onLongClick: (() -> Unit)? = null,
tonalElevation: Dp = Elevation.Level0,
shape: ToggleableSurfaceShape = ToggleableSurfaceDefaults.shape(),
colors: ToggleableSurfaceColors = ToggleableSurfaceDefaults.colors(),
scale: ToggleableSurfaceScale = ToggleableSurfaceDefaults.scale(),
border: ToggleableSurfaceBorder = ToggleableSurfaceDefaults.border(),
glow: ToggleableSurfaceGlow = ToggleableSurfaceDefaults.glow(),
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
content: @Composable (BoxScope.() -> Unit)
)
Switch
@Composable
fun Switch(
checked: Boolean,
onCheckedChange: ((Boolean) -> Unit)?,
modifier: Modifier = Modifier,
thumbContent: (@Composable () -> Unit)? = null,
enabled: Boolean = true,
colors: SwitchColors = SwitchDefaults.colors(),
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
)
📺 Button
📺 Checkbox
📺 Radio Button
📺 Wide Button
Material Components
Reusing Composables
Mobile App
Component
Library
Material Card
Mobile App
Component
Library
Material Card
TV App
Material TV Card
TV App
Material TV Card
Mobile App
Material Card
Component
Library
Card Content
TV App
Material TV Card
Mobile App
Material Card
Component
Library
Card Content
@Composable
fun TvMovieCard() {
Card(...) {
MySharedContent()
}
}
@Composable
fun MovieCard() {
Card(...) {
MySharedContent()
}
}
@Composable
fun MySharedContent() {
...
}
That’s all
Practical Jetpack Compose
Build 12 independent projects, interacting
with a vast range of essential Compose
APIs.
ComposeBook.com
25% o
ff
using code DROIDCON

More Related Content

Recently uploaded

2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
PuktoonEngr
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
JamalHussainArman
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
University of Maribor
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
Mukeshwaran Balu
 
Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
Madhumitha Jayaram
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
nooriasukmaningtyas
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
ihlasbinance2003
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
anoopmanoharan2
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 

Recently uploaded (20)

2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptxML Based Model for NIDS MSc Updated Presentation.v2.pptx
ML Based Model for NIDS MSc Updated Presentation.v2.pptx
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
 
Wearable antenna for antenna applications
Wearable antenna for antenna applicationsWearable antenna for antenna applications
Wearable antenna for antenna applications
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...A review on techniques and modelling methodologies used for checking electrom...
A review on techniques and modelling methodologies used for checking electrom...
 
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
5214-1693458878915-Unit 6 2023 to 2024 academic year assignment (AutoRecovere...
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
PPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testingPPT on GRP pipes manufacturing and testing
PPT on GRP pipes manufacturing and testing
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Kicking Back with Compose for Android TV

  • 1. Kicking Back with Compose for Android TV
  • 2. Joe Birch @HiThereJoe Android @ Bu ff er Running @ Droid.Academy 👋
  • 3. What we’ll learn 📺 Foundations of Android TV 📺 Layout Composables for Android TV 📺 Material Composables for Android TV 📺 Sharing composables across TV and Mobile
  • 4. 150 million monthly active devices running Android TV (smart TVs and chromecast devices)
  • 7.
  • 8.
  • 9.
  • 10. Focus
  • 11.
  • 12.
  • 13.
  • 14.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. Compose, as you know it implementation 'androidx.tv:tv-foundation:1.0.0-alpha07' implementation ‘androidx.tv:tv-material:1.0.0-alpha07'
  • 22.
  • 25.
  • 26. @Composable fun TvLazyRow( modifier: Modifier = Modifier, state: TvLazyListState = rememberTvLazyListState(), contentPadding: PaddingValues = PaddingValues(0.dp), reverseLayout: Boolean = false, horizontalArrangement: Arrangement.Horizontal = if (!reverseLayout) Arrangement.Start else Arrangement.End, verticalAlignment: Alignment.Vertical = Alignment.Top, userScrollEnabled: Boolean = true, pivotOffsets: PivotOffsets = PivotOffsets(), content: TvLazyListScope.() -> Unit )
  • 27. TvLazyRow( contentPadding = PaddingValues(16.dp), horizontalArrangement = Arrangement.spacedBy(18.dp) ) { items(data) { cardItem -> ... } }
  • 28. 📺 Display horizontally scrolling content 📺 Use to display content in feeds 📺 In most cases, prioritise Row over Column for content browsing TV Lazy Row
  • 29. 📺 Display horizontally scrolling content 📺 Use to display content in feeds 📺 In most cases, prioritise Row over Column for content browsing TV Lazy Row
  • 30. 📺 Display horizontally scrolling content 📺 Use to display content in feeds 📺 In most cases, prioritise Row over Column for content browsing TV Lazy Row
  • 32.
  • 33. @Composable fun TvLazyColumn( modifier: Modifier = Modifier, state: TvLazyListState = rememberTvLazyListState(), contentPadding: PaddingValues = PaddingValues(0.dp), reverseLayout: Boolean = false, verticalArrangement: Arrangement.Vertical = if (!reverseLayout) Arrangement.Top else Arrangement.Bottom, horizontalAlignment: Alignment.Horizontal = Alignment.Start, userScrollEnabled: Boolean = true, pivotOffsets: PivotOffsets = PivotOffsets(), content: TvLazyListScope.() -> Unit )
  • 34. TvLazyColumn( contentPadding = PaddingValues(16.dp), verticalArrangement = Arrangement.spacedBy(18.dp) ) { items(data) { cardItem -> ... } }
  • 35. TV Lazy or Lazy 🤔
  • 36. @Composable fun TvLazyColumn( modifier: Modifier = Modifier, state: TvLazyListState = rememberTvLazyListState(), contentPadding: PaddingValues = PaddingValues(0.dp), reverseLayout: Boolean = false, verticalArrangement: Arrangement.Vertical = …, horizontalAlignment: Alignment.Horizontal = Alignment.Start, userScrollEnabled: Boolean = true, pivotOffsets: PivotOffsets = PivotOffsets(), content: TvLazyListScope.() -> Unit ) @Composable fun LazyColumn( modifier: Modifier = Modifier, state: LazyListState = rememberLazyListState(), contentPadding: PaddingValues = PaddingValues(0.dp), reverseLayout: Boolean = false, verticalArrangement: Arrangement.Vertical = …, horizontalAlignment: Alignment.Horizontal = Alignment.Start, flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(), userScrollEnabled: Boolean = true, content: LazyListScope.() -> Unit )
  • 37. @Composable fun TvLazyColumn( modifier: Modifier = Modifier, state: TvLazyListState = rememberTvLazyListState(), contentPadding: PaddingValues = PaddingValues(0.dp), reverseLayout: Boolean = false, verticalArrangement: Arrangement.Vertical = …, horizontalAlignment: Alignment.Horizontal = Alignment.Start, userScrollEnabled: Boolean = true, pivotOffsets: PivotOffsets = PivotOffsets(), content: TvLazyListScope.() -> Unit ) @Composable fun LazyColumn( modifier: Modifier = Modifier, state: LazyListState = rememberLazyListState(), contentPadding: PaddingValues = PaddingValues(0.dp), reverseLayout: Boolean = false, verticalArrangement: Arrangement.Vertical = …, horizontalAlignment: Alignment.Horizontal = Alignment.Start, flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(), userScrollEnabled: Boolean = true, content: LazyListScope.() -> Unit )
  • 38. @Composable fun TvLazyColumn( modifier: Modifier = Modifier, state: TvLazyListState = rememberTvLazyListState(), contentPadding: PaddingValues = PaddingValues(0.dp), reverseLayout: Boolean = false, verticalArrangement: Arrangement.Vertical = …, horizontalAlignment: Alignment.Horizontal = Alignment.Start, userScrollEnabled: Boolean = true, pivotOffsets: PivotOffsets = PivotOffsets(), content: TvLazyListScope.() -> Unit ) @Composable fun LazyColumn( modifier: Modifier = Modifier, state: LazyListState = rememberLazyListState(), contentPadding: PaddingValues = PaddingValues(0.dp), reverseLayout: Boolean = false, verticalArrangement: Arrangement.Vertical = …, horizontalAlignment: Alignment.Horizontal = Alignment.Start, flingBehavior: FlingBehavior = ScrollableDefaults.flingBehavior(), userScrollEnabled: Boolean = true, content: LazyListScope.() -> Unit )
  • 41. 📺 Use TV Lazy over Lazy layouts to ensure TV specific behaviours are automatically applied 📺 Familiar API for composing child items 📺 Enforce TV composable properties and scope TV Lazy Layouts
  • 42. 📺 Use TV Lazy over Lazy layouts to ensure TV specific behaviours are automatically applied 📺 Familiar API for composing child items 📺 Enforce TV composable properties and scope TV Lazy Layouts
  • 43. 📺 Use TV Lazy over Lazy layouts to ensure TV specific behaviours are automatically applied 📺 Familiar API for composing child items 📺 Enforce TV composable properties and scope TV Lazy Layouts
  • 45. @Composable fun TvLazyVerticalGrid( columns: TvGridCells, modifier: Modifier = Modifier, state: TvLazyGridState = rememberTvLazyGridState(), contentPadding: PaddingValues = PaddingValues(0.dp), reverseLayout: Boolean = false, verticalArrangement: Arrangement.Vertical = if (!reverseLayout) Arrangement.Top else Arrangement.Bottom, horizontalArrangement: Arrangement.Horizontal = Arrangement.Start, userScrollEnabled: Boolean = true, pivotOffsets: PivotOffsets = PivotOffsets(), content: TvLazyGridScope.() -> Unit )
  • 46. TvLazyVerticalGrid( columns = TvGridCells.Fixed(6), verticalArrangement = Arrangement.spacedBy(16.dp), horizontalArrangement = Arrangement.spacedBy(16.dp), contentPadding = PaddingValues(16.dp) ) { items(items) { … } }
  • 47.
  • 48. TvLazyVerticalGrid( columns = TvGridCells.Fixed(6), verticalArrangement = Arrangement.spacedBy(16.dp), horizontalArrangement = Arrangement.spacedBy(16.dp), contentPadding = PaddingValues(16.dp) )
  • 49.
  • 50. TvLazyVerticalGrid( columns = TvGridCells.Adaptive(120.dp), verticalArrangement = Arrangement.spacedBy(16.dp), horizontalArrangement = Arrangement.spacedBy(16.dp), contentPadding = PaddingValues(16.dp) )
  • 51.
  • 52. TvLazyHorizontalGrid( Rows = TvGridCells.Fixed(3), verticalArrangement = Arrangement.spacedBy(16.dp), horizontalArrangement = Arrangement.spacedBy(16.dp), contentPadding = PaddingValues(16.dp) ) { … }
  • 53.
  • 54. 📺 Display large collections of related content 📺 Use tabs to offer content filtering 📺 Use adaptive cell sizing to scale based on available space TV Grids
  • 55. 📺 Display large collections of related content 📺 Use tabs to offer content filtering 📺 Use adaptive cell sizing to scale based on available space TV Grids
  • 56. 📺 Display large collections of related content 📺 Use tabs to offer content filtering 📺 Use adaptive cell sizing to scale based on available space TV Grids
  • 58.
  • 59. @Composable fun Carousel( itemCount: Int, modifier: Modifier = Modifier, carouselState: CarouselState = remember { CarouselState() }, autoScrollDurationMillis: Long = CarouselDefaults.TimeToDisplayItemMillis, contentTransformStartToEnd: ContentTransform = CarouselDefaults.contentTransform, contentTransformEndToStart: ContentTransform = CarouselDefaults.contentTransform, carouselIndicator: @Composable BoxScope.() -> Unit = { … }, content: @Composable AnimatedContentScope.(index: Int) -> Unit )
  • 60. @Composable fun Carousel( itemCount: Int, modifier: Modifier = Modifier, carouselState: CarouselState = remember { CarouselState() }, autoScrollDurationMillis: Long = CarouselDefaults.TimeToDisplayItemMillis, contentTransformStartToEnd: ContentTransform = CarouselDefaults.contentTransform, contentTransformEndToStart: ContentTransform = CarouselDefaults.contentTransform, carouselIndicator: @Composable BoxScope.() -> Unit = { CarouselDefaults.IndicatorRow( itemCount = itemCount, activeItemIndex = carouselState.activeItemIndex, modifier = Modifier .align(Alignment.BottomEnd) .padding(16.dp), ) }, content: @Composable AnimatedContentScope.(index: Int) -> Unit )
  • 61. @Composable fun Carousel( itemCount: Int, modifier: Modifier = Modifier, carouselState: CarouselState = remember { CarouselState() }, autoScrollDurationMillis: Long = CarouselDefaults.TimeToDisplayItemMillis, contentTransformStartToEnd: ContentTransform = CarouselDefaults.contentTransform, contentTransformEndToStart: ContentTransform = CarouselDefaults.contentTransform, carouselIndicator: @Composable BoxScope.() -> Unit = { CarouselDefaults.IndicatorRow( itemCount = itemCount, activeItemIndex = carouselState.activeItemIndex, modifier = Modifier .align(Alignment.BottomEnd) .padding(16.dp), ) }, content: @Composable AnimatedContentScope.(index: Int) -> Unit )
  • 62. @Composable fun Carousel( itemCount: Int, modifier: Modifier = Modifier, carouselState: CarouselState = remember { CarouselState() }, autoScrollDurationMillis: Long = CarouselDefaults.TimeToDisplayItemMillis, contentTransformStartToEnd: ContentTransform = CarouselDefaults.contentTransform, contentTransformEndToStart: ContentTransform = CarouselDefaults.contentTransform, carouselIndicator: @Composable BoxScope.() -> Unit = { CarouselDefaults.IndicatorRow( itemCount = itemCount, activeItemIndex = carouselState.activeItemIndex, modifier = Modifier .align(Alignment.BottomEnd) .padding(16.dp), ) }, content: @Composable AnimatedContentScope.(index: Int) -> Unit )
  • 63. @Composable fun Carousel( itemCount: Int, modifier: Modifier = Modifier, carouselState: CarouselState = remember { CarouselState() }, autoScrollDurationMillis: Long = CarouselDefaults.TimeToDisplayItemMillis, contentTransformStartToEnd: ContentTransform = CarouselDefaults.contentTransform, contentTransformEndToStart: ContentTransform = CarouselDefaults.contentTransform, carouselIndicator: @Composable BoxScope.() -> Unit = { CarouselDefaults.IndicatorRow( itemCount = itemCount, activeItemIndex = carouselState.activeItemIndex, modifier = Modifier .align(Alignment.BottomEnd) .padding(16.dp), ) }, content: @Composable AnimatedContentScope.(index: Int) -> Unit )
  • 64. Carousel( itemCount = backgrounds.size, modifier = Modifier .fillMaxWidth() .padding(horizontal = 100.dp, vertical = 80.dp) .height(280.dp) .border(1.dp, Color.LightGray, RoundedCornerShape(16.dp)) ) { itemIndex -> … }
  • 65. 📺 Highlight featured content 📺 Always provide a way to access the content 📺 Not a replacement for content feeds Carousel
  • 66. 📺 Highlight featured content 📺 Always provide a way to access the content 📺 Not a replacement for content feeds Carousel
  • 67. 📺 Highlight featured content 📺 Always provide a way to access the content 📺 Not a replacement for content feeds Carousel
  • 69.
  • 70. @Composable fun ImmersiveList( background: @Composable ImmersiveListBackgroundScope.(index: Int, listHasFocus: Boolean) -> Unit, modifier: Modifier = Modifier, listAlignment: Alignment = Alignment.BottomEnd, list: @Composable ImmersiveListScope.() -> Unit, )
  • 71. ImmersiveList( modifier = Modifier .height(immersiveListHeight + cardHeight / 2) .fillMaxWidth(), background = { index, _ -> … } ) { }
  • 72. ImmersiveList( modifier = Modifier .height(immersiveListHeight + cardHeight / 2) .fillMaxWidth(), background = { index, _ -> … } ) { TvLazyRow { backgrounds.forEachIndexed { index, backgroundColor -> item { Box( modifier = Modifier … .immersiveListItem(index) ) } } } }
  • 73. ImmersiveList( modifier = Modifier .height(immersiveListHeight + cardHeight / 2) .fillMaxWidth(), background = { index, _ -> … } ) { TvLazyRow { backgrounds.forEachIndexed { index, backgroundColor -> item { Box( modifier = Modifier … .immersiveListItem(index) ) } } } }
  • 74. 📺 Give immersive focus to a selected item 📺 Show more information for content 📺 Greater efficiency for the user Immersive List
  • 75. 📺 Give immersive focus to a selected item 📺 Show more information for content 📺 Greater efficiency for the user Immersive List
  • 76. 📺 Give immersive focus to a selected item 📺 Show more information for content 📺 Greater efficiency for the user Immersive List
  • 79. @Composable fun NavigationDrawer( drawerContent: @Composable (DrawerValue) -> Unit, modifier: Modifier = Modifier, drawerState: DrawerState = rememberDrawerState(DrawerValue.Closed), content: @Composable () -> Unit )
  • 80.
  • 82. @Composable fun ModalNavigationDrawer( drawerContent: @Composable (DrawerValue) -> Unit, modifier: Modifier = Modifier, drawerState: DrawerState = rememberDrawerState(DrawerValue.Closed), scrimColor: Color = LocalColorScheme.current.scrim.copy(alpha = 0.5f), content: @Composable () -> Unit )
  • 83.
  • 84. Tabs
  • 85. @Composable fun TabRow( selectedTabIndex: Int, modifier: Modifier = Modifier, containerColor: Color = TabRowDefaults.ContainerColor, contentColor: Color = TabRowDefaults.contentColor(), separator: @Composable () -> Unit = { TabRowDefaults.TabSeparator() }, indicator: @Composable …, tabs: @Composable () -> Unit ) @Composable fun Tab( selected: Boolean, onFocus: () -> Unit, modifier: Modifier = Modifier, onClick: () -> Unit = { }, enabled: Boolean = true, colors: TabColors = TabDefaults.pillIndicatorTabColors(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, content: @Composable RowScope.() -> Unit )
  • 86. val tabs = listOf("View All", "Action", "Sci-Fi", "Drama", "Thriller") var selectedTabIndex by remember { mutableIntStateOf(0) } TabRow( selectedTabIndex = selectedTabIndex ) { tabs.forEachIndexed { index, tab -> Tab( selected = selectedTabIndex == index, onFocus = { selectedTabIndex = index }, ) { Text(…) } } }
  • 87.
  • 89. Card
  • 90. @Composable fun WideCardLayout( imageCard: @Composable (interactionSource: MutableInteractionSource) -> Unit, title: @Composable () -> Unit, modifier: Modifier = Modifier, subtitle: @Composable () -> Unit = {}, description: @Composable () -> Unit = {}, contentColor: CardLayoutColors = CardLayoutDefaults.contentColor(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() } )
  • 91. @Composable fun StandardCardLayout( imageCard: @Composable (interactionSource: MutableInteractionSource) -> Unit, title: @Composable () -> Unit, modifier: Modifier = Modifier, subtitle: @Composable () -> Unit = {}, description: @Composable () -> Unit = {}, contentColor: CardLayoutColors = CardLayoutDefaults.contentColor(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() } )
  • 92. @Composable fun ClassicCard( onClick: () -> Unit, image: @Composable BoxScope.() -> Unit, title: @Composable () -> Unit, modifier: Modifier = Modifier, onLongClick: (() -> Unit)? = null, subtitle: @Composable () -> Unit = {}, description: @Composable () -> Unit = {}, shape: CardShape = CardDefaults.shape(), colors: CardColors = CardDefaults.colors(), scale: CardScale = CardDefaults.scale(), border: CardBorder = CardDefaults.border(), glow: CardGlow = CardDefaults.glow(), contentPadding: PaddingValues = PaddingValues(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() } )
  • 93. @Composable fun WideClassicCard( onClick: () -> Unit, image: @Composable BoxScope.() -> Unit, title: @Composable () -> Unit, modifier: Modifier = Modifier, onLongClick: (() -> Unit)? = null, subtitle: @Composable () -> Unit = {}, description: @Composable () -> Unit = {}, shape: CardShape = CardDefaults.shape(), colors: CardColors = CardDefaults.colors(), scale: CardScale = CardDefaults.scale(), border: CardBorder = CardDefaults.border(), glow: CardGlow = CardDefaults.glow(), contentPadding: PaddingValues = PaddingValues(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() } )
  • 95.
  • 96. @Composable fun Surface( checked: Boolean, onCheckedChange: (Boolean) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, onLongClick: (() -> Unit)? = null, tonalElevation: Dp = Elevation.Level0, shape: ToggleableSurfaceShape = ToggleableSurfaceDefaults.shape(), colors: ToggleableSurfaceColors = ToggleableSurfaceDefaults.colors(), scale: ToggleableSurfaceScale = ToggleableSurfaceDefaults.scale(), border: ToggleableSurfaceBorder = ToggleableSurfaceDefaults.border(), glow: ToggleableSurfaceGlow = ToggleableSurfaceDefaults.glow(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, content: @Composable (BoxScope.() -> Unit) )
  • 97. @Composable fun Surface( checked: Boolean, onCheckedChange: (Boolean) -> Unit, modifier: Modifier = Modifier, enabled: Boolean = true, onLongClick: (() -> Unit)? = null, tonalElevation: Dp = Elevation.Level0, shape: ToggleableSurfaceShape = ToggleableSurfaceDefaults.shape(), colors: ToggleableSurfaceColors = ToggleableSurfaceDefaults.colors(), scale: ToggleableSurfaceScale = ToggleableSurfaceDefaults.scale(), border: ToggleableSurfaceBorder = ToggleableSurfaceDefaults.border(), glow: ToggleableSurfaceGlow = ToggleableSurfaceDefaults.glow(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, content: @Composable (BoxScope.() -> Unit) )
  • 98.
  • 100.
  • 101. @Composable fun Switch( checked: Boolean, onCheckedChange: ((Boolean) -> Unit)?, modifier: Modifier = Modifier, thumbContent: (@Composable () -> Unit)? = null, enabled: Boolean = true, colors: SwitchColors = SwitchDefaults.colors(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, )
  • 102.
  • 103. 📺 Button 📺 Checkbox 📺 Radio Button 📺 Wide Button Material Components
  • 107. TV App Material TV Card Mobile App Material Card Component Library Card Content
  • 108. TV App Material TV Card Mobile App Material Card Component Library Card Content
  • 109. @Composable fun TvMovieCard() { Card(...) { MySharedContent() } } @Composable fun MovieCard() { Card(...) { MySharedContent() } } @Composable fun MySharedContent() { ... }
  • 111. Practical Jetpack Compose Build 12 independent projects, interacting with a vast range of essential Compose APIs. ComposeBook.com 25% o ff using code DROIDCON