fix: bottom sheet animation
and improve dialogs API state
This commit is contained in:
parent
ef179890da
commit
eda91d9274
21 changed files with 130 additions and 160 deletions
|
@ -136,18 +136,17 @@ class AboutActivity : ComponentActivity() {
|
|||
DialogMember {
|
||||
ConfirmationAdvancedAlertDialog(
|
||||
alertDialogState = this,
|
||||
callback = { success ->
|
||||
if (success) {
|
||||
launchFAQActivity()
|
||||
} else {
|
||||
launchEmailIntent()
|
||||
}
|
||||
},
|
||||
message = "${getString(R.string.before_asking_question_read_faq)}\n\n${getString(R.string.make_sure_latest)}",
|
||||
messageId = null,
|
||||
positive = R.string.read_faq,
|
||||
negative = R.string.skip
|
||||
)
|
||||
) { success ->
|
||||
if (success) {
|
||||
launchFAQActivity()
|
||||
} else {
|
||||
launchEmailIntent()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -157,18 +156,17 @@ class AboutActivity : ComponentActivity() {
|
|||
DialogMember {
|
||||
ConfirmationAdvancedAlertDialog(
|
||||
alertDialogState = this,
|
||||
callback = { success ->
|
||||
if (success) {
|
||||
launchFAQActivity()
|
||||
} else {
|
||||
launchRateUsPrompt(showRateStarsDialog)
|
||||
}
|
||||
},
|
||||
message = "${getString(R.string.before_asking_question_read_faq)}\n\n${getString(R.string.make_sure_latest)}",
|
||||
messageId = null,
|
||||
positive = R.string.read_faq,
|
||||
negative = R.string.skip
|
||||
)
|
||||
) { success ->
|
||||
if (success) {
|
||||
launchFAQActivity()
|
||||
} else {
|
||||
launchRateUsPrompt(showRateStarsDialog)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,18 +80,17 @@ class ManageBlockedNumbersActivity : BaseSimpleActivity() {
|
|||
|
||||
addBlockedNumberDialogState.DialogMember {
|
||||
AddOrEditBlockedNumberAlertDialog(
|
||||
blockedNumber = clickedBlockedNumber,
|
||||
alertDialogState = addBlockedNumberDialogState,
|
||||
blockedNumber = clickedBlockedNumber,
|
||||
deleteBlockedNumber = { blockedNumber ->
|
||||
deleteBlockedNumber(blockedNumber)
|
||||
updateBlockedNumbers()
|
||||
},
|
||||
addBlockedNumber = { blockedNumber ->
|
||||
addBlockedNumber(blockedNumber)
|
||||
clickedBlockedNumber = null
|
||||
updateBlockedNumbers()
|
||||
}
|
||||
)
|
||||
) { blockedNumber ->
|
||||
addBlockedNumber(blockedNumber)
|
||||
clickedBlockedNumber = null
|
||||
updateBlockedNumbers()
|
||||
}
|
||||
}
|
||||
|
||||
ManageBlockedNumbersScreen(
|
||||
|
|
|
@ -2,12 +2,15 @@ package com.simplemobiletools.commons.compose.bottom_sheet
|
|||
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.material3.BottomSheetDefaults
|
||||
import androidx.compose.material3.SheetState
|
||||
import androidx.compose.material3.ModalBottomSheet
|
||||
import androidx.compose.material3.SheetValue
|
||||
import androidx.compose.material3.rememberModalBottomSheetState
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.runtime.saveable.mapSaver
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.ui.Modifier
|
||||
import com.simplemobiletools.commons.compose.alert_dialog.dialogContainerColor
|
||||
import com.simplemobiletools.commons.compose.alert_dialog.dialogElevation
|
||||
|
||||
@Composable
|
||||
fun rememberBottomSheetDialogState(
|
||||
|
@ -82,25 +85,34 @@ class BottomSheetDialogState(
|
|||
}
|
||||
|
||||
@Composable
|
||||
fun DialogMember(
|
||||
content: @Composable (
|
||||
state: SheetState,
|
||||
insets: WindowInsets
|
||||
) -> Unit
|
||||
fun BottomSheetContent(
|
||||
modifier: Modifier = Modifier,
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
val bottomSheetState = rememberSheetState()
|
||||
val windowInsets = rememberWindowInsets()
|
||||
|
||||
LaunchedEffect(isOpen) {
|
||||
if (isOpen) {
|
||||
if (isOpen && !bottomSheetState.isVisible) {
|
||||
bottomSheetState.show()
|
||||
} else {
|
||||
bottomSheetState.hide()
|
||||
}
|
||||
}
|
||||
|
||||
if (bottomSheetState.isVisible) {
|
||||
content(bottomSheetState, windowInsets)
|
||||
if (isOpen) {
|
||||
ModalBottomSheet(
|
||||
modifier = modifier,
|
||||
onDismissRequest = ::close,
|
||||
sheetState = bottomSheetState,
|
||||
windowInsets = windowInsets,
|
||||
dragHandle = {}, //leave empty as we provide our own dialog surfaces
|
||||
shape = bottomSheetDialogShape,
|
||||
containerColor = dialogContainerColor,
|
||||
tonalElevation = dialogElevation,
|
||||
) {
|
||||
content()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ fun FakeVersionCheck() {
|
|||
DialogMember {
|
||||
ConfirmationAlertDialog(
|
||||
alertDialogState = this,
|
||||
message = FAKE_VERSION_APP_LABEL,
|
||||
positive = R.string.ok,
|
||||
negative = null,
|
||||
message = FAKE_VERSION_APP_LABEL
|
||||
negative = null
|
||||
) {
|
||||
context.getActivity().launchViewIntent(DEVELOPER_PLAY_STORE_URL)
|
||||
}
|
||||
|
@ -35,9 +35,9 @@ fun CheckAppOnSdCard() {
|
|||
DialogMember {
|
||||
ConfirmationAlertDialog(
|
||||
alertDialogState = this,
|
||||
messageId = R.string.app_on_sd_card,
|
||||
positive = R.string.ok,
|
||||
negative = null,
|
||||
messageId = R.string.app_on_sd_card
|
||||
negative = null
|
||||
) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ import com.simplemobiletools.commons.models.BlockedNumber
|
|||
|
||||
@Composable
|
||||
fun AddOrEditBlockedNumberAlertDialog(
|
||||
modifier: Modifier = Modifier,
|
||||
blockedNumber: BlockedNumber?,
|
||||
alertDialogState: AlertDialogState,
|
||||
blockedNumber: BlockedNumber?,
|
||||
modifier: Modifier = Modifier,
|
||||
deleteBlockedNumber: (String) -> Unit,
|
||||
addBlockedNumber: (String) -> Unit
|
||||
) {
|
||||
|
@ -100,10 +100,9 @@ fun AddOrEditBlockedNumberAlertDialog(
|
|||
private fun AddOrEditBlockedNumberAlertDialogPreview() {
|
||||
AppThemeSurface {
|
||||
AddOrEditBlockedNumberAlertDialog(
|
||||
alertDialogState = rememberAlertDialogState(),
|
||||
blockedNumber = null,
|
||||
deleteBlockedNumber = {},
|
||||
addBlockedNumber = {},
|
||||
alertDialogState = rememberAlertDialogState()
|
||||
)
|
||||
deleteBlockedNumber = {}
|
||||
) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ class AppSideloadedDialog(val activity: Activity, val callback: () -> Unit) {
|
|||
|
||||
@Composable
|
||||
fun AppSideLoadedAlertDialog(
|
||||
alertDialogState: AlertDialogState,
|
||||
modifier: Modifier = Modifier,
|
||||
alertDialogState: AlertDialogState = rememberAlertDialogState(),
|
||||
onDownloadClick: (url: String) -> Unit,
|
||||
onCancelClick: () -> Unit
|
||||
) {
|
||||
|
@ -112,6 +112,6 @@ fun AppSideLoadedAlertDialog(
|
|||
@MyDevices
|
||||
private fun AppSideLoadedAlertDialogPreview() {
|
||||
AppThemeSurface {
|
||||
AppSideLoadedAlertDialog(alertDialogState = rememberAlertDialogState(), onDownloadClick = {}, onCancelClick = {})
|
||||
AppSideLoadedAlertDialog(alertDialogState = rememberAlertDialogState(), onDownloadClick = {}) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,10 @@ import android.os.Bundle
|
|||
import android.view.ViewGroup
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.material3.ListItem
|
||||
import androidx.compose.material3.ListItemDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
|
@ -19,12 +20,11 @@ import androidx.fragment.app.FragmentManager
|
|||
import com.simplemobiletools.commons.R
|
||||
import com.simplemobiletools.commons.adapters.setupSimpleListItem
|
||||
import com.simplemobiletools.commons.compose.alert_dialog.dialogContainerColor
|
||||
import com.simplemobiletools.commons.compose.alert_dialog.dialogElevation
|
||||
import com.simplemobiletools.commons.compose.alert_dialog.dialogTextColor
|
||||
import com.simplemobiletools.commons.compose.bottom_sheet.BottomSheetColumnDialogSurface
|
||||
import com.simplemobiletools.commons.compose.bottom_sheet.BottomSheetDialogState
|
||||
import com.simplemobiletools.commons.compose.bottom_sheet.BottomSheetSpacerEdgeToEdge
|
||||
import com.simplemobiletools.commons.compose.bottom_sheet.bottomSheetDialogShape
|
||||
import com.simplemobiletools.commons.compose.bottom_sheet.rememberBottomSheetDialogState
|
||||
import com.simplemobiletools.commons.compose.extensions.MyDevices
|
||||
import com.simplemobiletools.commons.compose.theme.AppThemeSurface
|
||||
import com.simplemobiletools.commons.compose.theme.SimpleTheme
|
||||
|
@ -82,35 +82,11 @@ open class BottomSheetChooserDialog : BaseBottomSheetDialogFragment() {
|
|||
@Composable
|
||||
fun ChooserBottomSheetDialog(
|
||||
bottomSheetDialogState: BottomSheetDialogState,
|
||||
windowInsets: WindowInsets,
|
||||
bottomSheetState : SheetState,
|
||||
items: ImmutableList<SimpleListItem>,
|
||||
modifier: Modifier = Modifier,
|
||||
items: ImmutableList<SimpleListItem>,
|
||||
onItemClicked: (SimpleListItem) -> Unit
|
||||
) {
|
||||
ModalBottomSheet(
|
||||
modifier = modifier,
|
||||
onDismissRequest = bottomSheetDialogState::close,
|
||||
sheetState = bottomSheetState,
|
||||
windowInsets = windowInsets,
|
||||
dragHandle = {}, //leave empty as we provide our own ColumnScope
|
||||
shape = bottomSheetDialogShape,
|
||||
containerColor = dialogContainerColor,
|
||||
tonalElevation = dialogElevation,
|
||||
) {
|
||||
ChooserScreenContent(items = items, onItemClicked = {
|
||||
onItemClicked(it)
|
||||
bottomSheetDialogState.close()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ChooserScreenContent(
|
||||
items: ImmutableList<SimpleListItem>,
|
||||
onItemClicked: (SimpleListItem) -> Unit
|
||||
) {
|
||||
BottomSheetColumnDialogSurface {
|
||||
BottomSheetColumnDialogSurface(modifier) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.please_select_destination),
|
||||
color = dialogTextColor,
|
||||
|
@ -126,6 +102,7 @@ private fun ChooserScreenContent(
|
|||
modifier = Modifier
|
||||
.clickable {
|
||||
onItemClicked(item)
|
||||
bottomSheetDialogState.close()
|
||||
},
|
||||
headlineContent = {
|
||||
Text(stringResource(id = item.textRes), color = color)
|
||||
|
@ -166,13 +143,6 @@ private fun ChooserBottomSheetDialogPreview() {
|
|||
SimpleListItem(4, R.string.choose_contact, R.drawable.ic_add_person_vector)
|
||||
).toImmutableList()
|
||||
}
|
||||
ChooserScreenContent(items = list, onItemClicked = {})
|
||||
/* https://issuetracker.google.com/issues/304300690
|
||||
ChooserBottomSheetDialog(
|
||||
bottomSheetDialogState = rememberBottomSheetDialogState(),
|
||||
items = list,
|
||||
onItemClicked = {},
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)*/
|
||||
ChooserBottomSheetDialog(bottomSheetDialogState = rememberBottomSheetDialogState(), items = list, onItemClicked = {})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,9 +60,9 @@ class CallConfirmationDialog(val activity: BaseSimpleActivity, val callee: Strin
|
|||
|
||||
@Composable
|
||||
fun CallConfirmationAlertDialog(
|
||||
modifier: Modifier = Modifier,
|
||||
alertDialogState: AlertDialogState,
|
||||
callee: String,
|
||||
modifier: Modifier = Modifier,
|
||||
callback: () -> Unit
|
||||
) {
|
||||
androidx.compose.material3.AlertDialog(
|
||||
|
@ -139,6 +139,7 @@ private fun CallConfirmationAlertDialogPreview() {
|
|||
AppThemeSurface {
|
||||
CallConfirmationAlertDialog(
|
||||
alertDialogState = rememberAlertDialogState(),
|
||||
callee = "Simple Mobile Tools", callback = {})
|
||||
callee = "Simple Mobile Tools"
|
||||
) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -105,8 +105,8 @@ class ChangeDateTimeFormatDialog(val activity: Activity, val callback: () -> Uni
|
|||
@Composable
|
||||
fun ChangeDateTimeFormatAlertDialog(
|
||||
alertDialogState: AlertDialogState,
|
||||
modifier: Modifier = Modifier,
|
||||
is24HourChecked: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
callback: (selectedFormat: String, is24HourChecked: Boolean) -> Unit
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
@ -254,6 +254,6 @@ internal fun DialogCheckBoxWithRadioAlignmentComponent(
|
|||
@MyDevices
|
||||
private fun ChangeDateTimeFormatAlertDialogPreview() {
|
||||
AppThemeSurface {
|
||||
ChangeDateTimeFormatAlertDialog(alertDialogState = rememberAlertDialogState(), callback = { _, _ -> }, is24HourChecked = true)
|
||||
ChangeDateTimeFormatAlertDialog(alertDialogState = rememberAlertDialogState(), is24HourChecked = true) { _, _ -> }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,8 +69,8 @@ data class ViewType(val title: String, val type: Int)
|
|||
@Composable
|
||||
fun ChangeViewTypeAlertDialog(
|
||||
alertDialogState: AlertDialogState,
|
||||
modifier: Modifier = Modifier,
|
||||
selectedViewType: Int,
|
||||
modifier: Modifier = Modifier,
|
||||
onTypeChosen: (type: Int) -> Unit
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
@ -137,6 +137,6 @@ private fun getSelectedValue(
|
|||
@Composable
|
||||
private fun ChangeViewTypeAlertDialogPreview() {
|
||||
AppThemeSurface {
|
||||
ChangeViewTypeAlertDialog(alertDialogState = rememberAlertDialogState(), onTypeChosen = {}, selectedViewType = VIEW_TYPE_GRID)
|
||||
ChangeViewTypeAlertDialog(alertDialogState = rememberAlertDialogState(), selectedViewType = VIEW_TYPE_GRID) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,9 +145,8 @@ class ColorPickerDialog(
|
|||
@Composable
|
||||
fun ColorPickerAlertDialog(
|
||||
alertDialogState: AlertDialogState,
|
||||
@ColorInt color: Int,
|
||||
modifier: Modifier = Modifier,
|
||||
@ColorInt
|
||||
color: Int,
|
||||
removeDimmedBackground: Boolean = false,
|
||||
addDefaultColorButton: Boolean = false,
|
||||
onActiveColorChange: (color: Int) -> Unit,
|
||||
|
@ -418,7 +417,7 @@ private fun ColorPickerAlertDialogPreview() {
|
|||
ColorPickerAlertDialog(
|
||||
alertDialogState = rememberAlertDialogState(),
|
||||
color = colorResource(id = R.color.color_primary).toArgb(),
|
||||
onActiveColorChange = {},
|
||||
onButtonPressed = { _, _ -> })
|
||||
onActiveColorChange = {}
|
||||
) { _, _ -> }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ class ConfirmationAdvancedDialog(
|
|||
|
||||
@Composable
|
||||
fun ConfirmationAdvancedAlertDialog(
|
||||
modifier: Modifier = Modifier,
|
||||
alertDialogState: AlertDialogState,
|
||||
modifier: Modifier = Modifier,
|
||||
message: String = "",
|
||||
messageId: Int? = R.string.proceed_with_deletion,
|
||||
positive: Int? = R.string.yes,
|
||||
|
@ -116,7 +116,8 @@ fun ConfirmationAdvancedAlertDialog(
|
|||
@MyDevices
|
||||
private fun ConfirmationAdvancedAlertDialogPreview() {
|
||||
AppThemeSurface {
|
||||
ConfirmationAdvancedAlertDialog(alertDialogState = rememberAlertDialogState(),
|
||||
callback = {})
|
||||
ConfirmationAdvancedAlertDialog(
|
||||
alertDialogState = rememberAlertDialogState()
|
||||
) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,8 +66,8 @@ class ConfirmationDialog(
|
|||
|
||||
@Composable
|
||||
fun ConfirmationAlertDialog(
|
||||
modifier: Modifier = Modifier,
|
||||
alertDialogState: AlertDialogState,
|
||||
modifier: Modifier = Modifier,
|
||||
message: String = "",
|
||||
messageId: Int? = R.string.proceed_with_deletion,
|
||||
positive: Int? = R.string.yes,
|
||||
|
@ -133,7 +133,8 @@ fun ConfirmationAlertDialog(
|
|||
@MyDevices
|
||||
private fun ConfirmationAlertDialogPreview() {
|
||||
AppThemeSurface {
|
||||
ConfirmationAlertDialog(alertDialogState = rememberAlertDialogState(),
|
||||
callback = {})
|
||||
ConfirmationAlertDialog(
|
||||
alertDialogState = rememberAlertDialogState()
|
||||
) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,8 +108,8 @@ class CreateNewFolderDialog(val activity: BaseSimpleActivity, val path: String,
|
|||
@Composable
|
||||
fun CreateNewFolderAlertDialog(
|
||||
alertDialogState: AlertDialogState,
|
||||
modifier: Modifier = Modifier,
|
||||
path: String,
|
||||
modifier: Modifier = Modifier,
|
||||
callback: (path: String) -> Unit
|
||||
) {
|
||||
val focusRequester = remember { FocusRequester() }
|
||||
|
@ -209,8 +209,7 @@ private fun CreateNewFolderAlertDialogPreview() {
|
|||
AppThemeSurface {
|
||||
CreateNewFolderAlertDialog(
|
||||
alertDialogState = rememberAlertDialogState(),
|
||||
path = "Internal/",
|
||||
callback = {}
|
||||
)
|
||||
path = "Internal/"
|
||||
) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,9 +93,9 @@ class FileConflictDialog(
|
|||
@Composable
|
||||
fun FileConflictAlertDialog(
|
||||
alertDialogState: AlertDialogState,
|
||||
modifier: Modifier = Modifier,
|
||||
fileDirItem: FileDirItemReadOnly,
|
||||
showApplyToAll: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
callback: (resolution: Int, applyForAll: Boolean) -> Unit
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
@ -207,8 +207,7 @@ private fun FileConflictAlertDialogPreview() {
|
|||
FileConflictAlertDialog(
|
||||
alertDialogState = rememberAlertDialogState(),
|
||||
fileDirItem = FileDirItem("", name = "test", children = 1).asReadOnly(),
|
||||
showApplyToAll = true,
|
||||
callback = { _, _ -> }
|
||||
)
|
||||
showApplyToAll = true
|
||||
) { _, _ -> }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,9 +168,9 @@ class LineColorPickerDialog(
|
|||
@Composable
|
||||
fun LineColorPickerAlertDialog(
|
||||
alertDialogState: AlertDialogState,
|
||||
modifier: Modifier = Modifier,
|
||||
@ColorInt color: Int,
|
||||
isPrimaryColorPicker: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
primaryColors: Int = R.array.md_primary_colors,
|
||||
appIconIDs: ArrayList<Int>? = null,
|
||||
onActiveColorChange: (color: Int) -> Unit,
|
||||
|
@ -330,7 +330,7 @@ private fun LineColorPickerAlertDialogPreview() {
|
|||
LineColorPickerAlertDialog(alertDialogState = rememberAlertDialogState(),
|
||||
color = R.color.color_primary,
|
||||
isPrimaryColorPicker = true,
|
||||
onActiveColorChange = {},
|
||||
onButtonPressed = { _, _ -> })
|
||||
onActiveColorChange = {}
|
||||
) { _, _ -> }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ class OpenDeviceSettingsDialog(val activity: BaseSimpleActivity, message: String
|
|||
@Composable
|
||||
fun OpenDeviceSettingsAlertDialog(
|
||||
alertDialogState: AlertDialogState,
|
||||
modifier: Modifier = Modifier,
|
||||
message: String
|
||||
message: String,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
|
||||
|
|
|
@ -44,10 +44,10 @@ class PermissionRequiredDialog(
|
|||
@Composable
|
||||
fun PermissionRequiredAlertDialog(
|
||||
alertDialogState: AlertDialogState,
|
||||
modifier: Modifier = Modifier,
|
||||
text: String,
|
||||
positiveActionCallback: () -> Unit,
|
||||
negativeActionCallback: (() -> Unit)? = null
|
||||
modifier: Modifier = Modifier,
|
||||
negativeActionCallback: (() -> Unit)? = null,
|
||||
positiveActionCallback: () -> Unit
|
||||
) {
|
||||
AlertDialog(
|
||||
containerColor = dialogContainerColor,
|
||||
|
@ -95,8 +95,7 @@ private fun PermissionRequiredAlertDialogPreview() {
|
|||
PermissionRequiredAlertDialog(
|
||||
alertDialogState = rememberAlertDialogState(),
|
||||
text = "Test",
|
||||
positiveActionCallback = {},
|
||||
negativeActionCallback = {}
|
||||
)
|
||||
) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,8 +103,8 @@ class RadioGroupDialog(
|
|||
@Composable
|
||||
fun RadioGroupAlertDialog(
|
||||
alertDialogState: AlertDialogState,
|
||||
modifier: Modifier = Modifier,
|
||||
items: ImmutableList<RadioItem>,
|
||||
modifier: Modifier = Modifier,
|
||||
selectedItemId: Int = -1,
|
||||
titleId: Int = 0,
|
||||
showOKButton: Boolean = false,
|
||||
|
@ -188,11 +188,10 @@ private fun RadioGroupDialogAlertDialogPreview(@PreviewParameter(BooleanPreviewP
|
|||
RadioItem(2, "Test 2"),
|
||||
RadioItem(3, "Test 3"),
|
||||
).toImmutableList(),
|
||||
callback = {},
|
||||
cancelCallback = {},
|
||||
showOKButton = showOKButton,
|
||||
selectedItemId = 1,
|
||||
titleId = R.string.title,
|
||||
selectedItemId = 1
|
||||
)
|
||||
showOKButton = showOKButton,
|
||||
cancelCallback = {}
|
||||
) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,8 +138,8 @@ class WritePermissionDialog(activity: Activity, val writePermissionDialogMode: W
|
|||
@Composable
|
||||
fun WritePermissionAlertDialog(
|
||||
alertDialogState: AlertDialogState,
|
||||
modifier: Modifier = Modifier,
|
||||
writePermissionDialogMode: WritePermissionDialog.WritePermissionDialogMode,
|
||||
modifier: Modifier = Modifier,
|
||||
callback: () -> Unit,
|
||||
onCancelCallback: () -> Unit
|
||||
) {
|
||||
|
@ -316,8 +316,7 @@ private fun WritePermissionAlertDialogPreview(@PreviewParameter(WritePermissionD
|
|||
WritePermissionAlertDialog(
|
||||
alertDialogState = rememberAlertDialogState(),
|
||||
writePermissionDialogMode = WritePermissionDialog.WritePermissionDialogMode.OpenDocumentTreeSDK30("."),
|
||||
callback = {},
|
||||
onCancelCallback = {}
|
||||
)
|
||||
callback = {}
|
||||
) {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ class TestDialogActivity : ComponentActivity() {
|
|||
|
||||
@Composable
|
||||
private fun getChooserBottomSheetDialogState() = rememberBottomSheetDialogState().apply {
|
||||
DialogMember { state, insets ->
|
||||
BottomSheetContent {
|
||||
val list = remember {
|
||||
listOf(
|
||||
SimpleListItem(1, R.string.record_video, R.drawable.ic_camera_vector),
|
||||
|
@ -110,13 +110,11 @@ class TestDialogActivity : ComponentActivity() {
|
|||
).toImmutableList()
|
||||
}
|
||||
ChooserBottomSheetDialog(
|
||||
bottomSheetDialogState = this,
|
||||
items = list,
|
||||
windowInsets = insets,
|
||||
bottomSheetState = state,
|
||||
onItemClicked = {
|
||||
toast("Selected ${getString(it.textRes)}")
|
||||
})
|
||||
bottomSheetDialogState = this@apply,
|
||||
items = list
|
||||
) {
|
||||
toast("Selected ${getString(it.textRes)}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,9 +149,8 @@ class TestDialogActivity : ComponentActivity() {
|
|||
WritePermissionAlertDialog(
|
||||
alertDialogState = this,
|
||||
writePermissionDialogMode = WritePermissionDialog.WritePermissionDialogMode.OpenDocumentTreeSDK30("."),
|
||||
callback = {},
|
||||
onCancelCallback = {}
|
||||
)
|
||||
callback = {}
|
||||
) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -206,16 +203,15 @@ class TestDialogActivity : ComponentActivity() {
|
|||
RadioItem(6, "Test 6"),
|
||||
RadioItem(6, "Test 7"),
|
||||
).toImmutableList(),
|
||||
showOKButton = true,
|
||||
selectedItemId = 2,
|
||||
titleId = R.string.title,
|
||||
showOKButton = true,
|
||||
cancelCallback = {
|
||||
Log.d("getRadioGroupDialogAlertDialogState", "cancelCallback")
|
||||
},
|
||||
callback = {
|
||||
Log.d("getRadioGroupDialogAlertDialogState", "Selected $it")
|
||||
},
|
||||
titleId = R.string.title
|
||||
)
|
||||
}
|
||||
) {
|
||||
Log.d("getRadioGroupDialogAlertDialogState", "Selected $it")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,11 +240,11 @@ class TestDialogActivity : ComponentActivity() {
|
|||
alertDialogState = this,
|
||||
color = baseConfig.customPrimaryColor,
|
||||
isPrimaryColorPicker = true,
|
||||
onButtonPressed = { wasPositivePressed, color ->
|
||||
Log.d("getLineColorPickerAlertDialogState", "wasPositivePressed=$wasPositivePressed color=${color.toHex()}")
|
||||
}, onActiveColorChange = { color ->
|
||||
onActiveColorChange = { color ->
|
||||
Log.d("getLineColorPickerAlertDialogState", "onActiveColorChange=${color.toHex()}")
|
||||
})
|
||||
}) { wasPositivePressed, color ->
|
||||
Log.d("getLineColorPickerAlertDialogState", "wasPositivePressed=$wasPositivePressed color=${color.toHex()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,11 +265,11 @@ class TestDialogActivity : ComponentActivity() {
|
|||
alertDialogState = this,
|
||||
color = config.customTextColor,
|
||||
removeDimmedBackground = true,
|
||||
onButtonPressed = { wasPositivePressed, color ->
|
||||
Log.d("getColorPickerAlertDialogState", "wasPositivePressed=$wasPositivePressed color=${color.toHex()}")
|
||||
}, onActiveColorChange = { color ->
|
||||
onActiveColorChange = { color ->
|
||||
Log.d("getColorPickerAlertDialogState", "onActiveColorChange=${color.toHex()}")
|
||||
})
|
||||
}) { wasPositivePressed, color ->
|
||||
Log.d("getColorPickerAlertDialogState", "wasPositivePressed=$wasPositivePressed color=${color.toHex()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,7 +283,7 @@ class TestDialogActivity : ComponentActivity() {
|
|||
@Composable
|
||||
private fun getCallConfirmationAlertDialogState() = rememberAlertDialogState().apply {
|
||||
DialogMember {
|
||||
CallConfirmationAlertDialog(alertDialogState = this, callee = "Simple Mobile Tools", callback = {})
|
||||
CallConfirmationAlertDialog(alertDialogState = this, callee = "Simple Mobile Tools") {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,7 +306,7 @@ class TestDialogActivity : ComponentActivity() {
|
|||
@Composable
|
||||
private fun getConfirmationAlertDialogState() = rememberAlertDialogState().apply {
|
||||
DialogMember {
|
||||
ConfirmationAlertDialog(alertDialogState = this, callback = {}, dialogTitle = "Some fancy title")
|
||||
ConfirmationAlertDialog(alertDialogState = this, dialogTitle = "Some fancy title") {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,7 +314,7 @@ class TestDialogActivity : ComponentActivity() {
|
|||
private fun getAppSideLoadedDialogState() =
|
||||
rememberAlertDialogState().apply {
|
||||
DialogMember {
|
||||
AppSideLoadedAlertDialog(onDownloadClick = {}, onCancelClick = {}, alertDialogState = this)
|
||||
AppSideLoadedAlertDialog(alertDialogState = this, onDownloadClick = {}) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,7 +322,7 @@ class TestDialogActivity : ComponentActivity() {
|
|||
private fun getAddBlockedNumberDialogState() =
|
||||
rememberAlertDialogState().apply {
|
||||
DialogMember {
|
||||
AddOrEditBlockedNumberAlertDialog(blockedNumber = null, deleteBlockedNumber = {}, addBlockedNumber = {}, alertDialogState = this)
|
||||
AddOrEditBlockedNumberAlertDialog(alertDialogState = this, blockedNumber = null, deleteBlockedNumber = {}) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -334,7 +330,7 @@ class TestDialogActivity : ComponentActivity() {
|
|||
private fun getConfirmationAdvancedAlertDialogState() =
|
||||
rememberAlertDialogState().apply {
|
||||
DialogMember {
|
||||
ConfirmationAdvancedAlertDialog(alertDialogState = this, callback = {})
|
||||
ConfirmationAdvancedAlertDialog(alertDialogState = this) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,9 +340,8 @@ class TestDialogActivity : ComponentActivity() {
|
|||
DialogMember {
|
||||
PermissionRequiredAlertDialog(
|
||||
alertDialogState = this,
|
||||
text = "Test permission",
|
||||
positiveActionCallback = {}
|
||||
)
|
||||
text = "Test permission"
|
||||
) {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue