Auto-commit after successful build: update app gameplay/UI, improve build setup

Changed files:\napp/build.gradle.kts
app/src/main/java/com/kawomi/githugandroid/GitHugApp.kt
This commit is contained in:
Joe Tretter
2026-04-23 12:07:47 -05:00
parent a830d41abf
commit 666534b21a
2 changed files with 100 additions and 55 deletions

View File

@@ -11,8 +11,8 @@ android {
applicationId = "com.kawomi.githugandroid" applicationId = "com.kawomi.githugandroid"
minSdk = 26 minSdk = 26
targetSdk = 34 targetSdk = 34
versionCode = 24 versionCode = 25
versionName = "0.1.23" versionName = "0.1.24"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true

View File

@@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer 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
@@ -122,13 +123,13 @@ private data class PaneLayout(
) )
private fun defaultPaneLayout(): PaneLayout = PaneLayout( private fun defaultPaneLayout(): PaneLayout = PaneLayout(
order = listOf(PaneId.LEVELS, PaneId.VISUAL, PaneId.EXERCISE, PaneId.TERMINAL), order = listOf(PaneId.EXERCISE, PaneId.TERMINAL, PaneId.VISUAL, PaneId.LEVELS),
collapsed = emptySet(), collapsed = emptySet(),
weights = mapOf( weights = mapOf(
PaneId.LEVELS to 0.9f, PaneId.EXERCISE to 0.95f,
PaneId.TERMINAL to 1.45f,
PaneId.VISUAL to 1.0f, PaneId.VISUAL to 1.0f,
PaneId.EXERCISE to 0.9f, PaneId.LEVELS to 0.8f,
PaneId.TERMINAL to 1.4f,
), ),
) )
@@ -657,14 +658,14 @@ private fun PaneDivider(
Box( Box(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.height(6.dp) .height(18.dp)
.draggable( .draggable(
state = dragState, state = dragState,
orientation = Orientation.Vertical, orientation = Orientation.Vertical,
enabled = enabled, enabled = enabled,
onDragStopped = { onDragFinished() }, onDragStopped = { onDragFinished() },
), ),
contentAlignment = Alignment.Center, contentAlignment = Alignment.CenterStart,
) { ) {
Box( Box(
modifier = Modifier modifier = Modifier
@@ -672,12 +673,87 @@ private fun PaneDivider(
.height(1.dp) .height(1.dp)
.background(if (enabled) Accent.copy(alpha = 0.45f) else PanelTertiary), .background(if (enabled) Accent.copy(alpha = 0.45f) else PanelTertiary),
) )
Text( Card(
text = "", colors = CardDefaults.cardColors(
color = if (enabled) Accent else TextMuted, containerColor = if (enabled) PanelPrimary else PanelTertiary,
modifier = Modifier.align(Alignment.CenterStart).padding(start = 28.dp), ),
fontSize = 12.sp, shape = RoundedCornerShape(999.dp),
fontWeight = FontWeight.Bold, modifier = Modifier.padding(start = 28.dp),
) {
Text(
text = "",
color = if (enabled) Accent else TextMuted,
modifier = Modifier.padding(horizontal = 8.dp, vertical = 1.dp),
fontSize = 13.sp,
fontWeight = FontWeight.ExtraBold,
)
}
}
}
@OptIn(ExperimentalFoundationApi::class)
@Composable
private fun RowScope.TerminalInputField(
inputFieldVersion: Int,
commandInput: TextFieldValue,
onValueChange: (TextFieldValue) -> Unit,
focusRequester: FocusRequester,
bringIntoViewRequester: BringIntoViewRequester,
keyboardController: androidx.compose.ui.platform.SoftwareKeyboardController?,
onSubmit: () -> Unit,
) {
val scope = rememberCoroutineScope()
key(inputFieldVersion) {
BasicTextField(
value = commandInput,
onValueChange = onValueChange,
modifier = Modifier
.weight(1f)
.focusRequester(focusRequester)
.bringIntoViewRequester(bringIntoViewRequester)
.onFocusChanged { state ->
if (state.isFocused) {
keyboardController?.show()
scope.launch {
delay(150)
bringIntoViewRequester.bringIntoView()
}
}
},
singleLine = true,
textStyle = TextStyle(
color = TextPrimary,
fontFamily = FontFamily.Monospace,
fontSize = 17.sp,
fontWeight = FontWeight.Medium,
),
cursorBrush = SolidColor(Accent),
keyboardOptions = KeyboardOptions(
autoCorrect = false,
keyboardType = KeyboardType.Ascii,
imeAction = ImeAction.Done,
),
keyboardActions = KeyboardActions(onDone = { onSubmit() }),
decorationBox = { innerTextField ->
Box(
modifier = Modifier
.fillMaxWidth()
.background(Color.Transparent)
.padding(vertical = 10.dp),
contentAlignment = Alignment.CenterStart,
) {
if (commandInput.text.isEmpty()) {
Text(
text = "Enter git command",
color = TextMuted.copy(alpha = 0.7f),
fontFamily = FontFamily.Monospace,
fontSize = 17.sp,
)
}
innerTextField()
}
},
) )
} }
} }
@@ -869,11 +945,8 @@ private fun TerminalPane(
val horizontalScroll = rememberScrollState() val horizontalScroll = rememberScrollState()
val outputVerticalScroll = rememberScrollState() val outputVerticalScroll = rememberScrollState()
val terminalMinWidth = 640.dp val terminalMinWidth = 640.dp
val scope = rememberCoroutineScope()
LaunchedEffect(inputFieldVersion) { LaunchedEffect(inputFieldVersion) {
if (inputFieldVersion == 0) return@LaunchedEffect
delay(75)
focusRequester.requestFocus() focusRequester.requestFocus()
keyboardController?.show() keyboardController?.show()
} }
@@ -941,45 +1014,17 @@ private fun TerminalPane(
color = Accent, color = Accent,
fontFamily = FontFamily.Monospace, fontFamily = FontFamily.Monospace,
fontWeight = FontWeight.Bold, fontWeight = FontWeight.Bold,
fontSize = 17.sp,
)
TerminalInputField(
inputFieldVersion = inputFieldVersion,
commandInput = commandInput,
onValueChange = onValueChange,
focusRequester = focusRequester,
bringIntoViewRequester = bringIntoViewRequester,
keyboardController = keyboardController,
onSubmit = { submitCommand() },
) )
key(inputFieldVersion) {
BasicTextField(
value = commandInput,
onValueChange = onValueChange,
modifier = Modifier
.weight(1f)
.focusRequester(focusRequester)
.bringIntoViewRequester(bringIntoViewRequester)
.onFocusChanged { state ->
if (state.isFocused) {
keyboardController?.show()
scope.launch {
delay(150)
bringIntoViewRequester.bringIntoView()
}
}
},
singleLine = true,
textStyle = TextStyle(color = TextPrimary, fontFamily = FontFamily.Monospace),
cursorBrush = SolidColor(Accent),
keyboardOptions = KeyboardOptions(
autoCorrect = false,
keyboardType = KeyboardType.Ascii,
imeAction = ImeAction.Done,
),
keyboardActions = KeyboardActions(onDone = { submitCommand() }),
decorationBox = { innerTextField ->
Box(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 8.dp),
contentAlignment = Alignment.CenterStart,
) {
innerTextField()
}
},
)
}
} }
} }
} }