feat: improve updater dialog
This commit is contained in:
parent
ea8ab16c18
commit
b2219f078b
2 changed files with 27 additions and 7 deletions
|
|
@ -43,12 +43,12 @@ class MainActivity : ComponentActivity() {
|
|||
theme = preferences.theme,
|
||||
dynamicColor = preferences.dynamicColor,
|
||||
) {
|
||||
StoragePermissionsDialog()
|
||||
|
||||
if (!IS_CUSTOM_BUILD) {
|
||||
UpdaterDialog()
|
||||
}
|
||||
|
||||
StoragePermissionsDialog()
|
||||
|
||||
@OptIn(ExperimentalVoyagerApi::class)
|
||||
CompositionLocalProvider(
|
||||
LocalNavigatorSaver provides parcelableNavigatorSaver(),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import androidx.compose.foundation.layout.size
|
|||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
import com.aliucord.manager.R
|
||||
|
|
@ -18,7 +20,13 @@ fun UpdaterDialog(
|
|||
|
||||
AlertDialog(
|
||||
confirmButton = {
|
||||
Button(onClick = viewModel::triggerUpdate) {
|
||||
FilledTonalButton(
|
||||
onClick = viewModel::triggerUpdate,
|
||||
colors = ButtonDefaults.filledTonalButtonColors(
|
||||
containerColor = MaterialTheme.colorScheme.primary,
|
||||
contentColor = MaterialTheme.colorScheme.onPrimary,
|
||||
),
|
||||
) {
|
||||
if (!viewModel.isWorking) {
|
||||
Text(stringResource(R.string.action_update))
|
||||
} else {
|
||||
|
|
@ -32,7 +40,7 @@ fun UpdaterDialog(
|
|||
}
|
||||
},
|
||||
dismissButton = {
|
||||
Button(
|
||||
TextButton(
|
||||
onClick = viewModel::dismissDialog,
|
||||
enabled = !viewModel.isWorking
|
||||
) {
|
||||
|
|
@ -43,10 +51,22 @@ fun UpdaterDialog(
|
|||
title = {
|
||||
Text(stringResource(R.string.updater_title, viewModel.targetVersion ?: ""))
|
||||
},
|
||||
text = { Text(stringResource(R.string.updater_body)) },
|
||||
text = {
|
||||
Text(
|
||||
text = stringResource(R.string.updater_body),
|
||||
textAlign = TextAlign.Center,
|
||||
)
|
||||
},
|
||||
icon = {
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.ic_warning),
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(36.dp),
|
||||
)
|
||||
},
|
||||
properties = DialogProperties(
|
||||
dismissOnBackPress = false,
|
||||
dismissOnClickOutside = false
|
||||
)
|
||||
dismissOnClickOutside = false,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue