feat: about screen
This commit is contained in:
1 parent
3aedc51b97
commit
31a1f5158f
7 files changed
+281
-104
No files matched your search
@@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user