@@ -14,19 +14,20 @@ import androidx.compose.foundation.background
1414import androidx.compose.foundation.layout.Column
1515import androidx.compose.foundation.layout.padding
1616import androidx.compose.foundation.layout.systemBarsPadding
17- import androidx.compose.material.TopAppBar
17+ import androidx.compose.material3.ExperimentalMaterial3Api
1818import androidx.compose.material3.Icon
1919import androidx.compose.material3.IconButton
2020import androidx.compose.material3.Scaffold
2121import androidx.compose.material3.Text
22+ import androidx.compose.material3.TopAppBar
23+ import androidx.compose.material3.TopAppBarDefaults
2224import androidx.compose.runtime.Composable
2325import androidx.compose.ui.Modifier
2426import androidx.compose.ui.platform.ComposeView
2527import androidx.compose.ui.platform.ViewCompositionStrategy
2628import androidx.compose.ui.res.colorResource
2729import androidx.compose.ui.res.painterResource
2830import androidx.compose.ui.res.stringResource
29- import androidx.compose.ui.unit.dp
3031import androidx.core.content.ContextCompat
3132import androidx.fragment.app.Fragment
3233import org.mozilla.focus.R
@@ -102,7 +103,7 @@ abstract class BaseComposeFragment : Fragment() {
102103 .background(colorResource(id = backgroundColorResource))
103104 .padding(paddingValues),
104105 ) {
105- TopAppBar (
106+ FocusTopAppBar (
106107 title = title,
107108 modifier = Modifier ,
108109 onNavigateUpClick = onNavigateUp(),
@@ -122,8 +123,9 @@ abstract class BaseComposeFragment : Fragment() {
122123 }
123124}
124125
126+ @OptIn(ExperimentalMaterial3Api ::class )
125127@Composable
126- private fun TopAppBar (
128+ private fun FocusTopAppBar (
127129 title : String ,
128130 modifier : Modifier = Modifier ,
129131 onNavigateUpClick : () -> Unit ,
@@ -132,7 +134,6 @@ private fun TopAppBar(
132134 title = {
133135 Text (
134136 text = title,
135- color = focusColors.toolbarColor,
136137 )
137138 },
138139 modifier = modifier,
@@ -143,11 +144,14 @@ private fun TopAppBar(
143144 Icon (
144145 painterResource(id = iconsR.drawable.mozac_ic_back_24),
145146 stringResource(R .string.go_back),
146- tint = focusColors.toolbarColor,
147147 )
148148 }
149149 },
150- backgroundColor = colorResource(R .color.settings_background),
151- elevation = 0 .dp,
150+ colors = TopAppBarDefaults .topAppBarColors(
151+ containerColor = colorResource(R .color.settings_background),
152+ scrolledContainerColor = colorResource(R .color.settings_background),
153+ navigationIconContentColor = focusColors.toolbarColor,
154+ titleContentColor = focusColors.toolbarColor,
155+ ),
152156 )
153157}
0 commit comments