Skip to content

Commit

Permalink
Merge pull request #758 from soramitsu/fixes/pankra
Browse files Browse the repository at this point in the history
fixes/pankra
  • Loading branch information
PankraSerg committed Nov 25, 2022
2 parents 3a7e3b5 + 56222d1 commit 9f224bf
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
Expand Up @@ -49,9 +49,6 @@ fun FeeInfo(state: FeeInfoViewState, modifier: Modifier = Modifier) {
.align(CenterVertically)
)
Column(modifier = Modifier.weight(1f)) {
state.feeAmountFiat?.let {
B2(text = it, color = black2, textAlign = TextAlign.End, modifier = Modifier.align(Alignment.End))
}
state.feeAmount?.let {
CapsTitle(text = it, textAlign = TextAlign.End, modifier = Modifier.align(Alignment.End))
} ?: Shimmer(
Expand All @@ -60,6 +57,9 @@ fun FeeInfo(state: FeeInfoViewState, modifier: Modifier = Modifier) {
.width(100.dp)
.align(Alignment.End)
)
state.feeAmountFiat?.let {
B2(text = it, color = black2, textAlign = TextAlign.End, modifier = Modifier.align(Alignment.End))
}
}
}
}
Expand Down
Expand Up @@ -130,6 +130,15 @@ fun SendSetupContent(
FeeInfo(state = state.feeInfoState)

Spacer(modifier = Modifier.weight(1f))
}

val isSoftKeyboardOpen = WindowInsets.ime.getBottom(LocalDensity.current) > 0
val showQuickInput = state.amountInputState.isFocused && isSoftKeyboardOpen
Column(
modifier = Modifier
.align(Alignment.BottomCenter)
.imePadding()
) {
LazyRow(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.spacedBy(12.dp, Alignment.CenterHorizontally)
Expand All @@ -149,22 +158,15 @@ fun SendSetupContent(
.fillMaxWidth()
.height(48.dp)
)

MarginVertical(margin = 12.dp)
}

val isSoftKeyboardOpen = WindowInsets.ime.getBottom(LocalDensity.current) > 0
val showQuickInput = state.amountInputState.isFocused && isSoftKeyboardOpen
if (showQuickInput) {
QuickAmountInput(
modifier = Modifier
.align(Alignment.BottomCenter)
.imePadding(),
onQuickAmountInput = {
keyboardController?.hide()
callback.onQuickAmountInput(it)
}
)
if (showQuickInput) {
QuickAmountInput(
onQuickAmountInput = {
keyboardController?.hide()
callback.onQuickAmountInput(it)
}
)
}
}
}
}
Expand Down
Expand Up @@ -300,7 +300,7 @@ class SendSetupViewModel @Inject constructor(
val amountInPlanks = asset?.token?.planksFromAmount(amount).orZero()
ButtonViewState(
text = resourceManager.getString(R.string.common_continue),
enabled = true
enabled = amountInPlanks.compareTo(BigInteger.ZERO) != 0
)
}.stateIn(viewModelScope, SharingStarted.Eagerly, defaultButtonState)

Expand Down Expand Up @@ -386,7 +386,12 @@ class SendSetupViewModel @Inject constructor(
}

override fun onNextClick() {
onNextStep()
val amount = enteredAmountFlow.value.toBigDecimalOrNull().orZero()
isValid(amount).fold({
onNextStep()
}, {
showError(it)
})
}

private val validations = listOf(
Expand Down
Expand Up @@ -73,7 +73,7 @@ class SendSuccessViewModel @Inject constructor(
TitleValueViewState(
title = resourceManager.getString(R.string.hash),
value = operationHash?.shorten(),
clickState = TitleValueViewState.ClickState(R.drawable.ic_arrow_top_right_white_16, SendSuccessViewState.CODE_HASH_CLICK)
clickState = TitleValueViewState.ClickState(R.drawable.ic_copy_filled_24, SendSuccessViewState.CODE_HASH_CLICK)
)
)

Expand Down

0 comments on commit 9f224bf

Please sign in to comment.