103 lines
3.7 KiB
Kotlin
103 lines
3.7 KiB
Kotlin
package de.waypointaudio.ui
|
|
|
|
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 de.waypointaudio.R
|
|
|
|
/**
|
|
* v2.5.9 — Erstmaliger Nutzungsbedingungen-/Lizenzhinweis-Dialog.
|
|
*
|
|
* Versioniert über [de.waypointaudio.data.TermsVersions.CURRENT];
|
|
* Zustimmung wird im [de.waypointaudio.data.TermsStore] persistiert.
|
|
* Ablehnen beendet die Activity — die App lässt sich nicht ohne
|
|
* Zustimmung verwenden.
|
|
*/
|
|
@Composable
|
|
fun TermsDialog(
|
|
onAccept: () -> Unit,
|
|
onDecline: () -> Unit
|
|
) {
|
|
AlertDialog(
|
|
onDismissRequest = { /* keine versehentliche Dismiss-Aktion */ },
|
|
title = {
|
|
Text(
|
|
text = stringResource(R.string.terms_dialog_title),
|
|
style = MaterialTheme.typography.headlineSmall
|
|
)
|
|
},
|
|
text = {
|
|
Column(
|
|
modifier = Modifier
|
|
.fillMaxWidth()
|
|
.verticalScroll(rememberScrollState())
|
|
.padding(vertical = 4.dp),
|
|
verticalArrangement = Arrangement.spacedBy(10.dp)
|
|
) {
|
|
Text(
|
|
text = stringResource(R.string.terms_dialog_intro),
|
|
style = MaterialTheme.typography.bodyMedium
|
|
)
|
|
|
|
Text(
|
|
text = stringResource(R.string.terms_dialog_license_heading),
|
|
style = MaterialTheme.typography.titleSmall,
|
|
fontWeight = FontWeight.SemiBold
|
|
)
|
|
Text(
|
|
text = stringResource(R.string.terms_dialog_license_body),
|
|
style = MaterialTheme.typography.bodySmall
|
|
)
|
|
|
|
Text(
|
|
text = stringResource(R.string.terms_dialog_commercial_heading),
|
|
style = MaterialTheme.typography.titleSmall,
|
|
fontWeight = FontWeight.SemiBold
|
|
)
|
|
Text(
|
|
text = stringResource(R.string.terms_dialog_commercial_body),
|
|
style = MaterialTheme.typography.bodySmall
|
|
)
|
|
|
|
Text(
|
|
text = stringResource(R.string.terms_dialog_liability_heading),
|
|
style = MaterialTheme.typography.titleSmall,
|
|
fontWeight = FontWeight.SemiBold
|
|
)
|
|
Text(
|
|
text = stringResource(R.string.terms_dialog_liability_body),
|
|
style = MaterialTheme.typography.bodySmall
|
|
)
|
|
|
|
Text(
|
|
text = stringResource(R.string.terms_dialog_version_label),
|
|
style = MaterialTheme.typography.labelSmall,
|
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f)
|
|
)
|
|
}
|
|
},
|
|
confirmButton = {
|
|
TextButton(onClick = onAccept) {
|
|
Text(stringResource(R.string.terms_dialog_accept))
|
|
}
|
|
},
|
|
dismissButton = {
|
|
TextButton(onClick = onDecline) {
|
|
Text(stringResource(R.string.terms_dialog_decline))
|
|
}
|
|
}
|
|
)
|
|
}
|