Skip to content

Commit

Permalink
[fix]linearprogreddindicator location
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve-Mr committed Oct 4, 2024
1 parent ca9014c commit 3d2ec11
Showing 1 changed file with 28 additions and 29 deletions.
57 changes: 28 additions & 29 deletions app/src/main/java/top/maary/oblivionis/ui/ActionComponents.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
import androidx.constraintlayout.compose.ConstraintLayout
import androidx.media3.common.MediaItem
import androidx.media3.exoplayer.ExoPlayer
import androidx.media3.ui.PlayerView
Expand All @@ -85,7 +84,8 @@ fun MediaPlayer(
onLongPress: () -> Unit = {} // 长按事件
) {
Box(
modifier = modifier.clip(RoundedCornerShape(8.dp))
modifier = modifier
.clip(RoundedCornerShape(8.dp))
.wrapContentSize()
.combinedClickable(
onLongClick = { onLongPress() },
Expand Down Expand Up @@ -114,8 +114,15 @@ fun MediaPlayer(

if (isMultiSelectionState) {
// 显示选择框的图标
Icon(imageVector = Icons.Default.Circle, contentDescription = null, tint = if (isSelected) MaterialTheme.colorScheme.primaryContainer else Color.Transparent,
modifier = Modifier.align(Alignment.TopEnd).size(48.dp).padding(8.dp))
Icon(
imageVector = Icons.Default.Circle,
contentDescription = null,
tint = if (isSelected) MaterialTheme.colorScheme.primaryContainer else Color.Transparent,
modifier = Modifier
.align(Alignment.TopEnd)
.size(48.dp)
.padding(8.dp)
)
Icon(
imageVector = if (isSelected) Icons.Default.CheckCircle else Icons.Default.RadioButtonUnchecked,
contentDescription = if (isSelected) "Selected" else "Not Selected",
Expand Down Expand Up @@ -212,32 +219,24 @@ fun ActionRow(
.align(Alignment.Center)
.wrapContentWidth()
) {
ConstraintLayout {
val (button, progressBar) = createRefs()
OutlinedButton(
onClick = {},
modifier = Modifier.constrainAs(button){
}
.height(48.dp)
) {
Text(
modifier = Modifier.padding(start = 8.dp, end = 32.dp),
text = stringResource(R.string.pager_count, currentPage, pagesCount)
)
OutlinedButton(
onClick = {},
modifier = Modifier
.height(48.dp)
) {
Text(
modifier = Modifier.padding(start = 8.dp, end = 32.dp),
text = stringResource(R.string.pager_count, currentPage, pagesCount)
)

}
if (loading) {
LinearProgressIndicator(
progress = { currentProgress },
modifier = Modifier
.height(48.dp).constrainAs(progressBar) {
start.linkTo(button.start)
end.linkTo(button.end)
top.linkTo(button.top)
bottom.linkTo(button.bottom)
}
)
}
}
if (loading) {
LinearProgressIndicator(
progress = { currentProgress },
modifier = Modifier
.height(48.dp)
.matchParentSize()
)
}
Button(
onClick = { },
Expand Down

0 comments on commit 3d2ec11

Please sign in to comment.