Whoops, accidentally made the create backup button unusable before
This commit is contained in:
parent
dcf0379496
commit
bf3899d04a
2 changed files with 50 additions and 43 deletions
|
@ -20,6 +20,7 @@ import tachiyomi.presentation.core.i18n.stringResource
|
||||||
internal class GuidesStep(
|
internal class GuidesStep(
|
||||||
private val onRestoreBackup: () -> Unit,
|
private val onRestoreBackup: () -> Unit,
|
||||||
) : OnboardingStep {
|
) : OnboardingStep {
|
||||||
|
|
||||||
override val isComplete: Boolean = true
|
override val isComplete: Boolean = true
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
@ -76,61 +77,66 @@ class CreateBackupScreen : Screen() {
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
) { contentPadding ->
|
) { contentPadding ->
|
||||||
LazyColumn(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(contentPadding)
|
.padding(contentPadding)
|
||||||
.fillMaxSize(),
|
.fillMaxSize(),
|
||||||
) {
|
) {
|
||||||
if (DeviceUtil.isMiui && DeviceUtil.isMiuiOptimizationDisabled()) {
|
LazyColumn(
|
||||||
item {
|
modifier = Modifier.weight(1f),
|
||||||
WarningBanner(MR.strings.restore_miui_warning)
|
) {
|
||||||
|
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 {
|
item {
|
||||||
LabeledCheckbox(
|
LabeledCheckbox(
|
||||||
label = stringResource(v),
|
label = stringResource(MR.strings.manga),
|
||||||
checked = state.flags.contains(k),
|
checked = true,
|
||||||
onCheckedChange = {
|
onCheckedChange = {},
|
||||||
model.toggleFlag(k)
|
enabled = false,
|
||||||
},
|
|
||||||
modifier = Modifier.padding(horizontal = MaterialTheme.padding.medium),
|
modifier = Modifier.padding(horizontal = MaterialTheme.padding.medium),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
BackupChoices.forEach { (k, v) ->
|
||||||
}
|
item {
|
||||||
|
LabeledCheckbox(
|
||||||
HorizontalDivider()
|
label = stringResource(v),
|
||||||
|
checked = state.flags.contains(k),
|
||||||
Button(
|
onCheckedChange = {
|
||||||
modifier = Modifier
|
model.toggleFlag(k)
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp)
|
},
|
||||||
.fillMaxWidth(),
|
modifier = Modifier.padding(horizontal = MaterialTheme.padding.medium),
|
||||||
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(
|
HorizontalDivider()
|
||||||
text = stringResource(MR.strings.action_create),
|
|
||||||
color = MaterialTheme.colorScheme.onPrimary,
|
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,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue