diff --git a/apps/flipcash/core/src/main/kotlin/com/flipcash/app/core/ui/Skeleton.kt b/apps/flipcash/core/src/main/kotlin/com/flipcash/app/core/ui/Skeleton.kt index 3fe9ce13a..ad621efb4 100644 --- a/apps/flipcash/core/src/main/kotlin/com/flipcash/app/core/ui/Skeleton.kt +++ b/apps/flipcash/core/src/main/kotlin/com/flipcash/app/core/ui/Skeleton.kt @@ -5,12 +5,15 @@ import androidx.compose.animation.core.animateFloat import androidx.compose.animation.core.infiniteRepeatable import androidx.compose.animation.core.rememberInfiniteTransition import androidx.compose.animation.core.tween -import androidx.compose.foundation.background import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.drawWithCache import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.graphics.drawOutline +import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.platform.LocalLayoutDirection import com.getcode.theme.CodeTheme @Composable @@ -18,7 +21,17 @@ fun Modifier.shimmer( shape: Shape = CodeTheme.shapes.medium ): Modifier { val alpha = rememberShimmerAlpha() - return this.background(Color.White.copy(alpha = alpha), shape) + val density = LocalDensity.current + val layoutDirection = LocalLayoutDirection.current + return this.drawWithCache { + val outline = shape.createOutline(size, layoutDirection, density) + onDrawBehind { + drawOutline( + outline = outline, + color = Color.White.copy(alpha = alpha), + ) + } + } } @Composable diff --git a/apps/flipcash/shared/bills/src/main/kotlin/com/flipcash/app/bills/CashBill.kt b/apps/flipcash/shared/bills/src/main/kotlin/com/flipcash/app/bills/CashBill.kt index 0d1be9c25..2a22e2ca5 100644 --- a/apps/flipcash/shared/bills/src/main/kotlin/com/flipcash/app/bills/CashBill.kt +++ b/apps/flipcash/shared/bills/src/main/kotlin/com/flipcash/app/bills/CashBill.kt @@ -612,13 +612,12 @@ private fun BillCode( @Composable private fun loadBillAsset(drawableRes: Int): ImageBitmap { - val option = BitmapFactory.Options() - option.inPreferredConfig = Bitmap.Config.ARGB_8888 - return BitmapFactory.decodeResource( - LocalResources.current, - drawableRes, - option - ).asImageBitmap() + val resources = LocalResources.current + return remember(drawableRes) { + val option = BitmapFactory.Options() + option.inPreferredConfig = Bitmap.Config.ARGB_8888 + BitmapFactory.decodeResource(resources, drawableRes, option).asImageBitmap() + } } private class BillPunchShape( diff --git a/ui/components/src/main/kotlin/com/getcode/ui/components/text/AmountTextAnimated.kt b/ui/components/src/main/kotlin/com/getcode/ui/components/text/AmountTextAnimated.kt index 6b4925be4..f994b5d06 100644 --- a/ui/components/src/main/kotlin/com/getcode/ui/components/text/AmountTextAnimated.kt +++ b/ui/components/src/main/kotlin/com/getcode/ui/components/text/AmountTextAnimated.kt @@ -100,8 +100,6 @@ internal fun AmountTextAnimated( } val digitDecimalVisibility = remember(totalDecimals) { mutableStateListOf(*Array(totalDecimals) { false }) } val digitDecimalZeroVisibility = remember(totalDecimals) { mutableStateListOf(*Array(totalDecimals) { false }) } - var firstDigit by remember(isInitiallyZero, initialAmount) { mutableStateOf(if (!isInitiallyZero && initialAmount.isNotEmpty()) initialAmount.first().toString() else "") } - //Font states var textSize by remember { mutableStateOf(textStyle.fontSize) } val fontDecreasePoints = remember { HashMap() } @@ -116,8 +114,10 @@ internal fun AmountTextAnimated( val isDecimal = amountSplit.size > 1 val isZero = amountSplit[0] == "0" || amountSplit[0].isEmpty() - if (amountSplit.firstOrNull() != null && !isZero) { - firstDigit = uiModel.amountData.amountText.first().toString() + val firstDigit = remember(uiModel.amountData.amountText, isZero) { + if (!isZero && uiModel.amountData.amountText.isNotEmpty()) + uiModel.amountData.amountText.first().toString() + else "" } fun getValue(i1: Int, i2: Int): String? =