diff --git a/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt b/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt index 3a3e25b66..539d5041d 100644 --- a/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt +++ b/app/src/main/java/com/google/samples/apps/nowinandroid/ui/NiaApp.kt @@ -27,7 +27,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.layout.safeDrawingPadding import androidx.compose.foundation.layout.windowInsetsPadding -import androidx.compose.material.ripple.LocalRippleTheme import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme @@ -41,7 +40,6 @@ import androidx.compose.material3.Text import androidx.compose.material3.windowsizeclass.WindowSizeClass import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass import androidx.compose.runtime.Composable -import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier @@ -52,7 +50,6 @@ import androidx.navigation.NavDestination import androidx.navigation.NavDestination.Companion.hierarchy import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController -import com.google.samples.apps.nowinandroid.core.ui.ClearRippleTheme import com.google.samples.apps.nowinandroid.core.ui.component.NiaBackground import com.google.samples.apps.nowinandroid.core.ui.theme.NiaTheme import com.google.samples.apps.nowinandroid.navigation.NiaNavHost @@ -149,35 +146,33 @@ private fun NiABottomBar( // Wrap the navigation bar in a surface so the color behind the system // navigation is equal to the container color of the navigation bar. Surface(color = MaterialTheme.colorScheme.surface) { - CompositionLocalProvider(LocalRippleTheme provides ClearRippleTheme) { - NavigationBar( - modifier = Modifier.windowInsetsPadding( - WindowInsets.safeDrawing.only( - WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom - ) - ), - tonalElevation = 0.dp - ) { + NavigationBar( + modifier = Modifier.windowInsetsPadding( + WindowInsets.safeDrawing.only( + WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom + ) + ), + tonalElevation = 0.dp + ) { - TOP_LEVEL_DESTINATIONS.forEach { destination -> - val selected = - currentDestination?.hierarchy?.any { it.route == destination.route } == true - NavigationBarItem( - selected = selected, - onClick = { onNavigateToTopLevelDestination(destination) }, - icon = { - Icon( - if (selected) { - destination.selectedIcon - } else { - destination.unselectedIcon - }, - contentDescription = null - ) - }, - label = { Text(stringResource(destination.iconTextId)) } - ) - } + TOP_LEVEL_DESTINATIONS.forEach { destination -> + val selected = + currentDestination?.hierarchy?.any { it.route == destination.route } == true + NavigationBarItem( + selected = selected, + onClick = { onNavigateToTopLevelDestination(destination) }, + icon = { + Icon( + if (selected) { + destination.selectedIcon + } else { + destination.unselectedIcon + }, + contentDescription = null + ) + }, + label = { Text(stringResource(destination.iconTextId)) } + ) } } } diff --git a/core-ui/src/main/java/com/google/samples/apps/nowinandroid/core/ui/ClearRippleTheme.kt b/core-ui/src/main/java/com/google/samples/apps/nowinandroid/core/ui/ClearRippleTheme.kt deleted file mode 100644 index bc7d10bf8..000000000 --- a/core-ui/src/main/java/com/google/samples/apps/nowinandroid/core/ui/ClearRippleTheme.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2021 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.samples.apps.nowinandroid.core.ui - -import androidx.compose.material.ripple.RippleAlpha -import androidx.compose.material.ripple.RippleTheme -import androidx.compose.runtime.Composable -import androidx.compose.ui.graphics.Color - -object ClearRippleTheme : RippleTheme { - - @Composable - override fun defaultColor(): Color = Color.Transparent - - @Composable - override fun rippleAlpha() = RippleAlpha( - draggedAlpha = 0.0f, - focusedAlpha = 0.0f, - hoveredAlpha = 0.0f, - pressedAlpha = 0.0f, - ) -}