-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement UI for SendEvmProcessing page
- Loading branch information
1 parent
233a9ed
commit 132070c
Showing
7 changed files
with
296 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
258 changes: 258 additions & 0 deletions
258
.../io/horizontalsystems/bankwallet/modules/send/evm/processing/SendEvmProcessingFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,258 @@ | ||
package io.horizontalsystems.bankwallet.modules.send.evm.processing | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.border | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.shape.CircleShape | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.material.Divider | ||
import androidx.compose.material.Icon | ||
import androidx.compose.material.Scaffold | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.text.style.TextOverflow | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.navigation.NavController | ||
import io.horizontalsystems.bankwallet.R | ||
import io.horizontalsystems.bankwallet.core.BaseComposeFragment | ||
import io.horizontalsystems.bankwallet.modules.evmfee.ButtonsGroupWithShade | ||
import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme | ||
import io.horizontalsystems.bankwallet.ui.compose.TranslatableString | ||
import io.horizontalsystems.bankwallet.ui.compose.components.AppBar | ||
import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryYellow | ||
import io.horizontalsystems.bankwallet.ui.compose.components.HSCircularProgressIndicator | ||
import io.horizontalsystems.bankwallet.ui.compose.components.HsImage | ||
import io.horizontalsystems.bankwallet.ui.compose.components.InfoText | ||
import io.horizontalsystems.bankwallet.ui.compose.components.MenuItem | ||
import io.horizontalsystems.bankwallet.ui.compose.components.PremiumHeader | ||
import io.horizontalsystems.bankwallet.ui.compose.components.TransactionInfoCancelCell | ||
import io.horizontalsystems.bankwallet.ui.compose.components.TransactionInfoSpeedUpCell | ||
import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer | ||
import io.horizontalsystems.bankwallet.ui.compose.components.body_leah | ||
import io.horizontalsystems.bankwallet.ui.compose.components.body_lucian | ||
import io.horizontalsystems.bankwallet.ui.compose.components.cell.SectionPremiumUniversalLawrence | ||
import io.horizontalsystems.bankwallet.ui.compose.components.headline1_leah | ||
import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey | ||
import io.horizontalsystems.marketkit.models.BlockchainType | ||
|
||
class SendEvmProcessingFragment : BaseComposeFragment() { | ||
|
||
@Composable | ||
override fun GetContent(navController: NavController) { | ||
SendEvmProcessingScreen(navController) | ||
} | ||
|
||
} | ||
|
||
@Composable | ||
private fun SendEvmProcessingScreen( | ||
navController: NavController | ||
) { | ||
Scaffold( | ||
backgroundColor = ComposeAppTheme.colors.tyler, | ||
topBar = { | ||
AppBar( | ||
menuItems = listOf( | ||
MenuItem( | ||
title = TranslatableString.ResString(R.string.Button_Close), | ||
icon = R.drawable.ic_close, | ||
onClick = { | ||
navController.popBackStack() | ||
} | ||
) | ||
) | ||
) | ||
}, | ||
) { innerPaddings -> | ||
Column( | ||
modifier = Modifier.padding(innerPaddings) | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.weight(1f) | ||
.verticalScroll(rememberScrollState()), | ||
) { | ||
VSpacer(12.dp) | ||
Box( | ||
modifier = Modifier | ||
.size(100.dp) | ||
.align(Alignment.CenterHorizontally) | ||
.background( | ||
color = ComposeAppTheme.colors.raina, | ||
shape = CircleShape | ||
), | ||
contentAlignment = Alignment.Center | ||
) { | ||
Icon( | ||
modifier = Modifier.size(48.dp), | ||
painter = painterResource(R.drawable.ic_checkmark_48), | ||
contentDescription = "checkmark", | ||
tint = ComposeAppTheme.colors.remus | ||
) | ||
} | ||
VSpacer(32.dp) | ||
headline1_leah( | ||
stringResource(R.string.Send_Processing), | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 48.dp), | ||
textAlign = TextAlign.Center | ||
) | ||
VSpacer(12.dp) | ||
subhead2_grey( | ||
text = stringResource(R.string.Send_Processing_Description), | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 48.dp), | ||
textAlign = TextAlign.Center | ||
) | ||
VSpacer(32.dp) | ||
TransactionDataView( | ||
title = "Ethereum", | ||
subtitle = "to 0x7a9f...77aa", | ||
coinIconUrl = "eth.png", | ||
coinIconPlaceholder = R.drawable.logo_ethereum_24, | ||
coinAmount = "0.0001 ETH", | ||
fiatAmount = "$0.0001", | ||
progress = 0.5f, | ||
) | ||
|
||
if (true) { | ||
VSpacer(height = 24.dp) | ||
PremiumHeader() | ||
SectionPremiumUniversalLawrence { | ||
TransactionInfoSpeedUpCell( | ||
transactionHash = "txhash", | ||
blockchainType = BlockchainType.fromUid("ethereum"), | ||
navController = navController | ||
) | ||
Divider( | ||
thickness = 1.dp, | ||
color = ComposeAppTheme.colors.steel10, | ||
) | ||
TransactionInfoCancelCell( | ||
transactionHash = "txhash", | ||
blockchainType = BlockchainType.fromUid("ethereum"), | ||
navController = navController | ||
) | ||
} | ||
InfoText( | ||
text = stringResource(R.string.TransactionInfo_SpeedUpDescription), | ||
) | ||
} | ||
} | ||
ButtonsGroupWithShade { | ||
ButtonPrimaryYellow( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 24.dp), | ||
title = stringResource(R.string.Button_Done), | ||
onClick = { | ||
|
||
}, | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun TransactionDataView( | ||
title: String, | ||
subtitle: String, | ||
coinIconUrl: String, | ||
coinIconPlaceholder: Int, | ||
coinAmount: String, | ||
fiatAmount: String? = null, | ||
progress: Float? = null, | ||
) { | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 16.dp) | ||
.clip(RoundedCornerShape(12.dp)) | ||
.border(1.dp, ComposeAppTheme.colors.steel20, RoundedCornerShape(12.dp)) | ||
.background(ComposeAppTheme.colors.tyler) | ||
.padding(vertical = 12.dp), | ||
verticalAlignment = Alignment.CenterVertically, | ||
) { | ||
Box( | ||
modifier = Modifier | ||
.padding(horizontal = 8.dp) | ||
.size(44.dp), | ||
contentAlignment = Alignment.Center | ||
) { | ||
progress?.let { progress -> | ||
HSCircularProgressIndicator(progress) | ||
} | ||
HsImage( | ||
url = coinIconUrl, | ||
placeholder = coinIconPlaceholder, | ||
modifier = Modifier | ||
.size(32.dp) | ||
.clip(CircleShape) | ||
) | ||
} | ||
Column { | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(end = 16.dp), | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
body_leah( | ||
text = title, | ||
maxLines = 1, | ||
overflow = TextOverflow.Ellipsis, | ||
modifier = Modifier.weight(1f) | ||
) | ||
body_lucian(coinAmount) | ||
} | ||
VSpacer(3.dp) | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(end = 16.dp), | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
subhead2_grey( | ||
text = subtitle, | ||
maxLines = 1, | ||
overflow = TextOverflow.Ellipsis, | ||
modifier = Modifier.weight(1f) | ||
) | ||
fiatAmount?.let { | ||
subhead2_grey(it) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun PreviewTransactionDataView() { | ||
ComposeAppTheme { | ||
TransactionDataView( | ||
title = "Ethereum", | ||
subtitle = "to 0x7a9f...77aa", | ||
coinIconUrl = "eth.png", | ||
coinAmount = "0.0001 ETH", | ||
fiatAmount = "$0.0001", | ||
coinIconPlaceholder = R.drawable.logo_ethereum_24, | ||
) | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...io/horizontalsystems/bankwallet/modules/send/evm/processing/SendEvmProcessingViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.horizontalsystems.bankwallet.modules.send.evm.processing | ||
|
||
import io.horizontalsystems.bankwallet.core.ViewModelUiState | ||
|
||
class SendEvmProcessingViewModel: ViewModelUiState<SendEvmProcessingUiState>() { | ||
|
||
override fun createState(): SendEvmProcessingUiState { | ||
TODO("Not yet implemented") | ||
} | ||
} | ||
|
||
data class SendEvmProcessingUiState( | ||
val processing: Boolean | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="48dp" | ||
android:height="48dp" | ||
android:viewportWidth="48" | ||
android:viewportHeight="48"> | ||
<path | ||
android:pathData="M41.414,10.586C42.195,11.367 42.195,12.633 41.414,13.414L19.414,35.414C18.633,36.195 17.367,36.195 16.586,35.414L6.586,25.414C5.805,24.633 5.805,23.367 6.586,22.586C7.367,21.805 8.633,21.805 9.414,22.586L18,31.172L38.586,10.586C39.367,9.805 40.633,9.805 41.414,10.586Z" | ||
android:fillColor="#808085" | ||
android:fillType="evenOdd"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters