@@ -20,7 +20,6 @@ import androidx.compose.animation.animate
20
20
import androidx.compose.foundation.Image
21
21
import androidx.compose.foundation.ScrollableColumn
22
22
import androidx.compose.foundation.ScrollableRow
23
- import androidx.compose.foundation.Text
24
23
import androidx.compose.foundation.clickable
25
24
import androidx.compose.foundation.layout.Box
26
25
import androidx.compose.foundation.layout.Column
@@ -36,15 +35,16 @@ import androidx.compose.foundation.layout.preferredHeight
36
35
import androidx.compose.foundation.layout.preferredSize
37
36
import androidx.compose.foundation.rememberScrollState
38
37
import androidx.compose.foundation.shape.RoundedCornerShape
39
- import androidx.compose.material.AmbientEmphasisLevels
38
+ import androidx.compose.material.AmbientContentAlpha
39
+ import androidx.compose.material.ContentAlpha
40
40
import androidx.compose.material.Divider
41
41
import androidx.compose.material.ExperimentalMaterialApi
42
42
import androidx.compose.material.FractionalThreshold
43
43
import androidx.compose.material.Icon
44
44
import androidx.compose.material.IconButton
45
45
import androidx.compose.material.MaterialTheme
46
- import androidx.compose.material.ProvideEmphasis
47
46
import androidx.compose.material.Surface
47
+ import androidx.compose.material.Text
48
48
import androidx.compose.material.TopAppBar
49
49
import androidx.compose.material.contentColorFor
50
50
import androidx.compose.material.icons.Icons
@@ -56,13 +56,14 @@ import androidx.compose.material.primarySurface
56
56
import androidx.compose.material.rememberSwipeableState
57
57
import androidx.compose.material.swipeable
58
58
import androidx.compose.runtime.Composable
59
+ import androidx.compose.runtime.Providers
59
60
import androidx.compose.runtime.remember
60
61
import androidx.compose.ui.Alignment
61
62
import androidx.compose.ui.Modifier
62
- import androidx.compose.ui.WithConstraints
63
63
import androidx.compose.ui.drawLayer
64
64
import androidx.compose.ui.gesture.scrollorientationlocking.Orientation
65
65
import androidx.compose.ui.graphics.Color
66
+ import androidx.compose.ui.layout.WithConstraints
66
67
import androidx.compose.ui.platform.DensityAmbient
67
68
import androidx.compose.ui.res.stringResource
68
69
import androidx.compose.ui.res.vectorResource
@@ -81,14 +82,14 @@ import com.example.owl.ui.common.OutlinedAvatar
81
82
import com.example.owl.ui.theme.BlueTheme
82
83
import com.example.owl.ui.theme.PinkTheme
83
84
import com.example.owl.ui.theme.pink500
84
- import com.example.owl.ui.utils.AmbientInsets
85
85
import com.example.owl.ui.utils.NetworkImage
86
86
import com.example.owl.ui.utils.backHandler
87
87
import com.example.owl.ui.utils.lerp
88
- import com.example.owl.ui.utils.navigationBarsPadding
89
88
import com.example.owl.ui.utils.scrim
90
- import com.example.owl.ui.utils.statusBarsPadding
91
- import com.example.owl.ui.utils.toPaddingValues
89
+ import dev.chrisbanes.accompanist.insets.AmbientWindowInsets
90
+ import dev.chrisbanes.accompanist.insets.navigationBarsPadding
91
+ import dev.chrisbanes.accompanist.insets.statusBarsPadding
92
+ import dev.chrisbanes.accompanist.insets.toPaddingValues
92
93
93
94
private val FabSize = 56 .dp
94
95
private const val ExpandedSheetAlpha = 0.96f
@@ -227,7 +228,7 @@ private fun CourseDescriptionBody(course: Course) {
227
228
.padding(horizontal = 16 .dp)
228
229
)
229
230
Spacer (modifier = Modifier .preferredHeight(16 .dp))
230
- ProvideEmphasis ( AmbientEmphasisLevels .current .medium) {
231
+ Providers ( AmbientContentAlpha provides ContentAlpha .medium) {
231
232
Text (
232
233
text = stringResource(id = R .string.course_desc),
233
234
style = MaterialTheme .typography.body1,
@@ -246,7 +247,7 @@ private fun CourseDescriptionBody(course: Course) {
246
247
.fillMaxWidth()
247
248
.padding(16 .dp)
248
249
)
249
- ProvideEmphasis ( AmbientEmphasisLevels .current .medium) {
250
+ Providers ( AmbientContentAlpha provides ContentAlpha .medium) {
250
251
Text (
251
252
text = stringResource(id = R .string.needs),
252
253
style = MaterialTheme .typography.body1,
@@ -320,7 +321,7 @@ private fun LessonsSheet(
320
321
) {
321
322
// Use the fraction that the sheet is open to drive the transformation from FAB -> Sheet
322
323
val fabSize = with (DensityAmbient .current) { FabSize .toPx() }
323
- val fabSheetHeight = fabSize + AmbientInsets .current.systemBars.bottom
324
+ val fabSheetHeight = fabSize + AmbientWindowInsets .current.systemBars.bottom
324
325
val offsetX = lerp(width - fabSize, 0f , 0f , 0.15f , openFraction)
325
326
val offsetY = lerp(height - fabSheetHeight, 0f , openFraction)
326
327
val tlCorner = lerp(fabSize, 0f , 0f , 0.15f , openFraction)
@@ -388,7 +389,7 @@ private fun Lessons(
388
389
}
389
390
ScrollableColumn (
390
391
scrollState = scroll,
391
- contentPadding = AmbientInsets .current.systemBars.toPaddingValues(
392
+ contentPadding = AmbientWindowInsets .current.systemBars.toPaddingValues(
392
393
top = false
393
394
)
394
395
) {
@@ -442,7 +443,7 @@ private fun Lesson(lesson: Lesson) {
442
443
maxLines = 2 ,
443
444
overflow = TextOverflow .Ellipsis
444
445
)
445
- ProvideEmphasis ( AmbientEmphasisLevels .current .medium) {
446
+ Providers ( AmbientContentAlpha provides ContentAlpha .medium) {
446
447
Row (
447
448
modifier = Modifier .padding(top = 4 .dp),
448
449
verticalAlignment = Alignment .CenterVertically
0 commit comments