Progress dialog : add dialog properties parameter
This commit is contained in:
@@ -292,7 +292,7 @@ private fun AttachmentStateView(
|
||||
is AttachmentsState.Sending.Processing -> ProgressDialogType.Indeterminate
|
||||
},
|
||||
text = stringResource(id = CommonStrings.common_sending),
|
||||
isCancellable = true,
|
||||
showCancelButton = true,
|
||||
onDismissRequest = onCancel,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ private fun AttachmentSendStateView(
|
||||
SendActionState.Sending.Processing -> ProgressDialogType.Indeterminate
|
||||
},
|
||||
text = stringResource(id = CommonStrings.common_sending),
|
||||
isCancellable = true,
|
||||
showCancelButton = true,
|
||||
onDismissRequest = onDismissClick,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
import io.element.android.features.messages.impl.timeline.FocusRequestState
|
||||
import io.element.android.libraries.designsystem.components.ProgressDialog
|
||||
import io.element.android.libraries.designsystem.components.dialogs.ErrorDialog
|
||||
@@ -49,7 +50,11 @@ fun FocusRequestStateView(
|
||||
)
|
||||
}
|
||||
FocusRequestState.Fetching -> {
|
||||
ProgressDialog(modifier = modifier, onDismissRequest = onClearFocusRequestState)
|
||||
ProgressDialog(
|
||||
modifier = modifier,
|
||||
properties = DialogProperties(dismissOnBackPress = true, dismissOnClickOutside = true),
|
||||
onDismissRequest = onClearFocusRequestState,
|
||||
)
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
|
||||
@@ -51,7 +51,8 @@ fun ProgressDialog(
|
||||
modifier: Modifier = Modifier,
|
||||
text: String? = null,
|
||||
type: ProgressDialogType = ProgressDialogType.Indeterminate,
|
||||
isCancellable: Boolean = false,
|
||||
properties: DialogProperties = DialogProperties(dismissOnBackPress = false, dismissOnClickOutside = false),
|
||||
showCancelButton: Boolean = false,
|
||||
onDismissRequest: () -> Unit = {},
|
||||
) {
|
||||
DisposableEffect(Unit) {
|
||||
@@ -61,12 +62,12 @@ fun ProgressDialog(
|
||||
}
|
||||
Dialog(
|
||||
onDismissRequest = onDismissRequest,
|
||||
properties = DialogProperties(dismissOnBackPress = false, dismissOnClickOutside = false)
|
||||
properties = properties,
|
||||
) {
|
||||
ProgressDialogContent(
|
||||
modifier = modifier,
|
||||
text = text,
|
||||
isCancellable = isCancellable,
|
||||
isCancellable = showCancelButton,
|
||||
onCancelClick = onDismissRequest,
|
||||
progressIndicator = {
|
||||
when (type) {
|
||||
@@ -152,5 +153,5 @@ internal fun ProgressDialogContentPreview() = ElementThemedPreview {
|
||||
@PreviewsDayNight
|
||||
@Composable
|
||||
internal fun ProgressDialogPreview() = ElementPreview {
|
||||
ProgressDialog(text = "test dialog content", isCancellable = true)
|
||||
ProgressDialog(text = "test dialog content", showCancelButton = true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user