more settings stuff

This commit is contained in:
MM20 2025-06-03 20:01:00 +02:00
parent c4ec894add
commit 28232a33b4
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
5 changed files with 37 additions and 53 deletions

View File

@ -43,13 +43,8 @@ fun AboutSettingsScreen() {
title = stringResource(R.string.preference_version), title = stringResource(R.string.preference_version),
summary = appVersion, summary = appVersion,
onClick = { onClick = {
when(easterEggCounter) {
3 -> Toast.makeText(context, context.getString(R.string.easter_egg_1), Toast.LENGTH_SHORT).show()
7 -> Toast.makeText(context, context.getString(R.string.easter_egg_2), Toast.LENGTH_SHORT).show()
11 -> Toast.makeText(context, context.getString(R.string.easter_egg_3), Toast.LENGTH_SHORT).show()
}
easterEggCounter++ easterEggCounter++
if (easterEggCounter >= 14) { if (easterEggCounter >= 9) {
navController?.navigate("settings/about/easteregg") navController?.navigate("settings/about/easteregg")
easterEggCounter = 0 easterEggCounter = 0
} }

View File

@ -1,5 +1,6 @@
package de.mm20.launcher2.ui.settings.crashreporter package de.mm20.launcher2.ui.settings.crashreporter
import androidx.compose.foundation.background
import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
@ -9,12 +10,16 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.BugReport import androidx.compose.material.icons.rounded.BugReport
import androidx.compose.material.icons.rounded.Share import androidx.compose.material.icons.rounded.Share
import androidx.compose.material3.* import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel import androidx.lifecycle.viewmodel.compose.viewModel
@ -44,31 +49,26 @@ fun CrashReportScreen(fileName: String) {
} }
) { ) {
item { item {
Surface( Box(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(8.dp), .clip(MaterialTheme.shapes.medium)
color = if (crashReport?.type == CrashReportType.Crash) { .background(MaterialTheme.colorScheme.surface)
MaterialTheme.colorScheme.errorContainer .horizontalScroll(
} else { rememberScrollState()
MaterialTheme.colorScheme.primaryContainer ),
},
shape = MaterialTheme.shapes.small,
) { ) {
Box( crashReport?.stacktrace?.let {
modifier = Modifier Text(
.fillMaxWidth() text = it,
.horizontalScroll( modifier = Modifier.padding(12.dp),
rememberScrollState() style = MaterialTheme.typography.bodySmall,
), color = if (crashReport?.type == CrashReportType.Crash) {
) { MaterialTheme.colorScheme.error
crashReport?.stacktrace?.let { } else {
Text( MaterialTheme.colorScheme.primary
text = it, },
modifier = Modifier.padding(16.dp), )
style = MaterialTheme.typography.bodySmall
)
}
} }
} }
} }
@ -76,7 +76,8 @@ fun CrashReportScreen(fileName: String) {
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.padding(12.dp) .background(MaterialTheme.colorScheme.surface, MaterialTheme.shapes.medium)
.padding(12.dp),
) { ) {
Text(text = "Device Information", style = MaterialTheme.typography.titleMedium) Text(text = "Device Information", style = MaterialTheme.typography.titleMedium)
val deviceInformation = remember { viewModel.getDeviceInformation(context) } val deviceInformation = remember { viewModel.getDeviceInformation(context) }

View File

@ -66,10 +66,8 @@ fun CrashReporterScreen() {
} }
} }
items(it) { items(it) {
OutlinedCard( Surface(
modifier = Modifier shape = MaterialTheme.shapes.medium,
.padding(vertical = 4.dp, horizontal = 8.dp)
,
) { ) {
Column( Column(
modifier = Modifier modifier = Modifier

View File

@ -142,27 +142,24 @@ fun LogScreen() {
items(lines) { items(lines) {
if (it is RawLogcatLine) { if (it is RawLogcatLine) {
Text( Text(
modifier = Modifier.padding(16.dp), modifier = Modifier
text = it.line ?: "", .fillMaxWidth()
.background(MaterialTheme.colorScheme.surface, MaterialTheme.shapes.medium)
.padding(16.dp),
text = it.line,
style = MaterialTheme.typography.bodySmall style = MaterialTheme.typography.bodySmall
) )
} else if (it is FormattedLogcatLine) { } else if (it is FormattedLogcatLine) {
val contentColor = when (it.level) { val contentColor = when (it.level) {
"E" -> MaterialTheme.colorScheme.onErrorContainer "E" -> MaterialTheme.colorScheme.error
"W" -> MaterialTheme.colorScheme.onPrimaryContainer "W" -> MaterialTheme.colorScheme.primary
"D" -> MaterialTheme.colorScheme.onSurfaceVariant "D" -> MaterialTheme.colorScheme.onSurfaceVariant
else -> MaterialTheme.colorScheme.onSurface else -> MaterialTheme.colorScheme.onSurface
} }
val bgColor = when (it.level) {
"E" -> MaterialTheme.colorScheme.errorContainer
"W" -> MaterialTheme.colorScheme.primaryContainer
"D" -> MaterialTheme.colorScheme.surfaceVariant
else -> MaterialTheme.colorScheme.surface
}
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
.background(bgColor) .background(MaterialTheme.colorScheme.surface, MaterialTheme.shapes.medium)
.padding(16.dp) .padding(16.dp)
) { ) {
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
@ -187,7 +184,7 @@ fun LogScreen() {
modifier = Modifier.padding(top = 8.dp), modifier = Modifier.padding(top = 8.dp),
text = it.message, text = it.message,
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodySmall,
color = contentColor color = MaterialTheme.colorScheme.onSurface,
) )
} }
} }

View File

@ -239,13 +239,6 @@
<string name="notes_widget_dismissed">Note dismissed.</string> <string name="notes_widget_dismissed">Note dismissed.</string>
<!-- Indicates to which app a shortcuts belongs. %1$s: the name of the app --> <!-- Indicates to which app a shortcuts belongs. %1$s: the name of the app -->
<string name="shortcut_summary">By %1$s</string> <string name="shortcut_summary">By %1$s</string>
<!-- Progress of the installation of another app. %1$s: the formatted percentage of the installation progress -->
<!-- Wait, we have easter eggs? No way! -->
<string name="easter_egg_1">There are no easter eggs here, unless you brought them with you.</string>
<!-- Wait, we have easter eggs? No way! -->
<string name="easter_egg_2">Please, stop it, you are wasting your time</string>
<!-- Wait, we have easter eggs? No way! -->
<string name="easter_egg_3">I won\'t say it again: there are absolutely no easter eggs hidden here</string>
<!-- Wait, we have easter eggs? No way! --> <!-- Wait, we have easter eggs? No way! -->
<string name="easter_egg_text">Well, you found me. Congratulations. Was it worth it\?</string> <string name="easter_egg_text">Well, you found me. Congratulations. Was it worth it\?</string>
<!-- Close a dialog --> <!-- Close a dialog -->