Merge pull request #2366 from element-hq/feature/bma/removeModifierParameterInPrivateMethods
Remove modifier parameter in private methods
This commit is contained in:
commit
cfcfadf2d4
61 changed files with 150 additions and 292 deletions
|
|
@ -35,10 +35,8 @@ import io.element.android.x.R
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
internal fun IconPreview(
|
internal fun IconPreview() {
|
||||||
modifier: Modifier = Modifier,
|
Box {
|
||||||
) {
|
|
||||||
Box(modifier = modifier) {
|
|
||||||
Image(painter = painterResource(id = R.mipmap.ic_launcher_background), contentDescription = null)
|
Image(painter = painterResource(id = R.mipmap.ic_launcher_background), contentDescription = null)
|
||||||
Image(painter = painterResource(id = R.mipmap.ic_launcher_foreground), contentDescription = null)
|
Image(painter = painterResource(id = R.mipmap.ic_launcher_foreground), contentDescription = null)
|
||||||
}
|
}
|
||||||
|
|
@ -46,10 +44,8 @@ internal fun IconPreview(
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
internal fun RoundIconPreview(
|
internal fun RoundIconPreview() {
|
||||||
modifier: Modifier = Modifier,
|
Box(modifier = Modifier.clip(shape = CircleShape)) {
|
||||||
) {
|
|
||||||
Box(modifier = modifier.clip(shape = CircleShape)) {
|
|
||||||
Image(painter = painterResource(id = R.mipmap.ic_launcher_background), contentDescription = null)
|
Image(painter = painterResource(id = R.mipmap.ic_launcher_background), contentDescription = null)
|
||||||
Image(painter = painterResource(id = R.mipmap.ic_launcher_foreground), contentDescription = null)
|
Image(painter = painterResource(id = R.mipmap.ic_launcher_foreground), contentDescription = null)
|
||||||
}
|
}
|
||||||
|
|
@ -57,11 +53,9 @@ internal fun RoundIconPreview(
|
||||||
|
|
||||||
@Preview
|
@Preview
|
||||||
@Composable
|
@Composable
|
||||||
internal fun MonochromeIconPreview(
|
internal fun MonochromeIconPreview() {
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.size(108.dp)
|
.size(108.dp)
|
||||||
.background(Color(0xFF2F3133))
|
.background(Color(0xFF2F3133))
|
||||||
.clip(shape = RoundedCornerShape(32.dp)),
|
.clip(shape = RoundedCornerShape(32.dp)),
|
||||||
|
|
|
||||||
|
|
@ -84,10 +84,8 @@ fun LoadingRoomNodeView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun LoadingRoomTopBar(
|
private fun LoadingRoomTopBar(
|
||||||
onBackClicked: () -> Unit,
|
onBackClicked: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = modifier,
|
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
BackButton(onClick = onBackClicked)
|
BackButton(onClick = onBackClicked)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -99,10 +99,8 @@ private const val LINK_TAG = "link"
|
||||||
private fun AnalyticsOptInHeader(
|
private fun AnalyticsOptInHeader(
|
||||||
state: AnalyticsOptInState,
|
state: AnalyticsOptInState,
|
||||||
onClickTerms: () -> Unit,
|
onClickTerms: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier,
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
) {
|
) {
|
||||||
IconTitleSubtitleMolecule(
|
IconTitleSubtitleMolecule(
|
||||||
|
|
@ -139,9 +137,9 @@ private fun AnalyticsOptInHeader(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun CheckIcon(modifier: Modifier = Modifier) {
|
private fun CheckIcon() {
|
||||||
Icon(
|
Icon(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.size(20.dp)
|
.size(20.dp)
|
||||||
.background(color = MaterialTheme.colorScheme.background, shape = CircleShape)
|
.background(color = MaterialTheme.colorScheme.background, shape = CircleShape)
|
||||||
.padding(2.dp),
|
.padding(2.dp),
|
||||||
|
|
@ -152,11 +150,9 @@ private fun CheckIcon(modifier: Modifier = Modifier) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun AnalyticsOptInContent(
|
private fun AnalyticsOptInContent() {
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
contentAlignment = BiasAlignment(
|
contentAlignment = BiasAlignment(
|
||||||
horizontalBias = 0f,
|
horizontalBias = 0f,
|
||||||
verticalBias = -0.4f
|
verticalBias = -0.4f
|
||||||
|
|
@ -188,11 +184,8 @@ private fun AnalyticsOptInContent(
|
||||||
private fun AnalyticsOptInFooter(
|
private fun AnalyticsOptInFooter(
|
||||||
onTermsAccepted: () -> Unit,
|
onTermsAccepted: () -> Unit,
|
||||||
onTermsDeclined: () -> Unit,
|
onTermsDeclined: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
ButtonColumnMolecule(
|
ButtonColumnMolecule {
|
||||||
modifier = modifier,
|
|
||||||
) {
|
|
||||||
Button(
|
Button(
|
||||||
text = stringResource(id = CommonStrings.action_ok),
|
text = stringResource(id = CommonStrings.action_ok),
|
||||||
onClick = onTermsAccepted,
|
onClick = onTermsAccepted,
|
||||||
|
|
|
||||||
|
|
@ -88,10 +88,8 @@ private fun AddPeopleViewTopBar(
|
||||||
hasSelectedUsers: Boolean,
|
hasSelectedUsers: Boolean,
|
||||||
onBackPressed: () -> Unit,
|
onBackPressed: () -> Unit,
|
||||||
onNextPressed: () -> Unit,
|
onNextPressed: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = modifier,
|
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = R.string.screen_create_room_add_people_title),
|
text = stringResource(id = R.string.screen_create_room_add_people_title),
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package io.element.android.features.createroom.impl.configureroom
|
||||||
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.gestures.detectTapGestures
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
|
|
@ -38,8 +37,6 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.focus.FocusManager
|
|
||||||
import androidx.compose.ui.input.pointer.pointerInput
|
|
||||||
import androidx.compose.ui.platform.LocalFocusManager
|
import androidx.compose.ui.platform.LocalFocusManager
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.input.KeyboardCapitalization
|
import androidx.compose.ui.text.input.KeyboardCapitalization
|
||||||
|
|
@ -52,6 +49,7 @@ import io.element.android.libraries.designsystem.components.LabelledTextField
|
||||||
import io.element.android.libraries.designsystem.components.async.AsyncActionView
|
import io.element.android.libraries.designsystem.components.async.AsyncActionView
|
||||||
import io.element.android.libraries.designsystem.components.async.AsyncActionViewDefaults
|
import io.element.android.libraries.designsystem.components.async.AsyncActionViewDefaults
|
||||||
import io.element.android.libraries.designsystem.components.button.BackButton
|
import io.element.android.libraries.designsystem.components.button.BackButton
|
||||||
|
import io.element.android.libraries.designsystem.modifiers.clearFocusOnTap
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
import io.element.android.libraries.designsystem.theme.aliasScreenTitle
|
import io.element.android.libraries.designsystem.theme.aliasScreenTitle
|
||||||
|
|
@ -173,10 +171,8 @@ private fun ConfigureRoomToolbar(
|
||||||
isNextActionEnabled: Boolean,
|
isNextActionEnabled: Boolean,
|
||||||
onBackPressed: () -> Unit,
|
onBackPressed: () -> Unit,
|
||||||
onNextPressed: () -> Unit,
|
onNextPressed: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = modifier,
|
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.screen_create_room_title),
|
text = stringResource(R.string.screen_create_room_title),
|
||||||
|
|
@ -259,13 +255,6 @@ private fun RoomPrivacyOptions(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Modifier.clearFocusOnTap(focusManager: FocusManager): Modifier =
|
|
||||||
pointerInput(Unit) {
|
|
||||||
detectTapGestures(onTap = {
|
|
||||||
focusManager.clearFocus()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreviewsDayNight
|
@PreviewsDayNight
|
||||||
@Composable
|
@Composable
|
||||||
internal fun ConfigureRoomViewPreview(@PreviewParameter(ConfigureRoomStateProvider::class) state: ConfigureRoomState) = ElementPreview {
|
internal fun ConfigureRoomViewPreview(@PreviewParameter(ConfigureRoomStateProvider::class) state: ConfigureRoomState) = ElementPreview {
|
||||||
|
|
|
||||||
|
|
@ -117,10 +117,8 @@ fun CreateRoomRootView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun CreateRoomRootViewTopBar(
|
private fun CreateRoomRootViewTopBar(
|
||||||
onClosePressed: () -> Unit,
|
onClosePressed: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = modifier,
|
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = CommonStrings.action_start_chat),
|
text = stringResource(id = CommonStrings.action_start_chat),
|
||||||
|
|
@ -141,9 +139,8 @@ private fun CreateRoomActionButtonsList(
|
||||||
state: CreateRoomRootState,
|
state: CreateRoomRootState,
|
||||||
onNewRoomClicked: () -> Unit,
|
onNewRoomClicked: () -> Unit,
|
||||||
onInvitePeopleClicked: () -> Unit,
|
onInvitePeopleClicked: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
Column(modifier = modifier) {
|
Column {
|
||||||
CreateRoomActionButton(
|
CreateRoomActionButton(
|
||||||
iconRes = CompoundDrawables.ic_plus,
|
iconRes = CompoundDrawables.ic_plus,
|
||||||
text = stringResource(id = R.string.screen_create_room_action_create_room),
|
text = stringResource(id = R.string.screen_create_room_action_create_room),
|
||||||
|
|
@ -162,10 +159,9 @@ private fun CreateRoomActionButton(
|
||||||
@DrawableRes iconRes: Int,
|
@DrawableRes iconRes: Int,
|
||||||
text: String,
|
text: String,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(56.dp)
|
.height(56.dp)
|
||||||
.clickable { onClick() }
|
.clickable { onClick() }
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ fun NotificationsOptInView(
|
||||||
header = { NotificationsOptInHeader(modifier = Modifier.padding(top = 60.dp, bottom = 12.dp)) },
|
header = { NotificationsOptInHeader(modifier = Modifier.padding(top = 60.dp, bottom = 12.dp)) },
|
||||||
footer = { NotificationsOptInFooter(state) },
|
footer = { NotificationsOptInFooter(state) },
|
||||||
) {
|
) {
|
||||||
NotificationsOptInContent(modifier = Modifier.fillMaxWidth())
|
NotificationsOptInContent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -104,10 +104,8 @@ private fun NotificationsOptInFooter(state: NotificationsOptInState) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun NotificationsOptInContent(
|
private fun NotificationsOptInContent() {
|
||||||
modifier: Modifier = Modifier,
|
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
||||||
) {
|
|
||||||
Box(modifier = modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
|
|
||||||
Column(
|
Column(
|
||||||
verticalArrangement = Arrangement.spacedBy(
|
verticalArrangement = Arrangement.spacedBy(
|
||||||
16.dp,
|
16.dp,
|
||||||
|
|
@ -144,10 +142,8 @@ private fun NotificationRow(
|
||||||
avatarColorsId: String,
|
avatarColorsId: String,
|
||||||
firstRowPercent: Float,
|
firstRowPercent: Float,
|
||||||
secondRowPercent: Float,
|
secondRowPercent: Float,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
modifier = modifier,
|
|
||||||
color = ElementTheme.colors.bgCanvasDisabled,
|
color = ElementTheme.colors.bgCanvasDisabled,
|
||||||
shape = RoundedCornerShape(14.dp),
|
shape = RoundedCornerShape(14.dp),
|
||||||
shadowElevation = 2.dp,
|
shadowElevation = 2.dp,
|
||||||
|
|
|
||||||
|
|
@ -66,10 +66,8 @@ fun PinEntryTextField(
|
||||||
private fun PinEntryRow(
|
private fun PinEntryRow(
|
||||||
pinEntry: PinEntry,
|
pinEntry: PinEntry,
|
||||||
isSecured: Boolean,
|
isSecured: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
FlowRow(
|
FlowRow(
|
||||||
modifier = modifier,
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp, alignment = Alignment.CenterHorizontally),
|
horizontalArrangement = Arrangement.spacedBy(8.dp, alignment = Alignment.CenterHorizontally),
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
) {
|
) {
|
||||||
|
|
@ -83,7 +81,6 @@ private fun PinEntryRow(
|
||||||
private fun PinDigitView(
|
private fun PinDigitView(
|
||||||
digit: PinDigit,
|
digit: PinDigit,
|
||||||
isSecured: Boolean,
|
isSecured: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
val shape = RoundedCornerShape(8.dp)
|
val shape = RoundedCornerShape(8.dp)
|
||||||
val appearanceModifier = when (digit) {
|
val appearanceModifier = when (digit) {
|
||||||
|
|
@ -95,7 +92,7 @@ private fun PinDigitView(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.size(48.dp)
|
.size(48.dp)
|
||||||
.then(appearanceModifier),
|
.then(appearanceModifier),
|
||||||
contentAlignment = Alignment.Center,
|
contentAlignment = Alignment.Center,
|
||||||
|
|
|
||||||
|
|
@ -57,13 +57,12 @@ fun SetupBiometricView(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SetupBiometricHeader(modifier: Modifier = Modifier) {
|
private fun SetupBiometricHeader() {
|
||||||
val biometricAuth = stringResource(id = R.string.screen_app_lock_biometric_authentication)
|
val biometricAuth = stringResource(id = R.string.screen_app_lock_biometric_authentication)
|
||||||
IconTitleSubtitleMolecule(
|
IconTitleSubtitleMolecule(
|
||||||
iconImageVector = Icons.Default.Fingerprint,
|
iconImageVector = Icons.Default.Fingerprint,
|
||||||
title = stringResource(id = R.string.screen_app_lock_settings_enable_biometric_unlock),
|
title = stringResource(id = R.string.screen_app_lock_settings_enable_biometric_unlock),
|
||||||
subTitle = stringResource(id = R.string.screen_app_lock_setup_biometric_unlock_subtitle, biometricAuth),
|
subTitle = stringResource(id = R.string.screen_app_lock_setup_biometric_unlock_subtitle, biometricAuth),
|
||||||
modifier = modifier
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,11 +70,8 @@ private fun SetupBiometricHeader(modifier: Modifier = Modifier) {
|
||||||
private fun SetupBiometricFooter(
|
private fun SetupBiometricFooter(
|
||||||
onAllowClicked: () -> Unit,
|
onAllowClicked: () -> Unit,
|
||||||
onSkipClicked: () -> Unit,
|
onSkipClicked: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
ButtonColumnMolecule(
|
ButtonColumnMolecule {
|
||||||
modifier = modifier,
|
|
||||||
) {
|
|
||||||
val biometricAuth = stringResource(id = R.string.screen_app_lock_biometric_authentication)
|
val biometricAuth = stringResource(id = R.string.screen_app_lock_biometric_authentication)
|
||||||
Button(
|
Button(
|
||||||
text = stringResource(id = R.string.screen_app_lock_setup_biometric_unlock_allow_title, biometricAuth),
|
text = stringResource(id = R.string.screen_app_lock_setup_biometric_unlock_allow_title, biometricAuth),
|
||||||
|
|
|
||||||
|
|
@ -86,10 +86,8 @@ fun SetupPinView(
|
||||||
private fun SetupPinHeader(
|
private fun SetupPinHeader(
|
||||||
isValidationStep: Boolean,
|
isValidationStep: Boolean,
|
||||||
appName: String,
|
appName: String,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier,
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
) {
|
) {
|
||||||
IconTitleSubtitleMolecule(
|
IconTitleSubtitleMolecule(
|
||||||
|
|
@ -107,7 +105,6 @@ private fun SetupPinHeader(
|
||||||
@Composable
|
@Composable
|
||||||
private fun SetupPinContent(
|
private fun SetupPinContent(
|
||||||
state: SetupPinState,
|
state: SetupPinState,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
val focusRequester = remember { FocusRequester() }
|
val focusRequester = remember { FocusRequester() }
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
|
|
@ -119,14 +116,13 @@ private fun SetupPinContent(
|
||||||
onValueChange = { entry ->
|
onValueChange = { entry ->
|
||||||
state.eventSink(SetupPinEvents.OnPinEntryChanged(entry, state.isConfirmationStep))
|
state.eventSink(SetupPinEvents.OnPinEntryChanged(entry, state.isConfirmationStep))
|
||||||
},
|
},
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.focusRequester(focusRequester)
|
.focusRequester(focusRequester)
|
||||||
.padding(top = 36.dp)
|
.padding(top = 36.dp)
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
)
|
)
|
||||||
if (state.setupPinFailure != null) {
|
if (state.setupPinFailure != null) {
|
||||||
ErrorDialog(
|
ErrorDialog(
|
||||||
modifier = modifier,
|
|
||||||
title = state.setupPinFailure.title(),
|
title = state.setupPinFailure.title(),
|
||||||
content = state.setupPinFailure.content(),
|
content = state.setupPinFailure.content(),
|
||||||
onDismiss = {
|
onDismiss = {
|
||||||
|
|
|
||||||
|
|
@ -107,10 +107,9 @@ fun PinUnlockView(
|
||||||
private fun PinUnlockPage(
|
private fun PinUnlockPage(
|
||||||
state: PinUnlockState,
|
state: PinUnlockState,
|
||||||
isInAppUnlock: Boolean,
|
isInAppUnlock: Boolean,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
BoxWithConstraints {
|
BoxWithConstraints {
|
||||||
val commonModifier = modifier
|
val commonModifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.systemBarsPadding()
|
.systemBarsPadding()
|
||||||
.imePadding()
|
.imePadding()
|
||||||
|
|
@ -188,7 +187,6 @@ private fun SignOutPrompt(
|
||||||
isCancellable: Boolean,
|
isCancellable: Boolean,
|
||||||
onSignOut: () -> Unit,
|
onSignOut: () -> Unit,
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
if (isCancellable) {
|
if (isCancellable) {
|
||||||
ConfirmationDialog(
|
ConfirmationDialog(
|
||||||
|
|
@ -196,14 +194,12 @@ private fun SignOutPrompt(
|
||||||
content = stringResource(id = R.string.screen_app_lock_signout_alert_message),
|
content = stringResource(id = R.string.screen_app_lock_signout_alert_message),
|
||||||
onSubmitClicked = onSignOut,
|
onSubmitClicked = onSignOut,
|
||||||
onDismiss = onDismiss,
|
onDismiss = onDismiss,
|
||||||
modifier = modifier,
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
ErrorDialog(
|
ErrorDialog(
|
||||||
title = stringResource(id = R.string.screen_app_lock_signout_alert_title),
|
title = stringResource(id = R.string.screen_app_lock_signout_alert_title),
|
||||||
content = stringResource(id = R.string.screen_app_lock_signout_alert_message),
|
content = stringResource(id = R.string.screen_app_lock_signout_alert_message),
|
||||||
onDismiss = onSignOut,
|
onDismiss = onSignOut,
|
||||||
modifier = modifier,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -258,9 +254,11 @@ private fun PinUnlockExpandedView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun PinDotsRow(
|
private fun PinDotsRow(
|
||||||
pinEntry: PinEntry,
|
pinEntry: PinEntry,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
Row(modifier, horizontalArrangement = spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically) {
|
Row(
|
||||||
|
horizontalArrangement = spacedBy(8.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
) {
|
||||||
for (digit in pinEntry.digits) {
|
for (digit in pinEntry.digits) {
|
||||||
PinDot(isFilled = digit is PinDigit.Filled)
|
PinDot(isFilled = digit is PinDigit.Filled)
|
||||||
}
|
}
|
||||||
|
|
@ -270,7 +268,6 @@ private fun PinDotsRow(
|
||||||
@Composable
|
@Composable
|
||||||
private fun PinDot(
|
private fun PinDot(
|
||||||
isFilled: Boolean,
|
isFilled: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
val backgroundColor = if (isFilled) {
|
val backgroundColor = if (isFilled) {
|
||||||
ElementTheme.colors.iconPrimary
|
ElementTheme.colors.iconPrimary
|
||||||
|
|
@ -278,7 +275,7 @@ private fun PinDot(
|
||||||
ElementTheme.colors.bgSubtlePrimary
|
ElementTheme.colors.bgSubtlePrimary
|
||||||
}
|
}
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.size(14.dp)
|
.size(14.dp)
|
||||||
.background(backgroundColor, CircleShape)
|
.background(backgroundColor, CircleShape)
|
||||||
)
|
)
|
||||||
|
|
@ -290,7 +287,10 @@ private fun PinUnlockHeader(
|
||||||
isInAppUnlock: Boolean,
|
isInAppUnlock: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
Column(modifier, horizontalAlignment = Alignment.CenterHorizontally) {
|
Column(
|
||||||
|
modifier = modifier,
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
) {
|
||||||
if (isInAppUnlock) {
|
if (isInAppUnlock) {
|
||||||
RoundedIconAtom(imageVector = Icons.Filled.Lock)
|
RoundedIconAtom(imageVector = Icons.Filled.Lock)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -108,14 +108,13 @@ private fun PinKeypadRow(
|
||||||
models: ImmutableList<PinKeypadModel>,
|
models: ImmutableList<PinKeypadModel>,
|
||||||
onClick: (PinKeypadModel) -> Unit,
|
onClick: (PinKeypadModel) -> Unit,
|
||||||
pinKeySize: Dp,
|
pinKeySize: Dp,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,
|
horizontalArrangement: Arrangement.Horizontal = Arrangement.Start,
|
||||||
verticalAlignment: Alignment.Vertical = Alignment.Top,
|
verticalAlignment: Alignment.Vertical = Alignment.Top,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
horizontalArrangement = horizontalArrangement,
|
horizontalArrangement = horizontalArrangement,
|
||||||
verticalAlignment = verticalAlignment,
|
verticalAlignment = verticalAlignment,
|
||||||
modifier = modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
) {
|
) {
|
||||||
val commonModifier = Modifier.size(pinKeySize)
|
val commonModifier = Modifier.size(pinKeySize)
|
||||||
for (model in models) {
|
for (model in models) {
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,6 @@ private fun LoginForm(
|
||||||
state: LoginPasswordState,
|
state: LoginPasswordState,
|
||||||
isLoading: Boolean,
|
isLoading: Boolean,
|
||||||
onSubmit: () -> Unit,
|
onSubmit: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
var loginFieldState by textFieldState(stateValue = state.formState.login)
|
var loginFieldState by textFieldState(stateValue = state.formState.login)
|
||||||
var passwordFieldState by textFieldState(stateValue = state.formState.password)
|
var passwordFieldState by textFieldState(stateValue = state.formState.password)
|
||||||
|
|
@ -187,7 +186,7 @@ private fun LoginForm(
|
||||||
val focusManager = LocalFocusManager.current
|
val focusManager = LocalFocusManager.current
|
||||||
val eventSink = state.eventSink
|
val eventSink = state.eventSink
|
||||||
|
|
||||||
Column(modifier) {
|
Column {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.screen_login_form_header),
|
text = stringResource(R.string.screen_login_form_header),
|
||||||
modifier = Modifier.padding(start = 16.dp),
|
modifier = Modifier.padding(start = 16.dp),
|
||||||
|
|
|
||||||
|
|
@ -119,9 +119,8 @@ private fun WaitListContent(
|
||||||
private fun OverallContent(
|
private fun OverallContent(
|
||||||
state: WaitListState,
|
state: WaitListState,
|
||||||
onCancelClicked: () -> Unit,
|
onCancelClicked: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
Box(modifier = modifier.fillMaxSize()) {
|
Box(modifier = Modifier.fillMaxSize()) {
|
||||||
if (state.loginAction !is AsyncData.Success) {
|
if (state.loginAction !is AsyncData.Success) {
|
||||||
CompositionLocalProvider(LocalContentColor provides ElementTheme.colors.textOnSolidPrimary) {
|
CompositionLocalProvider(LocalContentColor provides ElementTheme.colors.textOnSolidPrimary) {
|
||||||
TextButton(
|
TextButton(
|
||||||
|
|
|
||||||
|
|
@ -412,10 +412,9 @@ private fun MessagesViewContent(
|
||||||
private fun MessagesViewComposerBottomSheetContents(
|
private fun MessagesViewComposerBottomSheetContents(
|
||||||
subcomposing: Boolean,
|
subcomposing: Boolean,
|
||||||
state: MessagesState,
|
state: MessagesState,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
if (state.userHasPermissionToSendMessage) {
|
if (state.userHasPermissionToSendMessage) {
|
||||||
Column(modifier = modifier.fillMaxWidth()) {
|
Column(modifier = Modifier.fillMaxWidth()) {
|
||||||
MentionSuggestionsPickerView(
|
MentionSuggestionsPickerView(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.heightIn(max = 230.dp)
|
.heightIn(max = 230.dp)
|
||||||
|
|
@ -443,7 +442,7 @@ private fun MessagesViewComposerBottomSheetContents(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CantSendMessageBanner(modifier = modifier)
|
CantSendMessageBanner()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -456,10 +455,8 @@ private fun MessagesViewTopBar(
|
||||||
onRoomDetailsClicked: () -> Unit,
|
onRoomDetailsClicked: () -> Unit,
|
||||||
onJoinCallClicked: () -> Unit,
|
onJoinCallClicked: () -> Unit,
|
||||||
onBackPressed: () -> Unit,
|
onBackPressed: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = modifier,
|
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
BackButton(onClick = onBackPressed)
|
BackButton(onClick = onBackPressed)
|
||||||
},
|
},
|
||||||
|
|
@ -497,7 +494,6 @@ private fun MessagesViewTopBar(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun JoinCallMenuItem(
|
private fun JoinCallMenuItem(
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
onJoinCallClicked: () -> Unit,
|
onJoinCallClicked: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Material3Button(
|
Material3Button(
|
||||||
|
|
@ -507,7 +503,7 @@ private fun JoinCallMenuItem(
|
||||||
containerColor = ElementTheme.colors.iconAccentTertiary
|
containerColor = ElementTheme.colors.iconAccentTertiary
|
||||||
),
|
),
|
||||||
contentPadding = PaddingValues(horizontal = 10.dp, vertical = 0.dp),
|
contentPadding = PaddingValues(horizontal = 10.dp, vertical = 0.dp),
|
||||||
modifier = modifier.heightIn(min = 36.dp),
|
modifier = Modifier.heightIn(min = 36.dp),
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier.size(20.dp),
|
modifier = Modifier.size(20.dp),
|
||||||
|
|
@ -545,11 +541,9 @@ private fun RoomAvatarAndNameRow(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun CantSendMessageBanner(
|
private fun CantSendMessageBanner() {
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.background(MaterialTheme.colorScheme.secondary)
|
.background(MaterialTheme.colorScheme.secondary)
|
||||||
.padding(16.dp),
|
.padding(16.dp),
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,6 @@ private fun EmojiButton(
|
||||||
emoji: String,
|
emoji: String,
|
||||||
isHighlighted: Boolean,
|
isHighlighted: Boolean,
|
||||||
onClicked: (String) -> Unit,
|
onClicked: (String) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
val backgroundColor = if (isHighlighted) {
|
val backgroundColor = if (isHighlighted) {
|
||||||
ElementTheme.colors.bgActionPrimaryRest
|
ElementTheme.colors.bgActionPrimaryRest
|
||||||
|
|
@ -350,7 +349,7 @@ private fun EmojiButton(
|
||||||
stringResource(id = CommonStrings.a11y_react_with, emoji)
|
stringResource(id = CommonStrings.a11y_react_with, emoji)
|
||||||
}
|
}
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.size(48.dp)
|
.size(48.dp)
|
||||||
.background(backgroundColor, CircleShape)
|
.background(backgroundColor, CircleShape)
|
||||||
.clearAndSetSemantics {
|
.clearAndSetSemantics {
|
||||||
|
|
|
||||||
|
|
@ -118,10 +118,9 @@ private fun AttachmentPreviewContent(
|
||||||
attachment: Attachment,
|
attachment: Attachment,
|
||||||
onSendClicked: () -> Unit,
|
onSendClicked: () -> Unit,
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(top = 24.dp)
|
.padding(top = 24.dp)
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -101,10 +101,9 @@ private fun AttachmentSourcePickerMenu(
|
||||||
onSendLocationClicked: () -> Unit,
|
onSendLocationClicked: () -> Unit,
|
||||||
onCreatePollClicked: () -> Unit,
|
onCreatePollClicked: () -> Unit,
|
||||||
enableTextFormatting: Boolean,
|
enableTextFormatting: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.navigationBarsPadding()
|
.navigationBarsPadding()
|
||||||
.imePadding()
|
.imePadding()
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -126,9 +126,8 @@ private val ADD_EMOJI_SIZE = 16.dp
|
||||||
@Composable
|
@Composable
|
||||||
private fun TextContent(
|
private fun TextContent(
|
||||||
text: String,
|
text: String,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) = Text(
|
) = Text(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.height(REACTION_EMOJI_LINE_HEIGHT.toDp()),
|
.height(REACTION_EMOJI_LINE_HEIGHT.toDp()),
|
||||||
text = text,
|
text = text,
|
||||||
style = ElementTheme.typography.fontBodyMdRegular,
|
style = ElementTheme.typography.fontBodyMdRegular,
|
||||||
|
|
@ -138,27 +137,24 @@ private fun TextContent(
|
||||||
@Composable
|
@Composable
|
||||||
private fun IconContent(
|
private fun IconContent(
|
||||||
@DrawableRes resourceId: Int,
|
@DrawableRes resourceId: Int,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) = Icon(
|
) = Icon(
|
||||||
resourceId = resourceId,
|
resourceId = resourceId,
|
||||||
contentDescription = stringResource(id = R.string.screen_room_timeline_add_reaction),
|
contentDescription = stringResource(id = R.string.screen_room_timeline_add_reaction),
|
||||||
tint = ElementTheme.materialColors.secondary,
|
tint = ElementTheme.materialColors.secondary,
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.size(ADD_EMOJI_SIZE)
|
.size(ADD_EMOJI_SIZE)
|
||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ReactionContent(
|
private fun ReactionContent(
|
||||||
reaction: AggregatedReaction,
|
reaction: AggregatedReaction,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) = Row(
|
) = Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = modifier,
|
|
||||||
) {
|
) {
|
||||||
// Check if this is a custom reaction (MSC4027)
|
// Check if this is a custom reaction (MSC4027)
|
||||||
if (reaction.key.startsWith("mxc://")) {
|
if (reaction.key.startsWith("mxc://")) {
|
||||||
AsyncImage(
|
AsyncImage(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.heightIn(min = REACTION_EMOJI_LINE_HEIGHT.toDp(), max = REACTION_EMOJI_LINE_HEIGHT.toDp())
|
.heightIn(min = REACTION_EMOJI_LINE_HEIGHT.toDp(), max = REACTION_EMOJI_LINE_HEIGHT.toDp())
|
||||||
.aspectRatio(REACTION_IMAGE_ASPECT_RATIO, false),
|
.aspectRatio(REACTION_IMAGE_ASPECT_RATIO, false),
|
||||||
model = MediaRequestData(MediaSource(reaction.key), MediaRequestData.Kind.Content),
|
model = MediaRequestData(MediaSource(reaction.key), MediaRequestData.Kind.Content),
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.aspectRatio
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.heightIn
|
import androidx.compose.foundation.layout.heightIn
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
|
@ -106,7 +107,6 @@ fun ReactionSummaryView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun SheetContent(
|
private fun SheetContent(
|
||||||
summary: ReactionSummaryState.Summary,
|
summary: ReactionSummaryState.Summary,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
val animationScope = rememberCoroutineScope()
|
val animationScope = rememberCoroutineScope()
|
||||||
var selectedReactionKey: String by rememberSaveable { mutableStateOf(summary.selectedKey) }
|
var selectedReactionKey: String by rememberSaveable { mutableStateOf(summary.selectedKey) }
|
||||||
|
|
@ -127,9 +127,8 @@ private fun SheetContent(
|
||||||
}
|
}
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxSize()
|
||||||
.fillMaxHeight()
|
|
||||||
) {
|
) {
|
||||||
LazyRow(
|
LazyRow(
|
||||||
state = reactionListState,
|
state = reactionListState,
|
||||||
|
|
@ -172,7 +171,6 @@ private fun AggregatedReactionButton(
|
||||||
reaction: AggregatedReaction,
|
reaction: AggregatedReaction,
|
||||||
isHighlighted: Boolean,
|
isHighlighted: Boolean,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
val buttonColor = if (isHighlighted) {
|
val buttonColor = if (isHighlighted) {
|
||||||
ElementTheme.colors.bgActionPrimaryRest
|
ElementTheme.colors.bgActionPrimaryRest
|
||||||
|
|
@ -188,7 +186,7 @@ private fun AggregatedReactionButton(
|
||||||
|
|
||||||
val roundedCornerShape = RoundedCornerShape(corner = CornerSize(percent = 50))
|
val roundedCornerShape = RoundedCornerShape(corner = CornerSize(percent = 50))
|
||||||
Surface(
|
Surface(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.background(buttonColor, roundedCornerShape)
|
.background(buttonColor, roundedCornerShape)
|
||||||
.clip(roundedCornerShape)
|
.clip(roundedCornerShape)
|
||||||
.clickable(onClick = onClick)
|
.clickable(onClick = onClick)
|
||||||
|
|
@ -238,10 +236,9 @@ private fun SenderRow(
|
||||||
name: String,
|
name: String,
|
||||||
userId: String,
|
userId: String,
|
||||||
sentTime: String,
|
sentTime: String,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.heightIn(min = 56.dp)
|
.heightIn(min = 56.dp)
|
||||||
.padding(start = 16.dp, top = 4.dp, end = 16.dp, bottom = 4.dp),
|
.padding(start = 16.dp, top = 4.dp, end = 16.dp, bottom = 4.dp),
|
||||||
|
|
|
||||||
|
|
@ -125,11 +125,10 @@ fun EventDebugInfoView(
|
||||||
private fun CollapsibleSection(
|
private fun CollapsibleSection(
|
||||||
title: String,
|
title: String,
|
||||||
text: String,
|
text: String,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
initiallyExpanded: Boolean = false,
|
initiallyExpanded: Boolean = false,
|
||||||
) {
|
) {
|
||||||
var isExpanded by remember { mutableStateOf(initiallyExpanded) }
|
var isExpanded by remember { mutableStateOf(initiallyExpanded) }
|
||||||
Column(modifier = modifier.fillMaxWidth()) {
|
Column(modifier = Modifier.fillMaxWidth()) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clickable { isExpanded = !isExpanded }
|
.clickable { isExpanded = !isExpanded }
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
@Composable
|
@Composable
|
||||||
fun ConnectivityIndicatorView(
|
fun ConnectivityIndicatorView(
|
||||||
isOnline: Boolean,
|
isOnline: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
val isIndicatorVisible = remember { MutableTransitionState(!isOnline) }.apply { targetState = !isOnline }
|
val isIndicatorVisible = remember { MutableTransitionState(!isOnline) }.apply { targetState = !isOnline }
|
||||||
val isStatusBarPaddingVisible = remember { MutableTransitionState(isOnline) }.apply { targetState = isOnline }
|
val isStatusBarPaddingVisible = remember { MutableTransitionState(isOnline) }.apply { targetState = isOnline }
|
||||||
|
|
@ -48,7 +47,7 @@ fun ConnectivityIndicatorView(
|
||||||
enter = fadeIn() + expandVertically(),
|
enter = fadeIn() + expandVertically(),
|
||||||
exit = fadeOut() + shrinkVertically(),
|
exit = fadeOut() + shrinkVertically(),
|
||||||
) {
|
) {
|
||||||
Indicator(modifier)
|
Indicator()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show missing status bar padding when the indicator is not visible
|
// Show missing status bar padding when the indicator is not visible
|
||||||
|
|
@ -57,7 +56,7 @@ fun ConnectivityIndicatorView(
|
||||||
enter = fadeIn() + expandVertically(),
|
enter = fadeIn() + expandVertically(),
|
||||||
exit = fadeOut() + shrinkVertically(),
|
exit = fadeOut() + shrinkVertically(),
|
||||||
) {
|
) {
|
||||||
StatusBarPaddingSpacer(modifier)
|
StatusBarPaddingSpacer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,10 +93,9 @@ fun OnBoardingView(
|
||||||
private fun OnBoardingContent(
|
private fun OnBoardingContent(
|
||||||
state: OnBoardingState,
|
state: OnBoardingState,
|
||||||
onOpenDeveloperSettings: () -> Unit,
|
onOpenDeveloperSettings: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
|
@ -158,9 +157,8 @@ private fun OnBoardingButtons(
|
||||||
onSignIn: () -> Unit,
|
onSignIn: () -> Unit,
|
||||||
onCreateAccount: () -> Unit,
|
onCreateAccount: () -> Unit,
|
||||||
onReportProblem: () -> Unit,
|
onReportProblem: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
ButtonColumnMolecule(modifier = modifier) {
|
ButtonColumnMolecule {
|
||||||
val signInButtonStringRes = if (state.canLoginWithQrCode || state.canCreateAccount) {
|
val signInButtonStringRes = if (state.canLoginWithQrCode || state.canCreateAccount) {
|
||||||
R.string.screen_onboarding_sign_in_manually
|
R.string.screen_onboarding_sign_in_manually
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -143,10 +143,8 @@ fun PollContentView(
|
||||||
private fun PollTitle(
|
private fun PollTitle(
|
||||||
title: String,
|
title: String,
|
||||||
isPollEnded: Boolean,
|
isPollEnded: Boolean,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier,
|
|
||||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
) {
|
) {
|
||||||
if (isPollEnded) {
|
if (isPollEnded) {
|
||||||
|
|
@ -173,10 +171,9 @@ private fun PollTitle(
|
||||||
private fun PollAnswers(
|
private fun PollAnswers(
|
||||||
answerItems: ImmutableList<PollAnswerItem>,
|
answerItems: ImmutableList<PollAnswerItem>,
|
||||||
onAnswerSelected: (PollAnswer) -> Unit,
|
onAnswerSelected: (PollAnswer) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier.selectableGroup(),
|
modifier = Modifier.selectableGroup(),
|
||||||
verticalArrangement = Arrangement.spacedBy(16.dp),
|
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
) {
|
) {
|
||||||
answerItems.forEach {
|
answerItems.forEach {
|
||||||
|
|
@ -197,10 +194,9 @@ private fun PollAnswers(
|
||||||
@Composable
|
@Composable
|
||||||
private fun ColumnScope.DisclosedPollBottomNotice(
|
private fun ColumnScope.DisclosedPollBottomNotice(
|
||||||
votesCount: Int,
|
votesCount: Int,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
modifier = modifier.align(Alignment.End),
|
modifier = Modifier.align(Alignment.End),
|
||||||
style = ElementTheme.typography.fontBodyXsRegular,
|
style = ElementTheme.typography.fontBodyXsRegular,
|
||||||
color = ElementTheme.colors.textSecondary,
|
color = ElementTheme.colors.textSecondary,
|
||||||
text = stringResource(CommonStrings.common_poll_total_votes, votesCount),
|
text = stringResource(CommonStrings.common_poll_total_votes, votesCount),
|
||||||
|
|
@ -208,11 +204,9 @@ private fun ColumnScope.DisclosedPollBottomNotice(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ColumnScope.UndisclosedPollBottomNotice(
|
private fun ColumnScope.UndisclosedPollBottomNotice() {
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
|
||||||
Text(
|
Text(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.align(Alignment.Start)
|
.align(Alignment.Start)
|
||||||
.padding(start = 34.dp),
|
.padding(start = 34.dp),
|
||||||
style = ElementTheme.typography.fontBodyXsRegular,
|
style = ElementTheme.typography.fontBodyXsRegular,
|
||||||
|
|
|
||||||
|
|
@ -92,9 +92,8 @@ fun DeveloperSettingsView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun ElementCallCategory(
|
private fun ElementCallCategory(
|
||||||
state: DeveloperSettingsState,
|
state: DeveloperSettingsState,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
PreferenceCategory(modifier = modifier, title = "Element Call", showDivider = true) {
|
PreferenceCategory(title = "Element Call", showDivider = true) {
|
||||||
val callUrlState = state.customElementCallBaseUrlState
|
val callUrlState = state.customElementCallBaseUrlState
|
||||||
fun isUsingDefaultUrl(value: String?): Boolean {
|
fun isUsingDefaultUrl(value: String?): Boolean {
|
||||||
return value.isNullOrEmpty() || value == callUrlState.defaultUrl
|
return value.isNullOrEmpty() || value == callUrlState.defaultUrl
|
||||||
|
|
@ -120,14 +119,12 @@ private fun ElementCallCategory(
|
||||||
@Composable
|
@Composable
|
||||||
private fun FeatureListContent(
|
private fun FeatureListContent(
|
||||||
state: DeveloperSettingsState,
|
state: DeveloperSettingsState,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
fun onFeatureEnabled(feature: FeatureUiModel, isEnabled: Boolean) {
|
fun onFeatureEnabled(feature: FeatureUiModel, isEnabled: Boolean) {
|
||||||
state.eventSink(DeveloperSettingsEvents.UpdateEnabledFeature(feature, isEnabled))
|
state.eventSink(DeveloperSettingsEvents.UpdateEnabledFeature(feature, isEnabled))
|
||||||
}
|
}
|
||||||
|
|
||||||
FeatureListView(
|
FeatureListView(
|
||||||
modifier = modifier,
|
|
||||||
features = state.features,
|
features = state.features,
|
||||||
onCheckedChange = ::onFeatureEnabled,
|
onCheckedChange = ::onFeatureEnabled,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -141,14 +141,12 @@ fun ConfigureTracingView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun CrateListContent(
|
private fun CrateListContent(
|
||||||
state: ConfigureTracingState,
|
state: ConfigureTracingState,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
fun onLogLevelChange(target: Target, logLevel: LogLevel) {
|
fun onLogLevelChange(target: Target, logLevel: LogLevel) {
|
||||||
state.eventSink(ConfigureTracingEvents.UpdateFilter(target, logLevel))
|
state.eventSink(ConfigureTracingEvents.UpdateFilter(target, logLevel))
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetAndLogLevelListView(
|
TargetAndLogLevelListView(
|
||||||
modifier = modifier,
|
|
||||||
data = state.targetsToLogLevel,
|
data = state.targetsToLogLevel,
|
||||||
onLogLevelChange = ::onLogLevelChange,
|
onLogLevelChange = ::onLogLevelChange,
|
||||||
)
|
)
|
||||||
|
|
@ -158,11 +156,8 @@ private fun CrateListContent(
|
||||||
private fun TargetAndLogLevelListView(
|
private fun TargetAndLogLevelListView(
|
||||||
data: ImmutableMap<Target, LogLevel>,
|
data: ImmutableMap<Target, LogLevel>,
|
||||||
onLogLevelChange: (Target, LogLevel) -> Unit,
|
onLogLevelChange: (Target, LogLevel) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
Column(
|
Column {
|
||||||
modifier = modifier,
|
|
||||||
) {
|
|
||||||
data.forEach { item ->
|
data.forEach { item ->
|
||||||
fun onLogLevelChange(logLevel: LogLevel) {
|
fun onLogLevelChange(logLevel: LogLevel) {
|
||||||
onLogLevelChange(item.key, logLevel)
|
onLogLevelChange(item.key, logLevel)
|
||||||
|
|
@ -182,10 +177,8 @@ private fun TargetAndLogLevelView(
|
||||||
target: Target,
|
target: Target,
|
||||||
logLevel: LogLevel,
|
logLevel: LogLevel,
|
||||||
onLogLevelChange: (LogLevel) -> Unit,
|
onLogLevelChange: (LogLevel) -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
ListItem(
|
ListItem(
|
||||||
modifier = modifier,
|
|
||||||
headlineContent = { Text(text = target.filter.takeIf { it.isNotEmpty() } ?: "(common)") },
|
headlineContent = { Text(text = target.filter.takeIf { it.isNotEmpty() } ?: "(common)") },
|
||||||
trailingContent = ListItemContent.Custom {
|
trailingContent = ListItemContent.Custom {
|
||||||
LogLevelDropdownMenu(
|
LogLevelDropdownMenu(
|
||||||
|
|
@ -200,10 +193,9 @@ private fun TargetAndLogLevelView(
|
||||||
private fun LogLevelDropdownMenu(
|
private fun LogLevelDropdownMenu(
|
||||||
logLevel: LogLevel,
|
logLevel: LogLevel,
|
||||||
onLogLevelChange: (LogLevel) -> Unit,
|
onLogLevelChange: (LogLevel) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
var expanded by remember { mutableStateOf(false) }
|
var expanded by remember { mutableStateOf(false) }
|
||||||
Box(modifier = modifier) {
|
Box {
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
modifier = Modifier.widthIn(max = 120.dp),
|
modifier = Modifier.widthIn(max = 120.dp),
|
||||||
text = { Text(text = logLevel.filter) },
|
text = { Text(text = logLevel.filter) },
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,6 @@ private fun NotificationSettingsContentView(
|
||||||
// TODO We are removing the call notification toggle until support for call notifications has been added
|
// TODO We are removing the call notification toggle until support for call notifications has been added
|
||||||
// onCallsNotificationsChanged: (Boolean) -> Unit,
|
// onCallsNotificationsChanged: (Boolean) -> Unit,
|
||||||
onInviteForMeNotificationsChanged: (Boolean) -> Unit,
|
onInviteForMeNotificationsChanged: (Boolean) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
if (systemSettings.appNotificationsEnabled && !systemSettings.systemNotificationsEnabled) {
|
if (systemSettings.appNotificationsEnabled && !systemSettings.systemNotificationsEnabled) {
|
||||||
|
|
@ -117,7 +116,6 @@ private fun NotificationSettingsContentView(
|
||||||
}
|
}
|
||||||
|
|
||||||
PreferenceSwitch(
|
PreferenceSwitch(
|
||||||
modifier = modifier,
|
|
||||||
title = stringResource(id = R.string.screen_notification_settings_enable_notifications),
|
title = stringResource(id = R.string.screen_notification_settings_enable_notifications),
|
||||||
isChecked = systemSettings.appNotificationsEnabled,
|
isChecked = systemSettings.appNotificationsEnabled,
|
||||||
switchAlignment = Alignment.Top,
|
switchAlignment = Alignment.Top,
|
||||||
|
|
@ -182,10 +180,8 @@ private fun InvalidNotificationSettingsView(
|
||||||
showError: Boolean,
|
showError: Boolean,
|
||||||
onContinueClicked: () -> Unit,
|
onContinueClicked: () -> Unit,
|
||||||
onDismissError: () -> Unit,
|
onDismissError: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
DialogLikeBannerMolecule(
|
DialogLikeBannerMolecule(
|
||||||
modifier = modifier,
|
|
||||||
title = stringResource(R.string.screen_notification_settings_configuration_mismatch),
|
title = stringResource(R.string.screen_notification_settings_configuration_mismatch),
|
||||||
content = stringResource(R.string.screen_notification_settings_configuration_mismatch_description),
|
content = stringResource(R.string.screen_notification_settings_configuration_mismatch_description),
|
||||||
onSubmitClicked = onContinueClicked,
|
onSubmitClicked = onContinueClicked,
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package io.element.android.features.preferences.impl.user.editprofile
|
package io.element.android.features.preferences.impl.user.editprofile
|
||||||
|
|
||||||
import androidx.compose.foundation.gestures.detectTapGestures
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
|
@ -34,8 +33,6 @@ import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.focus.FocusManager
|
|
||||||
import androidx.compose.ui.input.pointer.pointerInput
|
|
||||||
import androidx.compose.ui.platform.LocalFocusManager
|
import androidx.compose.ui.platform.LocalFocusManager
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
|
|
@ -48,6 +45,7 @@ import io.element.android.libraries.designsystem.components.async.AsyncActionVie
|
||||||
import io.element.android.libraries.designsystem.components.async.AsyncActionViewDefaults
|
import io.element.android.libraries.designsystem.components.async.AsyncActionViewDefaults
|
||||||
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
|
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
|
||||||
import io.element.android.libraries.designsystem.components.button.BackButton
|
import io.element.android.libraries.designsystem.components.button.BackButton
|
||||||
|
import io.element.android.libraries.designsystem.modifiers.clearFocusOnTap
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
import io.element.android.libraries.designsystem.theme.aliasScreenTitle
|
import io.element.android.libraries.designsystem.theme.aliasScreenTitle
|
||||||
|
|
@ -166,13 +164,6 @@ fun EditUserProfileView(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Modifier.clearFocusOnTap(focusManager: FocusManager): Modifier =
|
|
||||||
pointerInput(Unit) {
|
|
||||||
detectTapGestures(onTap = {
|
|
||||||
focusManager.clearFocus()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreviewsDayNight
|
@PreviewsDayNight
|
||||||
@Composable
|
@Composable
|
||||||
internal fun EditUserProfileViewPreview(@PreviewParameter(EditUserProfileStateProvider::class) state: EditUserProfileState) =
|
internal fun EditUserProfileViewPreview(@PreviewParameter(EditUserProfileStateProvider::class) state: EditUserProfileState) =
|
||||||
|
|
|
||||||
|
|
@ -204,12 +204,10 @@ private fun RoomDetailsTopBar(
|
||||||
goBack: () -> Unit,
|
goBack: () -> Unit,
|
||||||
onActionClicked: (RoomDetailsAction) -> Unit,
|
onActionClicked: (RoomDetailsAction) -> Unit,
|
||||||
showEdit: Boolean,
|
showEdit: Boolean,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
var showMenu by remember { mutableStateOf(false) }
|
var showMenu by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = modifier,
|
|
||||||
title = { },
|
title = { },
|
||||||
navigationIcon = { BackButton(onClick = goBack) },
|
navigationIcon = { BackButton(onClick = goBack) },
|
||||||
actions = {
|
actions = {
|
||||||
|
|
@ -237,8 +235,14 @@ private fun RoomDetailsTopBar(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun MainActionsSection(state: RoomDetailsState, onShareRoom: () -> Unit, modifier: Modifier = Modifier) {
|
private fun MainActionsSection(
|
||||||
Row(modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center) {
|
state: RoomDetailsState,
|
||||||
|
onShareRoom: () -> Unit,
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
horizontalArrangement = Arrangement.Center,
|
||||||
|
) {
|
||||||
val roomNotificationSettings = state.roomNotificationSettings
|
val roomNotificationSettings = state.roomNotificationSettings
|
||||||
if (state.canShowNotificationSettings && roomNotificationSettings != null) {
|
if (state.canShowNotificationSettings && roomNotificationSettings != null) {
|
||||||
if (roomNotificationSettings.mode == RoomNotificationMode.MUTE) {
|
if (roomNotificationSettings.mode == RoomNotificationMode.MUTE) {
|
||||||
|
|
@ -275,10 +279,9 @@ private fun RoomHeaderSection(
|
||||||
roomName: String,
|
roomName: String,
|
||||||
roomAlias: String?,
|
roomAlias: String?,
|
||||||
openAvatarPreview: (url: String) -> Unit,
|
openAvatarPreview: (url: String) -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 16.dp),
|
.padding(horizontal = 16.dp),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
|
@ -312,9 +315,8 @@ private fun RoomHeaderSection(
|
||||||
private fun TopicSection(
|
private fun TopicSection(
|
||||||
roomTopic: RoomTopicState,
|
roomTopic: RoomTopicState,
|
||||||
onActionClicked: (RoomDetailsAction) -> Unit,
|
onActionClicked: (RoomDetailsAction) -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
PreferenceCategory(title = stringResource(CommonStrings.common_topic), modifier = modifier) {
|
PreferenceCategory(title = stringResource(CommonStrings.common_topic)) {
|
||||||
if (roomTopic is RoomTopicState.CanAddTopic) {
|
if (roomTopic is RoomTopicState.CanAddTopic) {
|
||||||
PreferenceText(
|
PreferenceText(
|
||||||
title = stringResource(R.string.screen_room_details_add_topic_title),
|
title = stringResource(R.string.screen_room_details_add_topic_title),
|
||||||
|
|
@ -338,14 +340,13 @@ private fun TopicSection(
|
||||||
private fun NotificationSection(
|
private fun NotificationSection(
|
||||||
isDefaultMode: Boolean,
|
isDefaultMode: Boolean,
|
||||||
openRoomNotificationSettings: () -> Unit,
|
openRoomNotificationSettings: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
val subtitle = if (isDefaultMode) {
|
val subtitle = if (isDefaultMode) {
|
||||||
stringResource(R.string.screen_room_details_notification_mode_default)
|
stringResource(R.string.screen_room_details_notification_mode_default)
|
||||||
} else {
|
} else {
|
||||||
stringResource(R.string.screen_room_details_notification_mode_custom)
|
stringResource(R.string.screen_room_details_notification_mode_custom)
|
||||||
}
|
}
|
||||||
PreferenceCategory(modifier = modifier) {
|
PreferenceCategory {
|
||||||
ListItem(
|
ListItem(
|
||||||
headlineContent = { Text(text = stringResource(R.string.screen_room_details_notification_title)) },
|
headlineContent = { Text(text = stringResource(R.string.screen_room_details_notification_title)) },
|
||||||
supportingContent = { Text(text = subtitle) },
|
supportingContent = { Text(text = subtitle) },
|
||||||
|
|
@ -359,9 +360,8 @@ private fun NotificationSection(
|
||||||
private fun MembersSection(
|
private fun MembersSection(
|
||||||
memberCount: Long,
|
memberCount: Long,
|
||||||
openRoomMemberList: () -> Unit,
|
openRoomMemberList: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
PreferenceCategory(modifier = modifier) {
|
PreferenceCategory {
|
||||||
ListItem(
|
ListItem(
|
||||||
headlineContent = { Text(stringResource(CommonStrings.common_people)) },
|
headlineContent = { Text(stringResource(CommonStrings.common_people)) },
|
||||||
leadingContent = ListItemContent.Icon(IconSource.Resource(CommonDrawables.ic_user)),
|
leadingContent = ListItemContent.Icon(IconSource.Resource(CommonDrawables.ic_user)),
|
||||||
|
|
@ -374,9 +374,8 @@ private fun MembersSection(
|
||||||
@Composable
|
@Composable
|
||||||
private fun InviteSection(
|
private fun InviteSection(
|
||||||
invitePeople: () -> Unit,
|
invitePeople: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
PreferenceCategory(modifier = modifier) {
|
PreferenceCategory {
|
||||||
ListItem(
|
ListItem(
|
||||||
headlineContent = { Text(stringResource(R.string.screen_room_details_invite_people_title)) },
|
headlineContent = { Text(stringResource(R.string.screen_room_details_invite_people_title)) },
|
||||||
leadingContent = ListItemContent.Icon(IconSource.Resource(CommonDrawables.ic_user_add)),
|
leadingContent = ListItemContent.Icon(IconSource.Resource(CommonDrawables.ic_user_add)),
|
||||||
|
|
@ -388,9 +387,8 @@ private fun InviteSection(
|
||||||
@Composable
|
@Composable
|
||||||
private fun PollsSection(
|
private fun PollsSection(
|
||||||
openPollHistory: () -> Unit,
|
openPollHistory: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
PreferenceCategory(modifier = modifier) {
|
PreferenceCategory {
|
||||||
ListItem(
|
ListItem(
|
||||||
headlineContent = { Text(stringResource(R.string.screen_polls_history_title)) },
|
headlineContent = { Text(stringResource(R.string.screen_polls_history_title)) },
|
||||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Polls)),
|
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Polls)),
|
||||||
|
|
@ -400,8 +398,8 @@ private fun PollsSection(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SecuritySection(modifier: Modifier = Modifier) {
|
private fun SecuritySection() {
|
||||||
PreferenceCategory(title = stringResource(R.string.screen_room_details_security_title), modifier = modifier) {
|
PreferenceCategory(title = stringResource(R.string.screen_room_details_security_title)) {
|
||||||
ListItem(
|
ListItem(
|
||||||
headlineContent = { Text(stringResource(R.string.screen_room_details_encryption_enabled_title)) },
|
headlineContent = { Text(stringResource(R.string.screen_room_details_encryption_enabled_title)) },
|
||||||
supportingContent = { Text(stringResource(R.string.screen_room_details_encryption_enabled_subtitle)) },
|
supportingContent = { Text(stringResource(R.string.screen_room_details_encryption_enabled_subtitle)) },
|
||||||
|
|
@ -411,15 +409,17 @@ private fun SecuritySection(modifier: Modifier = Modifier) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun OtherActionsSection(isDm: Boolean, onLeaveRoom: () -> Unit, modifier: Modifier = Modifier) {
|
private fun OtherActionsSection(isDm: Boolean, onLeaveRoom: () -> Unit) {
|
||||||
PreferenceCategory(showDivider = false, modifier = modifier) {
|
PreferenceCategory(showDivider = false) {
|
||||||
ListItem(
|
ListItem(
|
||||||
headlineContent = {
|
headlineContent = {
|
||||||
val leaveText = stringResource(id = if (isDm) {
|
val leaveText = stringResource(
|
||||||
R.string.screen_room_details_leave_conversation_title
|
id = if (isDm) {
|
||||||
} else {
|
R.string.screen_room_details_leave_conversation_title
|
||||||
R.string.screen_room_details_leave_room_title
|
} else {
|
||||||
})
|
R.string.screen_room_details_leave_room_title
|
||||||
|
}
|
||||||
|
)
|
||||||
Text(leaveText)
|
Text(leaveText)
|
||||||
},
|
},
|
||||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Leave)),
|
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Leave)),
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,8 @@ import io.element.android.libraries.designsystem.theme.components.Text
|
||||||
import io.element.android.libraries.ui.strings.CommonStrings
|
import io.element.android.libraries.ui.strings.CommonStrings
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun BlockUserSection(state: RoomMemberDetailsState, modifier: Modifier = Modifier) {
|
internal fun BlockUserSection(state: RoomMemberDetailsState) {
|
||||||
PreferenceCategory(showDivider = false, modifier = modifier) {
|
PreferenceCategory(showDivider = false) {
|
||||||
when (state.isBlocked) {
|
when (state.isBlocked) {
|
||||||
is AsyncData.Failure -> PreferenceBlockUser(isBlocked = state.isBlocked.prevData, isLoading = false, eventSink = state.eventSink)
|
is AsyncData.Failure -> PreferenceBlockUser(isBlocked = state.isBlocked.prevData, isLoading = false, eventSink = state.eventSink)
|
||||||
is AsyncData.Loading -> PreferenceBlockUser(isBlocked = state.isBlocked.prevData, isLoading = true, eventSink = state.eventSink)
|
is AsyncData.Loading -> PreferenceBlockUser(isBlocked = state.isBlocked.prevData, isLoading = true, eventSink = state.eventSink)
|
||||||
|
|
@ -70,7 +70,6 @@ private fun PreferenceBlockUser(
|
||||||
isBlocked: Boolean?,
|
isBlocked: Boolean?,
|
||||||
isLoading: Boolean,
|
isLoading: Boolean,
|
||||||
eventSink: (RoomMemberDetailsEvents) -> Unit,
|
eventSink: (RoomMemberDetailsEvents) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
val loadingCurrentValue = @Composable {
|
val loadingCurrentValue = @Composable {
|
||||||
CircularProgressIndicator(
|
CircularProgressIndicator(
|
||||||
|
|
@ -87,7 +86,6 @@ private fun PreferenceBlockUser(
|
||||||
onClick = { if (!isLoading) eventSink(RoomMemberDetailsEvents.UnblockUser(needsConfirmation = true)) },
|
onClick = { if (!isLoading) eventSink(RoomMemberDetailsEvents.UnblockUser(needsConfirmation = true)) },
|
||||||
trailingContent = if (isLoading) ListItemContent.Custom(loadingCurrentValue) else null,
|
trailingContent = if (isLoading) ListItemContent.Custom(loadingCurrentValue) else null,
|
||||||
style = ListItemStyle.Primary,
|
style = ListItemStyle.Primary,
|
||||||
modifier = modifier,
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
ListItem(
|
ListItem(
|
||||||
|
|
@ -96,7 +94,6 @@ private fun PreferenceBlockUser(
|
||||||
style = ListItemStyle.Destructive,
|
style = ListItemStyle.Destructive,
|
||||||
onClick = { if (!isLoading) eventSink(RoomMemberDetailsEvents.BlockUser(needsConfirmation = true)) },
|
onClick = { if (!isLoading) eventSink(RoomMemberDetailsEvents.BlockUser(needsConfirmation = true)) },
|
||||||
trailingContent = if (isLoading) ListItemContent.Custom(loadingCurrentValue) else null,
|
trailingContent = if (isLoading) ListItemContent.Custom(loadingCurrentValue) else null,
|
||||||
modifier = modifier,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
package io.element.android.features.roomdetails.impl.edit
|
package io.element.android.features.roomdetails.impl.edit
|
||||||
|
|
||||||
import androidx.compose.foundation.gestures.detectTapGestures
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
|
@ -38,8 +37,6 @@ import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.focus.FocusManager
|
|
||||||
import androidx.compose.ui.input.pointer.pointerInput
|
|
||||||
import androidx.compose.ui.platform.LocalFocusManager
|
import androidx.compose.ui.platform.LocalFocusManager
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.input.KeyboardCapitalization
|
import androidx.compose.ui.text.input.KeyboardCapitalization
|
||||||
|
|
@ -52,6 +49,7 @@ import io.element.android.libraries.designsystem.components.async.AsyncActionVie
|
||||||
import io.element.android.libraries.designsystem.components.async.AsyncActionViewDefaults
|
import io.element.android.libraries.designsystem.components.async.AsyncActionViewDefaults
|
||||||
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
|
import io.element.android.libraries.designsystem.components.avatar.AvatarSize
|
||||||
import io.element.android.libraries.designsystem.components.button.BackButton
|
import io.element.android.libraries.designsystem.components.button.BackButton
|
||||||
|
import io.element.android.libraries.designsystem.modifiers.clearFocusOnTap
|
||||||
import io.element.android.libraries.designsystem.preview.ElementPreview
|
import io.element.android.libraries.designsystem.preview.ElementPreview
|
||||||
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
|
||||||
import io.element.android.libraries.designsystem.theme.aliasScreenTitle
|
import io.element.android.libraries.designsystem.theme.aliasScreenTitle
|
||||||
|
|
@ -193,10 +191,8 @@ fun RoomDetailsEditView(
|
||||||
private fun LabelledReadOnlyField(
|
private fun LabelledReadOnlyField(
|
||||||
title: String,
|
title: String,
|
||||||
value: String,
|
value: String,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier,
|
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
|
|
@ -215,13 +211,6 @@ private fun LabelledReadOnlyField(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Modifier.clearFocusOnTap(focusManager: FocusManager): Modifier =
|
|
||||||
pointerInput(Unit) {
|
|
||||||
detectTapGestures(onTap = {
|
|
||||||
focusManager.clearFocus()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
@PreviewsDayNight
|
@PreviewsDayNight
|
||||||
@Composable
|
@Composable
|
||||||
internal fun RoomDetailsEditViewPreview(@PreviewParameter(RoomDetailsEditStateProvider::class) state: RoomDetailsEditState) = ElementPreview {
|
internal fun RoomDetailsEditViewPreview(@PreviewParameter(RoomDetailsEditStateProvider::class) state: RoomDetailsEditState) = ElementPreview {
|
||||||
|
|
|
||||||
|
|
@ -115,10 +115,8 @@ private fun RoomInviteMembersTopBar(
|
||||||
canSend: Boolean,
|
canSend: Boolean,
|
||||||
onBackPressed: () -> Unit,
|
onBackPressed: () -> Unit,
|
||||||
onSubmitPressed: () -> Unit,
|
onSubmitPressed: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = modifier,
|
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.screen_room_details_invite_people_title),
|
text = stringResource(R.string.screen_room_details_invite_people_title),
|
||||||
|
|
|
||||||
|
|
@ -194,10 +194,8 @@ private fun RoomMemberListTopBar(
|
||||||
canInvite: Boolean,
|
canInvite: Boolean,
|
||||||
onBackPressed: () -> Unit,
|
onBackPressed: () -> Unit,
|
||||||
onInvitePressed: () -> Unit,
|
onInvitePressed: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = modifier,
|
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(CommonStrings.common_people),
|
text = stringResource(CommonStrings.common_people),
|
||||||
|
|
|
||||||
|
|
@ -108,14 +108,12 @@ fun RoomMemberDetailsView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun StartDMSection(
|
private fun StartDMSection(
|
||||||
onStartDMClicked: () -> Unit,
|
onStartDMClicked: () -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
ListItem(
|
ListItem(
|
||||||
headlineContent = { Text(stringResource(CommonStrings.common_direct_chat)) },
|
headlineContent = { Text(stringResource(CommonStrings.common_direct_chat)) },
|
||||||
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Chat)),
|
leadingContent = ListItemContent.Icon(IconSource.Vector(CompoundIcons.Chat)),
|
||||||
style = ListItemStyle.Primary,
|
style = ListItemStyle.Primary,
|
||||||
onClick = onStartDMClicked,
|
onClick = onStartDMClicked,
|
||||||
modifier = modifier,
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -178,10 +178,8 @@ private fun RoomSpecificNotificationSettingsView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun RoomNotificationSettingsTopBar(
|
private fun RoomNotificationSettingsTopBar(
|
||||||
onBackPressed: () -> Unit,
|
onBackPressed: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = modifier,
|
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.screen_room_details_notification_title),
|
text = stringResource(R.string.screen_room_details_notification_title),
|
||||||
|
|
|
||||||
|
|
@ -103,10 +103,8 @@ fun UserDefinedRoomNotificationSettingsView(
|
||||||
private fun UserDefinedRoomNotificationSettingsTopBar(
|
private fun UserDefinedRoomNotificationSettingsTopBar(
|
||||||
roomName: String,
|
roomName: String,
|
||||||
onBackPressed: () -> Unit,
|
onBackPressed: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = modifier,
|
|
||||||
title = {
|
title = {
|
||||||
Text(
|
Text(
|
||||||
text = roomName,
|
text = roomName,
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,6 @@ private fun RoomListSearchResultContent(
|
||||||
state: RoomListState,
|
state: RoomListState,
|
||||||
onRoomClicked: (RoomId) -> Unit,
|
onRoomClicked: (RoomId) -> Unit,
|
||||||
onRoomLongClicked: (RoomListRoomSummary) -> Unit,
|
onRoomLongClicked: (RoomListRoomSummary) -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
val borderColor = MaterialTheme.colorScheme.tertiary
|
val borderColor = MaterialTheme.colorScheme.tertiary
|
||||||
val strokeWidth = 1.dp
|
val strokeWidth = 1.dp
|
||||||
|
|
@ -115,7 +114,6 @@ private fun RoomListSearchResultContent(
|
||||||
onRoomClicked(room.roomId)
|
onRoomClicked(room.roomId)
|
||||||
}
|
}
|
||||||
Scaffold(
|
Scaffold(
|
||||||
modifier = modifier,
|
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = Modifier.drawBehind {
|
modifier = Modifier.drawBehind {
|
||||||
|
|
|
||||||
|
|
@ -78,11 +78,9 @@ private fun SignedOutHeader(state: SignedOutState) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SignedOutContent(
|
private fun SignedOutContent() {
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
contentAlignment = BiasAlignment(
|
contentAlignment = BiasAlignment(
|
||||||
horizontalBias = 0f,
|
horizontalBias = 0f,
|
||||||
verticalBias = -0.4f
|
verticalBias = -0.4f
|
||||||
|
|
@ -112,12 +110,9 @@ private fun SignedOutContent(
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SignedOutFooter(
|
private fun SignedOutFooter(
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
onSignInAgain: () -> Unit,
|
onSignInAgain: () -> Unit,
|
||||||
) {
|
) {
|
||||||
ButtonColumnMolecule(
|
ButtonColumnMolecule {
|
||||||
modifier = modifier,
|
|
||||||
) {
|
|
||||||
Button(
|
Button(
|
||||||
text = stringResource(id = CommonStrings.action_sign_in_again),
|
text = stringResource(id = CommonStrings.action_sign_in_again),
|
||||||
onClick = onSignInAgain,
|
onClick = onSignInAgain,
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ fun VerifySelfSessionView(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun HeaderContent(verificationFlowStep: FlowStep, modifier: Modifier = Modifier) {
|
private fun HeaderContent(verificationFlowStep: FlowStep) {
|
||||||
val iconResourceId = when (verificationFlowStep) {
|
val iconResourceId = when (verificationFlowStep) {
|
||||||
FlowStep.Initial -> R.drawable.ic_verification_devices
|
FlowStep.Initial -> R.drawable.ic_verification_devices
|
||||||
FlowStep.Canceled -> R.drawable.ic_verification_warning
|
FlowStep.Canceled -> R.drawable.ic_verification_warning
|
||||||
|
|
@ -125,7 +125,7 @@ private fun HeaderContent(verificationFlowStep: FlowStep, modifier: Modifier = M
|
||||||
}
|
}
|
||||||
|
|
||||||
IconTitleSubtitleMolecule(
|
IconTitleSubtitleMolecule(
|
||||||
modifier = modifier.padding(top = 60.dp),
|
modifier = Modifier.padding(top = 60.dp),
|
||||||
iconResourceId = iconResourceId,
|
iconResourceId = iconResourceId,
|
||||||
title = stringResource(id = titleTextId),
|
title = stringResource(id = titleTextId),
|
||||||
subTitle = stringResource(id = subtitleTextId)
|
subTitle = stringResource(id = subtitleTextId)
|
||||||
|
|
@ -133,8 +133,8 @@ private fun HeaderContent(verificationFlowStep: FlowStep, modifier: Modifier = M
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Content(flowState: FlowStep, modifier: Modifier = Modifier) {
|
private fun Content(flowState: FlowStep) {
|
||||||
Column(modifier.fillMaxHeight(), verticalArrangement = Arrangement.Center) {
|
Column(Modifier.fillMaxHeight(), verticalArrangement = Arrangement.Center) {
|
||||||
when (flowState) {
|
when (flowState) {
|
||||||
FlowStep.Initial, FlowStep.Ready, FlowStep.Canceled, FlowStep.Completed -> Unit
|
FlowStep.Initial, FlowStep.Ready, FlowStep.Canceled, FlowStep.Completed -> Unit
|
||||||
FlowStep.AwaitingOtherDeviceResponse -> ContentWaiting()
|
FlowStep.AwaitingOtherDeviceResponse -> ContentWaiting()
|
||||||
|
|
@ -144,19 +144,19 @@ private fun Content(flowState: FlowStep, modifier: Modifier = Modifier) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ContentWaiting(modifier: Modifier = Modifier) {
|
private fun ContentWaiting() {
|
||||||
Row(modifier = modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center) {
|
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center) {
|
||||||
CircularProgressIndicator()
|
CircularProgressIndicator()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ContentVerifying(verificationFlowStep: FlowStep.Verifying, modifier: Modifier = Modifier) {
|
private fun ContentVerifying(verificationFlowStep: FlowStep.Verifying) {
|
||||||
when (verificationFlowStep.data) {
|
when (verificationFlowStep.data) {
|
||||||
is SessionVerificationData.Decimals -> {
|
is SessionVerificationData.Decimals -> {
|
||||||
val text = verificationFlowStep.data.decimals.joinToString(separator = " - ") { it.toString() }
|
val text = verificationFlowStep.data.decimals.joinToString(separator = " - ") { it.toString() }
|
||||||
Text(
|
Text(
|
||||||
modifier = modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
text = text,
|
text = text,
|
||||||
style = ElementTheme.typography.fontHeadingLgBold,
|
style = ElementTheme.typography.fontHeadingLgBold,
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = MaterialTheme.colorScheme.primary,
|
||||||
|
|
@ -167,7 +167,7 @@ private fun ContentVerifying(verificationFlowStep: FlowStep.Verifying, modifier:
|
||||||
// We want each row to have up to 4 emojis
|
// We want each row to have up to 4 emojis
|
||||||
val rows = verificationFlowStep.data.emojis.chunked(4)
|
val rows = verificationFlowStep.data.emojis.chunked(4)
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
verticalArrangement = Arrangement.spacedBy(40.dp),
|
verticalArrangement = Arrangement.spacedBy(40.dp),
|
||||||
) {
|
) {
|
||||||
rows.forEach { emojis ->
|
rows.forEach { emojis ->
|
||||||
|
|
|
||||||
|
|
@ -115,10 +115,8 @@ fun SunsetPage(
|
||||||
|
|
||||||
@OptIn(CoreColorToken::class)
|
@OptIn(CoreColorToken::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun SunsetBackground(
|
private fun SunsetBackground() {
|
||||||
modifier: Modifier = Modifier,
|
Column(modifier = Modifier.fillMaxSize()) {
|
||||||
) {
|
|
||||||
Column(modifier = modifier.fillMaxSize()) {
|
|
||||||
// The top background colors are the opposite of the current theme ones
|
// The top background colors are the opposite of the current theme ones
|
||||||
val topBackgroundColor = if (ElementTheme.isLightTheme) {
|
val topBackgroundColor = if (ElementTheme.isLightTheme) {
|
||||||
DarkColorTokens.colorThemeBg
|
DarkColorTokens.colorThemeBg
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,6 @@ fun BlurHashAsyncImage(
|
||||||
@Composable
|
@Composable
|
||||||
private fun BlurHashImage(
|
private fun BlurHashImage(
|
||||||
blurHash: String?,
|
blurHash: String?,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
contentDescription: String? = null,
|
contentDescription: String? = null,
|
||||||
contentScale: ContentScale = ContentScale.Fit,
|
contentScale: ContentScale = ContentScale.Fit,
|
||||||
) {
|
) {
|
||||||
|
|
@ -91,7 +90,7 @@ private fun BlurHashImage(
|
||||||
}
|
}
|
||||||
bitmapState.value?.let { bitmap ->
|
bitmapState.value?.let { bitmap ->
|
||||||
Image(
|
Image(
|
||||||
modifier = modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
bitmap = bitmap.asImageBitmap(),
|
bitmap = bitmap.asImageBitmap(),
|
||||||
contentScale = contentScale,
|
contentScale = contentScale,
|
||||||
contentDescription = contentDescription
|
contentDescription = contentDescription
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ private fun ConfirmationDialogContent(
|
||||||
cancelText: String,
|
cancelText: String,
|
||||||
onSubmitClicked: () -> Unit,
|
onSubmitClicked: () -> Unit,
|
||||||
onCancelClicked: () -> Unit,
|
onCancelClicked: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
thirdButtonText: String? = null,
|
thirdButtonText: String? = null,
|
||||||
onThirdButtonClicked: () -> Unit = {},
|
onThirdButtonClicked: () -> Unit = {},
|
||||||
|
|
@ -73,7 +72,6 @@ private fun ConfirmationDialogContent(
|
||||||
icon: @Composable (() -> Unit)? = null,
|
icon: @Composable (() -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
SimpleAlertDialogContent(
|
SimpleAlertDialogContent(
|
||||||
modifier = modifier,
|
|
||||||
title = title,
|
title = title,
|
||||||
content = content,
|
content = content,
|
||||||
submitText = submitText,
|
submitText = submitText,
|
||||||
|
|
|
||||||
|
|
@ -51,12 +51,10 @@ fun ErrorDialog(
|
||||||
private fun ErrorDialogContent(
|
private fun ErrorDialogContent(
|
||||||
content: String,
|
content: String,
|
||||||
onSubmitClicked: () -> Unit,
|
onSubmitClicked: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
title: String = ErrorDialogDefaults.title,
|
title: String = ErrorDialogDefaults.title,
|
||||||
submitText: String = ErrorDialogDefaults.submitText,
|
submitText: String = ErrorDialogDefaults.submitText,
|
||||||
) {
|
) {
|
||||||
SimpleAlertDialogContent(
|
SimpleAlertDialogContent(
|
||||||
modifier = modifier,
|
|
||||||
title = title,
|
title = title,
|
||||||
content = content,
|
content = content,
|
||||||
submitText = submitText,
|
submitText = submitText,
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@ private fun ListDialogContent(
|
||||||
onSubmitClicked: () -> Unit,
|
onSubmitClicked: () -> Unit,
|
||||||
cancelText: String,
|
cancelText: String,
|
||||||
submitText: String,
|
submitText: String,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
enabled: Boolean = true,
|
enabled: Boolean = true,
|
||||||
subtitle: @Composable (() -> Unit)? = null,
|
subtitle: @Composable (() -> Unit)? = null,
|
||||||
|
|
@ -88,7 +87,6 @@ private fun ListDialogContent(
|
||||||
SimpleAlertDialogContent(
|
SimpleAlertDialogContent(
|
||||||
title = title,
|
title = title,
|
||||||
subtitle = subtitle,
|
subtitle = subtitle,
|
||||||
modifier = modifier,
|
|
||||||
cancelText = cancelText,
|
cancelText = cancelText,
|
||||||
submitText = submitText,
|
submitText = submitText,
|
||||||
onCancelClicked = onDismissRequest,
|
onCancelClicked = onDismissRequest,
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,6 @@ private fun MultipleSelectionDialogContent(
|
||||||
onConfirmClicked: (List<Int>) -> Unit,
|
onConfirmClicked: (List<Int>) -> Unit,
|
||||||
dismissButtonTitle: String,
|
dismissButtonTitle: String,
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
initialSelected: ImmutableList<Int> = persistentListOf(),
|
initialSelected: ImmutableList<Int> = persistentListOf(),
|
||||||
subtitle: @Composable (() -> Unit)? = null,
|
subtitle: @Composable (() -> Unit)? = null,
|
||||||
|
|
@ -96,7 +95,6 @@ private fun MultipleSelectionDialogContent(
|
||||||
SimpleAlertDialogContent(
|
SimpleAlertDialogContent(
|
||||||
title = title,
|
title = title,
|
||||||
subtitle = subtitle,
|
subtitle = subtitle,
|
||||||
modifier = modifier,
|
|
||||||
submitText = confirmButtonTitle,
|
submitText = confirmButtonTitle,
|
||||||
onSubmitClicked = {
|
onSubmitClicked = {
|
||||||
onConfirmClicked(selectedOptionIndexes.toList())
|
onConfirmClicked(selectedOptionIndexes.toList())
|
||||||
|
|
|
||||||
|
|
@ -56,13 +56,11 @@ private fun RetryDialogContent(
|
||||||
content: String,
|
content: String,
|
||||||
onRetry: () -> Unit,
|
onRetry: () -> Unit,
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
title: String = RetryDialogDefaults.title,
|
title: String = RetryDialogDefaults.title,
|
||||||
retryText: String = RetryDialogDefaults.retryText,
|
retryText: String = RetryDialogDefaults.retryText,
|
||||||
dismissText: String = RetryDialogDefaults.dismissText,
|
dismissText: String = RetryDialogDefaults.dismissText,
|
||||||
) {
|
) {
|
||||||
SimpleAlertDialogContent(
|
SimpleAlertDialogContent(
|
||||||
modifier = modifier,
|
|
||||||
title = title,
|
title = title,
|
||||||
content = content,
|
content = content,
|
||||||
submitText = retryText,
|
submitText = retryText,
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,6 @@ private fun SingleSelectionDialogContent(
|
||||||
onOptionSelected: (Int) -> Unit,
|
onOptionSelected: (Int) -> Unit,
|
||||||
dismissButtonTitle: String,
|
dismissButtonTitle: String,
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
initialSelection: Int? = null,
|
initialSelection: Int? = null,
|
||||||
subtitle: @Composable (() -> Unit)? = null,
|
subtitle: @Composable (() -> Unit)? = null,
|
||||||
|
|
@ -87,7 +86,6 @@ private fun SingleSelectionDialogContent(
|
||||||
SimpleAlertDialogContent(
|
SimpleAlertDialogContent(
|
||||||
title = title,
|
title = title,
|
||||||
subtitle = subtitle,
|
subtitle = subtitle,
|
||||||
modifier = modifier,
|
|
||||||
submitText = dismissButtonTitle,
|
submitText = dismissButtonTitle,
|
||||||
onSubmitClicked = onDismissRequest,
|
onSubmitClicked = onDismissRequest,
|
||||||
applyPaddingToContents = false,
|
applyPaddingToContents = false,
|
||||||
|
|
|
||||||
|
|
@ -52,9 +52,9 @@ fun PreferenceCategory(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreferenceCategoryTitle(title: String, modifier: Modifier = Modifier) {
|
private fun PreferenceCategoryTitle(title: String) {
|
||||||
Text(
|
Text(
|
||||||
modifier = modifier.padding(
|
modifier = Modifier.padding(
|
||||||
top = 20.dp,
|
top = 20.dp,
|
||||||
bottom = 8.dp,
|
bottom = 8.dp,
|
||||||
start = preferencePaddingHorizontal,
|
start = preferencePaddingHorizontal,
|
||||||
|
|
|
||||||
|
|
@ -80,10 +80,8 @@ fun PreferencePage(
|
||||||
private fun PreferenceTopAppBar(
|
private fun PreferenceTopAppBar(
|
||||||
title: String,
|
title: String,
|
||||||
onBackPressed: () -> Unit,
|
onBackPressed: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
modifier = modifier,
|
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
BackButton(onClick = onBackPressed)
|
BackButton(onClick = onBackPressed)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,6 @@ private fun TextFieldDialog(
|
||||||
onDismissRequest: () -> Unit,
|
onDismissRequest: () -> Unit,
|
||||||
value: String?,
|
value: String?,
|
||||||
placeholder: String?,
|
placeholder: String?,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
validation: (String?) -> Boolean = { true },
|
validation: (String?) -> Boolean = { true },
|
||||||
onValidationErrorMessage: String? = null,
|
onValidationErrorMessage: String? = null,
|
||||||
autoSelectOnDisplay: Boolean = true,
|
autoSelectOnDisplay: Boolean = true,
|
||||||
|
|
@ -110,7 +109,6 @@ private fun TextFieldDialog(
|
||||||
onSubmit = { onSubmit(textFieldContents.text) },
|
onSubmit = { onSubmit(textFieldContents.text) },
|
||||||
onDismissRequest = onDismissRequest,
|
onDismissRequest = onDismissRequest,
|
||||||
enabled = canSubmit,
|
enabled = canSubmit,
|
||||||
modifier = modifier,
|
|
||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
TextFieldListItem(
|
TextFieldListItem(
|
||||||
|
|
|
||||||
|
|
@ -98,11 +98,9 @@ private fun IconsPreview(
|
||||||
title: String,
|
title: String,
|
||||||
iconsList: ImmutableList<Int>,
|
iconsList: ImmutableList<Int>,
|
||||||
iconNameTransform: (String) -> String,
|
iconNameTransform: (String) -> String,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) = ElementPreview {
|
) = ElementPreview {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier,
|
|
||||||
verticalArrangement = Arrangement.spacedBy(2.dp),
|
verticalArrangement = Arrangement.spacedBy(2.dp),
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2024 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package io.element.android.libraries.designsystem.modifiers
|
||||||
|
|
||||||
|
import androidx.compose.foundation.gestures.detectTapGestures
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.focus.FocusManager
|
||||||
|
import androidx.compose.ui.input.pointer.pointerInput
|
||||||
|
|
||||||
|
fun Modifier.clearFocusOnTap(focusManager: FocusManager): Modifier = then(
|
||||||
|
pointerInput(Unit) {
|
||||||
|
detectTapGestures(onTap = {
|
||||||
|
focusManager.clearFocus()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
@ -55,7 +55,6 @@ internal fun SimpleAlertDialogContent(
|
||||||
content: String,
|
content: String,
|
||||||
submitText: String,
|
submitText: String,
|
||||||
onSubmitClicked: () -> Unit,
|
onSubmitClicked: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
subtitle: @Composable (() -> Unit)? = null,
|
subtitle: @Composable (() -> Unit)? = null,
|
||||||
destructiveSubmit: Boolean = false,
|
destructiveSubmit: Boolean = false,
|
||||||
|
|
@ -67,7 +66,6 @@ internal fun SimpleAlertDialogContent(
|
||||||
icon: @Composable (() -> Unit)? = null,
|
icon: @Composable (() -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
SimpleAlertDialogContent(
|
SimpleAlertDialogContent(
|
||||||
modifier = modifier,
|
|
||||||
icon = icon,
|
icon = icon,
|
||||||
title = title,
|
title = title,
|
||||||
subtitle = subtitle,
|
subtitle = subtitle,
|
||||||
|
|
@ -92,7 +90,6 @@ internal fun SimpleAlertDialogContent(
|
||||||
internal fun SimpleAlertDialogContent(
|
internal fun SimpleAlertDialogContent(
|
||||||
submitText: String,
|
submitText: String,
|
||||||
onSubmitClicked: () -> Unit,
|
onSubmitClicked: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
subtitle: @Composable (() -> Unit)? = null,
|
subtitle: @Composable (() -> Unit)? = null,
|
||||||
destructiveSubmit: Boolean = false,
|
destructiveSubmit: Boolean = false,
|
||||||
|
|
@ -148,7 +145,6 @@ internal fun SimpleAlertDialogContent(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = modifier,
|
|
||||||
title = title?.let { titleText ->
|
title = title?.let { titleText ->
|
||||||
@Composable {
|
@Composable {
|
||||||
Text(
|
Text(
|
||||||
|
|
@ -192,11 +188,9 @@ internal fun AlertDialogContent(
|
||||||
iconContentColor: Color,
|
iconContentColor: Color,
|
||||||
titleContentColor: Color,
|
titleContentColor: Color,
|
||||||
textContentColor: Color,
|
textContentColor: Color,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
applyPaddingToContents: Boolean = true,
|
applyPaddingToContents: Boolean = true,
|
||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
modifier = modifier,
|
|
||||||
shape = shape,
|
shape = shape,
|
||||||
color = containerColor,
|
color = containerColor,
|
||||||
tonalElevation = tonalElevation,
|
tonalElevation = tonalElevation,
|
||||||
|
|
|
||||||
|
|
@ -49,13 +49,11 @@ fun FeatureListView(
|
||||||
private fun FeaturePreferenceView(
|
private fun FeaturePreferenceView(
|
||||||
feature: FeatureUiModel,
|
feature: FeatureUiModel,
|
||||||
onCheckedChange: (Boolean) -> Unit,
|
onCheckedChange: (Boolean) -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
PreferenceCheckbox(
|
PreferenceCheckbox(
|
||||||
title = feature.title,
|
title = feature.title,
|
||||||
supportingText = feature.description,
|
supportingText = feature.description,
|
||||||
isChecked = feature.isEnabled,
|
isChecked = feature.isEnabled,
|
||||||
modifier = modifier,
|
|
||||||
onCheckedChange = onCheckedChange
|
onCheckedChange = onCheckedChange
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,6 @@ private fun PdfPagesView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun PdfPageView(
|
private fun PdfPageView(
|
||||||
pdfPage: PdfPage,
|
pdfPage: PdfPage,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
val pdfPageState by pdfPage.stateFlow.collectAsState()
|
val pdfPageState by pdfPage.stateFlow.collectAsState()
|
||||||
DisposableEffect(pdfPage) {
|
DisposableEffect(pdfPage) {
|
||||||
|
|
@ -101,12 +100,12 @@ private fun PdfPageView(
|
||||||
bitmap = state.bitmap.asImageBitmap(),
|
bitmap = state.bitmap.asImageBitmap(),
|
||||||
contentDescription = stringResource(id = CommonStrings.a11y_page_n, pdfPage.pageIndex),
|
contentDescription = stringResource(id = CommonStrings.a11y_page_n, pdfPage.pageIndex),
|
||||||
contentScale = ContentScale.FillWidth,
|
contentScale = ContentScale.FillWidth,
|
||||||
modifier = modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
is PdfPage.State.Loading -> {
|
is PdfPage.State.Loading -> {
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.height(state.height.toDp())
|
.height(state.height.toDp())
|
||||||
.background(color = Color.White)
|
.background(color = Color.White)
|
||||||
|
|
|
||||||
|
|
@ -259,10 +259,8 @@ private fun ErrorView(
|
||||||
errorMessage: String,
|
errorMessage: String,
|
||||||
onRetry: () -> Unit,
|
onRetry: () -> Unit,
|
||||||
onDismiss: () -> Unit,
|
onDismiss: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
RetryDialog(
|
RetryDialog(
|
||||||
modifier = modifier,
|
|
||||||
content = errorMessage,
|
content = errorMessage,
|
||||||
onRetry = onRetry,
|
onRetry = onRetry,
|
||||||
onDismiss = onDismiss
|
onDismiss = onDismiss
|
||||||
|
|
|
||||||
|
|
@ -209,10 +209,9 @@ private fun RoomSummaryView(
|
||||||
summary: RoomSummaryDetails,
|
summary: RoomSummaryDetails,
|
||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
onSelection: (RoomSummaryDetails) -> Unit,
|
onSelection: (RoomSummaryDetails) -> Unit,
|
||||||
modifier: Modifier = Modifier
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.clickable { onSelection(summary) }
|
.clickable { onSelection(summary) }
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(start = 16.dp, end = 4.dp)
|
.padding(start = 16.dp, end = 4.dp)
|
||||||
|
|
|
||||||
|
|
@ -405,14 +405,13 @@ private fun TextInput(
|
||||||
onError: (Throwable) -> Unit,
|
onError: (Throwable) -> Unit,
|
||||||
onTyping: (Boolean) -> Unit,
|
onTyping: (Boolean) -> Unit,
|
||||||
onRichContentSelected: ((Uri) -> Unit)?,
|
onRichContentSelected: ((Uri) -> Unit)?,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
val bgColor = ElementTheme.colors.bgSubtleSecondary
|
val bgColor = ElementTheme.colors.bgSubtleSecondary
|
||||||
val borderColor = ElementTheme.colors.borderDisabled
|
val borderColor = ElementTheme.colors.borderDisabled
|
||||||
val roundedCorners = textInputRoundedCornerShape(composerMode = composerMode)
|
val roundedCorners = textInputRoundedCornerShape(composerMode = composerMode)
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.clip(roundedCorners)
|
.clip(roundedCorners)
|
||||||
.border(0.5.dp, borderColor, roundedCorners)
|
.border(0.5.dp, borderColor, roundedCorners)
|
||||||
.background(color = bgColor)
|
.background(color = bgColor)
|
||||||
|
|
@ -464,15 +463,14 @@ private fun TextInput(
|
||||||
private fun ComposerModeView(
|
private fun ComposerModeView(
|
||||||
composerMode: MessageComposerMode,
|
composerMode: MessageComposerMode,
|
||||||
onResetComposerMode: () -> Unit,
|
onResetComposerMode: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
when (composerMode) {
|
when (composerMode) {
|
||||||
is MessageComposerMode.Edit -> {
|
is MessageComposerMode.Edit -> {
|
||||||
EditingModeView(onResetComposerMode = onResetComposerMode, modifier = modifier)
|
EditingModeView(onResetComposerMode = onResetComposerMode)
|
||||||
}
|
}
|
||||||
is MessageComposerMode.Reply -> {
|
is MessageComposerMode.Reply -> {
|
||||||
ReplyToModeView(
|
ReplyToModeView(
|
||||||
modifier = modifier.padding(8.dp),
|
modifier = Modifier.padding(8.dp),
|
||||||
senderName = composerMode.senderName,
|
senderName = composerMode.senderName,
|
||||||
text = composerMode.defaultContent,
|
text = composerMode.defaultContent,
|
||||||
attachmentThumbnailInfo = composerMode.attachmentThumbnailInfo,
|
attachmentThumbnailInfo = composerMode.attachmentThumbnailInfo,
|
||||||
|
|
@ -486,12 +484,11 @@ private fun ComposerModeView(
|
||||||
@Composable
|
@Composable
|
||||||
private fun EditingModeView(
|
private fun EditingModeView(
|
||||||
onResetComposerMode: () -> Unit,
|
onResetComposerMode: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
horizontalArrangement = Arrangement.spacedBy(4.dp),
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(start = 12.dp)
|
.padding(start = 12.dp)
|
||||||
) {
|
) {
|
||||||
|
|
@ -881,11 +878,8 @@ internal fun TextComposerVoicePreview() = ElementPreview {
|
||||||
@Composable
|
@Composable
|
||||||
private fun PreviewColumn(
|
private fun PreviewColumn(
|
||||||
items: ImmutableList<@Composable () -> Unit>,
|
items: ImmutableList<@Composable () -> Unit>,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
Column(
|
Column {
|
||||||
modifier = modifier
|
|
||||||
) {
|
|
||||||
items.forEach { item ->
|
items.forEach { item ->
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.height(IntrinsicSize.Min)
|
modifier = Modifier.height(IntrinsicSize.Min)
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ import io.element.android.wysiwyg.view.models.LinkAction
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import uniffi.wysiwyg_composer.ActionState
|
import uniffi.wysiwyg_composer.ActionState
|
||||||
import uniffi.wysiwyg_composer.ComposerAction
|
import uniffi.wysiwyg_composer.ComposerAction
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun TextFormatting(
|
internal fun TextFormatting(
|
||||||
state: RichTextEditorState,
|
state: RichTextEditorState,
|
||||||
|
|
|
||||||
|
|
@ -124,11 +124,10 @@ private fun PlayerButton(
|
||||||
type: PlayerButtonType,
|
type: PlayerButtonType,
|
||||||
enabled: Boolean,
|
enabled: Boolean,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
) {
|
||||||
IconButton(
|
IconButton(
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.background(color = ElementTheme.colors.bgCanvasDefault, shape = CircleShape)
|
.background(color = ElementTheme.colors.bgCanvasDefault, shape = CircleShape)
|
||||||
.size(30.dp),
|
.size(30.dp),
|
||||||
enabled = enabled,
|
enabled = enabled,
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,7 @@ internal fun VoiceMessageRecording(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun RedRecordingDot(
|
private fun RedRecordingDot() {
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
) {
|
|
||||||
val infiniteTransition = rememberInfiniteTransition("RedRecordingDot")
|
val infiniteTransition = rememberInfiniteTransition("RedRecordingDot")
|
||||||
val alpha by infiniteTransition.animateFloat(
|
val alpha by infiniteTransition.animateFloat(
|
||||||
initialValue = 1f,
|
initialValue = 1f,
|
||||||
|
|
@ -102,7 +100,7 @@ private fun RedRecordingDot(
|
||||||
label = "RedRecordingDotAlpha",
|
label = "RedRecordingDotAlpha",
|
||||||
)
|
)
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = Modifier
|
||||||
.size(8.dp)
|
.size(8.dp)
|
||||||
.alpha(alpha)
|
.alpha(alpha)
|
||||||
.background(color = ElementTheme.colors.textCriticalPrimary, shape = CircleShape)
|
.background(color = ElementTheme.colors.textCriticalPrimary, shape = CircleShape)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue