blob: d966d005a26309b7b3bf0232368baa74385f73e0 [file] [log] [blame]
Vighnesh Rautcb8c6312022-10-06 13:08:59 +05301/*
2 * Copyright 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Vighnesh Raut2a78f562022-12-01 13:43:27 +053017package androidx.tv.integration.demos
Vighnesh Rautcb8c6312022-10-06 13:08:59 +053018
Vighnesh Rautf6360362023-03-23 16:44:25 +053019import androidx.compose.foundation.background
Vighnesh Rautcb8c6312022-10-06 13:08:59 +053020import androidx.compose.foundation.layout.Arrangement
21import androidx.compose.foundation.layout.Column
Vighnesh Rautf6360362023-03-23 16:44:25 +053022import androidx.compose.foundation.layout.fillMaxSize
Vighnesh Rautcb8c6312022-10-06 13:08:59 +053023import androidx.compose.foundation.layout.padding
24import androidx.compose.runtime.Composable
25import androidx.compose.runtime.getValue
26import androidx.compose.runtime.mutableStateOf
27import androidx.compose.runtime.remember
28import androidx.compose.runtime.setValue
29import androidx.compose.ui.Modifier
Vighnesh Rautf6360362023-03-23 16:44:25 +053030import androidx.compose.ui.graphics.Color
Vighnesh Rautcb8c6312022-10-06 13:08:59 +053031import androidx.compose.ui.unit.dp
Vineet Kumar507211d2023-01-04 19:16:38 +053032import androidx.tv.material3.ExperimentalTvMaterial3Api
Shubham Singh0151b4b2022-12-19 17:01:02 +053033import androidx.tv.material3.MaterialTheme
34import androidx.tv.material3.darkColorScheme
Vighnesh Rautcb8c6312022-10-06 13:08:59 +053035
Vighnesh Rautf6360362023-03-23 16:44:25 +053036val pageColor = Color.Black
37
Vineet Kumar507211d2023-01-04 19:16:38 +053038@OptIn(ExperimentalTvMaterial3Api::class)
Vighnesh Rautcb8c6312022-10-06 13:08:59 +053039@Composable
40fun App() {
Vineet Kumar94bb7112022-11-17 19:20:44 +053041 var selectedTab by remember { mutableStateOf(Navigation.FeaturedCarousel) }
Vighnesh Rautcb8c6312022-10-06 13:08:59 +053042
Vighnesh Rautf6360362023-03-23 16:44:25 +053043 MaterialTheme(colorScheme = darkColorScheme()) {
Shubham Singh0151b4b2022-12-19 17:01:02 +053044 Column(
Vighnesh Rautf6360362023-03-23 16:44:25 +053045 modifier = Modifier
46 .background(pageColor)
47 .fillMaxSize()
48 .padding(20.dp),
49 verticalArrangement = Arrangement.spacedBy(20.dp),
Shubham Singh0151b4b2022-12-19 17:01:02 +053050 ) {
51 TopNavigation(updateSelectedTab = { selectedTab = it })
52 selectedTab.action.invoke()
53 }
Vighnesh Rautcb8c6312022-10-06 13:08:59 +053054 }
Shubham Singh0151b4b2022-12-19 17:01:02 +053055}