Justify the tracker toolbar rows edge to edge (v0.3.2)
Each transport-toolbar row now distributes its elements across the full width (Arrangement.SpaceBetween) instead of clustering at the left: dropped the per-row horizontalScroll (which gave the row infinite width and defeated any distribution) and the manual landscape spacer. Rows no longer scroll — elements fill the bar edge to edge. Patch bump to 0.3.2 (versionCode 5). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -22,8 +22,8 @@ android {
|
|||||||
// (android.media.midi) and AAudio low-latency audio we rely on.
|
// (android.media.midi) and AAudio low-latency audio we rely on.
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 4
|
versionCode = 5
|
||||||
versionName = "0.3.1"
|
versionName = "0.3.2"
|
||||||
|
|
||||||
// We provide our own instrumentation runner if/when tests are added.
|
// We provide our own instrumentation runner if/when tests are added.
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|||||||
@@ -4,20 +4,17 @@
|
|||||||
package space.rcmd.android.sizzle.ui.tracker
|
package space.rcmd.android.sizzle.ui.tracker
|
||||||
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.horizontalScroll
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.RowScope
|
import androidx.compose.foundation.layout.RowScope
|
||||||
import androidx.compose.foundation.layout.Spacer
|
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.rememberScrollState
|
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
@@ -102,37 +99,37 @@ private fun TrackerLandscape(vm: AppViewModel) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The transport toolbar. Three scrolling rows in portrait; in landscape the
|
/** The transport toolbar. Three rows in portrait; in landscape the length/scale and
|
||||||
* length/scale and edit groups are merged into one row so it's only two rows tall,
|
* edit groups are merged into one row so it's only two rows tall, leaving the (short)
|
||||||
* leaving the (short) height for the pattern grid. */
|
* height for the pattern grid. Each row is JUSTIFIED — its elements are distributed
|
||||||
|
* edge to edge across the full width (Arrangement.SpaceBetween), so the toolbar fills
|
||||||
|
* the bar instead of clustering at the left. */
|
||||||
@Composable
|
@Composable
|
||||||
private fun TransportToolbar(vm: AppViewModel) {
|
private fun TransportToolbar(vm: AppViewModel) {
|
||||||
val c = LocalRetro.current
|
val c = LocalRetro.current
|
||||||
val landscape = isLandscape()
|
val landscape = isLandscape()
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun scrollRow(topPad: Boolean, content: @Composable RowScope.() -> Unit) {
|
fun barRow(topPad: Boolean, content: @Composable RowScope.() -> Unit) {
|
||||||
Row(
|
Row(
|
||||||
Modifier.fillMaxWidth()
|
Modifier.fillMaxWidth()
|
||||||
.then(if (topPad) Modifier.padding(top = 6.dp) else Modifier)
|
.then(if (topPad) Modifier.padding(top = 6.dp) else Modifier),
|
||||||
.horizontalScroll(rememberScrollState()),
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
content = content,
|
content = content,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(Modifier.fillMaxWidth().background(c.surface).padding(6.dp)) {
|
Column(Modifier.fillMaxWidth().background(c.surface).padding(6.dp)) {
|
||||||
scrollRow(topPad = false) { TransportButtons(vm) }
|
barRow(topPad = false) { TransportButtons(vm) }
|
||||||
if (landscape) {
|
if (landscape) {
|
||||||
scrollRow(topPad = true) {
|
barRow(topPad = true) {
|
||||||
PatternButtons(vm)
|
PatternButtons(vm)
|
||||||
Spacer(Modifier.width(16.dp))
|
|
||||||
EditButtons(vm)
|
EditButtons(vm)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
scrollRow(topPad = true) { PatternButtons(vm) }
|
barRow(topPad = true) { PatternButtons(vm) }
|
||||||
scrollRow(topPad = true) { EditButtons(vm) }
|
barRow(topPad = true) { EditButtons(vm) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user