<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gv Harish on Medium]]></title>
        <description><![CDATA[Stories by Gv Harish on Medium]]></description>
        <link>https://medium.com/@hariharangv9894?source=rss-5a3460260788------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_ZejLOq1L6-kH1SQoz5EoQ.jpeg</url>
            <title>Stories by Gv Harish on Medium</title>
            <link>https://medium.com/@hariharangv9894?source=rss-5a3460260788------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 23:07:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hariharangv9894/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Build Triggers Using GitHub Action In Android Project]]></title>
            <link>https://medium.com/@hariharangv9894/build-triggers-using-github-action-in-android-project-d45901fa69d9?source=rss-5a3460260788------2</link>
            <guid isPermaLink="false">https://medium.com/p/d45901fa69d9</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[automation-testing]]></category>
            <dc:creator><![CDATA[Gv Harish]]></dc:creator>
            <pubDate>Mon, 29 Apr 2024 06:21:58 GMT</pubDate>
            <atom:updated>2024-05-12T03:38:57.530Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*KMQFK22_nox3XYS2tr2n-A.png" /></figure><p>In recent time provide .apk and.aab files to testers after the development phase is finished or when bugs are fixed, as it takes longer to build those files in release type. Depending on the size of the project, each time I attempt to make those files in release type, it takes between 16–20 minutes. I should be idle in the meanwhile. due to the minimal configuration of my system. so, I thought why not automate to build this in cloud. After searching around for a solution, I eventually discovered GitHub Action. GitHub actions are easy to implement and provide free minutes and storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*kMosWI_mIfMBMVj7qHh8Sw.png" /></figure><p>Now let’s get started implementing…</p><h4><strong>1. Create new directory</strong></h4><blockquote>Need to create new directory for GitHub action workflows. Root Project → .github → workflows</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*Rnn7qv2-JtLsDL95UXKepQ.png" /></figure><h4>2. Create YAML file</h4><p>create new file your_file_name.yml for define our GitHub action workflow.</p><h4>3. Define your actions</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/580fee4a89c90c9ef9db9d75cfec376f/href">https://medium.com/media/580fee4a89c90c9ef9db9d75cfec376f/href</a></iframe><h4><strong>4. Checklist</strong></h4><p><strong><em>4.1 Control &amp; Branch - B</em></strong>ased on event happen and define your branch to trigger changes made on particular branch</p><p>4.2 <strong><em>Checkout </em></strong>- This action checks-out your repository under $GITHUB_WORKSPACE, so your workflow can access it.</p><p>4.3<em> </em><strong><em>Java JDK</em></strong> - Add correct version of your project compile JDK version otherwise will throw error</p><p>4.4 <strong><em>Upload-artifact</em></strong> - Add latest version of artifact to upload build. check-out latest version: <a href="https://github.com/actions/upload-artifact/releases">https://github.com/actions/upload-artifact/releases</a></p><p>4.5 <strong><em>Upload Path</em></strong><em> </em>- Add file path of want to upload file. If you going to add multiple path don’t forgot to add ‘ | ’</p><p>That’s it …😉</p><h4><strong>5. Upload Project to GitHub</strong></h4><p>Now upload your project to GitHub and commit your changes. The file will automatically begin to build when you make modifications to the specified branch. Your activity is visible in the project under action tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xkoaO2ILMJhgV_kGK8BAnA.png" /></figure><p>All done. However, you may face some issues while creating the files because Gradle throws some security exceptions.<br>This is the problem I faced when I tried to create the files<br><strong> “./gradlew: permission denied”</strong> To work around this issue, run the following line before commit your code.</p><pre>git update-index --chmod=+x gradlew</pre><p>That’s it, everything will be fine now. Now you can download the generated files from Job’s detail screen. You can see your artifacts on each complete job detail screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JUbSFeudh4_JkjxjgVC5ow.png" /></figure><p>Thank You :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d45901fa69d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Featured Carousels for Android TV using Compose]]></title>
            <link>https://medium.com/@hariharangv9894/featured-carousels-for-android-tv-using-compose-67e405ebccce?source=rss-5a3460260788------2</link>
            <guid isPermaLink="false">https://medium.com/p/67e405ebccce</guid>
            <category><![CDATA[android-tv]]></category>
            <category><![CDATA[compose]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[compose-ui]]></category>
            <dc:creator><![CDATA[Gv Harish]]></dc:creator>
            <pubDate>Wed, 22 Nov 2023 06:07:59 GMT</pubDate>
            <atom:updated>2023-11-22T06:07:59.642Z</atom:updated>
            <content:encoded><![CDATA[<p>Featured carousels showcase a selection of content relevant to the user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RWKmXwt_1dyisNycy9MbXQ.png" /></figure><p><strong>Highlights</strong></p><ul><li>Use featured carousels to draw attention to specific content.</li><li>Images, headlines, content details, videos, actions, and pagination controls can all be included in featured carousels.</li><li>Carousels are typically found on an app’s homepage or landing page, making them easily accessible.</li><li>Carousels with featured images are visually appealing, which helps to engage the user and create an immersive experience.</li><li>The displayed content can be customized based on the user’s viewing history, preferences, or current trends.</li></ul><p>Let’s get started with the implementation…🚀</p><pre>@ExperimentalTvMaterial3Api<br>@Composable<br>fun Carousel(<br>    itemCount: Int,<br>    modifier: Modifier = Modifier,<br>    carouselState: CarouselState = rememberCarouselState(),<br>    autoScrollDurationMillis: Long = CarouselDefaults.TimeToDisplayItemMillis,<br>    contentTransformStartToEnd: ContentTransform = CarouselDefaults.contentTransform,<br>    contentTransformEndToStart: ContentTransform = CarouselDefaults.contentTransform,<br>    carouselIndicator: @Composable BoxScope.() -&gt; Unit = {<br>        CarouselDefaults.IndicatorRow(<br>            itemCount = itemCount,<br>            activeItemIndex = carouselState.activeItemIndex,<br>            modifier = Modifier<br>                .align(Alignment.BottomEnd)<br>                .padding(16.dp),<br>        )<br>    },<br>    content: @Composable AnimatedContentScope.(index: Int) -&gt; Unit<br>): Unit<br><br><br>/*<br>* itemCount: total number of items present in the carousel<br>* modifier: Modifier applied to the Carousel<br>* carouselState: state associated with this carousel<br>* autoScrollDurationMillis : duration for which item should be visible before moving to the next item.<br>* contentTransformStartToEnd: animation transform applied when we are moving from start to end in the carousel while scrolling to the next item<br>* contentTransformEndToStart: animation transform applied when we are moving from end to start in the carousel while scrolling to the next item<br>* carouselIndicator: indicator showing the position of the current item among all items<br>* content: defines the items that must be displayed for a given index<br>* */</pre><h4>Implementation:</h4><pre>@OptIn(ExperimentalTvMaterial3Api::class, ExperimentalAnimationApi::class)<br>@Composable<br>fun FeaturedCarouselExample() {<br><br>    /* list of carousel item */<br>    val list = getCarouselList()<br><br>    val carouselState = rememberCarouselState()<br>    var isCarouselFocused by remember { mutableStateOf(false) }<br><br>    TvLazyColumn(<br>        verticalArrangement = Arrangement.spacedBy(20.dp),<br>        horizontalAlignment = Alignment.CenterHorizontally,<br>        contentPadding = PaddingValues(vertical = 30.dp),<br>        modifier = Modifier<br>            .fillMaxSize()<br>    ) {<br><br>        item {<br>            Carousel(<br>                itemCount = list.size,<br>                modifier = Modifier<br>                    .height(400.dp)<br>                    .fillMaxWidth()<br>                    .padding(horizontal = 30.dp)<br>                    .clip(ShapeDefaults.Medium)<br>                    .border(<br>                        width = 4.dp,<br>                        color = MaterialTheme.colorScheme.onSurface.copy(alpha = if (isCarouselFocused) 1f else 0f),<br>                        shape = ShapeDefaults.Medium,<br>                    )<br>                    .onFocusChanged {<br>                        isCarouselFocused = it.hasFocus<br>                    },<br>                carouselState = carouselState,<br>                carouselIndicator = {<br>                    CarouselDefaults.IndicatorRow(<br>                        itemCount = list.size,<br>                        activeItemIndex = carouselState.activeItemIndex,<br>                        modifier = Modifier<br>                            .align(Alignment.BottomEnd) //Bottom indicator alignment<br>                            .padding(vertical = 16.dp, horizontal = 30.dp),<br>                    )<br>                },<br>                contentTransformEndToStart =<br>                fadeIn(tween(1000)).togetherWith(fadeOut(tween(1000))),<br>                contentTransformStartToEnd =<br>                fadeIn(tween(1000)).togetherWith(fadeOut(tween(1000)))<br>            ) { itemIndex -&gt;<br>                Box(<br>                    modifier = Modifier<br>                        .fillMaxSize()<br>                ) {<br><br>                    /* Showing background image */<br>                    AsyncImage(<br>                        model = ImageRequest.Builder(LocalContext.current)<br>                            .data(list[itemIndex].backdrop)<br>                            .build(),<br>                        contentDescription = stringResource(R.string.app_name),<br>                        contentScale = ContentScale.Fit,<br>                        modifier = Modifier.fillMaxSize(),<br>                        alignment = Alignment.CenterEnd<br>                    )<br><br>                    /* Overlay to image to show cinematic effect */<br>                    Image(<br>                        painter = painterResource(id = R.drawable.scrim),<br>                        contentDescription = null,<br>                        modifier = Modifier.fillMaxSize(),<br>                        alignment = Alignment.BottomStart,<br>                        contentScale = ContentScale.FillWidth<br>                    )<br><br>                    /* Content */<br>                    CarouselContentBlock(<br>                        item = list[itemIndex],<br>                        modifier = Modifier<br>                            .align(Alignment.BottomStart)<br>                            .padding(start = 60.dp, end = 30.dp, bottom = 30.dp)<br>                            .fillMaxWidth(0.6f)<br>                            .animateEnterExit(<br>                                enter = slideInHorizontally(animationSpec = tween(1000)) { it / 2 },<br>                                exit = slideOutHorizontally(animationSpec = tween(1000))<br>                            )<br>                    )<br><br>                }<br>            }<br>        }<br>        <br>        /* Child content */<br>        <br>        items(3) {<br>            CarouselCardList()<br>        }<br><br>    }<br><br>}</pre><h4><strong>CarouselContentBlock()</strong></h4><pre>@OptIn(ExperimentalTvMaterial3Api::class)<br>@Composable<br>fun CarouselContentBlock(item: ImmersiveListItem, modifier: Modifier) {<br>    Column(<br>        horizontalAlignment = Alignment.Start,<br>        verticalArrangement = Arrangement.Center,<br>        modifier = modifier<br>    ) {<br>        /* About content */<br>        Text(<br>            text = &quot;${item.category} • ${item.getYear()} • ${item.getHours()}&quot;,<br>            style = AppTypography.labelMedium.copy(color = bodyColor),<br>        )<br><br>        /* Title */<br>        Text(<br>            text = item.title,<br>            style = AppTypography.headlineLarge.copy(color = headLineColor),<br>            modifier = Modifier.padding(top = 4.dp)<br>        )<br><br>        /* Description*/<br>        Text(<br>            text = item.description,<br>            style = AppTypography.bodySmall.copy(color = bodyColor),<br>            modifier = Modifier.padding(top = 20.dp),<br>            maxLines = 2,<br>            softWrap = true,<br>            overflow = TextOverflow.Ellipsis<br>        )<br><br>        /* Action button to play content */<br>        Button(<br>            onClick = { /* define your action */ },<br>            modifier = Modifier.padding(top = 20.dp),<br>            colors = ButtonDefaults.colors(<br>                focusedContainerColor = Color.White,<br>                focusedContentColor = Color.Black<br>            )<br>        ) {<br>            Icon(imageVector = Icons.Filled.PlayArrow, contentDescription = &quot;&quot;)<br>            Text(text = &quot;Watch Now&quot;)<br>        }<br>    }<br>}</pre><h4><strong>CarouselList</strong></h4><pre>val carouselList = listOf(<br>    CarouselItem(<br>        title = &quot;Meg 2: The Trench&quot;,<br>        description = &quot;An exploratory dive into the deepest depths of the ocean of a daring research team spirals into chaos when a malevolent mining operation threatens their mission and forces them into a high-stakes battle for survival.&quot;,<br>        backdrop = &quot;https://image.tmdb.org/t/p/original/qlxy8yo5bcgUw2KAmmojUKp4rHd.jpg&quot;,<br>        poster = &quot;https://image.tmdb.org/t/p/original/8pjWz2lt29KyVGoq1mXYu6Br7dE.jpg&quot;,<br>        runTime = 116,<br>        releaseDate = &quot;2023-08-02&quot;,<br>        category = &quot;Action/Horror&quot;<br>    ),<br>    CarouselItem(<br>        title = &quot;Indiana Jones and the Dial of Destiny&quot;,<br>        description = &quot;Finding himself in a new era, and approaching retirement, Indy wrestles with fitting into a world that seems to have outgrown him. But as the tentacles of an all-too-familiar evil return in the form of an old rival, Indy must don his hat and pick up his whip once more to make sure an ancient and powerful artifact doesn&#39;t fall into the wrong hands.&quot;,<br>        backdrop = &quot;https://image.tmdb.org/t/p/original/b0UUx8OvqQASesc78mXRzvjmxmj.jpg&quot;,<br>        poster = &quot;https://image.tmdb.org/t/p/original/po6AvQRVi01teGlRMX3VYsJ5zuc.jpg&quot;,<br>        runTime = 155,<br>        releaseDate = &quot;2023-06-28&quot;,<br>        category = &quot;Action/Adventure&quot;<br>    ),<br>    CarouselItem(<br>        title = &quot;Elemental&quot;,<br>        description = &quot;In a city where fire, water, land and air residents live together, a fiery young woman and a go-with-the-flow guy will discover something elemental: how much they have in common.&quot;,<br>        backdrop = &quot;https://image.tmdb.org/t/p/original/wVfnJX7FfUis4Yl6eIgTnYycrGb.jpg&quot;,<br>        poster = &quot;https://image.tmdb.org/t/p/original/uahy4sZXrrYNrQBU7FZEWJAXiZm.jpg&quot;,<br>        runTime = 102,<br>        releaseDate = &quot;2023-06-14&quot;,<br>        category = &quot;Animation/Family&quot;<br>    ),<br>    CarouselItem(<br>        title = &quot;Barbie&quot;,<br>        description = &quot;Barbie and Ken are having the time of their lives in the colorful and seemingly perfect world of Barbie Land. However, when they get a chance to go to the real world, they soon discover the joys and perils of living among humans.&quot;,<br>        backdrop = &quot;https://www.themoviedb.org/t/p/original/lLRrR9gQW2sMddvuc3AnA4JLDkt.jpg&quot;,<br>        poster = &quot;https://www.themoviedb.org/t/p/original/frYbmlPnVwQNr1RrpyDhihPNz3B.jpg&quot;,<br>        runTime = 114,<br>        releaseDate = &quot;2023-07-19&quot;,<br>        category = &quot;Fantasy/Comedy&quot;<br>    ),<br>    CarouselItem(<br>        title = &quot;The Last Voyage of the Demeter&quot;,<br>        description = &quot;The crew of the merchant ship Demeter attempts to survive the ocean voyage from Carpathia to London as they are stalked each night by a merciless presence onboard the ship.&quot;,<br>        backdrop = &quot;https://www.themoviedb.org/t/p/original/guRsapvkl8cScqVkeKyJn4NptSq.jpg&quot;,<br>        poster = &quot;https://www.themoviedb.org/t/p/original/2xMJ9yAkcxvRbzR8403naynjlcg.jpg&quot;,<br>        runTime = 116,<br>        releaseDate = &quot;2023-08-02&quot;,<br>        category = &quot;Horror/Thriller&quot;<br>    ),<br>    CarouselItem(<br>        title = &quot;Heart of Stone&quot;,<br>        description = &quot;An intelligence operative for a shadowy global peacekeeping agency races to stop a hacker from stealing its most valuable — and dangerous — weapon.&quot;,<br>        backdrop = &quot;https://www.themoviedb.org/t/p/original/goAzVKxNMUcF4YWLFEwvdA422Nn.jpg&quot;,<br>        poster = &quot;https://www.themoviedb.org/t/p/original/XB5k1KYDr3dnieojeLOgoZbtSH.jpg&quot;,<br>        runTime = 124,<br>        releaseDate = &quot;2023-08-09&quot;,<br>        category = &quot;Action/Adventure&quot;<br>    ),<br>    CarouselItem(<br>        title = &quot;Spider-Man: Across the Spider-Verse&quot;,<br>        description = &quot;After reuniting with Gwen Stacy, Brooklyn’s full-time, friendly neighborhood Spider-Man is catapulted across the Multiverse, where he encounters the Spider Society, a team of Spider-People charged with protecting the Multiverse’s very existence. But when the heroes clash on how to handle a new threat, Miles finds himself pitted against the other Spiders and must set out on his own to save those he loves most.&quot;,<br>        backdrop = &quot;https://www.themoviedb.org/t/p/original/kVd3a9YeLGkoeR50jGEXM6EqseS.jpg&quot;,<br>        poster = &quot;https://www.themoviedb.org/t/p/original/nGxUxi3PfXDRm7Vg95VBNgNM8yc.jpg&quot;,<br>        runTime = 140,<br>        releaseDate = &quot;2023-05-31&quot;,<br>        category = &quot;Animation/Action&quot;<br>    ),<br>    CarouselItem(<br>        title = &quot;Transformers: Rise of the Beasts&quot;,<br>        description = &quot;When a new threat capable of destroying the entire planet emerges, Optimus Prime and the Autobots must team up with a powerful faction known as the Maximals. With the fate of humanity hanging in the balance, humans Noah and Elena will do whatever it takes to help the Transformers as they engage in the ultimate battle to save Earth.&quot;,<br>        backdrop = &quot;https://www.themoviedb.org/t/p/original/p8djosrgWSKh6jQkrWJXzzZRABl.jpg&quot;,<br>        poster = &quot;https://www.themoviedb.org/t/p/original/rkOE88JKK1lHSXFkDNd2zZW81LU.jpg&quot;,<br>        runTime = 127,<br>        releaseDate = &quot;2023-06-06&quot;,<br>        category = &quot;Action/Science Fiction&quot;<br>    )<br>)<br><br>fun getCarouselList(): List&lt;CarouselItem&gt; {<br>    return carouselList<br>}<br><br>data class CarouselItem(<br>    val title: String,<br>    val description: String,<br>    val backdrop: String,<br>    val poster: String,/* */<br>    val runTime: Int,<br>    val releaseDate: String,<br>    val category: String<br>) {<br>    fun getHours(): String {<br>        return &quot;${runTime / 60}h ${runTime % 60}m&quot;<br>    }<br><br>    fun getYear(): String {<br>        return releaseDate.split(&quot;-&quot;)[0]<br>    }<br>}</pre><p><strong>Output</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQPkR0smdzVk%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQPkR0smdzVk&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FQPkR0smdzVk%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c563b3296f330a54b1d810754b16f6e6/href">https://medium.com/media/c563b3296f330a54b1d810754b16f6e6/href</a></iframe><h3><strong>About Featured Carousels</strong></h3><ul><li>Featured Carousels can start auto-scrolling to the next content by default 5000 milliseconds.</li><li>Carousels get paused with the current item once it gets focused.</li><li>After the focus is changed item starts to auto-scroll.</li></ul><p><strong>Helpful Links:</strong></p><p>🎨<a href="https://developer.android.com/design/ui/tv/guides/components/featured-carousel"><em>UI Design Guide</em></a></p><p>📃<a href="https://developer.android.com/reference/kotlin/androidx/tv/material3/package-summary#Carousel(kotlin.Int,androidx.compose.ui.Modifier,androidx.tv.material3.CarouselState,kotlin.Long,androidx.compose.animation.ContentTransform,androidx.compose.animation.ContentTransform,kotlin.Function1,kotlin.Function2)"><em>Official Documentation</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67e405ebccce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Navigation Drawer for Android TV using Compose]]></title>
            <link>https://medium.com/@hariharangv9894/navigation-drawer-for-android-tv-using-compose-edacb28ec550?source=rss-5a3460260788------2</link>
            <guid isPermaLink="false">https://medium.com/p/edacb28ec550</guid>
            <category><![CDATA[android-tv]]></category>
            <category><![CDATA[compose-on-android-tv]]></category>
            <category><![CDATA[compose]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Gv Harish]]></dc:creator>
            <pubDate>Tue, 21 Nov 2023 05:28:59 GMT</pubDate>
            <atom:updated>2023-11-21T05:28:59.314Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UXKmE82t0oZ2M20n8eciuA.png" /></figure><p>Navigation drawers are essential components in any TV app because they allow users to access various destinations and features. A navigation drawer is the backbone of the app’s information architecture, providing a clear and intuitive way to navigate through the app.</p><p>In contrast to the mobile navigation drawer, the user can see the navigation drawer on TV in both expanded and collapsed states.<br>Most television applications use their own custom navigation drawer to provide users with a better user interface and to help them discover content based on category.</p><p>There is no UI component for navigation in the Leanback library, so most developers create their own navigation drawer (custom view) to achieve the functionality, which is difficult and time-consuming.</p><p>Now Compose for TV changed everything, you can easily achieve this type of view with <strong>androidx.tv:tv-material</strong> provides a user interface component for this. There are two types of navigation drawers provided by tv-material.</p><p>1.NavigationDrawer</p><p>2.ModalNavigationDrawer</p><p>These two have different user experiences that you can use based on your preferences.</p><h3><strong>1. NavigationDrawer</strong></h3><pre>@ExperimentalTvMaterial3Api<br>@Composable<br>fun NavigationDrawer(<br>    drawerContent: @Composable NavigationDrawerScope.(DrawerValue) -&gt; Unit,<br>    modifier: Modifier = Modifier,<br>    drawerState: DrawerState = rememberDrawerState(DrawerValue.Closed),<br>    content: @Composable () -&gt; Unit<br>) {<br>    Row(modifier = modifier) {<br>        DrawerSheet(<br>            drawerState = drawerState,<br>            content = drawerContent<br>        )<br>        content()<br>    }<br>}<br><br><br>/*<br>* drawerContent: your screen menu items list,<br>* modifier: customise the size, colour, and length of your DrawerSheet,<br>* drawerState: modify based on your ux requirements.<br>* content: the logic behind your screen listing<br>* */</pre><p>Before going into how to implement it, you should understand how the internal <strong>DrawerSheet </strong>works. Let’s begin with a small overview.</p><blockquote>A DrawerSheet is built with a composable box component and is used to hold menu items and handle drawerstate based on the focus of the <strong>DrawerSheet</strong>.</blockquote><pre>@OptIn(ExperimentalTvMaterial3Api::class)<br>@Composable<br>private fun DrawerSheet(<br>    modifier: Modifier = Modifier,<br>    drawerState: DrawerState = remember { DrawerState() },<br>    sizeAnimationFinishedListener: ((initialValue: IntSize, targetValue: IntSize) -&gt; Unit)? = null,<br>    content: @Composable NavigationDrawerScope.(DrawerValue) -&gt; Unit<br>) {<br>    // indicates that the drawer has been set to its initial state and has grabbed focus if<br>    // necessary. Controls whether focus is used to decide the state of the drawer going forward.<br>    var initializationComplete: Boolean by remember { mutableStateOf(false) }<br>    var focusState by remember { mutableStateOf&lt;FocusState?&gt;(null) }<br>    val focusRequester = remember { FocusRequester() }<br>    LaunchedEffect(key1 = drawerState.currentValue) {<br>        if (drawerState.currentValue == DrawerValue.Open &amp;&amp; focusState?.hasFocus == false) {<br>            // used to grab focus if the drawer state is set to Open on start.<br>            focusRequester.requestFocus()<br>        }<br>        initializationComplete = true<br>    }<br><br>    val internalModifier =<br>        Modifier<br>            .focusRequester(focusRequester)<br>            .animateContentSize(finishedListener = sizeAnimationFinishedListener)<br>            .fillMaxHeight()<br>            // adding passed-in modifier here to ensure animateContentSize is called before other<br>            // size based modifiers.<br>            .then(modifier)<br>            .onFocusChanged {<br>                focusState = it<br><br>                if (initializationComplete) {<br>                    drawerState.setValue(if (it.hasFocus) DrawerValue.Open else DrawerValue.Closed)<br>                }<br>            }<br>            .focusGroup()<br><br>    Box(modifier = internalModifier) {<br>        NavigationDrawerScopeImpl(drawerState.currentValue == DrawerValue.Open).apply {<br>            content(drawerState.currentValue)<br>        }<br>    }<br>}</pre><h4><strong>Implementation:</strong></h4><pre>import androidx.compose.foundation.layout.Arrangement<br>import androidx.compose.foundation.layout.Column<br>import androidx.compose.foundation.layout.fillMaxHeight<br>import androidx.compose.foundation.layout.padding<br>import androidx.compose.foundation.selection.selectableGroup<br>import androidx.compose.runtime.Composable<br>import androidx.compose.runtime.getValue<br>import androidx.compose.runtime.mutableStateOf<br>import androidx.compose.runtime.remember<br>import androidx.compose.runtime.setValue<br>import androidx.compose.ui.Alignment<br>import androidx.compose.ui.Modifier<br>import androidx.compose.ui.res.stringResource<br>import androidx.compose.ui.unit.dp<br>import androidx.tv.foundation.lazy.list.TvLazyColumn<br>import androidx.tv.foundation.lazy.list.items<br>import androidx.tv.material3.ExperimentalTvMaterial3Api<br>import androidx.tv.material3.Icon<br>import androidx.tv.material3.NavigationDrawer<br>import androidx.tv.material3.NavigationDrawerItem<br>import androidx.tv.material3.Text<br><br>@OptIn(ExperimentalTvMaterial3Api::class)<br>@Composable<br>fun NavigationDrawerExample() {<br><br>    val defaultSelection: DrawerScreen = DrawerScreen.HomeScreen<br><br>    var currentScreen by remember { mutableStateOf(defaultSelection) }<br><br>    NavigationDrawer(<br>        drawerContent = {<br><br>            Column(<br>                Modifier<br>                    .fillMaxHeight()<br>                    .padding(12.dp),<br>                horizontalAlignment = Alignment.Start,<br>                verticalArrangement = Arrangement.SpaceBetween<br>            ) {<br>                NavigationDrawerItem(<br>                    selected = currentScreen == DrawerScreen.UserAccount,<br>                    onClick = {<br>                        currentScreen = DrawerScreen.UserAccount<br>                    },<br>                    leadingContent = {<br>                        Icon(<br>                            imageVector = DrawerScreen.UserAccount.icon,<br>                            contentDescription = null,<br>                        )<br>                    }<br>                ) {<br>                    Text(stringResource(id = DrawerScreen.UserAccount.title))<br>                }<br><br>                /* Group of item with same padding */<br><br>                TvLazyColumn(<br>                    Modifier<br>                        .selectableGroup(),<br>                    horizontalAlignment = Alignment.Start,<br>                    verticalArrangement = Arrangement.spacedBy(10.dp, Alignment.CenterVertically)<br>                ) {<br><br>                    items(screenList, key = { it.route }) { screen -&gt;<br>                        NavigationDrawerItem(<br>                            selected = currentScreen == screen,<br>                            onClick = {<br>                                currentScreen = screen<br>                            },<br>                            leadingContent = {<br>                                Icon(<br>                                    imageVector = screen.icon,<br>                                    contentDescription = null,<br>                                )<br>                            }<br>                        ) {<br>                            Text(stringResource(id = screen.title))<br>                        }<br>                    }<br>                }<br><br>     /* Separated item from other for better UI purpose */<br>                NavigationDrawerItem(<br>                    selected = currentScreen == DrawerScreen.SettingsScreen,<br>                    onClick = {<br>                        currentScreen = DrawerScreen.SettingsScreen<br>                    },<br>                    leadingContent = {<br>                        Icon(<br>                            imageVector = DrawerScreen.SettingsScreen.icon,<br>                            contentDescription = null,<br>                        )<br>                    }<br>                ) {<br>                    Text(stringResource(id = DrawerScreen.SettingsScreen.title))<br>                }<br>            }<br><br>        }<br>    ) {<br>        /* switching screens based on currentScreen changes */<br>        when (currentScreen) {<br>            DrawerScreen.HomeScreen -&gt; {<br>                NavigationTempScreen(<br>                    screenName = &quot;Home Screen&quot;,<br>                )<br>            }<br><br>            DrawerScreen.LibraryScreen -&gt; {<br>                NavigationTempScreen(<br>                    screenName = &quot;Library Screen&quot;,<br>                )<br>            }<br><br>            DrawerScreen.MovieScreen -&gt; {<br>                NavigationTempScreen(<br>                    screenName = &quot;Movie Screen&quot;,<br>                )<br>            }<br><br>            DrawerScreen.SearchScreen -&gt; {<br>                NavigationTempScreen(<br>                    screenName = &quot;Search Screen&quot;,<br>                )<br>            }<br><br>            DrawerScreen.SettingsScreen -&gt; {<br>                NavigationTempScreen(<br>                    screenName = &quot;Settings Screen&quot;<br>                )<br>            }<br><br>            DrawerScreen.ShowsScreen -&gt; {<br>                NavigationTempScreen(<br>                    screenName = &quot;Shows Screen&quot;<br>                )<br>            }<br><br>            DrawerScreen.UserAccount -&gt; {<br>                NavigationTempScreen(<br>                    screenName = &quot;User Profile Screen&quot;<br>                )<br>            }<br>        }<br><br>    }<br>}</pre><p>List of Screens:</p><pre>sealed class DrawerScreen(<br>    val route: String,<br>    val icon: ImageVector,<br>    @StringRes val  title: Int,<br>    @StringRes val descriptionId: Int,<br>) {<br><br>    object UserAccount: DrawerScreen(<br>        &quot;UserAccount&quot;,<br>        Icons.Outlined.AccountCircle,<br>        R.string.user_account,<br>        R.string.user_account,<br>    )<br>    object SearchScreen: DrawerScreen(<br>        &quot;SearchScreen&quot;,<br>        Icons.Outlined.Search,<br>        R.string.search,<br>        R.string.search,<br>    )<br><br>    object HomeScreen : DrawerScreen(<br>        &quot;HomeScreen&quot;,<br>        Icons.Outlined.Home,<br>        R.string.home,<br>        R.string.home,<br>    )<br><br>    object MovieScreen : DrawerScreen(<br>        &quot;MovieScreen&quot;,<br>        Icons.Outlined.Movie,<br>        R.string.movies,<br>        R.string.movies<br>    )<br><br>    object ShowsScreen: DrawerScreen(<br>        &quot;ShowsScreen&quot;,<br>        Icons.Outlined.Tv,<br>        R.string.shows,<br>        R.string.shows<br>    )<br><br>    object LibraryScreen: DrawerScreen(<br>        &quot;LibraryScreen&quot;,<br>        Icons.Outlined.VideoLibrary,<br>        R.string.library,<br>        R.string.library<br>    )<br><br>    object SettingsScreen : DrawerScreen(<br>        &quot;SettingsScreen&quot;,<br>        Icons.Outlined.Settings,<br>        R.string.settings,<br>        R.string.settings<br>    )<br>}<br><br>val screenList = listOf(<br>    DrawerScreen.SearchScreen,<br>    DrawerScreen.HomeScreen,<br>    DrawerScreen.MovieScreen,<br>    DrawerScreen.ShowsScreen,<br>    DrawerScreen.LibraryScreen<br>)</pre><p>Output:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FTJqldaBy9GM&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DTJqldaBy9GM&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FTJqldaBy9GM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e38f84b397ec5a71d4a94d7e408ecc9/href">https://medium.com/media/5e38f84b397ec5a71d4a94d7e408ecc9/href</a></iframe><p>Before proceeding with ModalNavigationDrawer implementation, check out <strong>NavigationDrawerItem</strong>.</p><h3><strong>NavigationDrawerItem</strong></h3><p>A NavigationDrawerItem represents a destination within drawers, either NavigationDrawer or ModalNavigationDrawer.</p><pre>@Composable<br>fun NavigationDrawerScope.NavigationDrawerItem(<br>    selected: Boolean,<br>    onClick: () -&gt; Unit,<br>    leadingContent: @Composable () -&gt; Unit,<br>    modifier: Modifier = Modifier,<br>    enabled: Boolean = true,<br>    onLongClick: (() -&gt; Unit)? = null,<br>    supportingContent: (@Composable () -&gt; Unit)? = null,<br>    trailingContent: (@Composable () -&gt; Unit)? = null,<br>    tonalElevation: Dp = NavigationDrawerItemDefaults.NavigationDrawerItemElevation,<br>    shape: NavigationDrawerItemShape = NavigationDrawerItemDefaults.shape(),<br>    colors: NavigationDrawerItemColors = NavigationDrawerItemDefaults.colors(),<br>    scale: NavigationDrawerItemScale = NavigationDrawerItemScale.None,<br>    border: NavigationDrawerItemBorder = NavigationDrawerItemDefaults.border(),<br>    glow: NavigationDrawerItemGlow = NavigationDrawerItemDefaults.glow(),<br>    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },<br>    content: @Composable () -&gt; Unit,<br>): Unit<br><br>/*<br>* selected: Define item selected or not<br>* onClick: Define action when item is clicked<br>* leadingContent: Define leading content of item like icon or image<br>* modifier: Define modifier for item<br>* enabled: Define button status<br>* onLongClick: Define action when item is long clicked<br>* supportingContent: Define supporting content of item like icon or image<br>* trailingContent: Define trailing content of item like icon or image<br>* tonalElevation: Define elevation of item<br>* shape: Define shape of item<br>* colors: Define colors of item<br>* scale: Define scale of item<br>* border: Define border of item<br>* glow: Define glow effect<br>* interactionSource: Define item interaction<br>* content: Define content of item<br>* */</pre><h3>2. <strong>NavigationDrawerItem</strong></h3><pre>@ExperimentalTvMaterial3Api<br>@Composable<br>fun ModalNavigationDrawer(<br>    drawerContent: @Composable NavigationDrawerScope.(DrawerValue) -&gt; Unit,<br>    modifier: Modifier = Modifier,<br>    drawerState: DrawerState = rememberDrawerState(DrawerValue.Closed),<br>    scrimBrush: Brush = SolidColor(LocalColorScheme.current.scrim.copy(alpha = 0.5f)),<br>    content: @Composable () -&gt; Unit<br>) {<br>    val localDensity = LocalDensity.current<br>    val closedDrawerWidth: MutableState&lt;Dp?&gt; = remember { mutableStateOf(null) }<br>    val internalDrawerModifier =<br>        Modifier<br>            .zIndex(Float.MAX_VALUE)<br>            .onSizeChanged {<br>                if (closedDrawerWidth.value == null &amp;&amp;<br>                    drawerState.currentValue == DrawerValue.Closed<br>                ) {<br>                    with(localDensity) {<br>                        closedDrawerWidth.value = it.width.toDp()<br>                    }<br>                }<br>            }<br><br>    Box(modifier = modifier) {<br>        DrawerSheet(<br>            modifier = internalDrawerModifier.align(Alignment.CenterStart),<br>            drawerState = drawerState,<br>            sizeAnimationFinishedListener = { _, targetSize -&gt;<br>                if (drawerState.currentValue == DrawerValue.Closed) {<br>                    with(localDensity) {<br>                        closedDrawerWidth.value = targetSize.width.toDp()<br>                    }<br>                }<br>            },<br>            content = drawerContent<br>        )<br><br>        content()<br><br>        if (drawerState.currentValue == DrawerValue.Open) {<br>            // Scrim<br>            Canvas(Modifier.fillMaxSize()) {<br>                drawRect(scrimBrush)<br>            }<br>        }<br>    }<br>}<br><br>    /*<br>    * drawerContent: Your screen menu items list<br>    * modifier: Define modifier for item<br>    * drawerState: Define state of drawer<br>    * scrimBrush: Define scrim color<br>    * content: Define content of item<br>    * */</pre><h4>Implementation:</h4><p>In ModalNavigationDrawerExample, we’ll try to Compose navigation to navigate between screens.</p><pre>import androidx.compose.foundation.layout.Arrangement<br>import androidx.compose.foundation.layout.Column<br>import androidx.compose.foundation.layout.fillMaxHeight<br>import androidx.compose.foundation.layout.fillMaxSize<br>import androidx.compose.foundation.layout.padding<br>import androidx.compose.foundation.selection.selectableGroup<br>import androidx.compose.runtime.Composable<br>import androidx.compose.ui.Alignment<br>import androidx.compose.ui.Modifier<br>import androidx.compose.ui.graphics.Brush<br>import androidx.compose.ui.graphics.Color<br>import androidx.compose.ui.graphics.TileMode<br>import androidx.compose.ui.res.stringResource<br>import androidx.compose.ui.unit.dp<br>import androidx.navigation.compose.NavHost<br>import androidx.navigation.compose.composable<br>import androidx.navigation.compose.rememberNavController<br>import androidx.tv.foundation.lazy.list.TvLazyColumn<br>import androidx.tv.foundation.lazy.list.items<br>import androidx.tv.material3.DrawerValue<br>import androidx.tv.material3.ExperimentalTvMaterial3Api<br>import androidx.tv.material3.Icon<br>import androidx.tv.material3.ModalNavigationDrawer<br>import androidx.tv.material3.NavigationDrawerItem<br>import androidx.tv.material3.Text<br>import androidx.tv.material3.rememberDrawerState<br><br>@OptIn(ExperimentalTvMaterial3Api::class)<br>@Composable<br>fun ModalNavigationDrawerExample() {<br><br>    val drawerState = rememberDrawerState(DrawerValue.Closed)<br><br>    val collapsedDrawerItemWidth = 56.dp<br>    val paddingValue = 12.dp<br><br>    val navController = rememberNavController()<br><br>    ModalNavigationDrawer(<br>        drawerState = drawerState,<br>        drawerContent = {<br>            Column(<br>                Modifier<br>                    .fillMaxHeight()<br>                    .padding(12.dp),<br>                horizontalAlignment = Alignment.Start,<br>                verticalArrangement = Arrangement.SpaceBetween<br>            ) {<br>                NavigationDrawerItem(<br>                    selected = navController.currentDestination?.route == DrawerScreen.UserAccount.route,<br>                    onClick = {<br>                        navController.navigate(DrawerScreen.UserAccount.route)<br>                    },<br>                    leadingContent = {<br>                        Icon(<br>                            imageVector = DrawerScreen.UserAccount.icon,<br>                            contentDescription = null,<br>                        )<br>                    }<br>                ) {<br>                    Text(stringResource(id = DrawerScreen.UserAccount.title))<br>                }<br><br>                TvLazyColumn(<br>                    Modifier<br>                        .selectableGroup(),<br>                    horizontalAlignment = Alignment.Start,<br>                    verticalArrangement = Arrangement.spacedBy(10.dp, Alignment.CenterVertically)<br>                ) {<br><br>                    items(screenList, key = { it.route }) { screen -&gt;<br>                        NavigationDrawerItem(<br>                            selected = navController.currentDestination?.route == screen.route,<br>                            onClick = {<br>                                navController.navigate(screen.route) {<br>                                    /* remove the previous Composable from the back stack  */<br>                                    popUpTo(navController.currentDestination?.route ?: &quot;&quot;) {<br>                                        inclusive = true<br>                                    }<br>                                }<br>                            },<br>                            leadingContent = {<br>                                Icon(<br>                                    imageVector = screen.icon,<br>                                    contentDescription = null,<br>                                )<br>                            }<br>                        ) {<br>                            Text(stringResource(id = screen.title))<br>                        }<br>                    }<br>                }<br><br>                NavigationDrawerItem(<br>                    selected = navController.currentDestination?.route == DrawerScreen.SettingsScreen.route,<br>                    onClick = {<br>                        navController.navigate(DrawerScreen.SettingsScreen.route)<br>                    },<br>                    leadingContent = {<br>                        Icon(<br>                            imageVector = DrawerScreen.SettingsScreen.icon,<br>                            contentDescription = null,<br>                        )<br>                    }<br>                ) {<br>                    Text(stringResource(id = DrawerScreen.SettingsScreen.title))<br>                }<br>            }<br><br>        },<br>        scrimBrush = Brush.linearGradient(<br>            colors = listOf(<br>                Color.Black, Color.Transparent<br>            ), tileMode = TileMode.Clamp<br>        )<br>    ) {<br>        /*Added Navigation instead of changing screen*/<br>        NavHost(<br>            navController = navController,<br>            startDestination = DrawerScreen.HomeScreen.route,<br>            modifier = Modifier<br>                .fillMaxSize()<br>                .padding(start = collapsedDrawerItemWidth + (paddingValue * 2))<br>        ) {<br>            composable(route = DrawerScreen.HomeScreen.route) {<br>                NavigationTempScreen(<br>                    screenName = &quot;Home Screen&quot;,<br>                )<br>            }<br>            composable(route = DrawerScreen.SettingsScreen.route) {<br>                NavigationTempScreen(<br>                    screenName = &quot;Settings Screen&quot;<br>                )<br>            }<br>            composable(route = DrawerScreen.SearchScreen.route) {<br>                NavigationTempScreen(<br>                    screenName = &quot;Search Screen&quot;,<br>                )<br>            }<br>            composable(route = DrawerScreen.MovieScreen.route) {<br>                NavigationTempScreen(<br>                    screenName = &quot;Movie Screen&quot;,<br>                )<br>            }<br>            composable(route = DrawerScreen.ShowsScreen.route) {<br>                NavigationTempScreen(<br>                    screenName = &quot;Shows Screen&quot;<br>                )<br>            }<br>            composable(route = DrawerScreen.LibraryScreen.route) {<br>                NavigationTempScreen(<br>                    screenName = &quot;Library Screen&quot;,<br>                )<br>            }<br>            composable(route = DrawerScreen.UserAccount.route) {<br>                NavigationTempScreen(<br>                    screenName = &quot;User Profile Screen&quot;<br>                )<br>            }<br>        }<br>    }<br>}</pre><p>Output:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FS3M99JMtwwQ%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DS3M99JMtwwQ&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FS3M99JMtwwQ%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/095ebd4cd127a957879d6a10991abc3c/href">https://medium.com/media/095ebd4cd127a957879d6a10991abc3c/href</a></iframe><p>Helpful Links:</p><p>🎨<a href="https://developer.android.com/design/ui/tv/guides/components/navigation-drawer"><em>UI Design Guide</em></a></p><p>📃<a href="https://developer.android.com/reference/kotlin/androidx/tv/material3/package-summary#NavigationDrawer(kotlin.Function2,androidx.compose.ui.Modifier,androidx.tv.material3.DrawerState,kotlin.Function0)"><em>Official Documentation</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=edacb28ec550" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Immersive list in Compose for Android TV (Part 1)]]></title>
            <link>https://medium.com/@hariharangv9894/immersive-list-in-compose-for-android-tv-part-1-d52ad4c29a2?source=rss-5a3460260788------2</link>
            <guid isPermaLink="false">https://medium.com/p/d52ad4c29a2</guid>
            <category><![CDATA[android-tv]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[compose]]></category>
            <category><![CDATA[android-leanback]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Gv Harish]]></dc:creator>
            <pubDate>Thu, 12 Oct 2023 10:47:02 GMT</pubDate>
            <atom:updated>2023-11-18T14:09:45.067Z</atom:updated>
            <content:encoded><![CDATA[<p>An immersive list combines a row of content with a preview of the selected item. It includes more content in a larger viewport. It is one of the Material 3 TV components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W7tyDtZFIa28GiTd6PovHQ.png" /></figure><p><strong>Highlights</strong></p><ul><li>Preview of dynamic content. When a user scrolls through the row of content, the preview area updates to show the currently focused item.</li><li>The Immersive list component has a larger viewport for displaying content, which allows users to see and appreciate the visual details of the focused item more easily.</li><li>Immersive lists provide users with relevant and contextual information about the focused item, allowing them to make informed decisions without leaving the browsing experience.</li><li>The Immersive list component uses progressive disclosure to reveal more content details as users navigate, reducing cognitive load and maintaining user engagement.</li><li>The Immersive list component ensures that interactions are consistent throughout the app, giving users a familiar and predictable experience.</li></ul><h4>Steps to build the Immersive list</h4><ol><li>Overview</li><li>Create Immersive List Data</li><li>Create Background</li><li>Create List Item</li></ol><h4><strong>1. Overview</strong></h4><p>Use immersive carousels when you want to draw attention to featured or promoted content, such as new releases, popular shows, or exclusive titles. The larger viewport and dynamic preview provide a compelling way to showcase these high-priority items.</p><pre>@OptIn(ExperimentalComposeUiApi::class)<br>@ExperimentalTvMaterial3Api<br>@Composable<br>fun ImmersiveList(<br>    background:<br>    @Composable ImmersiveListBackgroundScope.(index: Int, listHasFocus: Boolean) -&gt; Unit,<br>    modifier: Modifier = Modifier,<br>    listAlignment: Alignment = Alignment.BottomEnd,<br>    list: @Composable ImmersiveListScope.() -&gt; Unit,<br>) {<br>    var currentItemIndex by remember { mutableIntStateOf(0) }<br>    var listHasFocus by remember { mutableStateOf(false) }<br><br>    Box(modifier.bringIntoViewIfChildrenAreFocused()) {<br>        ImmersiveListBackgroundScope(this).background(currentItemIndex, listHasFocus)<br><br>        val focusManager = LocalFocusManager.current<br><br>        Box(Modifier.align(listAlignment).onFocusChanged { listHasFocus = it.hasFocus }) {<br>            ImmersiveListScope {<br>                currentItemIndex = it<br>                focusManager.moveFocus(FocusDirection.Enter)<br>            }.list()<br>        }<br>    }<br>}</pre><h4><strong>2. Create Immersive List Data</strong></h4><p>Created a dummy list for Immersive list with the help of <a href="https://www.themoviedb.org/"><strong>The Movie Database</strong></a> source.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/00b80c481f6067cf0c841e95282eab50/href">https://medium.com/media/00b80c481f6067cf0c841e95282eab50/href</a></iframe><h4>3. Create Background</h4><pre>Box(<br>    modifier = Modifier<br>        .fillMaxSize()<br>) {<br>//Showing background image with help of coil library<br>    AsyncImage(<br>        model = ImageRequest.Builder(LocalContext.current)<br>            .data(list[index].backdrop)<br>            .build(),<br>        contentDescription = stringResource(R.string.app_name),<br>        contentScale = ContentScale.Fit,<br>        modifier = Modifier.fillMaxSize()<br>    )<br><br>//Showing Cinematic scrim<br>    Image(<br>        painter = painterResource(id = R.drawable.scrim),<br>        contentDescription = null,<br>        modifier = Modifier.fillMaxSize(),<br>        alignment = Alignment.BottomStart,<br>        contentScale = ContentScale.FillWidth<br>    )<br><br>    ContentBlock(<br>        index = list[index],<br>        modifier = Modifier<br>            .align(Alignment.CenterStart)<br>            .padding(start = 60.dp, end = 30.dp, bottom = 30.dp)<br>            .fillMaxWidth(0.6f)<br>    )<br><br>}</pre><p>There are three items in the background: the content image, the top of the Scrim layer, and the content details.</p><pre>@OptIn(ExperimentalTvMaterial3Api::class)<br>@Composable<br>fun ContentBlock(index: ImmersiveListItem, modifier: Modifier) {<br><br>    AnimatedContent(<br>        targetState = index,<br>        transitionSpec = {<br>            fadeIn(animationSpec = tween(durationMillis = 500)) togetherWith<br>                    fadeOut(animationSpec = tween(durationMillis = 500))<br>        },<br>        label = &quot;&quot;,<br>        contentAlignment = Alignment.CenterStart,<br>        modifier = modifier<br>    ) { item -&gt;<br>        Column(<br>            horizontalAlignment = Alignment.Start,<br>            verticalArrangement = Arrangement.Center<br>        ) {<br>            Text(<br>                text = &quot;${item.category} • ${item.getYear()} • ${item.getHours()}&quot;,<br>                style = AppTypography.labelMedium.copy(color = bodyColor),<br>            )<br><br>            Text(<br>                text = item.title,<br>                style = AppTypography.headlineLarge.copy(color = headLineColor),<br>                modifier = Modifier.padding(top = 4.dp)<br>            )<br><br>            Text(<br>                text = item.description,<br>                style = AppTypography.bodyLarge.copy(color = bodyColor),<br>                modifier = Modifier.padding(top = 20.dp),<br>                maxLines = 2,<br>                softWrap = true,<br>                overflow = TextOverflow.Ellipsis<br>            )<br>        }<br><br>    }<br>}</pre><p>In the content block, I added an animation transition only for text items and not for background images. In the ImmersiveList component, internal animation functions are <a href="https://developer.android.com/reference/kotlin/androidx/tv/material3/ImmersiveListBackgroundScope#AnimatedVisibility(kotlin.Boolean,androidx.compose.ui.Modifier,androidx.compose.animation.EnterTransition,androidx.compose.animation.ExitTransition,kotlin.String,kotlin.Function1)">AnimatedVisibility </a>and <a href="https://developer.android.com/reference/kotlin/androidx/tv/material3/ImmersiveListBackgroundScope#AnimatedContent(kotlin.Int,androidx.compose.ui.Modifier,kotlin.Function1,androidx.compose.ui.Alignment,kotlin.Function2)">AnimatedContent </a>you can use them as per your requirements.</p><h4>4. Create List Items</h4><p>List items created with the help of <a href="https://developer.android.com/reference/androidx/tv/foundation/lazy/list/package-summary">TvLazyRow</a>, Card, and AsyncImage.</p><p>TvLazyRow → Show a list of items in horizontally</p><p>Card → Place the image on top of the card view</p><p>AsyncImage → Use to load images from URL</p><pre>val cardSpacing = 20.dp<br>val cardWidth = 196.dp<br>val cardHeight = 110.dp<br><br>    TvLazyRow(<br>        horizontalArrangement = Arrangement.spacedBy(cardSpacing),<br>        state = tvRowListState,<br>        modifier = Modifier<br>            .fillMaxWidth(),<br>        contentPadding = PaddingValues(<br>            start = 60.dp,<br>            end = 30.dp,<br>            top = 40.dp,<br>            bottom = 30.dp<br>        )<br>    ) {<br>        itemsIndexed(list) { index, item -&gt;<br>            Card(<br>                onClick = { /*TODO*/ },<br>                modifier = Modifier<br>                    .width(cardWidth)<br>                    .height(cardHeight)<br>                    .immersiveListItem(index),<br>                border = CardDefaults.border(<br>                    focusedBorder = Border(<br>                        BorderStroke(<br>                            2.dp,<br>                            Color.White<br>                        )<br>                    )<br>                ),<br>            ) {<br>                AsyncImage(<br>                    model = item.backdrop,<br>                    contentDescription = item.title,<br>                    contentScale = ContentScale.FillBounds,<br>                    placeholder = painterResource(R.drawable.empty_card_bg),<br>                )<br>            }<br>        }<br>    }</pre><p>Now that everything has been completed, let us put everything together.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b3cd98dd7c38dd3fc513cdf6eb4ac6d/href">https://medium.com/media/5b3cd98dd7c38dd3fc513cdf6eb4ac6d/href</a></iframe><h4><strong>Output:</strong></h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FrJvZkeSBtrc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DrJvZkeSBtrc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FrJvZkeSBtrc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/13f2561b3f488184f97718f9c01fea0c/href">https://medium.com/media/13f2561b3f488184f97718f9c01fea0c/href</a></iframe><h4><strong>Helpful Links:</strong></h4><p>Scrim &amp; Placeholder Source: <a href="https://drive.google.com/drive/folders/1V2rPZj0JoAelTC7-Ur3x7INt7j7F_0qD?usp=sharing">G-Drive</a></p><p>Design Pattern: <a href="https://developer.android.com/design/ui/tv/guides/components/immersive-list">Immersive list</a></p><p>Movie Data Provider: <a href="https://www.themoviedb.org/">The Movie Database</a></p><p>Tv Samples by Google: <a href="https://github.com/android/tv-samples">https://github.com/android/tv-samples</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d52ad4c29a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>