Skip to content

Commit b6030ad

Browse files
authored
Merge pull request #448 from code-payments/chore/share-download-small-device-refinement
chore(share): update layout to better handle smaller device screens
2 parents b5b5741 + 64d39ad commit b6030ad

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

app/src/main/java/com/getcode/view/download/ShareDownloadScreen.kt

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ package com.getcode.view.download
33
import androidx.compose.animation.core.animateFloatAsState
44
import androidx.compose.foundation.Image
55
import androidx.compose.foundation.layout.Arrangement
6-
import androidx.compose.foundation.layout.Box
76
import androidx.compose.foundation.layout.Column
87
import androidx.compose.foundation.layout.Spacer
98
import androidx.compose.foundation.layout.WindowInsets
109
import androidx.compose.foundation.layout.fillMaxSize
1110
import androidx.compose.foundation.layout.fillMaxWidth
12-
import androidx.compose.foundation.layout.height
1311
import androidx.compose.foundation.layout.navigationBars
1412
import androidx.compose.foundation.layout.padding
1513
import androidx.compose.foundation.layout.windowInsetsPadding
@@ -41,7 +39,6 @@ import com.getcode.ui.components.CodeCircularProgressIndicator
4139
import com.getcode.ui.components.Row
4240
import com.getcode.ui.components.SelectionContainer
4341
import com.getcode.ui.components.rememberSelectionState
44-
import com.getcode.ui.utils.debugBounds
4542
import com.getcode.ui.utils.measured
4643
import com.getcode.ui.utils.rememberedLongClickable
4744
import com.getcode.util.shareDownloadLink
@@ -56,6 +53,7 @@ fun ShareDownloadScreen() {
5653
var contentRect: Rect by remember {
5754
mutableStateOf(Rect.Zero)
5855
}
56+
5957
SelectionContainer(
6058
modifier = Modifier
6159
.fillMaxSize()
@@ -75,14 +73,6 @@ fun ShareDownloadScreen() {
7573
.padding(bottom = CodeTheme.dimens.grid.x4),
7674
horizontalAlignment = Alignment.CenterHorizontally
7775
) {
78-
Text(
79-
modifier = Modifier
80-
.fillMaxWidth(0.6f)
81-
.padding(top = CodeTheme.dimens.grid.x15),
82-
text = stringResource(R.string.subtitle_scanToDownload),
83-
style = CodeTheme.typography.textLarge,
84-
textAlign = TextAlign.Center
85-
)
8676

8777
Spacer(modifier = Modifier.weight(1f))
8878

@@ -99,26 +89,38 @@ fun ShareDownloadScreen() {
9989
Column(
10090
modifier = Modifier
10191
.fillMaxSize()
102-
.align(Alignment.Center),
92+
.align(Alignment.Center)
93+
.padding(bottom = CodeTheme.dimens.grid.x11),
10394
verticalArrangement = Arrangement.spacedBy(
10495
space = CodeTheme.dimens.grid.x7,
10596
alignment = Alignment.CenterVertically
10697
),
10798
horizontalAlignment = Alignment.CenterHorizontally
10899
) {
109-
val qrCode = LocalDownloadQrCode.current
110-
val iconAlpha by animateFloatAsState(
100+
val contentAlpha by animateFloatAsState(
111101
targetValue = if (selectionState.shown) 0f else 1f,
112102
label = "icon alpha"
113103
)
104+
Text(
105+
modifier = Modifier
106+
.padding(bottom = CodeTheme.dimens.grid.x4)
107+
.alpha(contentAlpha),
108+
text = stringResource(R.string.subtitle_scanToDownload),
109+
style = CodeTheme.typography.textLarge,
110+
textAlign = TextAlign.Center
111+
)
112+
113+
val qrCode = LocalDownloadQrCode.current
114+
114115

115116
if (qrCode != null) {
116117
Image(
117118
modifier = Modifier
118119
.onPlaced { contentRect = it.boundsInWindow() }
119120
.rememberedLongClickable {
120121
onClick()
121-
}.scale(selectionState.scale.value),
122+
}
123+
.scale(selectionState.scale.value),
122124
painter = qrCode,
123125
contentDescription = "qr"
124126
)
@@ -127,7 +129,7 @@ fun ShareDownloadScreen() {
127129
}
128130

129131
Row(
130-
modifier = Modifier.alpha(iconAlpha),
132+
modifier = Modifier.alpha(contentAlpha),
131133
horizontalArrangement = Arrangement.spacedBy(
132134
space = CodeTheme.dimens.inset,
133135
alignment = Alignment.CenterHorizontally

0 commit comments

Comments
 (0)