Skip to content

Commit 319e79b

Browse files
authored
Merge branch 'feat/system-widgets-foundation' into feat/price-widget-v61
2 parents 3dc0cbc + 245021b commit 319e79b

23 files changed

Lines changed: 268 additions & 198 deletions

File tree

app/src/main/java/to/bitkit/appwidget/config/AppWidgetConfigActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class AppWidgetConfigActivity : ComponentActivity() {
4242
val type = typeName?.let { runCatching { AppWidgetType.valueOf(it) }.getOrNull() }
4343
?: AppWidgetType.PRICE
4444

45-
viewModel.init(appWidgetId, type)
45+
if (savedInstanceState == null) viewModel.init(appWidgetId, type)
4646

4747
setContent {
4848
AppThemeSurface {

app/src/main/java/to/bitkit/appwidget/config/AppWidgetConfigScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fun AppWidgetConfigScreen(
4444
val state by viewModel.uiState.collectAsStateWithLifecycle()
4545

4646
when (state.type) {
47-
AppWidgetType.PRICE -> PriceConfigContent(
47+
AppWidgetType.PRICE -> Content(
4848
state = state,
4949
onSelectPair = { viewModel.selectPricePair(it) },
5050
onSelectPeriod = { viewModel.selectPricePeriod(it) },
@@ -56,7 +56,7 @@ fun AppWidgetConfigScreen(
5656
}
5757

5858
@Composable
59-
private fun PriceConfigContent(
59+
private fun Content(
6060
state: AppWidgetConfigUiState,
6161
onSelectPair: (TradingPair) -> Unit,
6262
onSelectPeriod: (GraphPeriod) -> Unit,

app/src/main/java/to/bitkit/ui/ContentView.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,11 @@ fun ContentView(
451451

452452
TimedSheetType.NOTIFICATIONS -> {
453453
BackgroundPaymentsIntroSheet(
454-
onContinue = {
454+
onLater = {
455+
appViewModel.dismissTimedSheet()
456+
settingsViewModel.setBgPaymentsIntroSeen(true)
457+
},
458+
onEnable = {
455459
appViewModel.dismissTimedSheet()
456460
navController.navigateTo(Routes.BackgroundPaymentsSettings)
457461
settingsViewModel.setBgPaymentsIntroSeen(true)
@@ -1145,9 +1149,10 @@ private fun NavGraphBuilder.generalSettingsSubScreens(navController: NavHostCont
11451149
composableWithDefaultTransitions<Routes.BackgroundPaymentsIntro> {
11461150
BackgroundPaymentsIntroScreen(
11471151
onBack = { navController.popBackStack() },
1148-
onContinue = {
1152+
onLater = { navController.popBackStack() },
1153+
onEnable = {
11491154
navController.navigateTo(Routes.BackgroundPaymentsSettings)
1150-
}
1155+
},
11511156
)
11521157
}
11531158
}

app/src/main/java/to/bitkit/ui/components/EmptyWalletView.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import androidx.compose.ui.res.stringResource
2626
import androidx.compose.ui.text.AnnotatedString
2727
import androidx.compose.ui.tooling.preview.Preview
2828
import androidx.compose.ui.unit.dp
29+
import androidx.compose.ui.unit.sp
2930
import to.bitkit.R
3031
import to.bitkit.ui.shared.modifiers.rememberDebouncedClick
3132
import to.bitkit.ui.theme.AppThemeSurface
@@ -36,8 +37,11 @@ import to.bitkit.ui.utils.withAccent
3637
fun EmptyStateView(
3738
text: AnnotatedString,
3839
modifier: Modifier = Modifier,
40+
isSmallScreen: Boolean = false,
3941
onClose: (() -> Unit)? = null,
4042
) {
43+
val fontSize = if (isSmallScreen) 32.sp else 44.sp
44+
val arrowMaxHeight = if (isSmallScreen) 96.dp else 144.dp
4145
Box(modifier = modifier) {
4246
Column(
4347
modifier = Modifier
@@ -52,14 +56,15 @@ fun EmptyStateView(
5256
) {
5357
Display(
5458
text = text,
59+
fontSize = fontSize,
5560
modifier = Modifier.width(220.dp)
5661
)
5762
Image(
5863
painter = painterResource(id = R.drawable.empty_state_arrow),
5964
contentDescription = null,
6065
contentScale = ContentScale.Fit,
6166
modifier = Modifier
62-
.heightIn(max = 144.dp)
67+
.heightIn(max = arrowMaxHeight)
6368
.offset(x = (-10).dp)
6469
)
6570
Spacer(modifier = Modifier.weight(1f))

app/src/main/java/to/bitkit/ui/components/Text.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,14 @@ fun Display(
4646
fun Display(
4747
text: AnnotatedString,
4848
modifier: Modifier = Modifier,
49+
fontSize: TextUnit = 44.sp,
4950
color: Color = MaterialTheme.colorScheme.primary,
5051
) {
5152
Text(
5253
text = text.toUpperCase(),
5354
style = AppTextStyles.Display.merge(
55+
fontSize = fontSize,
56+
lineHeight = fontSize,
5457
color = color,
5558
),
5659
modifier = modifier

app/src/main/java/to/bitkit/ui/onboarding/CreateWalletScreen.kt

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@ package to.bitkit.ui.onboarding
22

33
import androidx.compose.foundation.Image
44
import androidx.compose.foundation.layout.Arrangement
5-
import androidx.compose.foundation.layout.Box
65
import androidx.compose.foundation.layout.Column
76
import androidx.compose.foundation.layout.Row
8-
import androidx.compose.foundation.layout.Spacer
7+
import androidx.compose.foundation.layout.fillMaxSize
98
import androidx.compose.foundation.layout.fillMaxWidth
10-
import androidx.compose.foundation.layout.height
119
import androidx.compose.foundation.layout.padding
10+
import androidx.compose.foundation.layout.sizeIn
1211
import androidx.compose.runtime.Composable
1312
import androidx.compose.ui.Alignment
1413
import androidx.compose.ui.Modifier
@@ -39,57 +38,59 @@ fun CreateWalletScreen(
3938
onRestoreClick: () -> Unit,
4039
modifier: Modifier = Modifier,
4140
) {
42-
Box(
43-
contentAlignment = Alignment.TopCenter,
41+
Column(
4442
modifier = modifier
4543
.screen(insets = null)
44+
.fillMaxSize()
4645
) {
46+
FillHeight()
47+
4748
Image(
4849
painter = painterResource(id = R.drawable.wallet),
4950
contentDescription = null,
5051
contentScale = ContentScale.Fit,
5152
modifier = Modifier
52-
.padding(top = 125.dp)
53-
.fillMaxWidth()
53+
.align(Alignment.CenterHorizontally)
54+
.sizeIn(maxWidth = 311.dp, maxHeight = 311.dp)
5455
)
56+
5557
Column(
5658
modifier = Modifier
5759
.fillMaxWidth()
58-
.align(Alignment.BottomCenter)
60+
.padding(top = 48.dp)
5961
) {
60-
FillHeight()
6162
Display(text = stringResource(R.string.onboarding__slide4_header).withAccent())
62-
VerticalSpacer(8.dp)
63+
VerticalSpacer(14.dp)
6364
BodyM(
6465
text = stringResource(R.string.onboarding__slide4_text).withAccent(
6566
defaultColor = Colors.White64,
6667
accentStyle = SpanStyle(fontWeight = FontWeight.Bold, color = Colors.White),
6768
),
6869
)
70+
}
6971

70-
VerticalSpacer(32.dp)
72+
VerticalSpacer(32.dp)
7173

72-
Row(
73-
modifier = Modifier.fillMaxWidth(),
74-
horizontalArrangement = Arrangement.spacedBy(16.dp)
75-
) {
76-
PrimaryButton(
77-
text = stringResource(R.string.onboarding__new_wallet),
78-
onClick = onCreateClick,
79-
modifier = Modifier
80-
.weight(1f)
81-
.testTag("NewWallet")
82-
)
83-
SecondaryButton(
84-
text = stringResource(R.string.onboarding__restore),
85-
onClick = onRestoreClick,
86-
modifier = Modifier
87-
.weight(1f)
88-
.testTag("RestoreWallet")
89-
)
90-
}
91-
Spacer(modifier = Modifier.height(16.dp))
74+
Row(
75+
horizontalArrangement = Arrangement.spacedBy(16.dp),
76+
modifier = Modifier.fillMaxWidth()
77+
) {
78+
PrimaryButton(
79+
text = stringResource(R.string.onboarding__new_wallet),
80+
onClick = onCreateClick,
81+
modifier = Modifier
82+
.weight(1f)
83+
.testTag("NewWallet")
84+
)
85+
SecondaryButton(
86+
text = stringResource(R.string.onboarding__restore),
87+
onClick = onRestoreClick,
88+
modifier = Modifier
89+
.weight(1f)
90+
.testTag("RestoreWallet")
91+
)
9292
}
93+
VerticalSpacer(16.dp)
9394
}
9495
}
9596

app/src/main/java/to/bitkit/ui/onboarding/OnboardingSlidesScreen.kt

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import androidx.compose.foundation.layout.Box
1010
import androidx.compose.foundation.layout.Column
1111
import androidx.compose.foundation.layout.PaddingValues
1212
import androidx.compose.foundation.layout.Row
13-
import androidx.compose.foundation.layout.Spacer
13+
import androidx.compose.foundation.layout.defaultMinSize
1414
import androidx.compose.foundation.layout.fillMaxSize
1515
import androidx.compose.foundation.layout.fillMaxWidth
16-
import androidx.compose.foundation.layout.height
1716
import androidx.compose.foundation.layout.offset
1817
import androidx.compose.foundation.layout.padding
1918
import androidx.compose.foundation.layout.size
19+
import androidx.compose.foundation.layout.sizeIn
2020
import androidx.compose.foundation.pager.HorizontalPager
2121
import androidx.compose.foundation.pager.rememberPagerState
2222
import androidx.compose.foundation.shape.CircleShape
@@ -39,6 +39,7 @@ import to.bitkit.R
3939
import to.bitkit.ui.components.BodyM
4040
import to.bitkit.ui.components.ButtonSize
4141
import to.bitkit.ui.components.Display
42+
import to.bitkit.ui.components.FillHeight
4243
import to.bitkit.ui.components.Footnote
4344
import to.bitkit.ui.components.SecondaryButton
4445
import to.bitkit.ui.components.VerticalSpacer
@@ -53,18 +54,18 @@ private const val PAGE_COUNT = LAST_PAGE_INDEX + 1
5354

5455
@Composable
5556
fun OnboardingSlidesScreen(
56-
currentTab: Int = 0,
5757
isGeoBlocked: Boolean,
5858
onAdvancedSetupClick: () -> Unit,
5959
onCreateClick: () -> Unit,
6060
onRestoreClick: () -> Unit,
61+
modifier: Modifier = Modifier,
62+
currentTab: Int = 0,
6163
) {
6264
val scope = rememberCoroutineScope()
6365
val pagerState = rememberPagerState(initialPage = currentTab, pageCount = { PAGE_COUNT })
6466

6567
Box(
66-
modifier = Modifier
67-
.screen()
68+
modifier = modifier.screen()
6869
) {
6970
HorizontalPager(
7071
state = pagerState,
@@ -123,16 +124,14 @@ fun OnboardingSlidesScreen(
123124
verticalAlignment = Alignment.CenterVertically,
124125
modifier = Modifier
125126
.align(Alignment.BottomCenter)
126-
.padding(bottom = 16.dp)
127-
.height(16.dp)
128127
.offset { IntOffset(0, yOffset.roundToPx()) }
129128
.alpha(alpha)
130129
) {
131130
repeat(PAGE_COUNT) { index ->
132131
val size by animateDpAsState(
133132
targetValue = if (index == pagerState.currentPage) 10.dp else 7.dp,
134133
animationSpec = tween(durationMillis = 300),
135-
label = "dotSize"
134+
label = "dotSize",
136135
)
137136
Box(
138137
modifier = Modifier
@@ -186,34 +185,37 @@ fun OnboardingTab(
186185
modifier: Modifier = Modifier,
187186
disclaimerText: String? = null,
188187
) {
189-
Box(
190-
contentAlignment = Alignment.TopCenter,
188+
Column(
191189
modifier = modifier.fillMaxSize()
192190
) {
191+
FillHeight()
192+
193193
Image(
194194
painter = painterResource(id = imageResId),
195195
contentDescription = null,
196196
contentScale = ContentScale.Fit,
197197
modifier = Modifier
198-
.padding(top = 125.dp)
199-
.fillMaxWidth()
198+
.align(Alignment.CenterHorizontally)
199+
.sizeIn(maxWidth = 311.dp, maxHeight = 311.dp)
200200
)
201+
201202
Column(
202203
modifier = Modifier
203204
.fillMaxWidth()
204-
.align(Alignment.BottomCenter),
205+
.padding(top = 48.dp)
206+
.defaultMinSize(minHeight = 255.dp)
205207
) {
206208
Display(text = title.withAccent(accentColor = titleAccentColor))
207-
Spacer(modifier = Modifier.height(8.dp))
209+
VerticalSpacer(14.dp)
208210
BodyM(
209211
text = text,
210212
color = Colors.White64,
211-
minLines = 3
213+
minLines = 3,
212214
)
213215
disclaimerText?.let {
214-
Footnote(text = it)
216+
VerticalSpacer(4.dp)
217+
Footnote(text = it, color = Colors.White32)
215218
}
216-
VerticalSpacer(70.dp)
217219
}
218220
}
219221
}

0 commit comments

Comments
 (0)