Skip to content

Commit 89ef2dc

Browse files
committed
sepereted eat platform by added them in a card
1 parent 7e58468 commit 89ef2dc

1 file changed

Lines changed: 20 additions & 60 deletions

File tree

app/src/main/java/com/example/sw0b_001/ui/views/tabs/SupportedPlatformsViews.kt

Lines changed: 20 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.example.sw0b_001.ui.views.tabs
22

33
import androidx.compose.foundation.background
4+
import androidx.compose.foundation.clickable
45
import androidx.compose.foundation.layout.Arrangement
56
import androidx.compose.foundation.layout.Box
67
import androidx.compose.foundation.layout.Column
@@ -230,41 +231,6 @@ fun PlatformListContent(
230231
.fillMaxWidth()
231232
.padding(16.dp)
232233
) {
233-
if(!isOnboarding) {
234-
Spacer(modifier = Modifier.height(8.dp))
235-
236-
PlatformCard(
237-
platform = null,
238-
modifier = Modifier,
239-
isActive = true,
240-
onClick = {
241-
clickedPlatform = null
242-
showPlatformOptions = true
243-
}
244-
)
245-
246-
Spacer(modifier = Modifier.height(8.dp))
247-
248-
Text(
249-
text = stringResource(R.string.use_your_relaysms_account),
250-
style = MaterialTheme.typography.titleSmall,
251-
color = MaterialTheme.colorScheme.secondary
252-
)
253-
254-
Spacer(modifier = Modifier.height(24.dp))
255-
}
256-
257-
HorizontalDivider()
258-
259-
Spacer(modifier = Modifier.height(24.dp))
260-
261-
Text(
262-
text = stringResource(R.string.use_your_online_accounts),
263-
style = MaterialTheme.typography.titleSmall,
264-
color = MaterialTheme.colorScheme.secondary
265-
)
266-
267-
Spacer(modifier = Modifier.padding(8.dp))
268234

269235
when(val state = states) {
270236
is SupportedPlatformsUiState.Loading -> {
@@ -279,7 +245,7 @@ fun PlatformListContent(
279245
modifier = Modifier.fillMaxWidth(),
280246
verticalArrangement = Arrangement.spacedBy(8.dp)
281247
) {
282-
supportedPlatforms.forEach { platform ->
248+
supportedPlatforms.forEach { platform ->
283249
val isStored = tokens.find { it.platformName == platform.name }
284250

285251
PlatformListRow(
@@ -290,9 +256,11 @@ fun PlatformListContent(
290256
clickedPlatform = platform
291257
showPlatformOptions = true
292258
}
259+
293260
}
294261
}
295262

263+
296264
val storeCallback : () -> Unit = {
297265
CoroutineScope(Dispatchers.Default).launch {
298266
when(v1PayloadSupportProtocolsFromU8(
@@ -470,11 +438,10 @@ fun PlatformListRow(
470438
) {
471439
Card(
472440
onClick = { onClick(platform) },
473-
modifier = Modifier
474-
.fillMaxWidth(),
441+
modifier = Modifier.fillMaxWidth(),
475442
shape = RoundedCornerShape(12.dp),
476443
colors = CardDefaults.cardColors(
477-
containerColor = MaterialTheme.colorScheme.surface
444+
containerColor = MaterialTheme.colorScheme.surfaceContainer
478445
)
479446
) {
480447
Row(
@@ -483,27 +450,19 @@ fun PlatformListRow(
483450
.padding(16.dp),
484451
verticalAlignment = Alignment.CenterVertically
485452
) {
486-
Box(
487-
modifier = Modifier
488-
.size(45.dp)
489-
.clip(CircleShape)
490-
.background(MaterialTheme.colorScheme.surfaceVariant),
491-
contentAlignment = Alignment.Center
453+
GlideImage(
454+
model = platform?.icon_png,
455+
contentDescription = stringResource(R.string.platform_image),
456+
contentScale = ContentScale.Fit,
457+
modifier = Modifier.size(28.dp),
458+
colorFilter = if (!isActive && platform != null)
459+
ColorFilter.tint(
460+
MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.5f))
461+
else null,
462+
loading = placeholder(R.drawable.logo),
463+
failure = placeholder(R.drawable.logo)
492464
) {
493-
GlideImage(
494-
model = platform?.icon_png,
495-
contentDescription = stringResource(R.string.platform_image),
496-
contentScale = ContentScale.Fit,
497-
modifier = Modifier.size(28.dp),
498-
colorFilter = if (!isActive && platform != null)
499-
ColorFilter.tint(
500-
MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.5f))
501-
else null,
502-
loading = placeholder(R.drawable.logo),
503-
failure = placeholder(R.drawable.logo)
504-
) {
505-
it.diskCacheStrategy(DiskCacheStrategy.ALL).circleCrop()
506-
}
465+
it.diskCacheStrategy(DiskCacheStrategy.ALL).circleCrop()
507466
}
508467

509468
Spacer(modifier = Modifier.width(16.dp))
@@ -539,4 +498,5 @@ fun PlatformListRow(
539498
}
540499
}
541500
}
542-
}
501+
}
502+

0 commit comments

Comments
 (0)