Misc Changes

This commit is contained in:
Joe Tretter
2026-05-11 20:20:13 -05:00
parent 7e55084815
commit 316323a00c
3 changed files with 22 additions and 29 deletions

View File

@@ -19,8 +19,8 @@ android {
applicationId = "solutions.tretter.githugandroid" applicationId = "solutions.tretter.githugandroid"
minSdk = 26 minSdk = 26
targetSdk = 35 targetSdk = 35
versionCode = 134 versionCode = 135
versionName = "0.1.133" versionName = "0.1.134"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true

View File

@@ -46,12 +46,10 @@ internal fun HelpCalloutOverlay(
onShowHelpOnStartChange: (Boolean) -> Unit, onShowHelpOnStartChange: (Boolean) -> Unit,
onOk: () -> Unit, onOk: () -> Unit,
onClose: () -> Unit, onClose: () -> Unit,
workspaceBounds: Rect?,
exerciseBounds: Rect?, exerciseBounds: Rect?,
promptBounds: Rect?, promptBounds: Rect?,
) { ) {
val density = LocalDensity.current val density = LocalDensity.current
val workspaceTop = workspaceBounds?.top ?: 0f
val insetPx = with(density) { 14.dp.roundToPx() } val insetPx = with(density) { 14.dp.roundToPx() }
Box(modifier = Modifier.fillMaxSize()) { Box(modifier = Modifier.fillMaxSize()) {
HelpBubble( HelpBubble(
@@ -60,7 +58,7 @@ internal fun HelpCalloutOverlay(
Modifier.offset { Modifier.offset {
IntOffset( IntOffset(
x = insetPx, x = insetPx,
y = (bounds.top - workspaceTop - insetPx).roundToInt().coerceAtLeast(0), y = (bounds.top - insetPx).roundToInt().coerceAtLeast(0),
) )
} }
} ?: Modifier } ?: Modifier
@@ -73,7 +71,7 @@ internal fun HelpCalloutOverlay(
Modifier.offset { Modifier.offset {
IntOffset( IntOffset(
x = insetPx, x = insetPx,
y = (bounds.top - workspaceTop - bubbleHeight).roundToInt().coerceAtLeast(0), y = (bounds.top - bubbleHeight).roundToInt().coerceAtLeast(0),
) )
} }
} ?: Modifier } ?: Modifier

View File

@@ -21,6 +21,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Rect import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.platform.LocalConfiguration import androidx.compose.ui.platform.LocalConfiguration
@@ -28,8 +29,6 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.text.TextRange import androidx.compose.ui.text.TextRange
import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.layout.boundsInRoot
import androidx.compose.ui.layout.onGloballyPositioned
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@@ -74,10 +73,9 @@ fun GitHugApp() {
var solvedCelebrationTitle by remember { mutableStateOf<String?>(null) } var solvedCelebrationTitle by remember { mutableStateOf<String?>(null) }
var showTerminalInputHint by remember { mutableStateOf(true) } var showTerminalInputHint by remember { mutableStateOf(true) }
var showExerciseDescriptionHint by remember { mutableStateOf(true) } var showExerciseDescriptionHint by remember { mutableStateOf(true) }
var showHelpOverlay by remember { mutableStateOf(false) } var showHelpOverlay by rememberSaveable { mutableStateOf(false) }
var showHelpOnStart by remember { mutableStateOf(true) } var showHelpOnStart by rememberSaveable { mutableStateOf(true) }
var helpPreferenceInitialized by remember { mutableStateOf(false) } var helpPreferenceInitialized by rememberSaveable { mutableStateOf(false) }
var workspaceBounds by remember { mutableStateOf<Rect?>(null) }
var exerciseBounds by remember { mutableStateOf<Rect?>(null) } var exerciseBounds by remember { mutableStateOf<Rect?>(null) }
var promptBounds by remember { mutableStateOf<Rect?>(null) } var promptBounds by remember { mutableStateOf<Rect?>(null) }
val currentLevel = levels[currentLevelIndex] val currentLevel = levels[currentLevelIndex]
@@ -480,9 +478,7 @@ fun GitHugApp() {
) { ) {
FixedHeader() FixedHeader()
Box( Box(
modifier = Modifier modifier = Modifier.fillMaxWidth(),
.fillMaxWidth()
.onGloballyPositioned { workspaceBounds = it.boundsInRoot() },
) { ) {
PaneWorkspace( PaneWorkspace(
modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(),
@@ -570,6 +566,8 @@ fun GitHugApp() {
) )
}, },
) )
}
}
if (showHelpOverlay) { if (showHelpOverlay) {
HelpCalloutOverlay( HelpCalloutOverlay(
showHelpOnStart = showHelpOnStart, showHelpOnStart = showHelpOnStart,
@@ -579,7 +577,6 @@ fun GitHugApp() {
scope.launch { gameProgressStore.saveShowHelpOnStart(showHelpOnStart) } scope.launch { gameProgressStore.saveShowHelpOnStart(showHelpOnStart) }
}, },
onClose = { showHelpOverlay = false }, onClose = { showHelpOverlay = false },
workspaceBounds = workspaceBounds,
exerciseBounds = exerciseBounds, exerciseBounds = exerciseBounds,
promptBounds = promptBounds, promptBounds = promptBounds,
) )
@@ -587,8 +584,6 @@ fun GitHugApp() {
} }
} }
} }
}
}
editorState?.let { state -> editorState?.let { state ->
TextEditorDialog( TextEditorDialog(