Misc Changes
This commit is contained in:
@@ -19,8 +19,8 @@ android {
|
||||
applicationId = "solutions.tretter.githugandroid"
|
||||
minSdk = 26
|
||||
targetSdk = 35
|
||||
versionCode = 134
|
||||
versionName = "0.1.133"
|
||||
versionCode = 135
|
||||
versionName = "0.1.134"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
|
||||
@@ -46,12 +46,10 @@ internal fun HelpCalloutOverlay(
|
||||
onShowHelpOnStartChange: (Boolean) -> Unit,
|
||||
onOk: () -> Unit,
|
||||
onClose: () -> Unit,
|
||||
workspaceBounds: Rect?,
|
||||
exerciseBounds: Rect?,
|
||||
promptBounds: Rect?,
|
||||
) {
|
||||
val density = LocalDensity.current
|
||||
val workspaceTop = workspaceBounds?.top ?: 0f
|
||||
val insetPx = with(density) { 14.dp.roundToPx() }
|
||||
Box(modifier = Modifier.fillMaxSize()) {
|
||||
HelpBubble(
|
||||
@@ -60,7 +58,7 @@ internal fun HelpCalloutOverlay(
|
||||
Modifier.offset {
|
||||
IntOffset(
|
||||
x = insetPx,
|
||||
y = (bounds.top - workspaceTop - insetPx).roundToInt().coerceAtLeast(0),
|
||||
y = (bounds.top - insetPx).roundToInt().coerceAtLeast(0),
|
||||
)
|
||||
}
|
||||
} ?: Modifier
|
||||
@@ -73,7 +71,7 @@ internal fun HelpCalloutOverlay(
|
||||
Modifier.offset {
|
||||
IntOffset(
|
||||
x = insetPx,
|
||||
y = (bounds.top - workspaceTop - bubbleHeight).roundToInt().coerceAtLeast(0),
|
||||
y = (bounds.top - bubbleHeight).roundToInt().coerceAtLeast(0),
|
||||
)
|
||||
}
|
||||
} ?: Modifier
|
||||
|
||||
@@ -21,6 +21,7 @@ import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.geometry.Rect
|
||||
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.input.TextFieldValue
|
||||
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.launch
|
||||
|
||||
@@ -74,10 +73,9 @@ fun GitHugApp() {
|
||||
var solvedCelebrationTitle by remember { mutableStateOf<String?>(null) }
|
||||
var showTerminalInputHint by remember { mutableStateOf(true) }
|
||||
var showExerciseDescriptionHint by remember { mutableStateOf(true) }
|
||||
var showHelpOverlay by remember { mutableStateOf(false) }
|
||||
var showHelpOnStart by remember { mutableStateOf(true) }
|
||||
var helpPreferenceInitialized by remember { mutableStateOf(false) }
|
||||
var workspaceBounds by remember { mutableStateOf<Rect?>(null) }
|
||||
var showHelpOverlay by rememberSaveable { mutableStateOf(false) }
|
||||
var showHelpOnStart by rememberSaveable { mutableStateOf(true) }
|
||||
var helpPreferenceInitialized by rememberSaveable { mutableStateOf(false) }
|
||||
var exerciseBounds by remember { mutableStateOf<Rect?>(null) }
|
||||
var promptBounds by remember { mutableStateOf<Rect?>(null) }
|
||||
val currentLevel = levels[currentLevelIndex]
|
||||
@@ -480,9 +478,7 @@ fun GitHugApp() {
|
||||
) {
|
||||
FixedHeader()
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.onGloballyPositioned { workspaceBounds = it.boundsInRoot() },
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
) {
|
||||
PaneWorkspace(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
@@ -570,22 +566,21 @@ fun GitHugApp() {
|
||||
)
|
||||
},
|
||||
)
|
||||
if (showHelpOverlay) {
|
||||
HelpCalloutOverlay(
|
||||
showHelpOnStart = showHelpOnStart,
|
||||
onShowHelpOnStartChange = { showHelpOnStart = it },
|
||||
onOk = {
|
||||
showHelpOverlay = false
|
||||
scope.launch { gameProgressStore.saveShowHelpOnStart(showHelpOnStart) }
|
||||
},
|
||||
onClose = { showHelpOverlay = false },
|
||||
workspaceBounds = workspaceBounds,
|
||||
exerciseBounds = exerciseBounds,
|
||||
promptBounds = promptBounds,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (showHelpOverlay) {
|
||||
HelpCalloutOverlay(
|
||||
showHelpOnStart = showHelpOnStart,
|
||||
onShowHelpOnStartChange = { showHelpOnStart = it },
|
||||
onOk = {
|
||||
showHelpOverlay = false
|
||||
scope.launch { gameProgressStore.saveShowHelpOnStart(showHelpOnStart) }
|
||||
},
|
||||
onClose = { showHelpOverlay = false },
|
||||
exerciseBounds = exerciseBounds,
|
||||
promptBounds = promptBounds,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user