Even out the composer's row, and put its two pickers in settings
The composer's row gave the model and the permission mode whatever width their words asked for, after three word-shaped action buttons had taken theirs. A llama session's model names run long, so the permission mode was squeezed to a chip too small to tap. The three actions are circles now -- one diameter, the platform's minimum touch target -- so they take what their glyph needs and nothing more, and the two pickers share what is left evenly rather than by the length of what they say. Every gap on the row is the same. Both pickers are also rows in the session settings dialog, for every provider that offers them: the dialog has a line each, so the whole model name is readable there. Choosing goes through the same two functions as the composer's pickers, so the model switch warning cannot be skipped by picking from one of the two places -- and it closes the dialog rather than stacking a question behind it. Looked at on the emulator against the sandbox: a llama session with the 27B loaded, and a claude-cli one, both composer and dialog, with the keyboard up and down.
This commit is contained in:
1 parent
81ab564a09
commit
45f249ae91
3 files changed
+169
-35
No files matched your search
@@ -1,10 +1,15 @@
|
||||
package com.example.aiapp
|
||||
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.OutlinedButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.Shape
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@@ -49,3 +54,49 @@ val BubbleShape: Shape = RoundedCornerShape(percent = 50)
|
||||
* ends that tall would bow its sides.
|
||||
*/
|
||||
val BubbleMenuShape: Shape = RoundedCornerShape(20.dp)
|
||||
|
||||
/**
|
||||
* A round button sized to the mark it draws.
|
||||
*
|
||||
* The composer's three actions -- attach, stop, send -- are single glyphs, and a pill's word-shaped
|
||||
* padding around one glyph was width taken from the pickers beside it: with a long model name on
|
||||
* the row, the permission mode ended up too small to hit. One diameter for all three, and it is the
|
||||
* platform's minimum touch target rather than a button's shorter default height.
|
||||
*
|
||||
* [fill] null draws the outlined form, for the one of the three that does not act on the session.
|
||||
*/
|
||||
@Composable
|
||||
fun CircleButton(
|
||||
onClick: () -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
fill: Color? = null,
|
||||
enabled: Boolean = true,
|
||||
content: @Composable () -> Unit,
|
||||
) {
|
||||
val sized = modifier.size(CircleButtonSize)
|
||||
if (fill == null) {
|
||||
OutlinedButton(
|
||||
onClick = onClick,
|
||||
enabled = enabled,
|
||||
shape = CircleShape,
|
||||
contentPadding = PaddingValues(0.dp),
|
||||
modifier = sized,
|
||||
) {
|
||||
content()
|
||||
}
|
||||
} else {
|
||||
Button(
|
||||
onClick = onClick,
|
||||
enabled = enabled,
|
||||
shape = CircleShape,
|
||||
colors = actionButtonColors(fill),
|
||||
contentPadding = PaddingValues(0.dp),
|
||||
modifier = sized,
|
||||
) {
|
||||
content()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** How wide and tall one of those is; see [CircleButton]. */
|
||||
val CircleButtonSize = 48.dp
|
||||
Reference in new issue
Block a user