-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3977 from element-hq/feature/bma/captionWarning
Add warning when adding a caption.
- Loading branch information
Showing
26 changed files
with
289 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...pl/src/main/kotlin/io/element/android/libraries/textcomposer/CaptionWarningBottomSheet.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright 2024 New Vector Ltd. | ||
* | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
* Please see LICENSE in the repository root for full details. | ||
*/ | ||
|
||
package io.element.android.libraries.textcomposer | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.ExperimentalMaterial3Api | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.unit.dp | ||
import io.element.android.compound.theme.ElementTheme | ||
import io.element.android.libraries.designsystem.components.BigIcon | ||
import io.element.android.libraries.designsystem.preview.ElementPreview | ||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight | ||
import io.element.android.libraries.designsystem.theme.components.ModalBottomSheet | ||
import io.element.android.libraries.designsystem.theme.components.OutlinedButton | ||
import io.element.android.libraries.ui.strings.CommonStrings | ||
|
||
@OptIn(ExperimentalMaterial3Api::class) | ||
@Composable | ||
fun CaptionWarningBottomSheet( | ||
onDismiss: () -> Unit, | ||
modifier: Modifier = Modifier, | ||
) { | ||
ModalBottomSheet( | ||
modifier = modifier, | ||
onDismissRequest = onDismiss, | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 16.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.spacedBy(16.dp), | ||
) { | ||
BigIcon( | ||
style = BigIcon.Style.AlertSolid, | ||
) | ||
Text( | ||
text = stringResource(CommonStrings.screen_media_upload_preview_caption_warning), | ||
style = ElementTheme.typography.fontBodyMdRegular, | ||
color = ElementTheme.colors.textPrimary, | ||
textAlign = TextAlign.Center, | ||
) | ||
OutlinedButton( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(vertical = 16.dp), | ||
onClick = onDismiss, | ||
text = stringResource(CommonStrings.action_ok), | ||
) | ||
} | ||
} | ||
} | ||
|
||
@PreviewsDayNight | ||
@Composable | ||
internal fun CaptionWarningBottomSheetPreview() = ElementPreview { | ||
CaptionWarningBottomSheet( | ||
onDismiss = {}, | ||
) | ||
} |
Oops, something went wrong.