-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b877ac5
commit ba79b94
Showing
12 changed files
with
465 additions
and
133 deletions.
There are no files selected for viewing
71 changes: 51 additions & 20 deletions
71
app/src/main/java/io/horizontalsystems/bankwallet/modules/address/HSAddressCell.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 |
---|---|---|
@@ -1,39 +1,70 @@ | ||
package io.horizontalsystems.bankwallet.modules.address | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.border | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.unit.dp | ||
import io.horizontalsystems.bankwallet.R | ||
import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme | ||
import io.horizontalsystems.bankwallet.ui.compose.components.HSpacer | ||
import io.horizontalsystems.bankwallet.ui.compose.components.cell.CellUniversal | ||
import io.horizontalsystems.bankwallet.ui.compose.components.cell.SectionUniversalLawrence | ||
import io.horizontalsystems.bankwallet.ui.compose.components.subhead1_leah | ||
import io.horizontalsystems.bankwallet.ui.compose.components.subhead2_grey | ||
|
||
@Composable | ||
fun HSAddressCell(title: String, value: String, onClick: () -> Unit) { | ||
SectionUniversalLawrence { | ||
CellUniversal( | ||
borderTop = false, | ||
onClick = onClick | ||
) { | ||
subhead2_grey(text = title) | ||
fun HSAddressCell( | ||
title: String, | ||
value: String, | ||
riskyAddress: Boolean, | ||
onClick: () -> Unit | ||
) { | ||
val borderColor = if (riskyAddress) { | ||
ComposeAppTheme.colors.red50 | ||
} else { | ||
ComposeAppTheme.colors.transparent | ||
} | ||
|
||
Column( | ||
modifier = Modifier | ||
.padding(horizontal = 16.dp) | ||
.clip(RoundedCornerShape(12.dp)) | ||
.border(1.dp, borderColor, RoundedCornerShape(12.dp)) | ||
.background(ComposeAppTheme.colors.lawrence), | ||
content = { | ||
CellUniversal( | ||
borderTop = false, | ||
onClick = onClick | ||
) { | ||
subhead2_grey(text = title) | ||
|
||
HSpacer(16.dp) | ||
subhead1_leah( | ||
modifier = Modifier.weight(1f), | ||
text = value | ||
) | ||
HSpacer(16.dp) | ||
subhead1_leah( | ||
modifier = Modifier.weight(1f), | ||
text = value | ||
) | ||
if (riskyAddress) { | ||
HSpacer(16.dp) | ||
Icon( | ||
painter = painterResource(id = R.drawable.ic_attention_20), | ||
contentDescription = null, | ||
tint = ComposeAppTheme.colors.lucian | ||
) | ||
} | ||
|
||
HSpacer(16.dp) | ||
Icon( | ||
painter = painterResource(id = R.drawable.ic_down_arrow_20), | ||
contentDescription = null, | ||
tint = ComposeAppTheme.colors.grey | ||
) | ||
HSpacer(16.dp) | ||
Icon( | ||
painter = painterResource(id = R.drawable.ic_down_arrow_20), | ||
contentDescription = null, | ||
tint = ComposeAppTheme.colors.grey | ||
) | ||
} | ||
} | ||
} | ||
) | ||
} |
105 changes: 105 additions & 0 deletions
105
...rc/main/java/io/horizontalsystems/bankwallet/modules/send/AddressRiskyBottomSheetAlert.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,105 @@ | ||
package io.horizontalsystems.bankwallet.modules.send | ||
|
||
import android.os.Bundle | ||
import android.os.Parcelable | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.platform.ComposeView | ||
import androidx.compose.ui.platform.ViewCompositionStrategy | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.unit.dp | ||
import io.horizontalsystems.bankwallet.R | ||
import io.horizontalsystems.bankwallet.core.getInput | ||
import io.horizontalsystems.bankwallet.core.setNavigationResultX | ||
import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme | ||
import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryRed | ||
import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryTransparent | ||
import io.horizontalsystems.bankwallet.ui.compose.components.TextImportantError | ||
import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer | ||
import io.horizontalsystems.bankwallet.ui.extensions.BaseComposableBottomSheetFragment | ||
import io.horizontalsystems.bankwallet.ui.extensions.BottomSheetHeader | ||
import io.horizontalsystems.core.findNavController | ||
import kotlinx.parcelize.Parcelize | ||
|
||
class AddressRiskyBottomSheetAlert : BaseComposableBottomSheetFragment() { | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
return ComposeView(requireContext()).apply { | ||
setViewCompositionStrategy( | ||
ViewCompositionStrategy.DisposeOnLifecycleDestroyed(viewLifecycleOwner) | ||
) | ||
setContent { | ||
val navController = findNavController() | ||
navController.getInput<Input>()?.let { input -> | ||
RiskyAddressAlertView( | ||
alertText = input.alertText, | ||
onCloseClick = { | ||
navController.popBackStack() | ||
}, | ||
onContinueClick = { | ||
navController.setNavigationResultX(Result(true)) | ||
} | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Parcelize | ||
data class Input(val alertText: String) : Parcelable | ||
|
||
@Parcelize | ||
data class Result(val canContinue: Boolean) : Parcelable | ||
} | ||
|
||
@Composable | ||
private fun RiskyAddressAlertView( | ||
alertText: String, | ||
onCloseClick: () -> Unit, | ||
onContinueClick: () -> Unit, | ||
) { | ||
ComposeAppTheme { | ||
BottomSheetHeader( | ||
iconPainter = painterResource(R.drawable.ic_attention_24), | ||
iconTint = ColorFilter.tint(ComposeAppTheme.colors.lucian), | ||
title = stringResource(R.string.Send_RiskyAddress), | ||
onCloseClick = onCloseClick | ||
) { | ||
VSpacer(12.dp) | ||
TextImportantError( | ||
modifier = Modifier.padding(horizontal = 16.dp), | ||
text = alertText | ||
) | ||
VSpacer(32.dp) | ||
ButtonPrimaryRed( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 24.dp), | ||
title = stringResource(R.string.Button_ContinueAnyway), | ||
onClick = { | ||
onContinueClick() | ||
} | ||
) | ||
VSpacer(12.dp) | ||
ButtonPrimaryTransparent( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(horizontal = 24.dp), | ||
title = stringResource(R.string.Button_Cancel), | ||
onClick = onCloseClick | ||
) | ||
VSpacer(32.dp) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.