Vighnesh Raut | cb8c631 | 2022-10-06 13:08:59 +0530 | [diff] [blame] | 1 | /* |
| 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 Raut | 2a78f56 | 2022-12-01 13:43:27 +0530 | [diff] [blame] | 17 | package androidx.tv.integration.demos |
Vighnesh Raut | cb8c631 | 2022-10-06 13:08:59 +0530 | [diff] [blame] | 18 | |
Vighnesh Raut | f636036 | 2023-03-23 16:44:25 +0530 | [diff] [blame^] | 19 | import androidx.compose.foundation.background |
Vighnesh Raut | cb8c631 | 2022-10-06 13:08:59 +0530 | [diff] [blame] | 20 | import androidx.compose.foundation.layout.Arrangement |
| 21 | import androidx.compose.foundation.layout.Column |
Vighnesh Raut | f636036 | 2023-03-23 16:44:25 +0530 | [diff] [blame^] | 22 | import androidx.compose.foundation.layout.fillMaxSize |
Vighnesh Raut | cb8c631 | 2022-10-06 13:08:59 +0530 | [diff] [blame] | 23 | import androidx.compose.foundation.layout.padding |
| 24 | import androidx.compose.runtime.Composable |
| 25 | import androidx.compose.runtime.getValue |
| 26 | import androidx.compose.runtime.mutableStateOf |
| 27 | import androidx.compose.runtime.remember |
| 28 | import androidx.compose.runtime.setValue |
| 29 | import androidx.compose.ui.Modifier |
Vighnesh Raut | f636036 | 2023-03-23 16:44:25 +0530 | [diff] [blame^] | 30 | import androidx.compose.ui.graphics.Color |
Vighnesh Raut | cb8c631 | 2022-10-06 13:08:59 +0530 | [diff] [blame] | 31 | import androidx.compose.ui.unit.dp |
Vineet Kumar | 507211d | 2023-01-04 19:16:38 +0530 | [diff] [blame] | 32 | import androidx.tv.material3.ExperimentalTvMaterial3Api |
Shubham Singh | 0151b4b | 2022-12-19 17:01:02 +0530 | [diff] [blame] | 33 | import androidx.tv.material3.MaterialTheme |
| 34 | import androidx.tv.material3.darkColorScheme |
Vighnesh Raut | cb8c631 | 2022-10-06 13:08:59 +0530 | [diff] [blame] | 35 | |
Vighnesh Raut | f636036 | 2023-03-23 16:44:25 +0530 | [diff] [blame^] | 36 | val pageColor = Color.Black |
| 37 | |
Vineet Kumar | 507211d | 2023-01-04 19:16:38 +0530 | [diff] [blame] | 38 | @OptIn(ExperimentalTvMaterial3Api::class) |
Vighnesh Raut | cb8c631 | 2022-10-06 13:08:59 +0530 | [diff] [blame] | 39 | @Composable |
| 40 | fun App() { |
Vineet Kumar | 94bb711 | 2022-11-17 19:20:44 +0530 | [diff] [blame] | 41 | var selectedTab by remember { mutableStateOf(Navigation.FeaturedCarousel) } |
Vighnesh Raut | cb8c631 | 2022-10-06 13:08:59 +0530 | [diff] [blame] | 42 | |
Vighnesh Raut | f636036 | 2023-03-23 16:44:25 +0530 | [diff] [blame^] | 43 | MaterialTheme(colorScheme = darkColorScheme()) { |
Shubham Singh | 0151b4b | 2022-12-19 17:01:02 +0530 | [diff] [blame] | 44 | Column( |
Vighnesh Raut | f636036 | 2023-03-23 16:44:25 +0530 | [diff] [blame^] | 45 | modifier = Modifier |
| 46 | .background(pageColor) |
| 47 | .fillMaxSize() |
| 48 | .padding(20.dp), |
| 49 | verticalArrangement = Arrangement.spacedBy(20.dp), |
Shubham Singh | 0151b4b | 2022-12-19 17:01:02 +0530 | [diff] [blame] | 50 | ) { |
| 51 | TopNavigation(updateSelectedTab = { selectedTab = it }) |
| 52 | selectedTab.action.invoke() |
| 53 | } |
Vighnesh Raut | cb8c631 | 2022-10-06 13:08:59 +0530 | [diff] [blame] | 54 | } |
Shubham Singh | 0151b4b | 2022-12-19 17:01:02 +0530 | [diff] [blame] | 55 | } |