1+ /*
2+ * Copyright 2025 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+ * https://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+
117package com.example.compose.snippets.components
218
319import androidx.compose.foundation.layout.Box
420import androidx.compose.foundation.layout.fillMaxSize
21+ import androidx.compose.foundation.layout.padding
522import androidx.compose.material.icons.Icons
623import androidx.compose.material.icons.filled.Album
724import androidx.compose.material.icons.filled.MusicNote
825import androidx.compose.material.icons.filled.PlaylistAddCircle
26+ import androidx.compose.material3.ExperimentalMaterial3Api
927import androidx.compose.material3.Icon
1028import androidx.compose.material3.NavigationBar
1129import androidx.compose.material3.NavigationBarDefaults
1230import androidx.compose.material3.NavigationBarItem
31+ import androidx.compose.material3.NavigationRail
32+ import androidx.compose.material3.NavigationRailItem
33+ import androidx.compose.material3.PrimaryTabRow
1334import androidx.compose.material3.Scaffold
35+ import androidx.compose.material3.Tab
1436import androidx.compose.material3.Text
1537import androidx.compose.runtime.Composable
38+ import androidx.compose.runtime.getValue
39+ import androidx.compose.runtime.mutableIntStateOf
1640import androidx.compose.runtime.saveable.rememberSaveable
41+ import androidx.compose.runtime.setValue
1742import androidx.compose.ui.Alignment
1843import androidx.compose.ui.Modifier
1944import androidx.compose.ui.graphics.vector.ImageVector
45+ import androidx.compose.ui.text.style.TextOverflow
2046import androidx.compose.ui.tooling.preview.Preview
2147import androidx.navigation.NavHostController
2248import androidx.navigation.compose.NavHost
2349import androidx.navigation.compose.composable
2450import androidx.navigation.compose.rememberNavController
25- import androidx.compose.runtime.mutableIntStateOf
26- import androidx.compose.runtime.getValue
27- import androidx.compose.runtime.setValue
28- import androidx.compose.material3.NavigationRail
29- import androidx.compose.material3.NavigationRailItem
30- import androidx.compose.foundation.layout.padding
31- import androidx.compose.material3.ExperimentalMaterial3Api
32- import androidx.compose.material3.PrimaryTabRow
33- import androidx.compose.material3.Tab
34- import androidx.compose.ui.text.style.TextOverflow
3551
3652@Composable
3753fun SongsScreen (modifier : Modifier = Modifier ) {
@@ -140,7 +156,7 @@ fun NavigationRailExample(modifier: Modifier = Modifier) {
140156 var selectedDestination by rememberSaveable { mutableIntStateOf(startDestination.ordinal) }
141157
142158 Scaffold { contentPadding ->
143- NavigationRail (modifier = Modifier .padding(contentPadding)) {
159+ NavigationRail (modifier = Modifier .padding(contentPadding)) {
144160 Destination .entries.forEachIndexed { index, destination ->
145161 NavigationRailItem (
146162 selected = selectedDestination == index,
@@ -172,7 +188,7 @@ fun NavigationTabExample(modifier: Modifier = Modifier) {
172188 val startDestination = Destination .SONGS
173189 var selectedDestination by rememberSaveable { mutableIntStateOf(startDestination.ordinal) }
174190
175- Scaffold { contentPadding ->
191+ Scaffold { contentPadding ->
176192 PrimaryTabRow (selectedTabIndex = selectedDestination, modifier = Modifier .padding(contentPadding)) {
177193 Destination .entries.forEachIndexed { index, destination ->
178194 Tab (
@@ -195,5 +211,3 @@ fun NavigationTabExample(modifier: Modifier = Modifier) {
195211 }
196212}
197213// [END android_compose_components_navigationtabexample]
198-
199-
0 commit comments