Add missing base text styles

This commit is contained in:
Andrew 2024-06-12 08:56:48 +09:30
parent 3c36f1247b
commit 48febb4f10
10 changed files with 92 additions and 58 deletions

View File

@ -33,7 +33,9 @@ import org.thoughtcrime.securesms.onboarding.messagenotifications.startMessageNo
import org.thoughtcrime.securesms.onboarding.pickname.startPickDisplayNameActivity
import org.thoughtcrime.securesms.ui.AppTheme
import org.thoughtcrime.securesms.ui.ProgressArc
import org.thoughtcrime.securesms.ui.base
import org.thoughtcrime.securesms.ui.contentDescription
import org.thoughtcrime.securesms.ui.h7
import org.thoughtcrime.securesms.util.setUpActionBarSessionLogo
import javax.inject.Inject
@ -104,11 +106,20 @@ class LoadingActivity: BaseActionBarActivity() {
}
AppTheme {
Column {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Spacer(modifier = Modifier.weight(1f))
ProgressArc(animatable.value, modifier = Modifier.align(Alignment.CenterHorizontally).contentDescription(R.string.AccessibilityId_loading_animation))
Text(stringResource(R.string.waitOneMoment), modifier = Modifier.align(Alignment.CenterHorizontally), style = MaterialTheme.typography.h6)
Text(stringResource(R.string.loadAccountProgressMessage), modifier = Modifier.align(Alignment.CenterHorizontally))
ProgressArc(
animatable.value,
modifier = Modifier.contentDescription(R.string.AccessibilityId_loading_animation)
)
Text(
stringResource(R.string.waitOneMoment),
style = MaterialTheme.typography.h7
)
Text(
stringResource(R.string.loadAccountProgressMessage),
style = MaterialTheme.typography.base
)
Spacer(modifier = Modifier.weight(2f))
}
}

View File

@ -40,6 +40,7 @@ import org.thoughtcrime.securesms.notifications.PushRegistry
import org.thoughtcrime.securesms.ui.AppTheme
import org.thoughtcrime.securesms.ui.PreviewTheme
import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider
import org.thoughtcrime.securesms.ui.base
import org.thoughtcrime.securesms.ui.components.OutlineButton
import org.thoughtcrime.securesms.ui.contentDescription
import org.thoughtcrime.securesms.ui.h8
@ -106,7 +107,7 @@ fun MessageNotificationsScreen(
Spacer(Modifier.weight(1f))
Text(stringResource(R.string.notificationsMessage), style = MaterialTheme.typography.h4)
Spacer(Modifier.height(16.dp))
Text(stringResource(R.string.onboardingMessageNotificationExplaination))
Text(stringResource(R.string.onboardingMessageNotificationExplaination), style = MaterialTheme.typography.base)
Spacer(Modifier.height(16.dp))
NotificationRadioButton(
R.string.activity_pn_mode_fast_mode,

View File

@ -7,6 +7,7 @@ import androidx.activity.viewModels
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
@ -37,10 +38,12 @@ import org.thoughtcrime.securesms.BaseActionBarActivity
import org.thoughtcrime.securesms.onboarding.messagenotifications.MessageNotificationsActivity
import org.thoughtcrime.securesms.onboarding.messagenotifications.startMessageNotificationsActivity
import org.thoughtcrime.securesms.ui.AppTheme
import org.thoughtcrime.securesms.ui.GetString
import org.thoughtcrime.securesms.ui.PreviewTheme
import org.thoughtcrime.securesms.ui.base
import org.thoughtcrime.securesms.ui.baseBold
import org.thoughtcrime.securesms.ui.components.OutlineButton
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
import org.thoughtcrime.securesms.ui.contentDescription
import org.thoughtcrime.securesms.ui.outlinedTextFieldColors
import org.thoughtcrime.securesms.util.setUpActionBarSessionLogo
@ -106,32 +109,17 @@ class PickDisplayNameActivity : BaseActionBarActivity() {
style = MaterialTheme.typography.base,
modifier = Modifier.padding(bottom = 12.dp))
OutlinedTextField(
value = state.displayName,
modifier = Modifier.contentDescription(R.string.AccessibilityId_enter_display_name),
onValueChange = { onChange(it) },
placeholder = { Text(stringResource(R.string.displayNameEnter)) },
colors = outlinedTextFieldColors(state.error != null),
singleLine = true,
keyboardActions = KeyboardActions(
onDone = { onContinue() },
onGo = { onContinue() },
onSearch = { onContinue() },
onSend = { onContinue() },
),
isError = state.error != null,
shape = RoundedCornerShape(12.dp)
SessionOutlinedTextField(
text = state.displayName,
modifier = Modifier
.fillMaxWidth()
.contentDescription(R.string.AccessibilityId_enter_display_name),
placeholder = stringResource(R.string.displayNameEnter),
onChange = onChange,
onContinue = onContinue,
error = state.error?.let { stringResource(it) }
)
state.error?.let {
Text(
stringResource(it),
modifier = Modifier.contentDescription(R.string.AccessibilityId_error_message),
style = MaterialTheme.typography.baseBold,
color = MaterialTheme.colors.error
)
}
Spacer(modifier = Modifier.weight(2f))
OutlineButton(

View File

@ -73,7 +73,8 @@ class PickDisplayNameViewModel(
}
fun onChange(value: String) {
state.update { state -> state.copy(
state.update { state ->
state.copy(
displayName = value,
error = value.takeIf { it.length > NAME_PADDED_LENGTH }?.let { R.string.displayNameErrorDescriptionShorter }
)

View File

@ -26,7 +26,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter
@ -41,6 +40,7 @@ import org.thoughtcrime.securesms.ui.PreviewTheme
import org.thoughtcrime.securesms.ui.SessionShieldIcon
import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider
import org.thoughtcrime.securesms.ui.base
import org.thoughtcrime.securesms.ui.baseBold
import org.thoughtcrime.securesms.ui.classicDarkColors
import org.thoughtcrime.securesms.ui.components.DestructiveButtons
import org.thoughtcrime.securesms.ui.components.OutlineButton
@ -49,7 +49,7 @@ import org.thoughtcrime.securesms.ui.components.QrImage
import org.thoughtcrime.securesms.ui.components.SmallButtons
import org.thoughtcrime.securesms.ui.contentDescription
import org.thoughtcrime.securesms.ui.h8
import org.thoughtcrime.securesms.ui.small
import org.thoughtcrime.securesms.ui.smallMonospace
class RecoveryPasswordActivity : BaseActionBarActivity() {
@ -135,14 +135,20 @@ fun RecoveryPasswordCell(seed: String, copySeed:() -> Unit = {}) {
CellWithPaddingAndMargin {
Column {
Row {
Text(stringResource(R.string.sessionRecoveryPassword), style = MaterialTheme.typography.h8)
Spacer(Modifier.width(8.dp))
Text(
stringResource(R.string.sessionRecoveryPassword),
style = MaterialTheme.typography.h8
)
Spacer(Modifier.width(LocalDimensions.current.itemSpacingExtraSmall))
SessionShieldIcon()
}
Spacer(modifier = Modifier.height(LocalDimensions.current.marginTiny))
Text(stringResource(R.string.recoveryPasswordDescription), style = MaterialTheme.typography.base)
Text(
stringResource(R.string.recoveryPasswordDescription),
style = MaterialTheme.typography.base
)
AnimatedVisibility(!showQr) {
RecoveryPassword(seed)
@ -155,7 +161,7 @@ fun RecoveryPasswordCell(seed: String, copySeed:() -> Unit = {}) {
QrImage(
seed,
modifier = Modifier
.padding(vertical = 24.dp)
.padding(vertical = LocalDimensions.current.marginSmall)
.contentDescription(R.string.AccessibilityId_qr_code),
icon = R.drawable.session_shield
)
@ -169,9 +175,16 @@ fun RecoveryPasswordCell(seed: String, copySeed:() -> Unit = {}) {
.contentDescription(R.string.AccessibilityId_copy_button),
onClick = copySeed
) { isTemporary ->
Text(stringResource( if (isTemporary) R.string.copied else R.string.copy))
Text(
stringResource( if (isTemporary) R.string.copied else R.string.copy),
style = MaterialTheme.typography.baseBold
)
}
OutlineButton(textId = R.string.qrView, modifier = Modifier.weight(1f), onClick = { showQr = !showQr })
OutlineButton(
textId = R.string.qrView,
modifier = Modifier.weight(1f),
onClick = { showQr = !showQr }
)
}
}
@ -191,15 +204,15 @@ private fun RecoveryPassword(seed: String) {
seed,
modifier = Modifier
.contentDescription(R.string.AccessibilityId_recovery_password_container)
.padding(vertical = 24.dp)
.padding(vertical = LocalDimensions.current.marginSmall)
.border(
width = 1.dp,
color = classicDarkColors[3],
shape = RoundedCornerShape(11.dp)
)
.padding(24.dp),
.padding(LocalDimensions.current.marginSmall),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.small.copy(fontFamily = FontFamily.Monospace),
style = MaterialTheme.typography.smallMonospace,
color = MaterialTheme.colors.run { if (isLight) onSurface else secondary },
)
}
@ -211,8 +224,14 @@ private fun HideRecoveryPasswordCell(onHide: () -> Unit = {}) {
Column(
Modifier.weight(1f)
) {
Text(text = stringResource(R.string.recoveryPasswordHideRecoveryPassword), style = MaterialTheme.typography.h8)
Text(text = stringResource(R.string.recoveryPasswordHideRecoveryPasswordDescription))
Text(
stringResource(R.string.recoveryPasswordHideRecoveryPassword),
style = MaterialTheme.typography.h8
)
Text(
stringResource(R.string.recoveryPasswordHideRecoveryPasswordDescription),
style = MaterialTheme.typography.base
)
}
DestructiveButtons {
OutlineButton(

View File

@ -23,6 +23,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
@ -79,6 +80,7 @@ import org.thoughtcrime.securesms.ui.Cell
import org.thoughtcrime.securesms.ui.Divider
import org.thoughtcrime.securesms.ui.ItemButton
import org.thoughtcrime.securesms.ui.ItemButtonWithDrawable
import org.thoughtcrime.securesms.ui.baseBold
import org.thoughtcrime.securesms.ui.components.OutlineButton
import org.thoughtcrime.securesms.ui.components.OutlineTemporaryStateButton
import org.thoughtcrime.securesms.ui.contentDescription
@ -394,18 +396,20 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() {
horizontalArrangement = Arrangement.spacedBy(16.dp),
) {
OutlineButton(
stringResource(R.string.share),
modifier = Modifier.weight(1f),
onClick = { sendInvitationToUseSession() }
) {
Text(stringResource(R.string.share))
}
)
OutlineTemporaryStateButton(
modifier = Modifier.weight(1f)
.contentDescription(R.string.AccessibilityId_copy_button),
onClick = { copyPublicKey() },
) { isTemporary ->
Text(stringResource(if (isTemporary) R.string.copied else R.string.copy))
Text(
stringResource(if (isTemporary) R.string.copied else R.string.copy),
style = MaterialTheme.typography.baseBold
)
}
}

View File

@ -91,7 +91,10 @@ data class RadioOption<T>(
@Composable
fun <T> OptionsCard(card: OptionsCard<T>, callbacks: Callbacks<T>) {
Text(text = card.title())
Text(
card.title(),
style = MaterialTheme.typography.base
)
CellNoMargin {
LazyColumn(
modifier = Modifier.heightIn(max = 5000.dp)
@ -348,7 +351,12 @@ fun ProgressArc(progress: Float, modifier: Modifier = Modifier) {
Box(modifier = modifier) {
Arc(percentage = progress, modifier = Modifier.align(Alignment.Center))
Text("${text}%", color = Color.White, modifier = Modifier.align(Alignment.Center), style = MaterialTheme.typography.h2)
Text(
"${text}%",
color = Color.White,
modifier = Modifier.align(Alignment.Center),
style = MaterialTheme.typography.h2
)
}
}

View File

@ -143,6 +143,7 @@ val Typography.base get() = defaultStyle(14.sp)
val Typography.baseBold get() = boldStyle(14.sp)
val Typography.baseMonospace get() = defaultStyle(14.sp).copy(fontFamily = FontFamily.Monospace)
val Typography.small get() = defaultStyle(12.sp)
val Typography.smallMonospace get() = defaultStyle(12.sp).copy(fontFamily = FontFamily.Monospace)
val Typography.extraSmall get() = defaultStyle(11.sp)
val Typography.fine get() = defaultStyle(9.sp)

View File

@ -56,6 +56,7 @@ import kotlinx.coroutines.flow.buffer
import kotlinx.coroutines.flow.filter
import network.loki.messenger.R
import org.session.libsignal.utilities.Log
import org.thoughtcrime.securesms.ui.base
import java.util.concurrent.Executors
private const val TAG = "NewMessageFragment"
@ -89,23 +90,22 @@ fun MaybeScanQrCode(
) {
Text(
stringResource(R.string.activity_link_camera_permission_permanently_denied_configure_in_settings),
style = MaterialTheme.typography.base,
textAlign = TextAlign.Center
)
Spacer(modifier = Modifier.size(20.dp))
OutlineButton(
stringResource(R.string.sessionSettings),
modifier = Modifier.align(Alignment.CenterHorizontally),
onClick = onClickSettings
) {
Text(stringResource(R.string.sessionSettings))
}
)
}
} else {
OutlineButton(
stringResource(R.string.cameraGrantAccess),
modifier = Modifier.align(Alignment.Center),
onClick = { cameraPermissionState.run { launchPermissionRequest() } }
) {
Text(stringResource(R.string.cameraGrantAccess))
}
)
}
}
}

View File

@ -12,6 +12,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import org.thoughtcrime.securesms.ui.LocalDimensions
import org.thoughtcrime.securesms.ui.base
import org.thoughtcrime.securesms.ui.baseBold
import org.thoughtcrime.securesms.ui.outlinedTextFieldColors
@ -51,7 +52,7 @@ fun SessionOutlinedTextField(
error?.let {
Text(
it,
modifier = Modifier.padding(top = 12.dp),
modifier = Modifier.padding(top = LocalDimensions.current.marginExtraExtraSmall),
textAlign = TextAlign.Center,
style = MaterialTheme.typography.baseBold,
color = MaterialTheme.colors.error