Change Dropcap typography

This commit is contained in:
Thomas Andres Gomez 2023-09-28 15:34:39 +02:00
parent 255ad7aed8
commit d25246f452
4 changed files with 17 additions and 14 deletions

View file

@ -4,6 +4,7 @@ import android.content.res.Configuration.UI_MODE_NIGHT_NO
import android.content.res.Configuration.UI_MODE_NIGHT_YES import android.content.res.Configuration.UI_MODE_NIGHT_YES
import androidx.activity.compose.BackHandler import androidx.activity.compose.BackHandler
import androidx.compose.animation.AnimatedContent import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.ContentTransform
import androidx.compose.animation.SizeTransform import androidx.compose.animation.SizeTransform
import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut import androidx.compose.animation.fadeOut
@ -53,6 +54,7 @@ import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.tooling.preview.PreviewParameterProvider import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel import androidx.hilt.navigation.compose.hiltViewModel
@ -224,12 +226,7 @@ private fun RollOverlayContent(
.align(Alignment.BottomCenter), .align(Alignment.BottomCenter),
targetState = card.value, targetState = card.value,
transitionSpec = { transitionSpec = {
val enter = animation(density = density) using SizeTransform(clip = false)
fadeIn() + slideInVertically { with(density) { 64.dp.roundToPx() } }
val exit =
fadeOut() + slideOutVertically { with(density) { -64.dp.roundToPx() } }
val transform = SizeTransform(clip = false)
enter togetherWith exit using transform
}, },
label = "RollOverlayDisplay", label = "RollOverlayDisplay",
) { ) {
@ -372,6 +369,12 @@ private class RollOverlayPreviewProvider : PreviewParameterProvider<RollOverlayP
) )
} }
fun animation(density: Density): ContentTransform {
val enter = fadeIn() + slideInVertically { with(density) { 64.dp.roundToPx() } }
val exit = fadeOut() + slideOutVertically { with(density) { -64.dp.roundToPx() } }
return enter togetherWith exit
}
@Stable @Stable
interface BlurredRollOverlayHostState : BlurredOverlayHostState { interface BlurredRollOverlayHostState : BlurredOverlayHostState {
fun prepareRoll(roll: Roll) fun prepareRoll(roll: Roll)

View file

@ -12,8 +12,8 @@ import androidx.compose.ui.unit.sp
import com.pixelized.rplexicon.R import com.pixelized.rplexicon.R
@Stable @Stable
val regalFontFamily = FontFamily( val zallFontFamily = FontFamily(
Font(resId = R.font.regal, weight = FontWeight.Normal), Font(resId = R.font.zallman_caps, weight = FontWeight.Normal)
) )
@Stable @Stable
@ -29,14 +29,14 @@ class LexiconTypography(
fontFamily = stampFontFamily, fontFamily = stampFontFamily,
), ),
val bodyDropCap: TextStyle = base.displaySmall.copy( val bodyDropCap: TextStyle = base.displaySmall.copy(
fontFamily = regalFontFamily, fontFamily = zallFontFamily,
baselineShift = BaselineShift(-0.3f), baselineShift = BaselineShift(-0.1f),
letterSpacing = (-6).sp letterSpacing = (-3).sp
), ),
val titleDropCap: TextStyle = base.displayLarge.copy( val titleDropCap: TextStyle = base.displayLarge.copy(
fontFamily = regalFontFamily, fontFamily = zallFontFamily,
baselineShift = BaselineShift(-0.3f), baselineShift = BaselineShift(-0.1f),
letterSpacing = (-8).sp letterSpacing = (-4).sp
), ),
val bodyDropCapSpan: SpanStyle = bodyDropCap.toSpanStyle(), val bodyDropCapSpan: SpanStyle = bodyDropCap.toSpanStyle(),
val titleDropCapSpan: SpanStyle = titleDropCap.toSpanStyle(), val titleDropCapSpan: SpanStyle = titleDropCap.toSpanStyle(),

Binary file not shown.

Binary file not shown.