1
1
package org.shirabox.app.ui.activity.player.presentation.controls
2
2
3
- import android.app.Activity
4
3
import android.content.pm.ActivityInfo
5
4
import android.content.res.Configuration
5
+ import androidx.activity.compose.LocalActivity
6
6
import androidx.compose.animation.core.animateDpAsState
7
7
import androidx.compose.animation.core.animateFloatAsState
8
8
import androidx.compose.foundation.interaction.MutableInteractionSource
@@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.Box
11
11
import androidx.compose.foundation.layout.Column
12
12
import androidx.compose.foundation.layout.Row
13
13
import androidx.compose.foundation.layout.fillMaxWidth
14
+ import androidx.compose.foundation.layout.height
14
15
import androidx.compose.foundation.layout.padding
15
16
import androidx.compose.foundation.layout.size
16
17
import androidx.compose.material3.ExperimentalMaterial3Api
@@ -31,7 +32,6 @@ import androidx.compose.ui.Alignment
31
32
import androidx.compose.ui.Modifier
32
33
import androidx.compose.ui.graphics.Color
33
34
import androidx.compose.ui.platform.LocalConfiguration
34
- import androidx.compose.ui.platform.LocalContext
35
35
import androidx.compose.ui.res.painterResource
36
36
import androidx.compose.ui.unit.DpSize
37
37
import androidx.compose.ui.unit.dp
@@ -61,7 +61,8 @@ internal fun PlayerBottomBar(
61
61
62
62
val thumbGapSize by animateDpAsState(if (isValueChanging) 8 .dp else 0 .dp, label = " " )
63
63
val cornerSize by animateDpAsState(if (isValueChanging) 4 .dp else 0 .dp, label = " " )
64
- val thumbHeight by animateDpAsState(if (isValueChanging) 36 .dp else 16 .dp, label = " " )
64
+ val thumbSize by animateDpAsState(if (isValueChanging) 24 .dp else 16 .dp, label = " " )
65
+ val trackHeight by animateDpAsState(if (isValueChanging) 3 .dp else 2 .dp)
65
66
66
67
Box (
67
68
contentAlignment = Alignment .BottomCenter
@@ -114,6 +115,7 @@ internal fun PlayerBottomBar(
114
115
},
115
116
track = {
116
117
SliderDefaults .Track (
118
+ modifier = Modifier .height(trackHeight),
117
119
colors = colors,
118
120
enabled = duration != C .TIME_UNSET ,
119
121
sliderState = it,
@@ -126,19 +128,19 @@ internal fun PlayerBottomBar(
126
128
interactionSource = interactionSource,
127
129
colors = colors,
128
130
enabled = true ,
129
- thumbSize = DpSize (6 .dp, thumbHeight )
131
+ thumbSize = DpSize (thumbSize, thumbSize )
130
132
)
131
133
},
132
134
colors = colors
133
135
)
134
136
135
137
val localConf = LocalConfiguration .current
136
- val activity = LocalContext .current as Activity
138
+ val activity = LocalActivity .current
137
139
val isLandscape = localConf.orientation == Configuration .ORIENTATION_LANDSCAPE
138
140
139
141
IconButton (
140
142
onClick = {
141
- activity.requestedOrientation =
143
+ activity? .requestedOrientation =
142
144
if (isLandscape) {
143
145
ActivityInfo .SCREEN_ORIENTATION_PORTRAIT
144
146
} else {
0 commit comments