Allow scrolling in restore confirmation dialog

Fixes #9460
This commit is contained in:
arkon 2023-05-06 12:18:52 -04:00
parent f0dd33ee4c
commit 2f5eb73d29

View file

@ -10,11 +10,14 @@ import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.StringRes
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Checkbox
import androidx.compose.material3.MaterialTheme
@ -255,18 +258,30 @@ object SettingsBackupScreen : SearchableSettings {
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.pref_restore_backup)) },
text = {
val msg = buildString {
append(stringResource(R.string.backup_restore_content_full))
if (err.sources.isNotEmpty()) {
append("\n\n").append(stringResource(R.string.backup_restore_missing_sources))
err.sources.joinTo(this, separator = "\n- ", prefix = "\n- ")
}
if (err.trackers.isNotEmpty()) {
append("\n\n").append(stringResource(R.string.backup_restore_missing_trackers))
err.trackers.joinTo(this, separator = "\n- ", prefix = "\n- ")
Column(
modifier = Modifier.verticalScroll(rememberScrollState()),
) {
val msg = buildString {
append(stringResource(R.string.backup_restore_content_full))
if (err.sources.isNotEmpty()) {
append("\n\n").append(stringResource(R.string.backup_restore_missing_sources))
err.sources.joinTo(
this,
separator = "\n- ",
prefix = "\n- ",
)
}
if (err.trackers.isNotEmpty()) {
append("\n\n").append(stringResource(R.string.backup_restore_missing_trackers))
err.trackers.joinTo(
this,
separator = "\n- ",
prefix = "\n- ",
)
}
}
Text(text = msg)
}
Text(text = msg)
},
confirmButton = {
TextButton(
@ -327,7 +342,7 @@ object SettingsBackupScreen : SearchableSettings {
}
@Composable
fun getAutomaticBackupGroup(
private fun getAutomaticBackupGroup(
backupPreferences: BackupPreferences,
): Preference.PreferenceGroup {
val context = LocalContext.current
@ -402,7 +417,7 @@ private data class MissingRestoreComponents(
val trackers: List<String>,
)
data class InvalidRestore(
private data class InvalidRestore(
val uri: Uri,
val message: String,
)