mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-11 04:55:37 +02:00
ConfirmDialog + fixes
This commit is contained in:
parent
2fc00f7b5f
commit
06b63669b2
4 changed files with 26 additions and 27 deletions
|
@ -1,21 +1,21 @@
|
|||
package app.revanced.manager.ui.component
|
||||
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.Delete
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import app.revanced.manager.R
|
||||
|
||||
@Composable
|
||||
fun GenericDeleteDialog(
|
||||
fun ConfirmDialog(
|
||||
onDismiss: () -> Unit,
|
||||
onConfirm: () -> Unit,
|
||||
title: @Composable () -> Unit,
|
||||
description: @Composable () -> Unit
|
||||
title: String,
|
||||
description: String,
|
||||
imageVector: ImageVector
|
||||
) {
|
||||
AlertDialog(
|
||||
onDismissRequest = onDismiss,
|
||||
|
@ -34,8 +34,8 @@ fun GenericDeleteDialog(
|
|||
Text(stringResource(R.string.confirm))
|
||||
}
|
||||
},
|
||||
title = title,
|
||||
icon = { Icon(Icons.Outlined.Delete, null) },
|
||||
text = description
|
||||
title = { Text(title) },
|
||||
icon = { Icon(imageVector, null) },
|
||||
text = { Text(description) }
|
||||
)
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package app.revanced.manager.ui.component.bundle
|
||||
|
||||
import androidx.compose.material.icons.outlined.Delete
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.combinedClickable
|
||||
import androidx.compose.foundation.layout.Row
|
||||
|
@ -27,7 +28,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
|||
import app.revanced.manager.R
|
||||
import app.revanced.manager.domain.bundles.PatchBundleSource
|
||||
import app.revanced.manager.domain.bundles.PatchBundleSource.Extensions.nameState
|
||||
import app.revanced.manager.ui.component.GenericDeleteDialog
|
||||
import app.revanced.manager.ui.component.ConfirmDialog
|
||||
import app.revanced.manager.ui.component.haptics.HapticCheckbox
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
|
@ -61,21 +62,15 @@ fun BundleItem(
|
|||
}
|
||||
|
||||
if (showDeleteConfirmationDialog) {
|
||||
GenericDeleteDialog(
|
||||
ConfirmDialog(
|
||||
onDismiss = { showDeleteConfirmationDialog = false },
|
||||
onConfirm = {
|
||||
onDelete()
|
||||
viewBundleDialogPage = false
|
||||
},
|
||||
title = { Text(stringResource(R.string.bundle_delete_single_dialog_title)) },
|
||||
description = {
|
||||
Text(
|
||||
stringResource(
|
||||
R.string.bundle_delete_single_dialog_description,
|
||||
name
|
||||
)
|
||||
)
|
||||
}
|
||||
title = stringResource(R.string.bundle_delete_single_dialog_title),
|
||||
description = stringResource(R.string.bundle_delete_single_dialog_description, name),
|
||||
imageVector = Icons.Outlined.Delete
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import androidx.compose.material.icons.filled.BatteryAlert
|
|||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.outlined.Apps
|
||||
import androidx.compose.material.icons.outlined.BugReport
|
||||
import androidx.compose.material.icons.outlined.Delete
|
||||
import androidx.compose.material.icons.outlined.DeleteOutline
|
||||
import androidx.compose.material.icons.outlined.Download
|
||||
import androidx.compose.material.icons.outlined.Refresh
|
||||
|
@ -62,7 +63,7 @@ import app.revanced.manager.ui.component.AppTopBar
|
|||
import app.revanced.manager.ui.component.AutoUpdatesDialog
|
||||
import app.revanced.manager.ui.component.AvailableUpdateDialog
|
||||
import app.revanced.manager.ui.component.NotificationCard
|
||||
import app.revanced.manager.ui.component.GenericDeleteDialog
|
||||
import app.revanced.manager.ui.component.ConfirmDialog
|
||||
import app.revanced.manager.ui.component.bundle.BundleTopBar
|
||||
import app.revanced.manager.ui.component.bundle.ImportPatchBundleDialog
|
||||
import app.revanced.manager.ui.component.haptics.HapticFloatingActionButton
|
||||
|
@ -157,14 +158,15 @@ fun DashboardScreen(
|
|||
|
||||
var showDeleteConfirmationDialog by rememberSaveable { mutableStateOf(false) }
|
||||
if (showDeleteConfirmationDialog) {
|
||||
GenericDeleteDialog(
|
||||
ConfirmDialog(
|
||||
onDismiss = { showDeleteConfirmationDialog = false },
|
||||
onConfirm = {
|
||||
vm.selectedSources.forEach { if (!it.isDefault) vm.delete(it) }
|
||||
vm.cancelSourceSelection()
|
||||
},
|
||||
title = { Text(stringResource(R.string.bundle_delete_multiple_dialog_title)) },
|
||||
description = { Text(stringResource(R.string.bundle_delete_multiple_dialog_description)) }
|
||||
title = stringResource(R.string.bundle_delete_multiple_dialog_title),
|
||||
description = stringResource(R.string.bundle_delete_multiple_dialog_description),
|
||||
imageVector = Icons.Outlined.Delete
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.padding
|
|||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Delete
|
||||
import androidx.compose.material.icons.outlined.Delete
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.Icon
|
||||
|
@ -43,7 +44,7 @@ import app.revanced.manager.ui.component.AppTopBar
|
|||
import app.revanced.manager.ui.component.ExceptionViewerDialog
|
||||
import app.revanced.manager.ui.component.GroupHeader
|
||||
import app.revanced.manager.ui.component.LazyColumnWithScrollbar
|
||||
import app.revanced.manager.ui.component.GenericDeleteDialog
|
||||
import app.revanced.manager.ui.component.ConfirmDialog
|
||||
import app.revanced.manager.ui.component.haptics.HapticCheckbox
|
||||
import app.revanced.manager.ui.component.settings.SettingsListItem
|
||||
import app.revanced.manager.ui.viewmodel.DownloadsViewModel
|
||||
|
@ -63,11 +64,12 @@ fun DownloadsSettingsScreen(
|
|||
var showDeleteConfirmationDialog by rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
if (showDeleteConfirmationDialog) {
|
||||
GenericDeleteDialog(
|
||||
ConfirmDialog(
|
||||
onDismiss = { showDeleteConfirmationDialog = false },
|
||||
onConfirm = { viewModel.deleteApps() },
|
||||
title = { Text(stringResource(R.string.downloader_plugin_delete_apps_title)) },
|
||||
description = { Text(stringResource(R.string.downloader_plugin_delete_apps_description)) }
|
||||
title = stringResource(R.string.downloader_plugin_delete_apps_title),
|
||||
description = stringResource(R.string.downloader_plugin_delete_apps_description),
|
||||
imageVector = Icons.Outlined.Delete
|
||||
)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue