mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-17 12:18:25 +00:00
Updated typography
Updated the typography in an composition local so it can be accessed from anyehere in compose and matching the figma declarations.
This commit is contained in:
parent
5061d3724b
commit
f8e238c73a
@ -25,8 +25,8 @@ import org.thoughtcrime.securesms.ui.RadioOption
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.components.SlimOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.theme.extraSmall
|
||||
import org.thoughtcrime.securesms.ui.fadingEdges
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
|
||||
typealias ExpiryCallbacks = Callbacks<ExpiryMode>
|
||||
typealias ExpiryRadioOption = RadioOption<ExpiryMode>
|
||||
@ -54,7 +54,7 @@ fun DisappearingMessages(
|
||||
|
||||
if (state.showGroupFooter) Text(
|
||||
text = stringResource(R.string.activity_disappearing_messages_group_footer),
|
||||
style = extraSmall,
|
||||
style = LocalType.current.extraSmall,
|
||||
fontWeight = FontWeight(400),
|
||||
color = LocalColors.current.textSecondary,
|
||||
textAlign = TextAlign.Center,
|
||||
|
@ -29,8 +29,7 @@ import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.components.AppBar
|
||||
import org.thoughtcrime.securesms.ui.components.QrImage
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.theme.small
|
||||
import org.thoughtcrime.securesms.ui.theme.xl
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
|
||||
@Composable
|
||||
internal fun StartConversationScreen(
|
||||
@ -78,12 +77,12 @@ internal fun StartConversationScreen(
|
||||
.padding(top = LocalDimensions.current.itemSpacing)
|
||||
.padding(bottom = LocalDimensions.current.margin)
|
||||
) {
|
||||
Text(stringResource(R.string.accountIdYours), style = xl)
|
||||
Text(stringResource(R.string.accountIdYours), style = LocalType.current.xl)
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.xxxsItemSpacing))
|
||||
Text(
|
||||
text = stringResource(R.string.qrYoursDescription),
|
||||
color = LocalColors.current.textSecondary,
|
||||
style = small
|
||||
style = LocalType.current.small
|
||||
)
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.smallItemSpacing))
|
||||
QrImage(
|
||||
|
@ -17,14 +17,13 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.base
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.components.AppBar
|
||||
import org.thoughtcrime.securesms.ui.components.SlimOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.components.SlimOutlineCopyButton
|
||||
import org.thoughtcrime.securesms.ui.components.border
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.theme.small
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
|
||||
@Composable
|
||||
internal fun InviteFriend(
|
||||
@ -47,7 +46,7 @@ internal fun InviteFriend(
|
||||
.border()
|
||||
.padding(LocalDimensions.current.smallMargin),
|
||||
textAlign = TextAlign.Center,
|
||||
style = base
|
||||
style = LocalType.current.base
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.xsItemSpacing))
|
||||
@ -55,7 +54,7 @@ internal fun InviteFriend(
|
||||
Text(
|
||||
stringResource(R.string.invite_your_friend_to_chat_with_you_on_session_by_sharing_your_account_id_with_them),
|
||||
textAlign = TextAlign.Center,
|
||||
style = small,
|
||||
style = LocalType.current.small,
|
||||
color = LocalColors.current.textSecondary,
|
||||
modifier = Modifier.padding(horizontal = LocalDimensions.current.smallItemSpacing)
|
||||
)
|
||||
|
@ -36,7 +36,7 @@ import org.thoughtcrime.securesms.ui.components.PrimaryOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
||||
import org.thoughtcrime.securesms.ui.components.SessionTabRow
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.theme.small
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
|
||||
private val TITLES = listOf(R.string.enter_account_id, R.string.qrScan)
|
||||
|
||||
@ -100,7 +100,7 @@ private fun EnterAccountId(
|
||||
.contentDescription(R.string.AccessibilityId_help_desk_link)
|
||||
.padding(horizontal = LocalDimensions.current.margin)
|
||||
.fillMaxWidth(),
|
||||
style = small,
|
||||
style = LocalType.current.small,
|
||||
color = LocalColors.current.textSecondary,
|
||||
iconRes = R.drawable.ic_circle_question_mark,
|
||||
onClick = onHelp
|
||||
|
@ -68,14 +68,14 @@ import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.TitledText
|
||||
import org.thoughtcrime.securesms.ui.theme.base
|
||||
import org.thoughtcrime.securesms.ui.theme.baseBold
|
||||
import org.thoughtcrime.securesms.ui.theme.baseMonospace
|
||||
import org.thoughtcrime.securesms.ui.theme.ThemeColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.theme.blackAlpha40
|
||||
import org.thoughtcrime.securesms.ui.theme.dangerButtonColors
|
||||
import org.thoughtcrime.securesms.ui.setComposeContent
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import org.thoughtcrime.securesms.ui.theme.bold
|
||||
import org.thoughtcrime.securesms.ui.theme.monospace
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
@ -361,7 +361,7 @@ fun FileDetails(fileDetails: List<TitledText>) {
|
||||
fun TitledErrorText(titledText: TitledText?) {
|
||||
TitledText(
|
||||
titledText,
|
||||
style = base,
|
||||
style = LocalType.current.base,
|
||||
color = LocalColors.current.danger
|
||||
)
|
||||
}
|
||||
@ -370,7 +370,7 @@ fun TitledErrorText(titledText: TitledText?) {
|
||||
fun TitledMonospaceText(titledText: TitledText?) {
|
||||
TitledText(
|
||||
titledText,
|
||||
style = baseMonospace
|
||||
style = LocalType.current.base.monospace()
|
||||
)
|
||||
}
|
||||
|
||||
@ -378,7 +378,7 @@ fun TitledMonospaceText(titledText: TitledText?) {
|
||||
fun TitledText(
|
||||
titledText: TitledText?,
|
||||
modifier: Modifier = Modifier,
|
||||
style: TextStyle = base,
|
||||
style: TextStyle = LocalType.current.base,
|
||||
color: Color = Color.Unspecified
|
||||
) {
|
||||
titledText?.apply {
|
||||
@ -396,7 +396,7 @@ fun TitledText(
|
||||
@Composable
|
||||
fun TitledView(title: GetString, modifier: Modifier = Modifier, content: @Composable () -> Unit) {
|
||||
Column(modifier = modifier, verticalArrangement = Arrangement.spacedBy(LocalDimensions.current.xxxsItemSpacing)) {
|
||||
Text(title.string(), style = baseBold)
|
||||
Text(title.string(), style = LocalType.current.base.bold())
|
||||
content()
|
||||
}
|
||||
}
|
||||
|
@ -19,12 +19,9 @@ import org.thoughtcrime.securesms.ui.Divider
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.theme.base
|
||||
import org.thoughtcrime.securesms.ui.theme.ThemeColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.theme.h4
|
||||
import org.thoughtcrime.securesms.ui.theme.h8
|
||||
import org.thoughtcrime.securesms.ui.theme.small
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
|
||||
@Composable
|
||||
internal fun EmptyView(newAccount: Boolean) {
|
||||
@ -42,12 +39,12 @@ internal fun EmptyView(newAccount: Boolean) {
|
||||
if (newAccount) {
|
||||
Text(
|
||||
stringResource(R.string.onboardingAccountCreated),
|
||||
style = h4,
|
||||
style = LocalType.current.h4,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
Text(
|
||||
stringResource(R.string.welcome_to_session),
|
||||
style = base,
|
||||
style = LocalType.current.base,
|
||||
color = LocalColors.current.primary,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
@ -57,12 +54,12 @@ internal fun EmptyView(newAccount: Boolean) {
|
||||
|
||||
Text(
|
||||
stringResource(R.string.conversationsNone),
|
||||
style = h8,
|
||||
style = LocalType.current.h8,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.padding(bottom = LocalDimensions.current.xsItemSpacing))
|
||||
Text(
|
||||
stringResource(R.string.onboardingHitThePlusButton),
|
||||
style = small,
|
||||
style = LocalType.current.small,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
Spacer(modifier = Modifier.weight(2f))
|
||||
|
@ -26,8 +26,7 @@ import org.thoughtcrime.securesms.ui.theme.ThemeColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.components.SlimPrimaryOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.theme.h8
|
||||
import org.thoughtcrime.securesms.ui.theme.small
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
|
||||
@Composable
|
||||
internal fun SeedReminder(startRecoveryPasswordActivity: () -> Unit) {
|
||||
@ -51,14 +50,14 @@ internal fun SeedReminder(startRecoveryPasswordActivity: () -> Unit) {
|
||||
Row {
|
||||
Text(
|
||||
stringResource(R.string.save_your_recovery_password),
|
||||
style = h8
|
||||
style = LocalType.current.h8
|
||||
)
|
||||
Spacer(Modifier.requiredWidth(LocalDimensions.current.xxsItemSpacing))
|
||||
SessionShieldIcon()
|
||||
}
|
||||
Text(
|
||||
stringResource(R.string.save_your_recovery_password_to_make_sure_you_don_t_lose_access_to_your_account),
|
||||
style = small
|
||||
style = LocalType.current.small
|
||||
)
|
||||
}
|
||||
Spacer(Modifier.width(LocalDimensions.current.xxsMargin))
|
||||
|
@ -48,8 +48,7 @@ import org.thoughtcrime.securesms.ui.components.BorderlessHtmlButton
|
||||
import org.thoughtcrime.securesms.ui.components.PrimaryFillButton
|
||||
import org.thoughtcrime.securesms.ui.components.PrimaryOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.theme.h4
|
||||
import org.thoughtcrime.securesms.ui.theme.large
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
@Preview
|
||||
@ -113,7 +112,7 @@ internal fun LandingScreen(
|
||||
Text(
|
||||
stringResource(R.string.onboardingBubblePrivacyInYourPocket),
|
||||
modifier = Modifier.align(Alignment.CenterHorizontally),
|
||||
style = h4,
|
||||
style = LocalType.current.h4,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacing))
|
||||
@ -217,7 +216,7 @@ private fun MessageText(
|
||||
) {
|
||||
Text(
|
||||
text,
|
||||
style = large,
|
||||
style = LocalType.current.large,
|
||||
color = textColor,
|
||||
modifier = Modifier.padding(
|
||||
horizontal = LocalDimensions.current.smallItemSpacing,
|
||||
|
@ -26,11 +26,10 @@ import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.onboarding.ui.ContinuePrimaryOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.base
|
||||
import org.thoughtcrime.securesms.ui.components.MaybeScanQrCode
|
||||
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
||||
import org.thoughtcrime.securesms.ui.components.SessionTabRow
|
||||
import org.thoughtcrime.securesms.ui.theme.h4
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
|
||||
private val TITLES = listOf(R.string.sessionRecoveryPassword, R.string.qrScan)
|
||||
|
||||
@ -83,7 +82,7 @@ private fun RecoveryPassword(state: State, onChange: (String) -> Unit = {}, onCo
|
||||
Row {
|
||||
Text(
|
||||
text = stringResource(R.string.sessionRecoveryPassword),
|
||||
style = h4
|
||||
style = LocalType.current.h4
|
||||
)
|
||||
Spacer(Modifier.width(LocalDimensions.current.xxsItemSpacing))
|
||||
Icon(
|
||||
@ -95,7 +94,7 @@ private fun RecoveryPassword(state: State, onChange: (String) -> Unit = {}, onCo
|
||||
Spacer(Modifier.height(LocalDimensions.current.smallItemSpacing))
|
||||
Text(
|
||||
stringResource(R.string.activity_link_enter_your_recovery_password_to_load_your_account_if_you_haven_t_saved_it_you_can_find_it_in_your_app_settings),
|
||||
style = base
|
||||
style = LocalType.current.base
|
||||
)
|
||||
Spacer(Modifier.height(LocalDimensions.current.itemSpacing))
|
||||
SessionOutlinedTextField(
|
||||
|
@ -11,9 +11,8 @@ import androidx.compose.ui.res.stringResource
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.ProgressArc
|
||||
import org.thoughtcrime.securesms.ui.theme.base
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.theme.h7
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
|
||||
@Composable
|
||||
internal fun LoadingScreen(progress: Float) {
|
||||
@ -25,12 +24,12 @@ internal fun LoadingScreen(progress: Float) {
|
||||
)
|
||||
Text(
|
||||
stringResource(R.string.waitOneMoment),
|
||||
style = h7
|
||||
style = LocalType.current.h7
|
||||
)
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.xxxsItemSpacing))
|
||||
Text(
|
||||
stringResource(R.string.loadAccountProgressMessage),
|
||||
style = base
|
||||
style = LocalType.current.base
|
||||
)
|
||||
Spacer(modifier = Modifier.weight(2f))
|
||||
}
|
||||
|
@ -25,16 +25,12 @@ import org.thoughtcrime.securesms.onboarding.ui.ContinuePrimaryOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.theme.base
|
||||
import org.thoughtcrime.securesms.ui.theme.ThemeColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.components.CircularProgressIndicator
|
||||
import org.thoughtcrime.securesms.ui.components.RadioButton
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.theme.h4
|
||||
import org.thoughtcrime.securesms.ui.theme.h8
|
||||
import org.thoughtcrime.securesms.ui.theme.h9
|
||||
import org.thoughtcrime.securesms.ui.theme.small
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
|
||||
@Composable
|
||||
internal fun MessageNotificationsScreen(
|
||||
@ -61,9 +57,9 @@ internal fun MessageNotificationsScreen(
|
||||
Spacer(Modifier.weight(1f))
|
||||
|
||||
Column(modifier = Modifier.padding(horizontal = LocalDimensions.current.onboardingMargin)) {
|
||||
Text(stringResource(R.string.notificationsMessage), style = h4)
|
||||
Text(stringResource(R.string.notificationsMessage), style = LocalType.current.h4)
|
||||
Spacer(Modifier.height(LocalDimensions.current.xsMargin))
|
||||
Text(stringResource(R.string.onboardingMessageNotificationExplaination), style = base)
|
||||
Text(stringResource(R.string.onboardingMessageNotificationExplaination), style = LocalType.current.base)
|
||||
Spacer(Modifier.height(LocalDimensions.current.itemSpacing))
|
||||
}
|
||||
|
||||
@ -119,15 +115,15 @@ private fun NotificationRadioButton(
|
||||
Column(modifier = Modifier
|
||||
.padding(horizontal = 15.dp)
|
||||
.padding(top = 10.dp, bottom = 11.dp)) {
|
||||
Text(stringResource(title), style = h8)
|
||||
Text(stringResource(title), style = LocalType.current.h8)
|
||||
|
||||
Text(stringResource(explanation), style = small, modifier = Modifier.padding(top = 7.dp))
|
||||
Text(stringResource(explanation), style = LocalType.current.small, modifier = Modifier.padding(top = 7.dp))
|
||||
tag?.let {
|
||||
Text(
|
||||
stringResource(it),
|
||||
modifier = Modifier.padding(top = 6.dp),
|
||||
color = LocalColors.current.primary,
|
||||
style = h9
|
||||
style = LocalType.current.h9
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,8 @@ import org.thoughtcrime.securesms.onboarding.OnboardingBackPressAlertDialog
|
||||
import org.thoughtcrime.securesms.onboarding.ui.ContinuePrimaryOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.base
|
||||
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
||||
import org.thoughtcrime.securesms.ui.theme.h4
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
@ -57,11 +56,11 @@ internal fun PickDisplayName(
|
||||
Column(
|
||||
modifier = Modifier.padding(horizontal = LocalDimensions.current.largeMargin)
|
||||
) {
|
||||
Text(stringResource(state.title), style = h4)
|
||||
Text(stringResource(state.title), style = LocalType.current.h4)
|
||||
Spacer(Modifier.height(LocalDimensions.current.smallItemSpacing))
|
||||
Text(
|
||||
stringResource(state.description),
|
||||
style = base,
|
||||
style = LocalType.current.base,
|
||||
modifier = Modifier.padding(bottom = LocalDimensions.current.xsItemSpacing))
|
||||
Spacer(Modifier.height(LocalDimensions.current.itemSpacing))
|
||||
SessionOutlinedTextField(
|
||||
|
@ -32,7 +32,7 @@ import org.thoughtcrime.securesms.ui.components.QrImage
|
||||
import org.thoughtcrime.securesms.ui.components.SessionTabRow
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.setComposeContent
|
||||
import org.thoughtcrime.securesms.ui.theme.small
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import org.thoughtcrime.securesms.util.start
|
||||
|
||||
private val TITLES = listOf(R.string.view, R.string.scan)
|
||||
@ -109,7 +109,7 @@ fun QrPage(string: String) {
|
||||
text = stringResource(R.string.this_is_your_account_id_other_users_can_scan_it_to_start_a_conversation_with_you),
|
||||
color = LocalColors.current.textSecondary,
|
||||
textAlign = TextAlign.Center,
|
||||
style = small
|
||||
style = LocalType.current.small
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.SessionShieldIcon
|
||||
import org.thoughtcrime.securesms.ui.theme.base
|
||||
import org.thoughtcrime.securesms.ui.theme.ThemeColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.components.QrImage
|
||||
@ -38,8 +37,8 @@ import org.thoughtcrime.securesms.ui.components.SlimOutlineButton
|
||||
import org.thoughtcrime.securesms.ui.components.SlimOutlineCopyButton
|
||||
import org.thoughtcrime.securesms.ui.components.border
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.theme.extraSmallMonospace
|
||||
import org.thoughtcrime.securesms.ui.theme.h8
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import org.thoughtcrime.securesms.ui.theme.monospace
|
||||
|
||||
@Composable
|
||||
internal fun RecoveryPasswordScreen(
|
||||
@ -75,7 +74,7 @@ private fun RecoveryPasswordCell(
|
||||
Row {
|
||||
Text(
|
||||
stringResource(R.string.sessionRecoveryPassword),
|
||||
style = h8
|
||||
style = LocalType.current.h8
|
||||
)
|
||||
Spacer(Modifier.width(LocalDimensions.current.xxsItemSpacing))
|
||||
SessionShieldIcon()
|
||||
@ -85,7 +84,7 @@ private fun RecoveryPasswordCell(
|
||||
|
||||
Text(
|
||||
stringResource(R.string.recoveryPasswordDescription),
|
||||
style = base
|
||||
style = LocalType.current.base
|
||||
)
|
||||
|
||||
AnimatedVisibility(!showQr) {
|
||||
@ -142,7 +141,7 @@ private fun RecoveryPassword(mnemonic: String) {
|
||||
.border()
|
||||
.padding(LocalDimensions.current.smallMargin),
|
||||
textAlign = TextAlign.Center,
|
||||
style = extraSmallMonospace,
|
||||
style = LocalType.current.extraSmall.monospace(),
|
||||
color = LocalColors.current.run { if (isLight) text else primary },
|
||||
)
|
||||
}
|
||||
@ -156,11 +155,11 @@ private fun HideRecoveryPasswordCell(onHide: () -> Unit = {}) {
|
||||
) {
|
||||
Text(
|
||||
stringResource(R.string.recoveryPasswordHideRecoveryPassword),
|
||||
style = h8
|
||||
style = LocalType.current.h8
|
||||
)
|
||||
Text(
|
||||
stringResource(R.string.recoveryPasswordHideRecoveryPasswordDescription),
|
||||
style = base
|
||||
style = LocalType.current.base
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.width(LocalDimensions.current.xxsMargin))
|
||||
|
@ -1,6 +1,5 @@
|
||||
package org.thoughtcrime.securesms.ui
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.IntrinsicSize
|
||||
@ -24,14 +23,12 @@ import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.h7
|
||||
import org.thoughtcrime.securesms.ui.theme.large
|
||||
import org.thoughtcrime.securesms.ui.theme.largeBold
|
||||
import org.thoughtcrime.securesms.ui.theme.bold
|
||||
|
||||
|
||||
class DialogButtonModel(
|
||||
@ -83,7 +80,7 @@ fun AlertDialog(
|
||||
Text(
|
||||
it,
|
||||
textAlign = TextAlign.Center,
|
||||
style = h7,
|
||||
style = LocalType.current.h7,
|
||||
modifier = Modifier.padding(bottom = LocalDimensions.current.xxsItemSpacing)
|
||||
)
|
||||
}
|
||||
@ -91,7 +88,7 @@ fun AlertDialog(
|
||||
Text(
|
||||
it,
|
||||
textAlign = TextAlign.Center,
|
||||
style = large,
|
||||
style = LocalType.current.large,
|
||||
modifier = Modifier.padding(bottom = LocalDimensions.current.xxsItemSpacing)
|
||||
)
|
||||
}
|
||||
@ -130,7 +127,7 @@ fun DialogButton(text: String, modifier: Modifier, color: Color = Color.Unspecif
|
||||
Text(
|
||||
text,
|
||||
color = color.takeOrElse { LocalColors.current.text },
|
||||
style = largeBold,
|
||||
style = LocalType.current.large.bold(),
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.padding(
|
||||
top = LocalDimensions.current.smallItemSpacing,
|
||||
|
@ -67,15 +67,10 @@ import org.thoughtcrime.securesms.conversation.disappearingmessages.ui.OptionsCa
|
||||
import org.thoughtcrime.securesms.ui.components.SmallCircularProgressIndicator
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.base
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import org.thoughtcrime.securesms.ui.theme.divider
|
||||
import org.thoughtcrime.securesms.ui.theme.extraSmall
|
||||
import org.thoughtcrime.securesms.ui.theme.h2
|
||||
import org.thoughtcrime.securesms.ui.theme.h8
|
||||
import org.thoughtcrime.securesms.ui.theme.large
|
||||
import org.thoughtcrime.securesms.ui.theme.radioButtonColors
|
||||
import org.thoughtcrime.securesms.ui.theme.transparentButtonColors
|
||||
import org.thoughtcrime.securesms.ui.theme.xl
|
||||
import kotlin.math.min
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
@ -102,7 +97,7 @@ data class RadioOption<T>(
|
||||
fun <T> OptionsCard(card: OptionsCard<T>, callbacks: Callbacks<T>) {
|
||||
Text(
|
||||
card.title(),
|
||||
style = base
|
||||
style = LocalType.current.base
|
||||
)
|
||||
CellNoMargin {
|
||||
LazyColumn(
|
||||
@ -124,7 +119,10 @@ fun LargeItemButtonWithDrawable(
|
||||
colors: ButtonColors = transparentButtonColors(),
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
ItemButtonWithDrawable(textId, icon, modifier.heightIn(min = LocalDimensions.current.minLargeItemButtonHeight), h8, colors, onClick)
|
||||
ItemButtonWithDrawable(
|
||||
textId, icon, modifier.heightIn(min = LocalDimensions.current.minLargeItemButtonHeight),
|
||||
LocalType.current.h8, colors, onClick
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
@ -132,7 +130,7 @@ fun ItemButtonWithDrawable(
|
||||
@StringRes textId: Int,
|
||||
@DrawableRes icon: Int,
|
||||
modifier: Modifier = Modifier,
|
||||
textStyle: TextStyle = xl,
|
||||
textStyle: TextStyle = LocalType.current.xl,
|
||||
colors: ButtonColors = transparentButtonColors(),
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
@ -162,7 +160,10 @@ fun LargeItemButton(
|
||||
colors: ButtonColors = transparentButtonColors(),
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
ItemButton(textId, icon, modifier.heightIn(min = LocalDimensions.current.minLargeItemButtonHeight), h8, colors, onClick)
|
||||
ItemButton(
|
||||
textId, icon, modifier.heightIn(min = LocalDimensions.current.minLargeItemButtonHeight),
|
||||
LocalType.current.h8, colors, onClick
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,7 +174,7 @@ fun ItemButton(
|
||||
@StringRes textId: Int,
|
||||
@DrawableRes icon: Int,
|
||||
modifier: Modifier = Modifier,
|
||||
textStyle: TextStyle = xl,
|
||||
textStyle: TextStyle = LocalType.current.xl,
|
||||
colors: ButtonColors = transparentButtonColors(),
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
@ -203,7 +204,7 @@ fun ItemButton(
|
||||
text: String,
|
||||
icon: @Composable BoxScope.() -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
textStyle: TextStyle = xl,
|
||||
textStyle: TextStyle = LocalType.current.xl,
|
||||
colors: ButtonColors = transparentButtonColors(),
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
@ -281,13 +282,13 @@ fun <T> TitledRadioButton(option: RadioOption<T>, onClick: () -> Unit) {
|
||||
Column {
|
||||
Text(
|
||||
text = option.title(),
|
||||
style = large,
|
||||
style = LocalType.current.large,
|
||||
color = color
|
||||
)
|
||||
option.subtitle?.let {
|
||||
Text(
|
||||
text = it(),
|
||||
style = extraSmall,
|
||||
style = LocalType.current.extraSmall,
|
||||
color = color
|
||||
)
|
||||
}
|
||||
@ -399,7 +400,7 @@ fun ProgressArc(progress: Float, modifier: Modifier = Modifier) {
|
||||
"${text}%",
|
||||
color = Color.White,
|
||||
modifier = Modifier.align(Alignment.Center),
|
||||
style = h2
|
||||
style = LocalType.current.h2
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.theme.ThemeColors
|
||||
import org.thoughtcrime.securesms.ui.theme.h4
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
@ -42,7 +42,7 @@ fun AppBar(title: String, onClose: () -> Unit = {}, onBack: (() -> Unit)? = null
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Text(text = title, style = h4)
|
||||
Text(text = title, style = LocalType.current.h4)
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Box(contentAlignment = Alignment.Center, modifier = Modifier.size(LocalDimensions.current.appBarHeight)) {
|
||||
IconButton(onClick = onClose) {
|
||||
|
@ -37,13 +37,14 @@ import kotlinx.coroutines.flow.collectLatest
|
||||
import kotlinx.coroutines.flow.filter
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.ui.LaunchedEffectAsync
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.theme.baseBold
|
||||
import org.thoughtcrime.securesms.ui.theme.buttonShape
|
||||
import org.thoughtcrime.securesms.ui.theme.ThemeColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.theme.bold
|
||||
import org.thoughtcrime.securesms.ui.theme.buttonShape
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
@ -257,7 +258,7 @@ fun BorderlessButtonWithIcon(
|
||||
text: String,
|
||||
@DrawableRes iconRes: Int,
|
||||
modifier: Modifier = Modifier,
|
||||
style: TextStyle = baseBold,
|
||||
style: TextStyle = LocalType.current.base.bold(),
|
||||
color: Color = LocalColors.current.text,
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
|
@ -10,9 +10,8 @@ import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.thoughtcrime.securesms.ui.theme.baseBold
|
||||
import org.thoughtcrime.securesms.ui.theme.extraSmall
|
||||
import org.thoughtcrime.securesms.ui.theme.extraSmallBold
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import org.thoughtcrime.securesms.ui.theme.bold
|
||||
|
||||
interface ButtonStyle {
|
||||
@OptIn(ExperimentalMaterialApi::class)
|
||||
@ -27,26 +26,34 @@ interface ButtonStyle {
|
||||
@SuppressLint("ComposableNaming")
|
||||
@Composable fun applyTextConstraints(content: @Composable () -> Unit) {
|
||||
CompositionLocalProvider(
|
||||
LocalTextStyle provides textStyle,
|
||||
LocalTextStyle provides textStyle(),
|
||||
content = content
|
||||
)
|
||||
}
|
||||
|
||||
val textStyle: TextStyle
|
||||
@Composable
|
||||
fun textStyle() : TextStyle
|
||||
|
||||
val minHeight: Dp
|
||||
|
||||
object Large: ButtonStyle {
|
||||
override val textStyle = baseBold.copy(textAlign = TextAlign.Center)
|
||||
@Composable
|
||||
override fun textStyle() = LocalType.current.base.bold()
|
||||
.copy(textAlign = TextAlign.Center)
|
||||
override val minHeight = 41.dp
|
||||
}
|
||||
|
||||
object Slim: ButtonStyle {
|
||||
override val textStyle = extraSmallBold.copy(textAlign = TextAlign.Center)
|
||||
@Composable
|
||||
override fun textStyle() = LocalType.current.extraSmall.bold()
|
||||
.copy(textAlign = TextAlign.Center)
|
||||
override val minHeight = 29.dp
|
||||
}
|
||||
|
||||
object Borderless: ButtonStyle {
|
||||
override val textStyle = extraSmall.copy(textAlign = TextAlign.Center)
|
||||
@Composable
|
||||
override fun textStyle() = LocalType.current.extraSmall
|
||||
.copy(textAlign = TextAlign.Center)
|
||||
override val minHeight = 37.dp
|
||||
}
|
||||
}
|
||||
|
@ -57,9 +57,8 @@ import kotlinx.coroutines.launch
|
||||
import network.loki.messenger.R
|
||||
import org.session.libsignal.utilities.Log
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.base
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.theme.xl
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
private const val TAG = "NewMessageFragment"
|
||||
@ -94,7 +93,7 @@ fun MaybeScanQrCode(
|
||||
) {
|
||||
Text(
|
||||
stringResource(R.string.activity_link_camera_permission_permanently_denied_configure_in_settings),
|
||||
style = base,
|
||||
style = LocalType.current.base,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
Spacer(modifier = Modifier.size(LocalDimensions.current.itemSpacing))
|
||||
@ -113,7 +112,8 @@ fun MaybeScanQrCode(
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Text(stringResource(R.string.fragment_scan_qr_code_camera_access_explanation), style = xl, textAlign = TextAlign.Center)
|
||||
Text(stringResource(R.string.fragment_scan_qr_code_camera_access_explanation),
|
||||
style = LocalType.current.xl, textAlign = TextAlign.Center)
|
||||
Spacer(modifier = Modifier.height(LocalDimensions.current.itemSpacing))
|
||||
PrimaryOutlineButton(
|
||||
stringResource(R.string.cameraGrantAccess),
|
||||
|
@ -19,13 +19,13 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
|
||||
import androidx.compose.ui.unit.dp
|
||||
import kotlinx.coroutines.launch
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.ThemeColors
|
||||
import org.thoughtcrime.securesms.ui.theme.SessionColorsParameterProvider
|
||||
import org.thoughtcrime.securesms.ui.theme.ThemeColors
|
||||
import org.thoughtcrime.securesms.ui.theme.divider
|
||||
import org.thoughtcrime.securesms.ui.theme.h8
|
||||
|
||||
private val TITLES = listOf(R.string.sessionRecoveryPassword, R.string.qrScan)
|
||||
|
||||
@ -58,7 +58,7 @@ fun SessionTabRow(pagerState: PagerState, titles: List<Int>) {
|
||||
) {
|
||||
Text(
|
||||
stringResource(id = it),
|
||||
style = h8
|
||||
style = LocalType.current.h8
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -39,13 +39,13 @@ import androidx.compose.ui.unit.sp
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalDimensions
|
||||
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
|
||||
import org.thoughtcrime.securesms.ui.theme.base
|
||||
import org.thoughtcrime.securesms.ui.theme.baseBold
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalColors
|
||||
import org.thoughtcrime.securesms.ui.theme.borders
|
||||
import org.thoughtcrime.securesms.ui.theme.text
|
||||
import org.thoughtcrime.securesms.ui.theme.textSecondary
|
||||
import org.thoughtcrime.securesms.ui.contentDescription
|
||||
import org.thoughtcrime.securesms.ui.theme.LocalType
|
||||
import org.thoughtcrime.securesms.ui.theme.bold
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
@ -85,7 +85,7 @@ fun SessionOutlinedTextField(
|
||||
modifier: Modifier = Modifier,
|
||||
contentDescription: String? = null,
|
||||
onChange: (String) -> Unit = {},
|
||||
textStyle: TextStyle = base,
|
||||
textStyle: TextStyle = LocalType.current.base,
|
||||
placeholder: String = "",
|
||||
onContinue: () -> Unit = {},
|
||||
error: String? = null,
|
||||
@ -106,7 +106,7 @@ fun SessionOutlinedTextField(
|
||||
if (text.isEmpty()) {
|
||||
Text(
|
||||
text = placeholder,
|
||||
style = base,
|
||||
style = LocalType.current.base,
|
||||
color = LocalColors.current.textSecondary(isTextErrorColor),
|
||||
modifier = Modifier.wrapContentSize()
|
||||
.align(Alignment.CenterStart)
|
||||
@ -136,7 +136,7 @@ fun SessionOutlinedTextField(
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
.contentDescription(R.string.AccessibilityId_error_message),
|
||||
textAlign = TextAlign.Center,
|
||||
style = baseBold,
|
||||
style = LocalType.current.base.bold(),
|
||||
color = LocalColors.current.danger
|
||||
)
|
||||
}
|
||||
@ -148,7 +148,7 @@ fun AnnotatedTextWithIcon(
|
||||
text: String,
|
||||
@DrawableRes iconRes: Int,
|
||||
modifier: Modifier = Modifier,
|
||||
style: TextStyle = base,
|
||||
style: TextStyle = LocalType.current.base,
|
||||
color: Color = Color.Unspecified,
|
||||
iconSize: TextUnit = 12.sp
|
||||
) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.thoughtcrime.securesms.ui.theme
|
||||
|
||||
import androidx.compose.material.Typography
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontFamily.Companion.Monospace
|
||||
@ -8,52 +9,158 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
fun boldStyle(size: TextUnit) = TextStyle.Default.copy(
|
||||
fontSize = size,
|
||||
lineHeight = size * 1.2,
|
||||
fontWeight = FontWeight.Bold,
|
||||
|
||||
|
||||
fun TextStyle.bold() = TextStyle.Default.copy(
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
|
||||
fun defaultStyle(size: TextUnit, fontFamily: FontFamily? = TextStyle.Default.fontFamily) = TextStyle.Default.copy(
|
||||
fontSize = size,
|
||||
lineHeight = size * 1.2,
|
||||
fontFamily = fontFamily
|
||||
fun TextStyle.monospace() = TextStyle.Default.copy(
|
||||
fontFamily = FontFamily.Monospace
|
||||
)
|
||||
|
||||
val xl = defaultStyle(18.sp)
|
||||
val sessionTypography = SessionTypography()
|
||||
|
||||
val large = defaultStyle(16.sp)
|
||||
val largeBold = boldStyle(16.sp)
|
||||
data class SessionTypography(
|
||||
// Body
|
||||
val xl: TextStyle = TextStyle(
|
||||
fontSize = 18.sp,
|
||||
lineHeight = 21.6.sp,
|
||||
fontWeight = FontWeight.Normal
|
||||
),
|
||||
|
||||
val base = defaultStyle(14.sp)
|
||||
val baseBold = boldStyle(14.sp)
|
||||
val baseMonospace = defaultStyle(14.sp, fontFamily = Monospace)
|
||||
val large: TextStyle = TextStyle(
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 19.2.sp,
|
||||
fontWeight = FontWeight.Normal
|
||||
),
|
||||
|
||||
val small = defaultStyle(12.sp)
|
||||
val smallBold = boldStyle(12.sp)
|
||||
val smallMonospace = defaultStyle(12.sp, fontFamily = Monospace)
|
||||
val base: TextStyle = TextStyle(
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 16.8.sp,
|
||||
fontWeight = FontWeight.Normal
|
||||
),
|
||||
|
||||
val extraSmall = defaultStyle(11.sp)
|
||||
val extraSmallBold = boldStyle(11.sp)
|
||||
val extraSmallMonospace = defaultStyle(11.sp, fontFamily = Monospace)
|
||||
val small: TextStyle = TextStyle(
|
||||
fontSize = 12.sp,
|
||||
lineHeight = 14.4.sp,
|
||||
fontWeight = FontWeight.Normal
|
||||
),
|
||||
|
||||
val fine = defaultStyle(9.sp)
|
||||
val extraSmall: TextStyle = TextStyle(
|
||||
fontSize = 11.sp,
|
||||
lineHeight = 13.2.sp,
|
||||
fontWeight = FontWeight.Normal
|
||||
),
|
||||
|
||||
val fine: TextStyle = TextStyle(
|
||||
fontSize = 9.sp,
|
||||
lineHeight = 10.8.sp,
|
||||
fontWeight = FontWeight.Normal
|
||||
),
|
||||
|
||||
// Headings
|
||||
val h1: TextStyle = TextStyle(
|
||||
fontSize = 36.sp,
|
||||
lineHeight = 43.2.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
|
||||
val h2: TextStyle = TextStyle(
|
||||
fontSize = 32.sp,
|
||||
lineHeight = 38.4.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
|
||||
val h3: TextStyle = TextStyle(
|
||||
fontSize = 29.sp,
|
||||
lineHeight = 34.8.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
|
||||
val h4: TextStyle = TextStyle(
|
||||
fontSize = 26.sp,
|
||||
lineHeight = 31.2.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
|
||||
val h5: TextStyle = TextStyle(
|
||||
fontSize = 23.sp,
|
||||
lineHeight = 27.6.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
|
||||
val h6: TextStyle = TextStyle(
|
||||
fontSize = 20.sp,
|
||||
lineHeight = 24.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
|
||||
val h7: TextStyle = TextStyle(
|
||||
fontSize = 18.sp,
|
||||
lineHeight = 21.6.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
|
||||
val h8: TextStyle = TextStyle(
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 19.2.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
),
|
||||
|
||||
val h9: TextStyle = TextStyle(
|
||||
fontSize = 14.sp,
|
||||
lineHeight = 16.8.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
) {
|
||||
//todo ready to go when we switch to Material3
|
||||
|
||||
// An opinionated override of Material's defaults
|
||||
/*@Composable
|
||||
fun asMaterialTypography() = Typography(
|
||||
// Display
|
||||
displayLarge = h1,
|
||||
displayMedium = h1,
|
||||
displaySmall = h1,
|
||||
|
||||
// Headline
|
||||
headlineLarge = h2,
|
||||
headlineMedium = h3,
|
||||
headlineSmall = h4,
|
||||
|
||||
// Title
|
||||
titleLarge = h5,
|
||||
titleMedium = h6,
|
||||
titleSmall = h7,
|
||||
|
||||
// Body
|
||||
bodyLarge = large,
|
||||
bodyMedium = base,
|
||||
bodySmall = small,
|
||||
|
||||
// Label
|
||||
labelLarge = extraSmall,
|
||||
labelMedium = fine,
|
||||
labelSmall = fine
|
||||
)*/
|
||||
|
||||
@Composable
|
||||
fun asMaterialTypography() = Typography(
|
||||
h1 = h1,
|
||||
h2 = h2,
|
||||
h3 = h3,
|
||||
h4 = h4,
|
||||
h5 = h5,
|
||||
h6 = h6,
|
||||
subtitle1 = h7,
|
||||
subtitle2 = h8,
|
||||
body1 = base,
|
||||
body2 = small,
|
||||
button = base,
|
||||
caption = small,
|
||||
overline = fine
|
||||
)
|
||||
}
|
||||
|
||||
val h1 = boldStyle(36.sp)
|
||||
val h2 = boldStyle(32.sp)
|
||||
val h3 = boldStyle(29.sp)
|
||||
val h4 = boldStyle(26.sp)
|
||||
val h5 = boldStyle(23.sp)
|
||||
val h6 = boldStyle(20.sp)
|
||||
val h7 = boldStyle(18.sp)
|
||||
val h8 = boldStyle(16.sp)
|
||||
val h9 = boldStyle(14.sp)
|
||||
|
||||
val sessionTypography = Typography(
|
||||
h1 = h1,
|
||||
h2 = h2,
|
||||
h3 = h3,
|
||||
h4 = h4,
|
||||
h5 = h5,
|
||||
h6 = h6,
|
||||
)
|
||||
|
@ -163,29 +163,26 @@ fun PreviewThemeColors(
|
||||
@Composable
|
||||
private fun ThemeColors() {
|
||||
Column {
|
||||
Box(Modifier.background(MaterialTheme.colors.primary)) {
|
||||
Text("primary", style = base)
|
||||
Box(Modifier.background(LocalColors.current.primary)) {
|
||||
Text("primary", style = LocalType.current.base)
|
||||
}
|
||||
Box(Modifier.background(MaterialTheme.colors.primaryVariant)) {
|
||||
Text("primaryVariant", style = base)
|
||||
Box(Modifier.background(LocalColors.current.background)) {
|
||||
Text("background", style = LocalType.current.base)
|
||||
}
|
||||
Box(Modifier.background(MaterialTheme.colors.secondary)) {
|
||||
Text("secondary", style = base)
|
||||
Box(Modifier.background(LocalColors.current.backgroundSecondary)) {
|
||||
Text("backgroundSecondary", style = LocalType.current.base)
|
||||
}
|
||||
Box(Modifier.background(MaterialTheme.colors.secondaryVariant)) {
|
||||
Text("secondaryVariant", style = base)
|
||||
Box(Modifier.background(LocalColors.current.text)) {
|
||||
Text("text", style = LocalType.current.base)
|
||||
}
|
||||
Box(Modifier.background(MaterialTheme.colors.surface)) {
|
||||
Text("surface", style = base)
|
||||
Box(Modifier.background(LocalColors.current.textSecondary)) {
|
||||
Text("textSecondary", style = LocalType.current.base)
|
||||
}
|
||||
Box(Modifier.background(MaterialTheme.colors.primarySurface)) {
|
||||
Text("primarySurface", style = base)
|
||||
Box(Modifier.background(LocalColors.current.danger)) {
|
||||
Text("danger", style = LocalType.current.base)
|
||||
}
|
||||
Box(Modifier.background(MaterialTheme.colors.background)) {
|
||||
Text("background", style = base)
|
||||
}
|
||||
Box(Modifier.background(MaterialTheme.colors.error)) {
|
||||
Text("error", style = base)
|
||||
Box(Modifier.background(LocalColors.current.borders)) {
|
||||
Text("border", style = LocalType.current.base)
|
||||
}
|
||||
}
|
||||
}
|
@ -21,6 +21,8 @@ import org.session.libsession.utilities.AppTextSecurePreferences
|
||||
|
||||
// Globally accessible composition local objects
|
||||
val LocalColors = compositionLocalOf <ThemeColors> { ClassicDark() }
|
||||
val LocalType = compositionLocalOf { sessionTypography }
|
||||
|
||||
var selectedTheme: ThemeColors? = null
|
||||
|
||||
/**
|
||||
@ -51,11 +53,12 @@ fun SessionMaterialTheme(
|
||||
) {
|
||||
MaterialTheme(
|
||||
colors = colors.toMaterialColors(),
|
||||
typography = sessionTypography,
|
||||
typography = sessionTypography.asMaterialTypography(),
|
||||
shapes = sessionShapes,
|
||||
) {
|
||||
CompositionLocalProvider(
|
||||
LocalColors provides colors,
|
||||
LocalType provides sessionTypography,
|
||||
LocalContentColor provides colors.text,
|
||||
LocalTextSelectionColors provides colors.textSelectionColors,
|
||||
) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user