Skip to content

Commit 72fe124

Browse files
committed
chore: tweak bill asset placements more
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent a9885bf commit 72fe124

3 files changed

Lines changed: 60 additions & 59 deletions

File tree

app/build.gradle.kts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ android {
4747
}
4848

4949
buildFeatures {
50+
buildConfig = true
5051
viewBinding = true
5152
dataBinding = true
5253
compose = true
5354
}
55+
5456
composeOptions {
5557
kotlinCompilerExtensionVersion = Versions.compose_compiler
5658
}
@@ -95,10 +97,6 @@ android {
9597
resources.excludes.add("META-INF/LICENSE.md")
9698
resources.excludes.add("META-INF/LICENSE-notice.md")
9799
}
98-
99-
buildFeatures {
100-
buildConfig = true
101-
}
102100
}
103101

104102

app/src/main/java/com/getcode/view/login/PhoneVerifyViewModel.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class PhoneVerifyViewModel @Inject constructor(
155155

156156
val phoneNumberCombined = areaCode.toString() + phoneInput
157157

158-
Timber.d("phoneNumber=$phoneNumberCombined")
158+
159159
val phoneNumber = phoneNumberCombined.makeE164(
160160
java.util.Locale(java.util.Locale.getDefault().language, countryCode)
161161
)
@@ -168,6 +168,7 @@ class PhoneVerifyViewModel @Inject constructor(
168168
client.startSmsRetriever()
169169
}
170170

171+
Timber.d("phoneNumber=$phoneNumber")
171172
phoneRepository.sendVerificationCode(phoneNumber)
172173
.firstElement()
173174
.observeOn(AndroidSchedulers.mainThread())
@@ -220,6 +221,7 @@ class PhoneVerifyViewModel @Inject constructor(
220221
)
221222
}
222223
}, {
224+
it.printStackTrace()
223225
setIsLoading(false)
224226
TopBarManager.showMessage(getGenericError())
225227
}

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

Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ import androidx.compose.foundation.layout.fillMaxWidth
2020
import androidx.compose.foundation.layout.height
2121
import androidx.compose.foundation.layout.offset
2222
import androidx.compose.foundation.layout.padding
23+
import androidx.compose.foundation.layout.requiredWidth
2324
import androidx.compose.foundation.layout.size
2425
import androidx.compose.foundation.layout.statusBarsIgnoringVisibility
2526
import androidx.compose.foundation.layout.width
2627
import androidx.compose.foundation.layout.windowInsetsPadding
28+
import androidx.compose.foundation.layout.wrapContentHeight
2729
import androidx.compose.material.Text
2830
import androidx.compose.runtime.Composable
2931
import androidx.compose.runtime.getValue
@@ -59,6 +61,7 @@ import com.getcode.model.KinAmount
5961
import com.getcode.solana.keys.Key32.Companion.kinMint
6062
import com.getcode.solana.keys.base58
6163
import com.getcode.theme.CodeTheme
64+
import com.getcode.ui.utils.debugBounds
6265
import com.getcode.util.formattedRaw
6366
import com.getcode.ui.utils.nonScaledSp
6467
import com.getcode.ui.utils.punchCircle
@@ -167,12 +170,16 @@ private class CashBillGeometry(width: Dp, height: Dp) {
167170
val codeSize: Dp
168171
get() = size.width * 0.6f
169172

173+
val globeWidth: Dp
174+
get() = size.width * 1.45f
170175
val globePosition: Offset
171176
get() = Offset(
172-
x = -(size.width.value * 1.25f),
173-
y = size.height.value * 0.5f
177+
x = -(size.width.value * 0.75f),
178+
y = size.height.value * 0.65f
174179
)
175180

181+
val gridWidth: Dp
182+
get() = size.width * 1.75f
176183

177184
val linesHeight: Dp
178185
get() = (topStripHeight.value - 2).dp
@@ -235,41 +242,49 @@ internal fun CashBill(
235242
image = ImageBitmap.imageResource(R.drawable.ic_bill_hexagons),
236243
blendMode = BlendMode.Multiply,
237244
alpha = 0.6f,
238-
fill = true,
239-
)
240-
241-
// Waves
242-
BillDecorImage(
243-
modifier = Modifier
244-
.matchParentSize()
245-
.clipToBounds(),
246-
image = ImageBitmap.imageResource(R.drawable.ic_bill_waves),
247-
fill = true,
248-
topLeft = Offset(
249-
x = 0f,
250-
y = with(LocalDensity.current) { geometry.securityStripPosition.y.toPx() }),
251245
)
246+
// Grid pattern
247+
CashBillAssets.grid?.let {
248+
Image(
249+
modifier = Modifier
250+
.requiredWidth(geometry.gridWidth)
251+
.clipToBounds(),
252+
alpha = 0.5f,
253+
bitmap = it,
254+
contentDescription = null
255+
)
256+
}
252257

253258
// Globe
254-
BillDecorImage(
255-
modifier = Modifier
256-
.matchParentSize()
257-
.clipToBounds(),
258-
size = DpSize(width = geometry.size.width * 1.45f, height = Dp.Unspecified),
259-
image = CashBillAssets.globe,
260-
topLeft = geometry.globePosition
261-
)
259+
CashBillAssets.globe?.let {
260+
Image(
261+
modifier = Modifier
262+
.requiredWidth(geometry.globeWidth)
263+
.offset {
264+
IntOffset(
265+
x = geometry.globePosition.x.toInt(),
266+
y = geometry.globePosition.y.toInt()
267+
)
268+
},
269+
bitmap = it,
270+
contentDescription = null
271+
)
272+
}
262273

263-
// Grid pattern
264-
BillDecorImage(
274+
// Waves
275+
Image(
265276
modifier = Modifier
266277
.matchParentSize()
278+
.offset {
279+
IntOffset(
280+
x = 0,
281+
y = geometry.securityStripPosition.y.roundToPx(),
282+
)
283+
}
267284
.clipToBounds(),
268-
image = CashBillAssets.grid,
269-
alpha = 0.5f,
270-
topLeft = Offset(
271-
x = 0f,
272-
y = with(LocalDensity.current) { geometry.securityStripPosition.y.toPx() }),
285+
contentDescription = null,
286+
contentScale = ContentScale.FillBounds,
287+
bitmap = ImageBitmap.imageResource(R.drawable.ic_bill_waves),
273288
)
274289

275290
// Security strip
@@ -408,36 +423,22 @@ private fun BillDecorImage(
408423
size: DpSize = DpSize.Unspecified,
409424
topLeft: Offset = Offset.Zero,
410425
blendMode: BlendMode = DrawScope.DefaultBlendMode,
411-
fill: Boolean = false,
412426
) {
413427
Canvas(
414428
modifier = modifier,
415429
) {
416430
// Hexagons
417431
image?.let {
418-
if (fill) {
419-
drawImage(
420-
image = it,
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-
),
425-
alpha = alpha,
426-
dstOffset = IntOffset(topLeft.x.roundToInt(), topLeft.y.roundToInt()),
427-
blendMode = blendMode,
428-
)
429-
} else {
430-
drawImage(
431-
image = it,
432-
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-
),
437-
dstOffset = IntOffset(topLeft.x.roundToInt(), topLeft.y.roundToInt()),
438-
blendMode = blendMode,
439-
)
440-
}
432+
drawImage(
433+
image = it,
434+
dstSize = IntSize(
435+
width = if (size.isSpecified && size.width.isSpecified) size.width.roundToPx() else this.size.width.toInt(),
436+
height = if (size.isSpecified && size.height.isSpecified) size.height.roundToPx() else this.size.height.toInt(),
437+
),
438+
alpha = alpha,
439+
dstOffset = IntOffset(topLeft.x.roundToInt(), topLeft.y.roundToInt()),
440+
blendMode = blendMode,
441+
)
441442
}
442443
}
443444
}

0 commit comments

Comments
 (0)