make more things selectable

This commit is contained in:
Chloe committed 2026-02-25 01:59:39 -07:00
1 parent df0cebaa89
commit 9307c74df4
5 files changed
+68 -77

No files matched your search

@@ -18,6 +18,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
@@ -38,12 +39,10 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ClipEntry
import androidx.compose.ui.platform.LocalClipboard
import androidx.compose.ui.platform.LocalClipboardManager
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalResources
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.TextLinkStyles
@@ -180,33 +179,35 @@ fun ErrorInfoDescription(description: String, modifier: Modifier = Modifier) {
GamePackageUtils.getUnifiedVersionName(context.packageManager)
}
Column(modifier = modifier) {
Text(
stringResource(R.string.launcher_error_details),
style = Typography.headlineSmall
)
SelectionContainer {
Column(modifier = modifier) {
Text(
stringResource(R.string.launcher_error_details),
style = Typography.headlineSmall
)
Spacer(Modifier.size(8.dp))
Spacer(Modifier.size(8.dp))
Text(
description,
fontFamily = FontFamily.Monospace,
style = Typography.bodyMedium
)
Text(
description,
fontFamily = FontFamily.Monospace,
style = Typography.bodyMedium
)
Spacer(Modifier.size(4.dp))
Spacer(Modifier.size(4.dp))
Text(
stringResource(R.string.launcher_error_device_info,
Build.MODEL,
Build.VERSION.RELEASE,
currentRelease ?: "unknown",
gameVersion,
LaunchUtils.applicationArchitecture,
BuildConfig.VERSION_NAME
),
style = Typography.labelMedium
)
Text(
stringResource(R.string.launcher_error_device_info,
Build.MODEL,
Build.VERSION.RELEASE,
currentRelease ?: "unknown",
gameVersion,
LaunchUtils.applicationArchitecture,
BuildConfig.VERSION_NAME
),
style = Typography.labelMedium
)
}
}
}
@@ -1,6 +1,5 @@
package com.geode.launcher.preferences
import android.content.ClipData
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
@@ -9,7 +8,6 @@ import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
@@ -18,6 +16,7 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material3.DropdownMenu
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
@@ -42,13 +41,8 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.platform.ClipEntry
import androidx.compose.ui.platform.LocalClipboard
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.platform.LocalResources
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
@@ -144,46 +138,24 @@ fun SelectLogLevelDialog(
@Composable
fun LogCard(logLine: LogLine, modifier: Modifier = Modifier) {
val haptics = LocalHapticFeedback.current
val clipboard = LocalClipboard.current
val resources = LocalResources.current
SelectionContainer {
Column(
modifier = modifier
.padding(8.dp)
) {
Text(
"[${logLine.priority.toChar()}] ${logLine.formattedTime}",
style = Typography.labelSmall,
color = getLogColor(logLine.priority),
fontFamily = robotoMonoFamily
)
val coroutineScope = rememberCoroutineScope()
Column(
modifier = modifier
.padding(8.dp)
.pointerInput(Unit) {
detectTapGestures(
onLongPress = {
haptics.performHapticFeedback(HapticFeedbackType.LongPress)
val clipboardLabel = resources.getString(R.string.application_log_copy_label)
val clipboardData = logLine.asSimpleString
coroutineScope.launch {
clipboard.setClipEntry(
ClipEntry(ClipData.newPlainText(
clipboardLabel, clipboardData
))
)
}
}
)
},
) {
Text(
"[${logLine.priority.toChar()}] ${logLine.formattedTime}",
style = Typography.labelSmall,
color = getLogColor(logLine.priority),
fontFamily = robotoMonoFamily
)
Text(
"[${logLine.tag}]: ${logLine.messageTrimmed}",
fontFamily = robotoMonoFamily,
style = Typography.bodyMedium
)
Text(
"[${logLine.tag}]: ${logLine.messageTrimmed}",
fontFamily = robotoMonoFamily,
style = Typography.bodyMedium
)
}
}
}
@@ -28,6 +28,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.CircularProgressIndicator
@@ -165,12 +166,14 @@ fun UpdateErrorDialog(
},
title = { Text(stringResource(R.string.preference_check_for_updates_help_title)) },
text = {
Text(
error.stackTraceToString(),
fontFamily = robotoMonoFamily,
style = Typography.bodyMedium,
modifier = Modifier.verticalScroll(rememberScrollState())
)
SelectionContainer {
Text(
error.stackTraceToString(),
fontFamily = robotoMonoFamily,
style = Typography.bodyMedium,
modifier = Modifier.verticalScroll(rememberScrollState())
)
}
},
dismissButton = {
TextButton(onClick = {
@@ -80,6 +80,11 @@ object LaunchUtils {
return File(base, "game/geode/crashlogs/")
}
fun getGeodeLogsDirectory(context: Context): File {
val base = getBaseDirectory(context)
return File(base, "game/geode/logs/")
}
fun getLastCrash(context: Context): File? {
val crashDirectory = getCrashDirectory(context)
if (!crashDirectory.exists()) {