Skip to content

Commit 4ba68b4

Browse files
committed
chore(bill): image alignment updates focusing on globe placement
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 6e10c4a commit 4ba68b4

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

  • app/src/main/java/com/getcode/view/main/bill

app/src/main/java/com/getcode/view/main/bill/CashBill.kt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ import androidx.compose.ui.unit.DpSize
5252
import androidx.compose.ui.unit.IntOffset
5353
import androidx.compose.ui.unit.IntSize
5454
import androidx.compose.ui.unit.dp
55+
import androidx.compose.ui.unit.isSpecified
5556
import androidx.core.content.ContextCompat
5657
import com.getcode.R
5758
import com.getcode.model.KinAmount
@@ -169,7 +170,7 @@ private class CashBillGeometry(width: Dp, height: Dp) {
169170
val globePosition: Offset
170171
get() = Offset(
171172
x = -(size.width.value * 1.25f),
172-
y = size.height.value * 1.2f
173+
y = size.height.value * 0.5f
173174
)
174175

175176

@@ -254,6 +255,7 @@ internal fun CashBill(
254255
modifier = Modifier
255256
.matchParentSize()
256257
.clipToBounds(),
258+
size = DpSize(width = geometry.size.width * 1.45f, height = Dp.Unspecified),
257259
image = CashBillAssets.globe,
258260
topLeft = geometry.globePosition
259261
)
@@ -368,7 +370,9 @@ private fun SecurityStrip(
368370
) {
369371
for (i in 0 until CashBillDefaults.SecurityStripCount) {
370372
Image(
371-
modifier = Modifier.weight(1f).alpha(0.5f),
373+
modifier = Modifier
374+
.weight(1f)
375+
.alpha(0.5f),
372376
contentScale = ContentScale.FillBounds,
373377
painter = painterResource(id = R.drawable.ic_bill_security_strip),
374378
contentDescription = null
@@ -401,6 +405,7 @@ private fun BillDecorImage(
401405
modifier: Modifier = Modifier,
402406
image: ImageBitmap?,
403407
alpha: Float = 1f,
408+
size: DpSize = DpSize.Unspecified,
404409
topLeft: Offset = Offset.Zero,
405410
blendMode: BlendMode = DrawScope.DefaultBlendMode,
406411
fill: Boolean = false,
@@ -413,7 +418,10 @@ private fun BillDecorImage(
413418
if (fill) {
414419
drawImage(
415420
image = it,
416-
dstSize = IntSize(size.width.roundToInt(), size.height.roundToInt()),
421+
dstSize = IntSize(
422+
width = if (size.isSpecified && size.width.isSpecified) size.width.roundToPx() else this.size.width.toInt(),
423+
height = if (size.isSpecified && size.height.isSpecified) size.height.roundToPx() else this.size.height.toInt(),
424+
),
417425
alpha = alpha,
418426
dstOffset = IntOffset(topLeft.x.roundToInt(), topLeft.y.roundToInt()),
419427
blendMode = blendMode,
@@ -422,6 +430,10 @@ private fun BillDecorImage(
422430
drawImage(
423431
image = it,
424432
alpha = alpha,
433+
dstSize = IntSize(
434+
width = if (size.isSpecified && size.width.isSpecified) size.width.roundToPx() else this.size.width.toInt(),
435+
height = if (size.isSpecified && size.height.isSpecified) size.height.roundToPx() else this.size.height.toInt(),
436+
),
425437
dstOffset = IntOffset(topLeft.x.roundToInt(), topLeft.y.roundToInt()),
426438
blendMode = blendMode,
427439
)

0 commit comments

Comments
 (0)