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),
summary = appVersion,
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++
if (easterEggCounter >= 14) {
if (easterEggCounter >= 9) {
navController?.navigate("settings/about/easteregg")
easterEggCounter = 0
}

View File

@ -1,5 +1,6 @@
package de.mm20.launcher2.ui.settings.crashreporter
import androidx.compose.foundation.background
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Box
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.rounded.BugReport
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.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
@ -44,20 +49,11 @@ fun CrashReportScreen(fileName: String) {
}
) {
item {
Surface(
modifier = Modifier
.fillMaxWidth()
.padding(8.dp),
color = if (crashReport?.type == CrashReportType.Crash) {
MaterialTheme.colorScheme.errorContainer
} else {
MaterialTheme.colorScheme.primaryContainer
},
shape = MaterialTheme.shapes.small,
) {
Box(
modifier = Modifier
.fillMaxWidth()
.clip(MaterialTheme.shapes.medium)
.background(MaterialTheme.colorScheme.surface)
.horizontalScroll(
rememberScrollState()
),
@ -65,18 +61,23 @@ fun CrashReportScreen(fileName: String) {
crashReport?.stacktrace?.let {
Text(
text = it,
modifier = Modifier.padding(16.dp),
style = MaterialTheme.typography.bodySmall
modifier = Modifier.padding(12.dp),
style = MaterialTheme.typography.bodySmall,
color = if (crashReport?.type == CrashReportType.Crash) {
MaterialTheme.colorScheme.error
} else {
MaterialTheme.colorScheme.primary
},
)
}
}
}
}
item {
Column(
modifier = Modifier
.fillMaxWidth()
.padding(12.dp)
.background(MaterialTheme.colorScheme.surface, MaterialTheme.shapes.medium)
.padding(12.dp),
) {
Text(text = "Device Information", style = MaterialTheme.typography.titleMedium)
val deviceInformation = remember { viewModel.getDeviceInformation(context) }

View File

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

View File

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

View File

@ -239,13 +239,6 @@
<string name="notes_widget_dismissed">Note dismissed.</string>
<!-- Indicates to which app a shortcuts belongs. %1$s: the name of the app -->
<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! -->
<string name="easter_egg_text">Well, you found me. Congratulations. Was it worth it\?</string>
<!-- Close a dialog -->