feat(settings): 设置页新增 Project Wiki 入口(fork 增量功能与用法说明)

This commit is contained in:
atsunatsu committed 2026-09-29 01:11:16 +08:00
1 parent 95d2d792cc
commit 2110bf0cd6
4 files changed
+164

No files matched your search

@@ -0,0 +1,113 @@
/*
* Look4Sat. Amateur radio satellite tracker and pass predictor.
* Copyright (C) 2019-2026 Arty Bishop and contributors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.rtbishop.look4sat.feature.settings
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.rtbishop.look4sat.core.presentation.R
import com.rtbishop.look4sat.core.presentation.sheetDialogContainerColor
import com.rtbishop.look4sat.core.presentation.sheetDialogShape
import com.rtbishop.look4sat.core.presentation.SheetDialogTitle
/**
* The fork's Project Wiki: a short overview of what Look4Sat-BA7OPF adds over upstream
* and how to use those features. Shown in the update-checker screen and behind the
* Settings → Project Wiki entry. Text lives in string resources (no release-body parsing),
* so it always renders even when the GitHub page is unreachable.
*/
@Composable
fun ProjectWikiBody(modifier: Modifier = Modifier) {
Column(modifier = modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(
text = stringResource(R.string.project_wiki_intro),
fontSize = 13.sp
)
WikiSection(stringResource(R.string.project_wiki_section_logbook))
WikiEntry(stringResource(R.string.project_wiki_logbook_1))
WikiEntry(stringResource(R.string.project_wiki_logbook_2))
WikiEntry(stringResource(R.string.project_wiki_logbook_3))
WikiHow(stringResource(R.string.project_wiki_logbook_how))
WikiSection(stringResource(R.string.project_wiki_section_mutual))
WikiEntry(stringResource(R.string.project_wiki_mutual_1))
WikiHow(stringResource(R.string.project_wiki_mutual_how))
WikiSection(stringResource(R.string.project_wiki_section_grids))
WikiEntry(stringResource(R.string.project_wiki_grids_1))
WikiHow(stringResource(R.string.project_wiki_grids_how))
}
}
@Composable
fun ProjectWikiDialog(onDismiss: () -> Unit) {
AlertDialog(
onDismissRequest = onDismiss,
shape = sheetDialogShape(),
containerColor = sheetDialogContainerColor(),
title = { SheetDialogTitle(stringResource(R.string.prefs_project_wiki)) },
text = {
ProjectWikiBody(
modifier = Modifier
.fillMaxWidth()
.verticalScroll(rememberScrollState())
)
},
confirmButton = {
TextButton(onClick = onDismiss) {
Text(stringResource(android.R.string.ok))
}
}
)
}
@Composable
private fun WikiSection(text: String) {
Text(
text = text,
color = MaterialTheme.colorScheme.primary,
fontWeight = FontWeight.Medium,
fontSize = 13.sp
)
}
@Composable
private fun WikiEntry(text: String) {
Text(text = text, fontSize = 12.sp)
}
@Composable
private fun WikiHow(text: String) {
Text(
text = text,
fontSize = 12.sp,
color = MaterialTheme.colorScheme.onSurfaceVariant,
modifier = Modifier.padding(start = 8.dp)
)
}
@@ -101,6 +101,10 @@ fun SettingsDestination() {
private fun SettingsScreen(uiState: SettingsState, onAction: (SettingsAction) -> Unit) {
var showUpdateChecker by rememberSaveable { mutableStateOf(false) }
var showMapSettings by rememberSaveable { mutableStateOf(false) }
var showProjectWiki by rememberSaveable { mutableStateOf(false) }
if (showProjectWiki) {
ProjectWikiDialog(onDismiss = { showProjectWiki = false })
}
if (showUpdateChecker) {
UpdateCheckerScreen(
currentVersion = uiState.appVersionName,
@@ -421,6 +425,7 @@ private fun SettingsScreen(uiState: SettingsState, onAction: (SettingsAction) ->
)
}
item { MapSettingsCard(onClick = { showMapSettings = true }) }
item { ProjectWikiCard(onClick = { showProjectWiki = true }) }
item { CardCredits() }
item(span = { GridItemSpan(maxLineSpan) }) {
CardButton(
@@ -852,6 +857,26 @@ private fun UpdateIndicator(isUpdating: Boolean, modifier: Modifier = Modifier)
)
}
@Composable
private fun ProjectWikiCard(onClick: () -> Unit, modifier: Modifier = Modifier) {
ElevatedCard(modifier = modifier) {
Row(
horizontalArrangement = Arrangement.spacedBy(12.dp),
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.height(48.dp)
.clickable { onClick() }) {
Spacer(Modifier)
Icon(painter = painterResource(id = R.drawable.ic_policy), contentDescription = null)
Text(
text = stringResource(R.string.prefs_project_wiki),
fontSize = 16.sp,
fontWeight = FontWeight.Medium
)
}
}
}
@Preview(showBackground = true)
@Composable
private fun CardCreditsPreview() = MainTheme { CardCredits() }