Fix level transition scrolling and keyboard blank-space behavior

Use commit-summary.txt for AndroidProjectTooling auto-commit messages
This commit is contained in:
Joe Tretter
2026-05-05 19:48:29 -05:00
parent 42c898f648
commit 9d09eb1385
5 changed files with 16 additions and 28 deletions

1
.gitignore vendored
View File

@@ -9,6 +9,7 @@ jdk/
.tmp-android-build/
.setup-build-environment.state
.android-project-tooling.state
commit-summary.txt
keystore.properties
*.keystore
*.jks

View File

@@ -10,6 +10,7 @@ JDK_DIR="$PROJECT_DIR/jdk"
GRADLE_USER_HOME_DIR="$PROJECT_DIR/.gradle-user-home"
STATE_FILE="$PROJECT_DIR/.android-project-tooling.state"
LEGACY_STATE_FILE="$PROJECT_DIR/.setup-build-environment.state"
COMMIT_SUMMARY_FILE="$PROJECT_DIR/commit-summary.txt"
CMDLINE_TOOLS_DIR="$SDK_DIR/cmdline-tools"
CMDLINE_TOOLS_LATEST_DIR="$CMDLINE_TOOLS_DIR/latest"
WRAPPER_JAR_PATH="$PROJECT_DIR/gradle/wrapper/gradle-wrapper.jar"
@@ -93,6 +94,7 @@ auto_commit_if_needed() {
# included in the automatic commit, even if a file was force-added manually.
git -C "$PROJECT_DIR" reset -q HEAD -- \
keystore.properties \
commit-summary.txt \
'*.keystore' \
'*.jks' 2>/dev/null || true
@@ -101,27 +103,13 @@ auto_commit_if_needed() {
return
fi
local changed_files
changed_files="$(git -C "$PROJECT_DIR" diff --cached --name-only)"
local -a summary_parts=()
if printf '%s\n' "$changed_files" | grep -q '^app/src/main/java/'; then
summary_parts+=("update app gameplay/UI")
fi
if printf '%s\n' "$changed_files" | grep -Eq '^(AndroidProjectTooling\.sh|gradle\.properties|gradle/|gradlew|gradlew\.bat|build\.gradle\.kts|settings\.gradle\.kts|app/build\.gradle\.kts)'; then
summary_parts+=("improve build setup")
fi
if printf '%s\n' "$changed_files" | grep -Eq '^(README\.md|\.gitignore)$'; then
summary_parts+=("update docs/config")
fi
if [ ${#summary_parts[@]} -eq 0 ]; then
summary_parts+=("project updates")
fi
local commit_message
commit_message="Auto-commit after successful build: $(printf '%s, ' "${summary_parts[@]}" | sed 's/, $//')"
log "Creating git commit for the latest successful build"
git -C "$PROJECT_DIR" commit -m "$commit_message" -m "Changed files:\n$changed_files"
if [ -s "$COMMIT_SUMMARY_FILE" ] && grep -q '[^[:space:]]' "$COMMIT_SUMMARY_FILE"; then
git -C "$PROJECT_DIR" commit -F "$COMMIT_SUMMARY_FILE"
else
git -C "$PROJECT_DIR" commit -m "Misc Changes"
fi
: > "$COMMIT_SUMMARY_FILE"
}
download_if_missing() {

View File

@@ -19,8 +19,8 @@ android {
applicationId = "solutions.tretter.githugandroid"
minSdk = 26
targetSdk = 35
versionCode = 112
versionName = "0.1.111"
versionCode = 113
versionName = "0.1.112"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true

View File

@@ -11,10 +11,8 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
@@ -92,6 +90,11 @@ fun GitHugApp() {
paneLayout = persistedPaneLayout
}
LaunchedEffect(currentLevelIndex) {
delay(100)
screenScrollState.animateScrollTo(0)
}
fun updatePaneLayout(transform: (PaneLayout) -> PaneLayout, persist: Boolean = true) {
val updated = transform(paneLayout)
paneLayout = updated
@@ -316,7 +319,6 @@ fun GitHugApp() {
)
scope.launch { persistProgress(updatedCompletedLevels, nextLevelId) }
loadLevel(nextLevelIndex, message = emptyList())
scope.launch { screenScrollState.animateScrollTo(0) }
} else {
AppLog.d("GitHugApp", "All levels completed")
scope.launch { persistProgress(updatedCompletedLevels, levels.lastOrNull()?.id) }
@@ -528,7 +530,6 @@ fun GitHugApp() {
)
},
)
Spacer(modifier = Modifier.height(220.dp))
}
}
}

View File

@@ -80,8 +80,6 @@ fun TerminalPane(
val desiredOutputHeight = (output.size.coerceAtLeast(6) * outputLineHeight.value).dp.coerceAtMost(maxOutputHeight)
LaunchedEffect(inputFieldVersion) {
focusRequester.requestFocus()
keyboardController?.show()
outputHorizontalScroll.scrollTo(0)
}