Skip to content

Commit 2703703

Browse files
authored
Merge pull request #173 from code-payments/chore/dont-clip-bill-dismiss
chore: hoist management button height padding down to bill to prevent clipping
2 parents 3685f7b + 0111c60 commit 2703703

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

app/src/main/java/com/getcode/view/main/home/HomeScan.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import androidx.compose.animation.slideOutVertically
1515
import androidx.compose.animation.togetherWith
1616
import androidx.compose.foundation.background
1717
import androidx.compose.foundation.layout.Box
18+
import androidx.compose.foundation.layout.PaddingValues
1819
import androidx.compose.foundation.layout.WindowInsets
1920
import androidx.compose.foundation.layout.fillMaxSize
2021
import androidx.compose.foundation.layout.fillMaxWidth
@@ -229,15 +230,18 @@ private fun HomeScan(
229230
OnLifecycleEvent { _, event ->
230231
when (event) {
231232
Lifecycle.Event.ON_START -> {
233+
Timber.d("onStart")
232234
isPaused = false
233235
startScanPreview()
234236
}
235237

236238
Lifecycle.Event.ON_STOP -> {
239+
Timber.d("onStop")
237240
stopScanPreview()
238241
}
239242

240243
Lifecycle.Event.ON_PAUSE -> {
244+
Timber.d("onPause")
241245
isPaused = true
242246
homeViewModel.startSheetDismissTimer {
243247
Timber.d("hiding from timeout")
@@ -246,6 +250,7 @@ private fun HomeScan(
246250
}
247251

248252
Lifecycle.Event.ON_RESUME -> {
253+
Timber.d("onResume")
249254
isPaused = false
250255
homeViewModel.stopSheetDismissTimer()
251256
}
@@ -398,11 +403,10 @@ private fun BillContainer(
398403
}
399404

400405
HomeBill(
401-
modifier = Modifier
402-
.fillMaxSize()
403-
.addIf(showManagementOptions) { Modifier.padding(bottom = managementHeight) },
406+
modifier = Modifier.fillMaxSize(),
404407
dismissState = billDismissState,
405408
dismissed = dismissed,
409+
contentPadding = PaddingValues(bottom = managementHeight),
406410
bill = updatedState.billState.bill,
407411
transitionSpec = {
408412
if (updatedState.presentationStyle is PresentationStyle.Slide) {

app/src/main/java/com/getcode/view/main/home/components/HomeBill.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ import androidx.compose.animation.AnimatedContent
44
import androidx.compose.animation.AnimatedContentTransitionScope
55
import androidx.compose.animation.ContentTransform
66
import androidx.compose.foundation.layout.Box
7+
import androidx.compose.foundation.layout.PaddingValues
78
import androidx.compose.foundation.layout.fillMaxSize
89
import androidx.compose.foundation.layout.fillMaxWidth
10+
import androidx.compose.foundation.layout.padding
911
import androidx.compose.material.DismissDirection
1012
import androidx.compose.material.DismissState
1113
import androidx.compose.material.ExperimentalMaterialApi
@@ -20,6 +22,7 @@ import com.getcode.view.main.bill.Bill
2022
@Composable
2123
fun HomeBill(
2224
modifier: Modifier = Modifier,
25+
contentPadding: PaddingValues = PaddingValues(),
2326
dismissState: DismissState,
2427
dismissed: Boolean,
2528
transitionSpec: AnimatedContentTransitionScope<Bill?>.() -> ContentTransform,
@@ -42,7 +45,8 @@ fun HomeBill(
4245
Bill(
4346
modifier = Modifier
4447
.fillMaxWidth()
45-
.weight(1f),
48+
.weight(1f)
49+
.padding(contentPadding),
4650
bill = b
4751
)
4852
}

0 commit comments

Comments
 (0)