From bf3899d04a50b77ad05e79b3317ac23ca2581183 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 22 Dec 2023 09:23:00 -0500 Subject: [PATCH] Whoops, accidentally made the create backup button unusable before --- .../more/onboarding/GuidesStep.kt | 1 + .../screen/data/CreateBackupScreen.kt | 92 ++++++++++--------- 2 files changed, 50 insertions(+), 43 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/more/onboarding/GuidesStep.kt b/app/src/main/java/eu/kanade/presentation/more/onboarding/GuidesStep.kt index 77e0e7b88..d1ac967fa 100644 --- a/app/src/main/java/eu/kanade/presentation/more/onboarding/GuidesStep.kt +++ b/app/src/main/java/eu/kanade/presentation/more/onboarding/GuidesStep.kt @@ -20,6 +20,7 @@ import tachiyomi.presentation.core.i18n.stringResource internal class GuidesStep( private val onRestoreBackup: () -> Unit, ) : OnboardingStep { + override val isComplete: Boolean = true @Composable diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/CreateBackupScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/CreateBackupScreen.kt index 7fd166802..8ec5dc362 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/CreateBackupScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/CreateBackupScreen.kt @@ -6,6 +6,7 @@ import android.content.Intent import android.net.Uri import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding @@ -76,61 +77,66 @@ class CreateBackupScreen : Screen() { ) }, ) { contentPadding -> - LazyColumn( + Column( modifier = Modifier .padding(contentPadding) .fillMaxSize(), ) { - if (DeviceUtil.isMiui && DeviceUtil.isMiuiOptimizationDisabled()) { - item { - WarningBanner(MR.strings.restore_miui_warning) + LazyColumn( + modifier = Modifier.weight(1f), + ) { + if (DeviceUtil.isMiui && DeviceUtil.isMiuiOptimizationDisabled()) { + item { + WarningBanner(MR.strings.restore_miui_warning) + } } - } - item { - LabeledCheckbox( - label = stringResource(MR.strings.manga), - checked = true, - onCheckedChange = {}, - enabled = false, - modifier = Modifier.padding(horizontal = MaterialTheme.padding.medium), - ) - } - BackupChoices.forEach { (k, v) -> + item { LabeledCheckbox( - label = stringResource(v), - checked = state.flags.contains(k), - onCheckedChange = { - model.toggleFlag(k) - }, + label = stringResource(MR.strings.manga), + checked = true, + onCheckedChange = {}, + enabled = false, modifier = Modifier.padding(horizontal = MaterialTheme.padding.medium), ) } - } - } - - HorizontalDivider() - - Button( - modifier = Modifier - .padding(horizontal = 16.dp, vertical = 8.dp) - .fillMaxWidth(), - onClick = { - if (!BackupCreateJob.isManualJobRunning(context)) { - try { - chooseBackupDir.launch(Backup.getFilename()) - } catch (e: ActivityNotFoundException) { - context.toast(MR.strings.file_picker_error) + BackupChoices.forEach { (k, v) -> + item { + LabeledCheckbox( + label = stringResource(v), + checked = state.flags.contains(k), + onCheckedChange = { + model.toggleFlag(k) + }, + modifier = Modifier.padding(horizontal = MaterialTheme.padding.medium), + ) } - } else { - context.toast(MR.strings.backup_in_progress) } - }, - ) { - Text( - text = stringResource(MR.strings.action_create), - color = MaterialTheme.colorScheme.onPrimary, - ) + } + + HorizontalDivider() + + Button( + modifier = Modifier + .padding(horizontal = 16.dp, vertical = 8.dp) + .fillMaxWidth(), + onClick = { + if (!BackupCreateJob.isManualJobRunning(context)) { + try { + chooseBackupDir.launch(Backup.getFilename()) + } catch (e: ActivityNotFoundException) { + context.toast(MR.strings.file_picker_error) + } + } else { + context.toast(MR.strings.backup_in_progress) + } + }, + ) { + Text( + text = stringResource(MR.strings.action_create), + color = MaterialTheme.colorScheme.onPrimary, + ) + } } } }