Skip to content

Commit 1c38ed9

Browse files
committed
fix: adapt layout to small screen
1 parent a452906 commit 1c38ed9

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

app/src/main/java/to/bitkit/ui/screens/transfer/SettingUpScreen.kt

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package to.bitkit.ui.screens.transfer
22

33
import androidx.compose.foundation.Image
4-
import androidx.compose.foundation.layout.Box
54
import androidx.compose.foundation.layout.Column
65
import androidx.compose.foundation.layout.Spacer
76
import androidx.compose.foundation.layout.fillMaxWidth
87
import androidx.compose.foundation.layout.height
98
import androidx.compose.foundation.layout.padding
10-
import androidx.compose.foundation.layout.size
119
import androidx.compose.material3.CenterAlignedTopAppBar
1210
import androidx.compose.material3.ExperimentalMaterial3Api
1311
import androidx.compose.runtime.Composable
@@ -20,6 +18,7 @@ import androidx.compose.ui.Modifier
2018
import androidx.compose.ui.layout.ContentScale
2119
import androidx.compose.ui.res.painterResource
2220
import androidx.compose.ui.res.stringResource
21+
import androidx.compose.ui.tooling.preview.Devices.NEXUS_5
2322
import androidx.compose.ui.tooling.preview.Preview
2423
import androidx.compose.ui.unit.dp
2524
import com.synonym.bitkitcore.regtestMine
@@ -110,6 +109,7 @@ private fun SettingUpScreen(
110109
actions = { CloseNavIcon(onCloseClick) },
111110
)
112111
Column(
112+
horizontalAlignment = Alignment.CenterHorizontally,
113113
modifier = Modifier
114114
.fillMaxWidth()
115115
.padding(horizontal = 16.dp)
@@ -119,6 +119,7 @@ private fun SettingUpScreen(
119119
Display(
120120
text = stringResource(R.string.lightning__savings_progress__title)
121121
.withAccent(accentColor = Colors.Purple),
122+
modifier = Modifier.fillMaxWidth(),
122123
)
123124
Spacer(modifier = Modifier.height(8.dp))
124125
BodyM(
@@ -129,6 +130,7 @@ private fun SettingUpScreen(
129130
Display(
130131
text = stringResource(R.string.lightning__transfer_success__title_spending)
131132
.withAccent(accentColor = Colors.Purple),
133+
modifier = Modifier.fillMaxWidth(),
132134
)
133135
Spacer(modifier = Modifier.height(8.dp))
134136
BodyM(
@@ -141,6 +143,7 @@ private fun SettingUpScreen(
141143
TransferAnimationView(
142144
largeCircleRes = R.drawable.ln_sync_large,
143145
smallCircleRes = R.drawable.ln_sync_small,
146+
modifier = Modifier.weight(1f)
144147
)
145148
Spacer(modifier = Modifier.height(16.dp))
146149
val steps = listOf(
@@ -157,23 +160,16 @@ private fun SettingUpScreen(
157160
.align(alignment = Alignment.CenterHorizontally)
158161
)
159162
} else {
160-
Box(
161-
contentAlignment = Alignment.Center,
163+
Image(
164+
painter = painterResource(id = R.drawable.check),
165+
contentDescription = null,
166+
contentScale = ContentScale.Fit,
162167
modifier = Modifier
163-
.fillMaxWidth()
164-
.padding(horizontal = 16.dp)
165-
.padding(top = 16.dp)
166-
) {
167-
Image(
168-
painter = painterResource(id = R.drawable.check),
169-
contentDescription = null,
170-
contentScale = ContentScale.Fit,
171-
modifier = Modifier.size(256.dp)
172-
)
173-
}
168+
.weight(1f)
169+
.padding(16.dp)
170+
)
174171
}
175172

176-
Spacer(modifier = Modifier.weight(1f))
177173

178174
val randomOkText = localizedRandom(R.string.common__ok_random)
179175
PrimaryButton(
@@ -199,6 +195,16 @@ private fun SettingUpScreenProgressPreview() {
199195
}
200196
}
201197

198+
@Preview(name = "Progress", showSystemUi = true, showBackground = true, device = NEXUS_5)
199+
@Composable
200+
private fun SettingUpScreenProgressSmallPreview() {
201+
AppThemeSurface {
202+
SettingUpScreen(
203+
lightningSetupStep = 2,
204+
)
205+
}
206+
}
207+
202208
@Preview(name = "Success", showSystemUi = true, showBackground = true)
203209
@Composable
204210
private fun SettingUpScreenSuccessPreview() {
@@ -208,3 +214,13 @@ private fun SettingUpScreenSuccessPreview() {
208214
)
209215
}
210216
}
217+
218+
@Preview(name = "Success", showSystemUi = true, showBackground = true, device = NEXUS_5)
219+
@Composable
220+
private fun SettingUpScreenSuccessSmallPreview() {
221+
AppThemeSurface {
222+
SettingUpScreen(
223+
lightningSetupStep = 3,
224+
)
225+
}
226+
}

0 commit comments

Comments
 (0)