Skip to content

Commit 653d9e4

Browse files
committedJan 21, 2025·
refactor(player): slider appearance
1 parent d4264e1 commit 653d9e4

File tree

1 file changed

+8
-6
lines changed
  • app/src/main/java/org/shirabox/app/ui/activity/player/presentation/controls

1 file changed

+8
-6
lines changed
 

‎app/src/main/java/org/shirabox/app/ui/activity/player/presentation/controls/PlayerBottomBar.kt

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package org.shirabox.app.ui.activity.player.presentation.controls
22

3-
import android.app.Activity
43
import android.content.pm.ActivityInfo
54
import android.content.res.Configuration
5+
import androidx.activity.compose.LocalActivity
66
import androidx.compose.animation.core.animateDpAsState
77
import androidx.compose.animation.core.animateFloatAsState
88
import androidx.compose.foundation.interaction.MutableInteractionSource
@@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.Box
1111
import androidx.compose.foundation.layout.Column
1212
import androidx.compose.foundation.layout.Row
1313
import androidx.compose.foundation.layout.fillMaxWidth
14+
import androidx.compose.foundation.layout.height
1415
import androidx.compose.foundation.layout.padding
1516
import androidx.compose.foundation.layout.size
1617
import androidx.compose.material3.ExperimentalMaterial3Api
@@ -31,7 +32,6 @@ import androidx.compose.ui.Alignment
3132
import androidx.compose.ui.Modifier
3233
import androidx.compose.ui.graphics.Color
3334
import androidx.compose.ui.platform.LocalConfiguration
34-
import androidx.compose.ui.platform.LocalContext
3535
import androidx.compose.ui.res.painterResource
3636
import androidx.compose.ui.unit.DpSize
3737
import androidx.compose.ui.unit.dp
@@ -61,7 +61,8 @@ internal fun PlayerBottomBar(
6161

6262
val thumbGapSize by animateDpAsState(if (isValueChanging) 8.dp else 0.dp, label = "")
6363
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)
6566

6667
Box(
6768
contentAlignment = Alignment.BottomCenter
@@ -114,6 +115,7 @@ internal fun PlayerBottomBar(
114115
},
115116
track = {
116117
SliderDefaults.Track(
118+
modifier = Modifier.height(trackHeight),
117119
colors = colors,
118120
enabled = duration != C.TIME_UNSET,
119121
sliderState = it,
@@ -126,19 +128,19 @@ internal fun PlayerBottomBar(
126128
interactionSource = interactionSource,
127129
colors = colors,
128130
enabled = true,
129-
thumbSize = DpSize(6.dp, thumbHeight)
131+
thumbSize = DpSize(thumbSize, thumbSize)
130132
)
131133
},
132134
colors = colors
133135
)
134136

135137
val localConf = LocalConfiguration.current
136-
val activity = LocalContext.current as Activity
138+
val activity = LocalActivity.current
137139
val isLandscape = localConf.orientation == Configuration.ORIENTATION_LANDSCAPE
138140

139141
IconButton(
140142
onClick = {
141-
activity.requestedOrientation =
143+
activity?.requestedOrientation =
142144
if (isLandscape) {
143145
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
144146
} else {

0 commit comments

Comments
 (0)
Please sign in to comment.