centered play btn for android
This commit is contained in:
parent
d25753aee4
commit
6dd58b8bb3
1 changed files with 71 additions and 22 deletions
|
|
@ -61,6 +61,7 @@ fun MidiControlPanel(
|
|||
|
||||
var showSATBTools by remember { mutableStateOf(false) }
|
||||
var expandedCtl by remember { mutableStateOf(false) }
|
||||
val platform = getPlatform().name
|
||||
LaunchedEffect(tempo) {
|
||||
currentBpm = mediaPlayer.getCurrentBPM()
|
||||
}
|
||||
|
|
@ -91,7 +92,7 @@ fun MidiControlPanel(
|
|||
) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxWidth(if (getPlatform().name.startsWith("Android")) 0.9f else 0.6f)
|
||||
.fillMaxWidth(if (platform.startsWith("Android")) 1f else 0.6f)
|
||||
.padding(16.dp)
|
||||
.background(color = Color.Gray.copy(alpha = 0.5f), shape = RoundedCornerShape(size = 5.dp)),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
|
|
@ -214,7 +215,7 @@ fun MidiControlPanel(
|
|||
slideInHorizontally { -it } + fadeIn() togetherWith slideOutHorizontally { it } + fadeOut()
|
||||
}
|
||||
},
|
||||
modifier = Modifier.padding(horizontal = 4.dp)
|
||||
modifier = Modifier.padding(horizontal = 2.dp)
|
||||
) { displayedBpm ->
|
||||
val isCenter = displayedBpm == currentBpmInt
|
||||
Text(
|
||||
|
|
@ -225,7 +226,7 @@ fun MidiControlPanel(
|
|||
modifier = Modifier
|
||||
.clip(CircleShape)
|
||||
.clickable(enabled = !isCenter) { updateTempoToBpm(displayedBpm) }
|
||||
.padding(horizontal = 4.dp)
|
||||
.padding(horizontal = 2.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -333,7 +334,26 @@ fun MidiControlPanel(
|
|||
}
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
|
||||
Column {
|
||||
if(platform.startsWith("Android")) {
|
||||
Column(
|
||||
modifier = Modifier.wrapContentWidth(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
IconButton(
|
||||
onClick = onPlayPauseClick,
|
||||
modifier = Modifier.size(48.dp).background(MaterialTheme.colorScheme.primary, CircleShape)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = if (isPause) Icons.Filled.PlayArrow else Icons.Filled.Pause,
|
||||
contentDescription = "Pla",
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
|
||||
Column {
|
||||
IconButton(
|
||||
onClick = {
|
||||
isPianoSelected = !isPianoSelected
|
||||
|
|
@ -361,29 +381,58 @@ fun MidiControlPanel(
|
|||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Column {
|
||||
IconButton(
|
||||
onClick = {
|
||||
isPianoSelected = !isPianoSelected
|
||||
if (isPianoSelected) {
|
||||
mediaPlayer?.changeInstru(1)
|
||||
} else {
|
||||
mediaPlayer?.changeInstru(20)
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
|
||||
Column(
|
||||
modifier = Modifier.wrapContentWidth(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
IconButton(
|
||||
onClick = onPlayPauseClick,
|
||||
modifier = Modifier.size(48.dp).background(MaterialTheme.colorScheme.primary, CircleShape)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = if (isPause) Icons.Filled.PlayArrow else Icons.Filled.Pause,
|
||||
contentDescription = "Pla",
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
) {
|
||||
if (isPianoSelected) {
|
||||
Icon(
|
||||
Icons.Default.Piano,
|
||||
contentDescription = "Piano",
|
||||
tint = Color.Black
|
||||
)
|
||||
} else {
|
||||
Icon(
|
||||
painter = painterResource(Res.drawable.ic_organ),
|
||||
contentDescription = "Orgue",
|
||||
tint = Color.Black,
|
||||
modifier = Modifier.size(25.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Column(
|
||||
modifier = Modifier.wrapContentWidth(),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
IconButton(
|
||||
onClick = onPlayPauseClick,
|
||||
modifier = Modifier.size(48.dp).background(MaterialTheme.colorScheme.primary, CircleShape)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = if (isPause) Icons.Filled.PlayArrow else Icons.Filled.Pause,
|
||||
contentDescription = "Pla",
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
|
||||
val platform = getPlatform()
|
||||
if (platform.name.startsWith("Java")) {
|
||||
if (platform.startsWith("Java")) {
|
||||
ModernVolumeSlider(
|
||||
volume, onVolumeChange = onVolumeChange
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue