Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f0f556e82 | ||
|
|
2a4b5f54a8 | ||
|
|
31a1f5158f |
No files matched your search
@@ -1,5 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## [1.4.1] - 2026-10-30
|
||||
### New
|
||||
* about screen
|
||||
|
||||
## [1.4.0] - 2026-10-30
|
||||
### New
|
||||
* settings
|
||||
|
||||
@@ -95,4 +95,5 @@ dependencies {
|
||||
implementation(libs.androidx.material.icons.extended)
|
||||
implementation("androidx.core:core-splashscreen:1.0.1")
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.7")
|
||||
implementation("androidx.navigation:navigation-compose:2.8.5")
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import androidx.activity.enableEdgeToEdge
|
||||
import androidx.compose.foundation.isSystemInDarkTheme
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Home
|
||||
import androidx.compose.material.icons.filled.List
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
@@ -20,15 +21,25 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import de.schanbro.weekfocus.ui.theme.WeekFocusTheme
|
||||
import androidx.navigation.NavGraph.Companion.findStartDestination
|
||||
import androidx.navigation.compose.*
|
||||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import de.schanbro.weekfocus.screens.AboutScreen
|
||||
import de.schanbro.weekfocus.screens.SettingsScreen
|
||||
import de.schanbro.weekfocus.screens.WordListScreen
|
||||
import de.schanbro.weekfocus.settings.SettingsRepository
|
||||
import de.schanbro.weekfocus.settings.ThemeMode
|
||||
import de.schanbro.weekfocus.ui.theme.WeekFocusTheme
|
||||
import de.schanbro.weekfocus.update.NetworkPermissionGate
|
||||
import de.schanbro.weekfocus.update.UpdateHandler
|
||||
|
||||
private object Routes {
|
||||
const val HOME = "home"
|
||||
const val WORDS = "words"
|
||||
const val SETTINGS = "settings"
|
||||
const val ABOUT = "about"
|
||||
}
|
||||
|
||||
class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
installSplashScreen()
|
||||
@@ -53,8 +64,6 @@ class MainActivity : ComponentActivity() {
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
// Falls das Widget (z.B. durch Energiesparmodus) nicht rechtzeitig aktualisiert
|
||||
// wurde, wird es beim Öffnen der App nachgezogen.
|
||||
updateWidget(this)
|
||||
}
|
||||
}
|
||||
@@ -62,7 +71,9 @@ class MainActivity : ComponentActivity() {
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun MainScreen() {
|
||||
var selectedTab by remember { mutableIntStateOf(0) }
|
||||
val navController = rememberNavController()
|
||||
val backStackEntry by navController.currentBackStackEntryAsState()
|
||||
val currentRoute = backStackEntry?.destination?.route
|
||||
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
|
||||
|
||||
Scaffold(
|
||||
@@ -73,14 +84,25 @@ fun MainScreen() {
|
||||
LargeTopAppBar(
|
||||
title = {
|
||||
Text(
|
||||
when (selectedTab) {
|
||||
0 -> stringResource(R.string.title_home)
|
||||
1 -> stringResource(R.string.title_words)
|
||||
2 -> stringResource(R.string.title_settings)
|
||||
when (currentRoute) {
|
||||
Routes.HOME -> stringResource(R.string.title_weekly_focus)
|
||||
Routes.WORDS -> stringResource(R.string.title_words)
|
||||
Routes.SETTINGS -> stringResource(R.string.title_settings)
|
||||
Routes.ABOUT -> stringResource(R.string.title_about)
|
||||
else -> stringResource(R.string.app_name)
|
||||
}
|
||||
)
|
||||
},
|
||||
navigationIcon = {
|
||||
if (currentRoute == Routes.ABOUT) {
|
||||
IconButton(onClick = { navController.popBackStack() }) {
|
||||
Icon(
|
||||
Icons.AutoMirrored.Filled.ArrowBack,
|
||||
contentDescription = stringResource(R.string.action_back)
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
scrollBehavior = scrollBehavior,
|
||||
colors = TopAppBarDefaults.largeTopAppBarColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface,
|
||||
@@ -89,40 +111,66 @@ fun MainScreen() {
|
||||
)
|
||||
},
|
||||
bottomBar = {
|
||||
NavigationBar {
|
||||
NavigationBarItem(
|
||||
selected = selectedTab == 0,
|
||||
onClick = { selectedTab = 0 },
|
||||
icon = {
|
||||
Icon(
|
||||
imageVector = if (selectedTab == 0) Icons.Filled.Home else Icons.Outlined.Home,
|
||||
contentDescription = stringResource(R.string.title_home)
|
||||
)
|
||||
},
|
||||
label = { Text(stringResource(R.string.title_home)) }
|
||||
)
|
||||
NavigationBarItem(
|
||||
selected = selectedTab == 1,
|
||||
onClick = { selectedTab = 1 },
|
||||
icon = {
|
||||
Icon(
|
||||
imageVector = if (selectedTab == 1) Icons.Filled.List else Icons.Outlined.List,
|
||||
contentDescription = stringResource(R.string.title_words)
|
||||
)
|
||||
},
|
||||
label = { Text(stringResource(R.string.title_words)) }
|
||||
)
|
||||
NavigationBarItem(
|
||||
selected = selectedTab == 2,
|
||||
onClick = { selectedTab = 2 },
|
||||
icon = {
|
||||
Icon(
|
||||
imageVector = if (selectedTab == 2) Icons.Filled.Settings else Icons.Outlined.Settings,
|
||||
contentDescription = stringResource(R.string.title_settings)
|
||||
)
|
||||
},
|
||||
label = { Text(stringResource(R.string.title_settings)) }
|
||||
)
|
||||
if (currentRoute != Routes.ABOUT) {
|
||||
NavigationBar {
|
||||
NavigationBarItem(
|
||||
selected = currentRoute == Routes.HOME,
|
||||
onClick = {
|
||||
navController.navigate(Routes.HOME) {
|
||||
popUpTo(navController.graph.findStartDestination().id) {
|
||||
saveState = true
|
||||
}
|
||||
launchSingleTop = true
|
||||
restoreState = true
|
||||
}
|
||||
},
|
||||
icon = {
|
||||
Icon(
|
||||
imageVector = if (currentRoute == Routes.HOME) Icons.Filled.Home else Icons.Outlined.Home,
|
||||
contentDescription = stringResource(R.string.title_home)
|
||||
)
|
||||
},
|
||||
label = { Text(stringResource(R.string.title_home)) }
|
||||
)
|
||||
NavigationBarItem(
|
||||
selected = currentRoute == Routes.WORDS,
|
||||
onClick = {
|
||||
navController.navigate(Routes.WORDS) {
|
||||
popUpTo(navController.graph.findStartDestination().id) {
|
||||
saveState = true
|
||||
}
|
||||
launchSingleTop = true
|
||||
restoreState = true
|
||||
}
|
||||
},
|
||||
icon = {
|
||||
Icon(
|
||||
imageVector = if (currentRoute == Routes.WORDS) Icons.Filled.List else Icons.Outlined.List,
|
||||
contentDescription = stringResource(R.string.title_words)
|
||||
)
|
||||
},
|
||||
label = { Text(stringResource(R.string.title_words)) }
|
||||
)
|
||||
NavigationBarItem(
|
||||
selected = currentRoute == Routes.SETTINGS,
|
||||
onClick = {
|
||||
navController.navigate(Routes.SETTINGS) {
|
||||
popUpTo(navController.graph.findStartDestination().id) {
|
||||
saveState = true
|
||||
}
|
||||
launchSingleTop = true
|
||||
restoreState = true
|
||||
}
|
||||
},
|
||||
icon = {
|
||||
Icon(
|
||||
imageVector = if (currentRoute == Routes.SETTINGS) Icons.Filled.Settings else Icons.Outlined.Settings,
|
||||
contentDescription = stringResource(R.string.title_settings)
|
||||
)
|
||||
},
|
||||
label = { Text(stringResource(R.string.title_settings)) }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
) { innerPadding ->
|
||||
@@ -132,10 +180,17 @@ fun MainScreen() {
|
||||
.padding(innerPadding),
|
||||
color = MaterialTheme.colorScheme.background
|
||||
) {
|
||||
when (selectedTab) {
|
||||
0 -> PlaceholderScreen(title = stringResource(R.string.title_weekly_focus))
|
||||
1 -> WordListScreen()
|
||||
2 -> SettingsScreen()
|
||||
NavHost(
|
||||
navController = navController,
|
||||
startDestination = Routes.HOME,
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
composable(Routes.HOME) { PlaceholderScreen(title = stringResource(R.string.title_weekly_focus)) }
|
||||
composable(Routes.WORDS) { WordListScreen() }
|
||||
composable(Routes.SETTINGS) {
|
||||
SettingsScreen(onOpenAbout = { navController.navigate(Routes.ABOUT) })
|
||||
}
|
||||
composable(Routes.ABOUT) { AboutScreen() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -155,9 +210,6 @@ fun PlaceholderScreen(title: String) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bleibt als Top-Level-Funktion erhalten, damit WordListScreen unverändert weiter funktioniert.
|
||||
*/
|
||||
fun updateWidget(context: Context) {
|
||||
SimpleWidget.updateAllWidgets(context)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package de.schanbro.weekfocus.components
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.selection.toggleable
|
||||
import androidx.compose.material3.ListItem
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.semantics.Role
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
internal fun SectionTitle(text: String) {
|
||||
Text(
|
||||
text = text,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 16.dp, bottom = 4.dp)
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun SwitchRow(
|
||||
title: String,
|
||||
summary: String,
|
||||
checked: Boolean,
|
||||
onCheckedChange: (Boolean) -> Unit
|
||||
) {
|
||||
ListItem(
|
||||
headlineContent = { Text(title) },
|
||||
supportingContent = { Text(summary) },
|
||||
trailingContent = { Switch(checked = checked, onCheckedChange = null) },
|
||||
// Die ganze Zeile ist klickbar, der Switch selbst nur Anzeige (gut für TalkBack)
|
||||
modifier = Modifier.toggleable(
|
||||
value = checked,
|
||||
role = Role.Switch,
|
||||
onValueChange = onCheckedChange
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun ClickRow(
|
||||
title: String,
|
||||
summary: String,
|
||||
onClick: () -> Unit,
|
||||
trailing: (@Composable () -> Unit)? = null
|
||||
) {
|
||||
ListItem(
|
||||
headlineContent = { Text(title) },
|
||||
supportingContent = { Text(summary) },
|
||||
trailingContent = trailing,
|
||||
modifier = Modifier.clickable(onClick = onClick)
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package de.schanbro.weekfocus.screens
|
||||
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.LocalUriHandler
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import de.schanbro.weekfocus.R
|
||||
import de.schanbro.weekfocus.components.ClickRow
|
||||
import de.schanbro.weekfocus.components.SectionTitle
|
||||
import de.schanbro.weekfocus.update.UpdateChecker
|
||||
|
||||
private const val REPO_URL = "https://git.schamagusa.de/robin/WeekFocus"
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun AboutScreen(
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val uriHandler = LocalUriHandler.current
|
||||
val version = remember { UpdateChecker.currentVersion(context) }
|
||||
|
||||
Column(modifier = modifier.fillMaxSize()) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.verticalScroll(rememberScrollState())
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 24.dp, vertical = 32.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.app_name),
|
||||
style = MaterialTheme.typography.headlineMedium
|
||||
)
|
||||
Spacer(Modifier.height(4.dp))
|
||||
Text(
|
||||
text = stringResource(R.string.about_version, version),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
Spacer(Modifier.height(16.dp))
|
||||
Text(
|
||||
text = stringResource(R.string.about_description),
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
|
||||
HorizontalDivider()
|
||||
|
||||
SectionTitle(stringResource(R.string.about_section_links))
|
||||
|
||||
ClickRow(
|
||||
title = stringResource(R.string.settings_source_title),
|
||||
summary = stringResource(R.string.settings_source_summary),
|
||||
onClick = { uriHandler.openUri(REPO_URL) }
|
||||
)
|
||||
ClickRow(
|
||||
title = stringResource(R.string.about_issues_title),
|
||||
summary = stringResource(R.string.about_issues_summary),
|
||||
onClick = { uriHandler.openUri("$REPO_URL/issues") }
|
||||
)
|
||||
ClickRow(
|
||||
title = stringResource(R.string.about_releases_title),
|
||||
summary = stringResource(R.string.about_releases_summary),
|
||||
onClick = { uriHandler.openUri("$REPO_URL/releases") }
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(16.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,9 @@ import de.schanbro.weekfocus.update.ReleaseInfo
|
||||
import de.schanbro.weekfocus.update.UpdateChecker
|
||||
import de.schanbro.weekfocus.update.UpdateDialog
|
||||
import kotlinx.coroutines.launch
|
||||
import de.schanbro.weekfocus.components.SectionTitle
|
||||
import de.schanbro.weekfocus.components.ClickRow
|
||||
import de.schanbro.weekfocus.components.SwitchRow
|
||||
|
||||
private const val REPO_URL = "https://git.schamagusa.de/robin/WeekFocus"
|
||||
|
||||
@@ -34,7 +37,10 @@ private enum class CheckStatus { IDLE, CHECKING, UP_TO_DATE, FAILED, AVAILABLE }
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun SettingsScreen(modifier: Modifier = Modifier) {
|
||||
fun SettingsScreen(
|
||||
modifier: Modifier = Modifier,
|
||||
onOpenAbout: () -> Unit
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
val settings = remember { SettingsRepository.get(context) }
|
||||
val haptic = LocalHapticFeedback.current
|
||||
@@ -170,15 +176,10 @@ fun SettingsScreen(modifier: Modifier = Modifier) {
|
||||
// ---------- Info ----------
|
||||
SectionTitle(stringResource(R.string.settings_section_about))
|
||||
|
||||
ListItem(
|
||||
headlineContent = { Text(stringResource(R.string.settings_version_title)) },
|
||||
supportingContent = { Text(currentVersion) }
|
||||
)
|
||||
|
||||
ClickRow(
|
||||
title = stringResource(R.string.settings_source_title),
|
||||
summary = stringResource(R.string.settings_source_summary),
|
||||
onClick = { uriHandler.openUri(REPO_URL) }
|
||||
title = stringResource(R.string.title_about),
|
||||
summary = stringResource(R.string.settings_about_summary),
|
||||
onClick = onOpenAbout
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(16.dp))
|
||||
@@ -188,49 +189,4 @@ fun SettingsScreen(modifier: Modifier = Modifier) {
|
||||
availableRelease?.let { info ->
|
||||
UpdateDialog(info = info, onDismiss = { availableRelease = null })
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SectionTitle(text: String) {
|
||||
Text(
|
||||
text = text,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.primary,
|
||||
modifier = Modifier.padding(start = 16.dp, end = 16.dp, top = 16.dp, bottom = 4.dp)
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun SwitchRow(
|
||||
title: String,
|
||||
summary: String,
|
||||
checked: Boolean,
|
||||
onCheckedChange: (Boolean) -> Unit
|
||||
) {
|
||||
ListItem(
|
||||
headlineContent = { Text(title) },
|
||||
supportingContent = { Text(summary) },
|
||||
trailingContent = { Switch(checked = checked, onCheckedChange = null) },
|
||||
// Die ganze Zeile ist klickbar, der Switch selbst nur Anzeige (gut für TalkBack)
|
||||
modifier = Modifier.toggleable(
|
||||
value = checked,
|
||||
role = Role.Switch,
|
||||
onValueChange = onCheckedChange
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ClickRow(
|
||||
title: String,
|
||||
summary: String,
|
||||
onClick: () -> Unit,
|
||||
trailing: (@Composable () -> Unit)? = null
|
||||
) {
|
||||
ListItem(
|
||||
headlineContent = { Text(title) },
|
||||
supportingContent = { Text(summary) },
|
||||
trailingContent = trailing,
|
||||
modifier = Modifier.clickable(onClick = onClick)
|
||||
)
|
||||
}
|
||||
@@ -53,4 +53,15 @@
|
||||
<string name="settings_version_title">Version</string>
|
||||
<string name="settings_source_title">Source code</string>
|
||||
<string name="settings_source_summary">Open repository on Gitea</string>
|
||||
|
||||
<string name="action_back">Back</string>
|
||||
<string name="settings_about_summary">Version, source code and more</string>
|
||||
|
||||
<string name="about_version">Version %1$s</string>
|
||||
<string name="about_description">Keep your words of the week in view, right on your home screen.</string>
|
||||
<string name="about_section_links">Links</string>
|
||||
<string name="about_issues_title">Report a problem</string>
|
||||
<string name="about_issues_summary">Bugs and requests in the issue tracker</string>
|
||||
<string name="about_releases_title">Releases</string>
|
||||
<string name="about_releases_summary">See all releases and changes</string>
|
||||
</resources>
|
||||
@@ -9,6 +9,7 @@
|
||||
<string name="title_settings">Einstellungen</string>
|
||||
<string name="title_words">Wörter</string>
|
||||
<string name="title_home">Start</string>
|
||||
<string name="title_about">Über</string>
|
||||
|
||||
<!-- Aktionen -->
|
||||
<string name="action_delete">Löschen</string>
|
||||
@@ -59,4 +60,15 @@
|
||||
<string name="settings_version_title">Version</string>
|
||||
<string name="settings_source_title">Quellcode</string>
|
||||
<string name="settings_source_summary">Repository auf Gitea öffnen</string>
|
||||
|
||||
<string name="action_back">Zurück</string>
|
||||
<string name="settings_about_summary">Version, Quellcode und mehr</string>
|
||||
|
||||
<string name="about_version">Version %1$s</string>
|
||||
<string name="about_description">Behalte deine Wörter der Woche im Blick, direkt auf dem Startbildschirm.</string>
|
||||
<string name="about_section_links">Links</string>
|
||||
<string name="about_issues_title">Fehler melden</string>
|
||||
<string name="about_issues_summary">Probleme und Wünsche im Issue-Tracker</string>
|
||||
<string name="about_releases_title">Versionen</string>
|
||||
<string name="about_releases_summary">Alle Releases und Änderungen ansehen</string>
|
||||
</resources>
|
||||
Reference in new issue
Block a user