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,
|
theme = preferences.theme,
|
||||||
dynamicColor = preferences.dynamicColor,
|
dynamicColor = preferences.dynamicColor,
|
||||||
) {
|
) {
|
||||||
StoragePermissionsDialog()
|
|
||||||
|
|
||||||
if (!IS_CUSTOM_BUILD) {
|
if (!IS_CUSTOM_BUILD) {
|
||||||
UpdaterDialog()
|
UpdaterDialog()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StoragePermissionsDialog()
|
||||||
|
|
||||||
@OptIn(ExperimentalVoyagerApi::class)
|
@OptIn(ExperimentalVoyagerApi::class)
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
LocalNavigatorSaver provides parcelableNavigatorSaver(),
|
LocalNavigatorSaver provides parcelableNavigatorSaver(),
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.window.DialogProperties
|
import androidx.compose.ui.window.DialogProperties
|
||||||
import com.aliucord.manager.R
|
import com.aliucord.manager.R
|
||||||
|
|
@ -18,7 +20,13 @@ fun UpdaterDialog(
|
||||||
|
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
confirmButton = {
|
confirmButton = {
|
||||||
Button(onClick = viewModel::triggerUpdate) {
|
FilledTonalButton(
|
||||||
|
onClick = viewModel::triggerUpdate,
|
||||||
|
colors = ButtonDefaults.filledTonalButtonColors(
|
||||||
|
containerColor = MaterialTheme.colorScheme.primary,
|
||||||
|
contentColor = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
),
|
||||||
|
) {
|
||||||
if (!viewModel.isWorking) {
|
if (!viewModel.isWorking) {
|
||||||
Text(stringResource(R.string.action_update))
|
Text(stringResource(R.string.action_update))
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -32,7 +40,7 @@ fun UpdaterDialog(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dismissButton = {
|
dismissButton = {
|
||||||
Button(
|
TextButton(
|
||||||
onClick = viewModel::dismissDialog,
|
onClick = viewModel::dismissDialog,
|
||||||
enabled = !viewModel.isWorking
|
enabled = !viewModel.isWorking
|
||||||
) {
|
) {
|
||||||
|
|
@ -43,10 +51,22 @@ fun UpdaterDialog(
|
||||||
title = {
|
title = {
|
||||||
Text(stringResource(R.string.updater_title, viewModel.targetVersion ?: ""))
|
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(
|
properties = DialogProperties(
|
||||||
dismissOnBackPress = false,
|
dismissOnBackPress = false,
|
||||||
dismissOnClickOutside = false
|
dismissOnClickOutside = false,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue