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 showSATBTools by remember { mutableStateOf(false) }
|
||||||
var expandedCtl by remember { mutableStateOf(false) }
|
var expandedCtl by remember { mutableStateOf(false) }
|
||||||
|
val platform = getPlatform().name
|
||||||
LaunchedEffect(tempo) {
|
LaunchedEffect(tempo) {
|
||||||
currentBpm = mediaPlayer.getCurrentBPM()
|
currentBpm = mediaPlayer.getCurrentBPM()
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +92,7 @@ fun MidiControlPanel(
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
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)
|
.padding(16.dp)
|
||||||
.background(color = Color.Gray.copy(alpha = 0.5f), shape = RoundedCornerShape(size = 5.dp)),
|
.background(color = Color.Gray.copy(alpha = 0.5f), shape = RoundedCornerShape(size = 5.dp)),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
|
@ -214,7 +215,7 @@ fun MidiControlPanel(
|
||||||
slideInHorizontally { -it } + fadeIn() togetherWith slideOutHorizontally { it } + fadeOut()
|
slideInHorizontally { -it } + fadeIn() togetherWith slideOutHorizontally { it } + fadeOut()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.padding(horizontal = 4.dp)
|
modifier = Modifier.padding(horizontal = 2.dp)
|
||||||
) { displayedBpm ->
|
) { displayedBpm ->
|
||||||
val isCenter = displayedBpm == currentBpmInt
|
val isCenter = displayedBpm == currentBpmInt
|
||||||
Text(
|
Text(
|
||||||
|
|
@ -225,7 +226,7 @@ fun MidiControlPanel(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clip(CircleShape)
|
.clip(CircleShape)
|
||||||
.clickable(enabled = !isCenter) { updateTempoToBpm(displayedBpm) }
|
.clickable(enabled = !isCenter) { updateTempoToBpm(displayedBpm) }
|
||||||
.padding(horizontal = 4.dp)
|
.padding(horizontal = 2.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -333,6 +334,54 @@ fun MidiControlPanel(
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
|
||||||
|
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
|
||||||
|
if (isPianoSelected) {
|
||||||
|
mediaPlayer?.changeInstru(1)
|
||||||
|
} else {
|
||||||
|
mediaPlayer?.changeInstru(20)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
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)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
Column {
|
Column {
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
|
|
@ -363,7 +412,6 @@ fun MidiControlPanel(
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.wrapContentWidth(),
|
modifier = Modifier.wrapContentWidth(),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
|
|
@ -379,11 +427,12 @@ fun MidiControlPanel(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
|
||||||
val platform = getPlatform()
|
if (platform.startsWith("Java")) {
|
||||||
if (platform.name.startsWith("Java")) {
|
|
||||||
ModernVolumeSlider(
|
ModernVolumeSlider(
|
||||||
volume, onVolumeChange = onVolumeChange
|
volume, onVolumeChange = onVolumeChange
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue