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