Compare commits
4
Commits
v1.4.0
...
168c3eeedc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
168c3eeedc | ||
|
|
1f0f556e82 | ||
|
|
2a4b5f54a8 | ||
|
|
31a1f5158f |
No files matched your search
@@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [1.4.1] - 2026-10-30
|
||||||
|
### New
|
||||||
|
* about screen
|
||||||
|
|
||||||
## [1.4.0] - 2026-10-30
|
## [1.4.0] - 2026-10-30
|
||||||
### New
|
### New
|
||||||
* settings
|
* settings
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
**One word. One week. One quality to grow.**
|
**One word. One week. One quality to grow.**
|
||||||
|
|
||||||
<a href="https://apps.obtainium.imranr.dev/redirect?r=obtainium://app/%7B%22id%22%3A%22de.schanbro.weekfocus%22%2C%22url%22%3A%22https%3A%2F%2Fgit.schamagusa.de%2FSchanbro%2FWeekFocus%22%2C%22author%22%3A%22Schanbro%22%2C%22name%22%3A%22WeekFocus%22%2C%22overrideSource%22%3A%22Codeberg%22%7D">
|
<a href="https://apps.obtainium.imranr.dev/redirect?r=obtainium://app/%7B%22id%22%3A%22de.schanbro.weekfocus%22%2C%22url%22%3A%22https%3A%2F%2Fgit.schamagusa.de%2Frobin%2FWeekFocus%22%2C%22author%22%3A%22robin%22%2C%22name%22%3A%22WeekFocus%22%2C%22overrideSource%22%3A%22Codeberg%22%7D">
|
||||||
<img src="https://raw.githubusercontent.com/ImranR98/Obtainium/main/assets/graphics/badge_obtainium.png" alt="Get it on Obtainium" height="64">
|
<img src="https://raw.githubusercontent.com/ImranR98/Obtainium/main/assets/graphics/badge_obtainium.png" alt="Get it on Obtainium" height="64">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
[](https://git.schamagusa.de/Schanbro/WeekFocus/releases)
|
[](https://git.schamagusa.de/robin/WeekFocus/releases)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
<!--[](https://weblate.schamagusa.de/engage/weekfocus/)-->
|
<!--[](https://weblate.schamagusa.de/engage/weekfocus/)-->
|
||||||
|
|
||||||
@@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
<!--[](https://git.schamagusa.de/Schanbro/WeekFocus)
|
<!--[](https://git.schamagusa.de/Schanbro/WeekFocus)
|
||||||
[](https://git.schamagusa.de/Schanbro/WeekFocus)-->
|
[](https://git.schamagusa.de/Schanbro/WeekFocus)-->
|
||||||
[](https://git.schamagusa.de/Schanbro/WeekFocus/issues)
|
[](https://git.schamagusa.de/robin/WeekFocus/issues)
|
||||||
[](https://git.schamagusa.de/Schanbro/WeekFocus)
|
[](https://git.schamagusa.de/robin/WeekFocus)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ https://git.schamagusa.de/Schanbro/WeekFocus
|
|||||||
|
|
||||||
### Manual APK Install
|
### Manual APK Install
|
||||||
|
|
||||||
1. Open the [Releases](https://git.schamagusa.de/Schanbro/WeekFocus/releases) page.
|
1. Open the [Releases](https://git.schamagusa.de/robin/WeekFocus/releases) page.
|
||||||
2. Download the latest `.apk` file.
|
2. Download the latest `.apk` file.
|
||||||
3. If prompted, allow installation from unknown sources, then install the APK.
|
3. If prompted, allow installation from unknown sources, then install the APK.
|
||||||
|
|
||||||
|
|||||||
@@ -95,4 +95,5 @@ dependencies {
|
|||||||
implementation(libs.androidx.material.icons.extended)
|
implementation(libs.androidx.material.icons.extended)
|
||||||
implementation("androidx.core:core-splashscreen:1.0.1")
|
implementation("androidx.core:core-splashscreen:1.0.1")
|
||||||
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.7")
|
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.isSystemInDarkTheme
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.icons.Icons
|
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.Home
|
||||||
import androidx.compose.material.icons.filled.List
|
import androidx.compose.material.icons.filled.List
|
||||||
import androidx.compose.material.icons.filled.Settings
|
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.Modifier
|
||||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
import androidx.compose.ui.res.stringResource
|
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 androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||||
|
import de.schanbro.weekfocus.screens.AboutScreen
|
||||||
import de.schanbro.weekfocus.screens.SettingsScreen
|
import de.schanbro.weekfocus.screens.SettingsScreen
|
||||||
import de.schanbro.weekfocus.screens.WordListScreen
|
import de.schanbro.weekfocus.screens.WordListScreen
|
||||||
import de.schanbro.weekfocus.settings.SettingsRepository
|
import de.schanbro.weekfocus.settings.SettingsRepository
|
||||||
import de.schanbro.weekfocus.settings.ThemeMode
|
import de.schanbro.weekfocus.settings.ThemeMode
|
||||||
|
import de.schanbro.weekfocus.ui.theme.WeekFocusTheme
|
||||||
import de.schanbro.weekfocus.update.NetworkPermissionGate
|
import de.schanbro.weekfocus.update.NetworkPermissionGate
|
||||||
import de.schanbro.weekfocus.update.UpdateHandler
|
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() {
|
class MainActivity : ComponentActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
installSplashScreen()
|
installSplashScreen()
|
||||||
@@ -53,8 +64,6 @@ class MainActivity : ComponentActivity() {
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
// Falls das Widget (z.B. durch Energiesparmodus) nicht rechtzeitig aktualisiert
|
|
||||||
// wurde, wird es beim Öffnen der App nachgezogen.
|
|
||||||
updateWidget(this)
|
updateWidget(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,7 +71,9 @@ class MainActivity : ComponentActivity() {
|
|||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun MainScreen() {
|
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()
|
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
@@ -73,14 +84,25 @@ fun MainScreen() {
|
|||||||
LargeTopAppBar(
|
LargeTopAppBar(
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
when (selectedTab) {
|
when (currentRoute) {
|
||||||
0 -> stringResource(R.string.title_home)
|
Routes.HOME -> stringResource(R.string.title_weekly_focus)
|
||||||
1 -> stringResource(R.string.title_words)
|
Routes.WORDS -> stringResource(R.string.title_words)
|
||||||
2 -> stringResource(R.string.title_settings)
|
Routes.SETTINGS -> stringResource(R.string.title_settings)
|
||||||
|
Routes.ABOUT -> stringResource(R.string.title_about)
|
||||||
else -> stringResource(R.string.app_name)
|
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,
|
scrollBehavior = scrollBehavior,
|
||||||
colors = TopAppBarDefaults.largeTopAppBarColors(
|
colors = TopAppBarDefaults.largeTopAppBarColors(
|
||||||
containerColor = MaterialTheme.colorScheme.surface,
|
containerColor = MaterialTheme.colorScheme.surface,
|
||||||
@@ -89,40 +111,66 @@ fun MainScreen() {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
bottomBar = {
|
bottomBar = {
|
||||||
NavigationBar {
|
if (currentRoute != Routes.ABOUT) {
|
||||||
NavigationBarItem(
|
NavigationBar {
|
||||||
selected = selectedTab == 0,
|
NavigationBarItem(
|
||||||
onClick = { selectedTab = 0 },
|
selected = currentRoute == Routes.HOME,
|
||||||
icon = {
|
onClick = {
|
||||||
Icon(
|
navController.navigate(Routes.HOME) {
|
||||||
imageVector = if (selectedTab == 0) Icons.Filled.Home else Icons.Outlined.Home,
|
popUpTo(navController.graph.findStartDestination().id) {
|
||||||
contentDescription = stringResource(R.string.title_home)
|
saveState = true
|
||||||
)
|
}
|
||||||
},
|
launchSingleTop = true
|
||||||
label = { Text(stringResource(R.string.title_home)) }
|
restoreState = true
|
||||||
)
|
}
|
||||||
NavigationBarItem(
|
},
|
||||||
selected = selectedTab == 1,
|
icon = {
|
||||||
onClick = { selectedTab = 1 },
|
Icon(
|
||||||
icon = {
|
imageVector = if (currentRoute == Routes.HOME) Icons.Filled.Home else Icons.Outlined.Home,
|
||||||
Icon(
|
contentDescription = stringResource(R.string.title_home)
|
||||||
imageVector = if (selectedTab == 1) Icons.Filled.List else Icons.Outlined.List,
|
)
|
||||||
contentDescription = stringResource(R.string.title_words)
|
},
|
||||||
)
|
label = { Text(stringResource(R.string.title_home)) }
|
||||||
},
|
)
|
||||||
label = { Text(stringResource(R.string.title_words)) }
|
NavigationBarItem(
|
||||||
)
|
selected = currentRoute == Routes.WORDS,
|
||||||
NavigationBarItem(
|
onClick = {
|
||||||
selected = selectedTab == 2,
|
navController.navigate(Routes.WORDS) {
|
||||||
onClick = { selectedTab = 2 },
|
popUpTo(navController.graph.findStartDestination().id) {
|
||||||
icon = {
|
saveState = true
|
||||||
Icon(
|
}
|
||||||
imageVector = if (selectedTab == 2) Icons.Filled.Settings else Icons.Outlined.Settings,
|
launchSingleTop = true
|
||||||
contentDescription = stringResource(R.string.title_settings)
|
restoreState = true
|
||||||
)
|
}
|
||||||
},
|
},
|
||||||
label = { Text(stringResource(R.string.title_settings)) }
|
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 ->
|
) { innerPadding ->
|
||||||
@@ -132,10 +180,17 @@ fun MainScreen() {
|
|||||||
.padding(innerPadding),
|
.padding(innerPadding),
|
||||||
color = MaterialTheme.colorScheme.background
|
color = MaterialTheme.colorScheme.background
|
||||||
) {
|
) {
|
||||||
when (selectedTab) {
|
NavHost(
|
||||||
0 -> PlaceholderScreen(title = stringResource(R.string.title_weekly_focus))
|
navController = navController,
|
||||||
1 -> WordListScreen()
|
startDestination = Routes.HOME,
|
||||||
2 -> SettingsScreen()
|
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) {
|
fun updateWidget(context: Context) {
|
||||||
SimpleWidget.updateAllWidgets(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.UpdateChecker
|
||||||
import de.schanbro.weekfocus.update.UpdateDialog
|
import de.schanbro.weekfocus.update.UpdateDialog
|
||||||
import kotlinx.coroutines.launch
|
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"
|
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)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun SettingsScreen(modifier: Modifier = Modifier) {
|
fun SettingsScreen(
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
|
onOpenAbout: () -> Unit
|
||||||
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val settings = remember { SettingsRepository.get(context) }
|
val settings = remember { SettingsRepository.get(context) }
|
||||||
val haptic = LocalHapticFeedback.current
|
val haptic = LocalHapticFeedback.current
|
||||||
@@ -170,15 +176,10 @@ fun SettingsScreen(modifier: Modifier = Modifier) {
|
|||||||
// ---------- Info ----------
|
// ---------- Info ----------
|
||||||
SectionTitle(stringResource(R.string.settings_section_about))
|
SectionTitle(stringResource(R.string.settings_section_about))
|
||||||
|
|
||||||
ListItem(
|
|
||||||
headlineContent = { Text(stringResource(R.string.settings_version_title)) },
|
|
||||||
supportingContent = { Text(currentVersion) }
|
|
||||||
)
|
|
||||||
|
|
||||||
ClickRow(
|
ClickRow(
|
||||||
title = stringResource(R.string.settings_source_title),
|
title = stringResource(R.string.title_about),
|
||||||
summary = stringResource(R.string.settings_source_summary),
|
summary = stringResource(R.string.settings_about_summary),
|
||||||
onClick = { uriHandler.openUri(REPO_URL) }
|
onClick = onOpenAbout
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(Modifier.height(16.dp))
|
Spacer(Modifier.height(16.dp))
|
||||||
@@ -189,48 +190,3 @@ fun SettingsScreen(modifier: Modifier = Modifier) {
|
|||||||
UpdateDialog(info = info, onDismiss = { availableRelease = null })
|
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_version_title">Version</string>
|
||||||
<string name="settings_source_title">Source code</string>
|
<string name="settings_source_title">Source code</string>
|
||||||
<string name="settings_source_summary">Open repository on Gitea</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>
|
</resources>
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
<string name="title_settings">Einstellungen</string>
|
<string name="title_settings">Einstellungen</string>
|
||||||
<string name="title_words">Wörter</string>
|
<string name="title_words">Wörter</string>
|
||||||
<string name="title_home">Start</string>
|
<string name="title_home">Start</string>
|
||||||
|
<string name="title_about">Über</string>
|
||||||
|
|
||||||
<!-- Aktionen -->
|
<!-- Aktionen -->
|
||||||
<string name="action_delete">Löschen</string>
|
<string name="action_delete">Löschen</string>
|
||||||
@@ -59,4 +60,15 @@
|
|||||||
<string name="settings_version_title">Version</string>
|
<string name="settings_version_title">Version</string>
|
||||||
<string name="settings_source_title">Quellcode</string>
|
<string name="settings_source_title">Quellcode</string>
|
||||||
<string name="settings_source_summary">Repository auf Gitea öffnen</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>
|
</resources>
|
||||||
Reference in new issue
Block a user