Skip to content

Commit 9b0ff04

Browse files
committed
chore(bill): further refine text scaling for compressed and mini
Signed-off-by: Brandon McAnsh <[email protected]>
1 parent 13a5a0f commit 9b0ff04

File tree

2 files changed

+7
-7
lines changed
  • apps/flipcash/shared/bills/src/main/kotlin/com/flipcash/app/bills
  • ui/theme/src/main/kotlin/com/getcode/ui/utils

2 files changed

+7
-7
lines changed

apps/flipcash/shared/bills/src/main/kotlin/com/flipcash/app/bills/CashBill.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ import androidx.compose.ui.unit.IntSize
5656
import androidx.compose.ui.unit.TextUnit
5757
import androidx.compose.ui.unit.dp
5858
import androidx.compose.ui.unit.isSpecified
59-
import androidx.compose.ui.unit.sp
6059
import com.flipcash.app.core.money.formatted
6160
import com.flipcash.shared.bills.R
6261
import com.getcode.opencode.compose.LocalExchange
@@ -266,9 +265,9 @@ private class CashBillGeometry(width: Dp, height: Dp) : Geometry(width, height)
266265
val mintFontSize: TextUnit
267266
@Composable get() = if (isCompressed) {
268267
if (isMini) {
269-
5.5.sp
268+
5.5.nonScaledSp
270269
} else {
271-
7.sp
270+
7.nonScaledSp
272271
}
273272
} else {
274273
8.nonScaledSp
@@ -278,12 +277,12 @@ private class CashBillGeometry(width: Dp, height: Dp) : Geometry(width, height)
278277
@Composable get() = if (isCompressed) {
279278
CodeTheme.typography.displayLarge.copy(
280279
fontWeight = FontWeight.W600,
281-
fontSize = if (isMini) 30.sp else 35.sp
280+
fontSize = if (isMini) 20.nonScaledSp else 35.nonScaledSp
282281
)
283282
} else {
284283
CodeTheme.typography.displayLarge.copy(
285284
fontWeight = FontWeight.W600,
286-
fontSize = 50.nonScaledSp
285+
fontSize = 40.nonScaledSp
287286
)
288287
}
289288

ui/theme/src/main/kotlin/com/getcode/ui/utils/View.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ import kotlin.concurrent.timerTask
1515

1616
fun Int.dipToPixels() = (Resources.getSystem().displayMetrics.density * this).toInt()
1717

18-
val Int.nonScaledSp
18+
val Number.nonScaledSp
1919
@Composable
20-
get() = (this / LocalDensity.current.fontScale).sp
20+
get() = (this.toDouble() / LocalDensity.current.fontScale).sp
21+
2122

2223
fun Context.getActivity(): FragmentActivity? = when (this) {
2324
is AppCompatActivity -> this

0 commit comments

Comments
 (0)