Updated on 2026-08-14
This commit is contained in:
parent
e03f078120
commit
a3cc0001f4
34 changed files with 489 additions and 283 deletions
|
|
@ -1,9 +1,9 @@
|
|||
package com.tangem.tap.common.redux
|
||||
|
||||
import com.tangem.tap.common.redux.global.globalReducer
|
||||
import com.tangem.tap.common.redux.navigation.navigationReducer
|
||||
import com.tangem.tap.common.redux.navigation.NavigationReducer
|
||||
import com.tangem.tap.features.send.redux.SendReducer
|
||||
import com.tangem.tap.features.wallet.redux.walletReducer
|
||||
import com.tangem.tap.features.wallet.redux.WalletReducer
|
||||
import org.rekotlin.Action
|
||||
|
||||
fun appReducer(action: Action, state: AppState?): AppState {
|
||||
|
|
@ -11,9 +11,9 @@ fun appReducer(action: Action, state: AppState?): AppState {
|
|||
if (action is AppAction.RestoreState) return action.state
|
||||
|
||||
return AppState(
|
||||
navigationState = navigationReducer(action, state),
|
||||
navigationState = NavigationReducer.reduce(action, state),
|
||||
globalState = globalReducer(action, state),
|
||||
walletState = walletReducer(action, state),
|
||||
walletState = WalletReducer.reduce(action, state),
|
||||
sendState = SendReducer.reduce(action, state.sendState)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
package com.tangem.tap.common.redux.global
|
||||
|
||||
import com.tangem.blockchain.common.WalletManager
|
||||
import com.tangem.commands.Card
|
||||
import com.tangem.tap.domain.tasks.ScanNoteResponse
|
||||
import org.rekotlin.Action
|
||||
import java.math.BigDecimal
|
||||
|
||||
sealed class GlobalAction : Action {
|
||||
|
||||
data class LoadCard(val card: Card) : GlobalAction()
|
||||
data class LoadWalletManager(val walletManager: WalletManager) : GlobalAction()
|
||||
data class SaveScanNoteResponse(val scanNoteResponse: ScanNoteResponse) : GlobalAction()
|
||||
data class SetFiatRate(val fiatRates: Pair<String, BigDecimal>) : GlobalAction()
|
||||
}
|
||||
|
|
@ -10,15 +10,13 @@ fun globalReducer(action: Action, state: AppState): GlobalState {
|
|||
var newState = state.globalState
|
||||
|
||||
when (action) {
|
||||
is GlobalAction.LoadCard -> newState = newState.copy(card = action.card)
|
||||
is GlobalAction.SaveScanNoteResponse ->
|
||||
newState = newState.copy(scanNoteResponse = action.scanNoteResponse)
|
||||
is GlobalAction.SetFiatRate -> {
|
||||
val rates = newState.fiatRates.rates.toMutableMap()
|
||||
rates[action.fiatRates.first] = action.fiatRates.second
|
||||
newState = newState.copy(fiatRates = FiatRates(rates))
|
||||
}
|
||||
is GlobalAction.LoadWalletManager ->
|
||||
newState = newState.copy(walletManager = action.walletManager)
|
||||
|
||||
}
|
||||
return newState
|
||||
}
|
||||
|
|
@ -1,14 +1,12 @@
|
|||
package com.tangem.tap.common.redux.global
|
||||
|
||||
import com.tangem.blockchain.common.WalletManager
|
||||
import com.tangem.commands.Card
|
||||
import com.tangem.tap.domain.TapWalletManager
|
||||
import com.tangem.tap.domain.tasks.ScanNoteResponse
|
||||
import org.rekotlin.StateType
|
||||
import java.math.BigDecimal
|
||||
|
||||
data class GlobalState(
|
||||
val card: Card? = null,
|
||||
val walletManager: WalletManager? = null,
|
||||
val scanNoteResponse: ScanNoteResponse? = null,
|
||||
val tapWalletManager: TapWalletManager = TapWalletManager(),
|
||||
val fiatRates: FiatRates = FiatRates(emptyMap()),
|
||||
) : StateType
|
||||
|
|
|
|||
|
|
@ -4,7 +4,13 @@ import com.tangem.tap.common.extensions.getPreviousScreen
|
|||
import com.tangem.tap.common.redux.AppState
|
||||
import org.rekotlin.Action
|
||||
|
||||
fun navigationReducer(action: Action, state: AppState): NavigationState {
|
||||
class NavigationReducer {
|
||||
companion object {
|
||||
fun reduce(action: Action, state: AppState): NavigationState = internalReduce(action, state)
|
||||
}
|
||||
}
|
||||
|
||||
private fun internalReduce(action: Action, state: AppState): NavigationState {
|
||||
|
||||
val navigationAction = action as? NavigationAction ?: return state.navigationState
|
||||
val navState = state.navigationState
|
||||
|
|
@ -15,7 +21,7 @@ fun navigationReducer(action: Action, state: AppState): NavigationState {
|
|||
}
|
||||
is NavigationAction.PopBackTo -> {
|
||||
val screen =
|
||||
navigationAction.screen ?: navState.activity?.get()?.getPreviousScreen()
|
||||
navigationAction.screen ?: navState.activity?.get()?.getPreviousScreen()
|
||||
val index = navState.backStack.lastIndexOf(screen) + 1
|
||||
state.navigationState.copy(backStack = navState.backStack.subList(0, index))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@ sealed class TapError(@StringRes val localizedMessage: Int): Throwable() {
|
|||
object PayIdAlreadyCreated: TapError(R.string.error_payid_already_created)
|
||||
object PayIdCreatingError: TapError(R.string.error_creating_payid)
|
||||
object PayIdEmptyField: TapError(R.string.wallet_create_payid_empty)
|
||||
object UnknownBlockchain: TapError(R.string.wallet_unknown_blockchain)
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ class TapWalletManager {
|
|||
private val tangemService = TangemService()
|
||||
|
||||
suspend fun loadWalletData() {
|
||||
val walletManager = store.state.globalState.walletManager
|
||||
val walletManager = store.state.globalState.scanNoteResponse?.walletManager
|
||||
if (walletManager == null) {
|
||||
store.dispatch(WalletAction.LoadWallet.Failure())
|
||||
return
|
||||
|
|
@ -38,7 +38,9 @@ class TapWalletManager {
|
|||
withContext(Dispatchers.Main) {
|
||||
when (result) {
|
||||
is Result.Success -> {
|
||||
store.dispatch(WalletAction.LoadArtwork.Success(result.data.byteStream().readBytes()))
|
||||
store.dispatch(WalletAction.LoadArtwork.Success(
|
||||
artworkId, result.data.byteStream().readBytes())
|
||||
)
|
||||
}
|
||||
is Result.Failure -> store.dispatch(WalletAction.LoadArtwork.Failure)
|
||||
}
|
||||
|
|
@ -51,8 +53,9 @@ class TapWalletManager {
|
|||
}
|
||||
|
||||
suspend fun loadFiatRate() {
|
||||
val blockchainCurrency = store.state.globalState.walletManager?.wallet?.blockchain?.currency
|
||||
val tokenCurrency = store.state.globalState.walletManager?.wallet?.token?.symbol
|
||||
val wallet = store.state.globalState.scanNoteResponse?.walletManager?.wallet
|
||||
val blockchainCurrency = wallet?.blockchain?.currency
|
||||
val tokenCurrency = wallet?.token?.symbol
|
||||
|
||||
val blockchainRate = blockchainCurrency?.let { coinMarketCapService.getRate(it) }
|
||||
val tokenRate = tokenCurrency?.let { coinMarketCapService.getRate(it) }
|
||||
|
|
@ -66,9 +69,8 @@ class TapWalletManager {
|
|||
|
||||
suspend fun onCardScanned(data: ScanNoteResponse) {
|
||||
withContext(Dispatchers.Main) {
|
||||
store.dispatch(GlobalAction.LoadCard(data.card))
|
||||
store.dispatch(GlobalAction.SaveScanNoteResponse(data))
|
||||
if (data.walletManager != null) {
|
||||
store.dispatch(GlobalAction.LoadWalletManager(data.walletManager))
|
||||
data.verifyResponse?.artworkInfo?.id?.let {
|
||||
store.dispatch(WalletAction.LoadArtwork(data.card, it))
|
||||
}
|
||||
|
|
@ -113,13 +115,14 @@ class TapWalletManager {
|
|||
|
||||
|
||||
private suspend fun loadPayIdIfNeeded(): Result<String?>? {
|
||||
val scanNoteResponse = store.state.globalState.scanNoteResponse
|
||||
if (!TapConfig.usePayId ||
|
||||
store.state.walletState.payIdData.payIdState == PayIdState.Disabled ||
|
||||
store.state.globalState.walletManager?.wallet?.blockchain?.isPayIdSupported() == false) {
|
||||
scanNoteResponse?.walletManager?.wallet?.blockchain?.isPayIdSupported() == false) {
|
||||
return null
|
||||
}
|
||||
val cardId = store.state.globalState.card?.cardId
|
||||
val publicKey = store.state.globalState.card?.cardPublicKey
|
||||
val cardId = scanNoteResponse?.card?.cardId
|
||||
val publicKey = scanNoteResponse?.card?.cardPublicKey
|
||||
if (cardId == null || publicKey == null) {
|
||||
return null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.tangem.tap.features.home
|
|||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.transition.TransitionInflater
|
||||
import com.tangem.tap.features.home.redux.HomeAction
|
||||
import com.tangem.tap.store
|
||||
import com.tangem.wallet.R
|
||||
|
|
@ -17,5 +18,11 @@ class HomeFragment : Fragment(R.layout.fragment_home) {
|
|||
btn_shop?.setOnClickListener { store.dispatch(HomeAction.GoToShop(requireContext())) }
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
val inflater = TransitionInflater.from(requireContext())
|
||||
exitTransition = inflater.inflateTransition(R.transition.fade)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ private fun handleSendAction(action: Action) {
|
|||
|
||||
internal class AddressPayIdHandler {
|
||||
fun handle(data: String?) {
|
||||
val walletManager = store.state.globalState.walletManager ?: return
|
||||
val walletManager = store.state.globalState.scanNoteResponse?.walletManager ?: return
|
||||
val clipboardData = data ?: return
|
||||
|
||||
if (PayIdManager.isPayId(clipboardData)) {
|
||||
|
|
@ -61,7 +61,7 @@ internal class AddressPayIdHandler {
|
|||
|
||||
private suspend fun verifyPayID(walletManager: WalletManager, payID: String?): String? {
|
||||
val cardId = walletManager.cardId
|
||||
val publicKey = store.state.globalState.card?.cardPublicKey
|
||||
val publicKey = store.state.globalState.scanNoteResponse?.card?.cardPublicKey
|
||||
|
||||
// val result = PayIdManager().getPayId(cardId, publicKey.toHexString())
|
||||
// withContext(Dispatchers.Main) {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ import java.math.BigDecimal
|
|||
|
||||
sealed class WalletAction : Action {
|
||||
|
||||
object LoadData : WalletAction()
|
||||
|
||||
object LoadWallet : WalletAction() {
|
||||
data class Success(val wallet: Wallet): WalletAction()
|
||||
data class NoAccount(val amountToCreateAccount: Int): WalletAction()
|
||||
|
|
@ -27,7 +29,7 @@ sealed class WalletAction : Action {
|
|||
object Failure: WalletAction()
|
||||
}
|
||||
data class LoadArtwork(val card: Card, val artworkId: String) : WalletAction() {
|
||||
data class Success(val artwork: ByteArray) : WalletAction()
|
||||
data class Success(val artworkId: String, val artwork: ByteArray) : WalletAction()
|
||||
object Failure: WalletAction()
|
||||
}
|
||||
object Scan : WalletAction()
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ val walletMiddleware: Middleware<AppState> = { dispatch, state ->
|
|||
}
|
||||
is WalletAction.CreatePayId.CompleteCreatingPayId -> {
|
||||
scope.launch {
|
||||
val cardId = store.state.globalState.card?.cardId
|
||||
val cardId = store.state.globalState.scanNoteResponse?.card?.cardId
|
||||
val wallet = store.state.walletState.wallet
|
||||
val publicKey = store.state.globalState.card?.cardPublicKey
|
||||
val publicKey = store.state.globalState.scanNoteResponse?.card?.cardPublicKey
|
||||
if (cardId != null && wallet != null && publicKey != null) {
|
||||
val result = PayIdManager().setPayId(
|
||||
cardId, publicKey.toHexString(),
|
||||
|
|
@ -90,14 +90,21 @@ val walletMiddleware: Middleware<AppState> = { dispatch, state ->
|
|||
}
|
||||
}
|
||||
}
|
||||
is WalletAction.LoadData -> {
|
||||
scope.launch {
|
||||
store.state.globalState.scanNoteResponse?.let {
|
||||
store.state.globalState.tapWalletManager.onCardScanned(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
is WalletAction.CopyAddress -> {
|
||||
store.state.walletState.wallet?.address?.let {
|
||||
store.state.walletState.addressData?.address?.let {
|
||||
action.context.copyToClipboard(it)
|
||||
store.dispatch(WalletAction.CopyAddress.Success)
|
||||
}
|
||||
}
|
||||
is WalletAction.ExploreAddress -> {
|
||||
val uri = Uri.parse(store.state.walletState.wallet?.exploreUrl)
|
||||
val uri = Uri.parse(store.state.walletState.addressData?.exploreUrl)
|
||||
val intent = Intent(Intent.ACTION_VIEW, uri)
|
||||
ContextCompat.startActivity(action.context, intent, null)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,13 @@ import com.tangem.tap.features.wallet.ui.BalanceWidgetData
|
|||
import com.tangem.tap.features.wallet.ui.TokenData
|
||||
import org.rekotlin.Action
|
||||
|
||||
fun walletReducer(action: Action, state: AppState): WalletState {
|
||||
class WalletReducer {
|
||||
companion object {
|
||||
fun reduce(action: Action, state: AppState): WalletState = internalReduce(action, state)
|
||||
}
|
||||
}
|
||||
|
||||
private fun internalReduce(action: Action, state: AppState): WalletState {
|
||||
|
||||
if (action !is WalletAction) return state.walletState
|
||||
|
||||
|
|
@ -24,15 +30,31 @@ fun walletReducer(action: Action, state: AppState): WalletState {
|
|||
currencyData = BalanceWidgetData(BalanceStatus.EmptyCard),
|
||||
mainButton = WalletMainButton.CreateWalletButton(true)
|
||||
)
|
||||
is WalletAction.LoadWallet -> newState = WalletState(
|
||||
state = ProgressState.Loading,
|
||||
currencyData = BalanceWidgetData(
|
||||
BalanceStatus.Loading,
|
||||
state.globalState.walletManager?.wallet?.blockchain?.fullName
|
||||
),
|
||||
mainButton = WalletMainButton.SendButton(false)
|
||||
is WalletAction.LoadWallet -> {
|
||||
val wallet = state.globalState.scanNoteResponse?.walletManager?.wallet
|
||||
val addressData = if (wallet == null) {
|
||||
null
|
||||
} else {
|
||||
AddressData(wallet.address, wallet.shareUrl, wallet.exploreUrl)
|
||||
}
|
||||
val currentArtworkId = state.globalState.scanNoteResponse?.verifyResponse?.artworkInfo?.id
|
||||
val cardImage = if (newState.cardImage?.artworkId == currentArtworkId) {
|
||||
newState.cardImage
|
||||
} else {
|
||||
null
|
||||
}
|
||||
newState = WalletState(
|
||||
state = ProgressState.Loading,
|
||||
cardImage = cardImage,
|
||||
currencyData = BalanceWidgetData(
|
||||
BalanceStatus.Loading,
|
||||
wallet?.blockchain?.fullName
|
||||
),
|
||||
addressData = addressData,
|
||||
mainButton = WalletMainButton.SendButton(false)
|
||||
|
||||
)
|
||||
)
|
||||
}
|
||||
is WalletAction.LoadWallet.Success -> {
|
||||
val token = action.wallet.amounts[AmountType.Token]
|
||||
val tokenData = if (token != null) {
|
||||
|
|
@ -62,7 +84,7 @@ fun walletReducer(action: Action, state: AppState): WalletState {
|
|||
)
|
||||
}
|
||||
is WalletAction.LoadWallet.NoAccount -> {
|
||||
val wallet = state.globalState.walletManager?.wallet
|
||||
val wallet = state.globalState.scanNoteResponse?.walletManager?.wallet
|
||||
newState = newState.copy(
|
||||
state = ProgressState.Done, wallet = wallet,
|
||||
currencyData = BalanceWidgetData(
|
||||
|
|
@ -85,26 +107,26 @@ fun walletReducer(action: Action, state: AppState): WalletState {
|
|||
val fiatAmount = if (currency == newState.wallet?.blockchain?.currency) {
|
||||
newState.wallet?.amounts?.get(AmountType.Coin)?.value?.toFiatString(rate)
|
||||
} else {
|
||||
null
|
||||
newState.currencyData.fiatAmount
|
||||
}
|
||||
val tokenFiatAmount = if (currency == newState.wallet?.token?.symbol) {
|
||||
newState.wallet?.amounts?.get(AmountType.Token)?.value?.toFiatString(rate)
|
||||
} else {
|
||||
null
|
||||
newState.currencyData.token?.fiatAmount
|
||||
}
|
||||
newState = newState.copy(currencyData = newState.currencyData.copy(
|
||||
fiatAmount = fiatAmount,
|
||||
token = newState.currencyData.token?.copy(fiatAmount = tokenFiatAmount)
|
||||
))
|
||||
}
|
||||
is WalletAction.LoadArtwork -> {
|
||||
newState = newState.copy(cardImage = null)
|
||||
}
|
||||
// is WalletAction.LoadArtwork -> {
|
||||
// newState = newState.copy(cardImage = null)
|
||||
// }
|
||||
is WalletAction.LoadArtwork.Success -> {
|
||||
newState = newState.copy(cardImage = action.artwork.toBitmap())
|
||||
newState = newState.copy(cardImage = Artwork(action.artworkId, action.artwork.toBitmap()))
|
||||
}
|
||||
is WalletAction.ShowQrCode -> {
|
||||
newState = newState.copy(qrCode = newState.wallet?.shareUrl?.toQrCode())
|
||||
newState = newState.copy(qrCode = newState.addressData?.shareUrl?.toQrCode())
|
||||
}
|
||||
is WalletAction.HideQrCode -> {
|
||||
newState = newState.copy(qrCode = null)
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ import org.rekotlin.StateType
|
|||
|
||||
data class WalletState(
|
||||
val state: ProgressState = ProgressState.Done,
|
||||
val cardImage: Bitmap? = null,
|
||||
val cardImage: Artwork? = null,
|
||||
val wallet: Wallet? = null,
|
||||
val addressData: AddressData? = null,
|
||||
val currencyData: BalanceWidgetData = BalanceWidgetData(),
|
||||
val payIdData: PayIdData = PayIdData(),
|
||||
val qrCode: Bitmap? = null,
|
||||
|
|
@ -32,4 +33,15 @@ enum class CreatingPayIdState { EnterPayId, Waiting }
|
|||
sealed class WalletMainButton(enabled: Boolean) : Button(enabled) {
|
||||
class SendButton(enabled: Boolean) : WalletMainButton(enabled)
|
||||
class CreateWalletButton(enabled: Boolean) : WalletMainButton(enabled)
|
||||
}
|
||||
}
|
||||
|
||||
data class AddressData(
|
||||
val address: String,
|
||||
val shareUrl: String,
|
||||
val exploreUrl: String
|
||||
)
|
||||
|
||||
data class Artwork(
|
||||
val artworkId: String,
|
||||
val artwork: Bitmap
|
||||
)
|
||||
|
|
@ -55,7 +55,8 @@ class BalanceWidget(
|
|||
fragment.l_balance.show()
|
||||
fragment.l_balance_error.hide()
|
||||
fragment.tv_currency.text = data.currency
|
||||
fragment.tv_amount.text = "-"
|
||||
fragment.tv_currency_symbol.text = "-"
|
||||
fragment.tv_amount.text = ""
|
||||
fragment.tv_fiat_amount.hide()
|
||||
showStatus(R.id.tv_status_loading)
|
||||
fragment.l_token.hide()
|
||||
|
|
@ -65,6 +66,7 @@ class BalanceWidget(
|
|||
fragment.l_balance_error.hide()
|
||||
fragment.tv_currency.text = data.currency
|
||||
fragment.tv_amount.text = data.amount
|
||||
fragment.tv_currency_symbol.text = data.currencySymbol
|
||||
fragment.tv_fiat_amount.show()
|
||||
fragment.tv_fiat_amount.text = data.fiatAmount
|
||||
showStatus(R.id.tv_status_verified)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
package com.tangem.tap.features.wallet.ui
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.transition.TransitionInflater
|
||||
import com.tangem.tap.common.extensions.getDrawable
|
||||
import com.tangem.tap.common.extensions.hide
|
||||
import com.tangem.tap.common.extensions.show
|
||||
|
|
@ -18,6 +20,7 @@ import kotlinx.android.synthetic.main.fragment_wallet.*
|
|||
import kotlinx.android.synthetic.main.layout_address.*
|
||||
import org.rekotlin.StoreSubscriber
|
||||
|
||||
|
||||
class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<WalletState> {
|
||||
|
||||
private var qrDialog: QrDialog? = null
|
||||
|
|
@ -30,6 +33,9 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
|
|||
store.dispatch(NavigationAction.PopBackTo())
|
||||
}
|
||||
})
|
||||
val inflater = TransitionInflater.from(requireContext())
|
||||
enterTransition = inflater.inflateTransition(R.transition.slide_right)
|
||||
exitTransition = inflater.inflateTransition(R.transition.fade)
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
|
|
@ -62,59 +68,26 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
|
|||
override fun newState(state: WalletState) {
|
||||
if (activity == null) return
|
||||
|
||||
if (state.wallet?.address != null) {
|
||||
l_address?.show()
|
||||
tv_address.text = state.wallet.address
|
||||
tv_explore?.setOnClickListener {
|
||||
store.dispatch(WalletAction.ExploreAddress(requireContext()))
|
||||
}
|
||||
} else {
|
||||
l_address?.hide()
|
||||
srl_wallet.setOnRefreshListener {
|
||||
store.dispatch(WalletAction.LoadData)
|
||||
}
|
||||
|
||||
if (state.cardImage != null) {
|
||||
iv_card.setImageBitmap(state.cardImage)
|
||||
} else {
|
||||
iv_card.setImageDrawable(getDrawable(R.drawable.card_default))
|
||||
}
|
||||
setupButtons(state)
|
||||
setupAddressCard(state)
|
||||
setupCardImage(state.cardImage?.artwork)
|
||||
|
||||
|
||||
btn_copy.setOnClickListener { store.dispatch(WalletAction.CopyAddress(requireContext())) }
|
||||
btn_show_qr.setOnClickListener { store.dispatch(WalletAction.ShowQrCode) }
|
||||
|
||||
val buttonTitle = when (state.mainButton) {
|
||||
is WalletMainButton.SendButton -> R.string.wallet_button_send
|
||||
is WalletMainButton.CreateWalletButton -> R.string.wallet_button_create_wallet
|
||||
}
|
||||
btn_main.text = getString(buttonTitle)
|
||||
btn_main.isEnabled = state.mainButton.enabled
|
||||
|
||||
btn_main.setOnClickListener {
|
||||
when (state.mainButton) {
|
||||
is WalletMainButton.SendButton -> store.dispatch(NavigationAction.NavigateTo(AppScreen.Send))
|
||||
is WalletMainButton.CreateWalletButton -> store.dispatch(WalletAction.CreateWallet)
|
||||
}
|
||||
}
|
||||
|
||||
if (state.qrCode != null && state.wallet?.shareUrl != null) {
|
||||
qrDialog = QrDialog(requireContext())
|
||||
qrDialog?.showQr(state.qrCode, state.wallet.shareUrl)
|
||||
if (state.qrCode != null && state.addressData?.shareUrl != null) {
|
||||
if (qrDialog == null) qrDialog = QrDialog(requireContext())
|
||||
qrDialog?.showQr(state.qrCode, state.addressData.shareUrl)
|
||||
} else {
|
||||
qrDialog?.dismiss()
|
||||
}
|
||||
|
||||
when (state.state) {
|
||||
ProgressState.Loading -> {
|
||||
l_balance.show()
|
||||
BalanceWidget(this, state.currencyData).setup()
|
||||
}
|
||||
ProgressState.Done -> {
|
||||
l_balance.show()
|
||||
BalanceWidget(this, state.currencyData).setup()
|
||||
}
|
||||
ProgressState.Error -> {
|
||||
l_balance.show()
|
||||
BalanceWidget(this, state.currencyData).setup()
|
||||
|
||||
}
|
||||
if (state.state == ProgressState.Done) {
|
||||
srl_wallet.isRefreshing = false
|
||||
}
|
||||
|
||||
when (state.payIdData.payIdState) {
|
||||
|
|
@ -150,5 +123,43 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupButtons(state: WalletState) {
|
||||
btn_copy.setOnClickListener { store.dispatch(WalletAction.CopyAddress(requireContext())) }
|
||||
btn_show_qr.setOnClickListener { store.dispatch(WalletAction.ShowQrCode) }
|
||||
|
||||
val buttonTitle = when (state.mainButton) {
|
||||
is WalletMainButton.SendButton -> R.string.wallet_button_send
|
||||
is WalletMainButton.CreateWalletButton -> R.string.wallet_button_create_wallet
|
||||
}
|
||||
btn_main.text = getString(buttonTitle)
|
||||
btn_main.isEnabled = state.mainButton.enabled
|
||||
|
||||
btn_main.setOnClickListener {
|
||||
when (state.mainButton) {
|
||||
is WalletMainButton.SendButton -> store.dispatch(NavigationAction.NavigateTo(AppScreen.Send))
|
||||
is WalletMainButton.CreateWalletButton -> store.dispatch(WalletAction.CreateWallet)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupAddressCard(state: WalletState) {
|
||||
if (state.addressData != null) {
|
||||
l_address?.show()
|
||||
tv_address.text = state.addressData.address
|
||||
tv_explore?.setOnClickListener {
|
||||
store.dispatch(WalletAction.ExploreAddress(requireContext()))
|
||||
}
|
||||
} else {
|
||||
l_address?.hide()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupCardImage(cardImage: Bitmap?) {
|
||||
if (cardImage != null) {
|
||||
iv_card.setImageBitmap(cardImage)
|
||||
} else {
|
||||
iv_card.setImageDrawable(getDrawable(R.drawable.card_default))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
7
app/src/main/res/color/btn_tap_text_color.xml
Normal file
7
app/src/main/res/color/btn_tap_text_color.xml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false"
|
||||
android:color="#66FFFFFF"
|
||||
android:textColor="#66FFFFFF"/>
|
||||
<item android:color="#FFFFFF"/>
|
||||
</selector>
|
||||
6
app/src/main/res/color/selector_btn_black.xml
Normal file
6
app/src/main/res/color/selector_btn_black.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false"
|
||||
android:color="@color/tapButtonBlackDisabled"/>
|
||||
<item android:color="@color/tapButtonColorBlack"/>
|
||||
</selector>
|
||||
6
app/src/main/res/color/selector_btn_green.xml
Normal file
6
app/src/main/res/color/selector_btn_green.xml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false"
|
||||
android:color="@color/tapButtonDisabled"/>
|
||||
<item android:color="@color/tapButtonColor"/>
|
||||
</selector>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 108 KiB |
|
|
@ -1,19 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="49dp"
|
||||
android:height="49dp"
|
||||
android:viewportWidth="49"
|
||||
android:viewportHeight="49">
|
||||
android:width="17dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="17"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M24.5,2L24.5,2A21.5,21.5 0,0 1,46 23.5L46,23.5A21.5,21.5 0,0 1,24.5 45L24.5,45A21.5,21.5 0,0 1,3 23.5L3,23.5A21.5,21.5 0,0 1,24.5 2z"
|
||||
android:fillColor="#F4F5F6"/>
|
||||
<path
|
||||
android:strokeWidth="1"
|
||||
android:pathData="M20,16.5L26,16.5A2.5,2.5 0,0 1,28.5 19L28.5,24A2.5,2.5 0,0 1,26 26.5L20,26.5A2.5,2.5 0,0 1,17.5 24L17.5,19A2.5,2.5 0,0 1,20 16.5z"
|
||||
android:fillColor="#F4F5F6"
|
||||
android:strokeColor="#1B1C20"/>
|
||||
<path
|
||||
android:strokeWidth="1"
|
||||
android:pathData="M23,20.5L29,20.5A2.5,2.5 0,0 1,31.5 23L31.5,28A2.5,2.5 0,0 1,29 30.5L23,30.5A2.5,2.5 0,0 1,20.5 28L20.5,23A2.5,2.5 0,0 1,23 20.5z"
|
||||
android:fillColor="#F4F5F6"
|
||||
android:strokeColor="#1B1C20"/>
|
||||
android:pathData="M12.3334,0.8333H2.3334C1.4167,0.8333 0.6667,1.5833 0.6667,2.5V14.1667H2.3334V2.5H12.3334V0.8333ZM11.5001,4.1667L16.5001,9.1667V17.5C16.5001,18.4167 15.7501,19.1667 14.8334,19.1667H5.6584C4.7417,19.1667 4.0001,18.4167 4.0001,17.5L4.0084,5.8333C4.0084,4.9167 4.7501,4.1667 5.6667,4.1667H11.5001ZM10.6667,10H15.2501L10.6667,5.4167V10Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
</vector>
|
||||
|
|
|
|||
|
|
@ -1,88 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="15dp"
|
||||
android:height="15dp"
|
||||
android:viewportWidth="15"
|
||||
android:viewportHeight="15">
|
||||
<group>
|
||||
<clip-path
|
||||
android:pathData="M0,0h15v15h-15z"/>
|
||||
<path
|
||||
android:pathData="M5.625,0H0V5.625H5.625V0ZM4.6875,4.6875H0.9375V0.9375H4.6875V4.6875Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M1.875,1.8752H3.75V3.7502H1.875V1.8752Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M0,15.0001H5.625V9.3751H0V15.0001ZM0.9375,10.3126H4.6875V14.0626H0.9375V10.3126Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M1.875,11.25H3.75V13.125H1.875V11.25Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M9.375,0V5.625H15V0H9.375ZM14.0625,4.6875H10.3125V0.9375H14.0625V4.6875Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M11.25,1.8752H13.125V3.7502H11.25V1.8752Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M1.875,6.5625H0V8.4375H2.8125V7.5H1.875V6.5625Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M6.5625,8.4376H8.4375V10.3126H6.5625V8.4376Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M2.8125,6.5625H4.6875V7.5H2.8125V6.5625Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M8.4375,11.25H6.5625V12.1875H7.5V13.125H8.4375V12.1875V11.25Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M5.625,6.5625V7.5H4.6875V8.4375H6.5625V6.5625H5.625Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M7.5,3.7501H8.4375V5.6251H7.5V3.7501Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M8.4375,7.5V8.4375H10.3125V6.5625H7.5V7.5H8.4375Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M6.5625,5.6251H7.5V6.5626H6.5625V5.6251Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M8.4375,13.1251H10.3125V15.0001H8.4375V13.1251Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M6.5625,13.1251H7.5V15.0001H6.5625V13.1251Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M8.4375,10.3126H9.375V11.2501H8.4375V10.3126Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M8.4375,2.8125V0.9375H7.5V0H6.5625V3.75H7.5V2.8125H8.4375Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M11.25,13.1251H12.1875V15.0001H11.25V13.1251Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M11.25,11.25H13.125V12.1875H11.25V11.25Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M10.3125,12.1875H11.25V13.125H10.3125V12.1875Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M9.375,11.25H10.3125V12.1875H9.375V11.25Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M13.125,9.3751V10.3126H14.0625V11.2501H15V9.3751H14.0625H13.125Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M14.0625,12.1875H13.125V15H15V13.125H14.0625V12.1875Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M9.375,9.3751V10.3126H12.1875V8.4376H10.3125V9.3751H9.375Z"
|
||||
android:fillColor="#000000"/>
|
||||
<path
|
||||
android:pathData="M11.25,6.5625V7.5H13.125V8.4375H15V6.5625H13.125H11.25Z"
|
||||
android:fillColor="#000000"/>
|
||||
</group>
|
||||
</vector>
|
||||
84
app/src/main/res/drawable/ic_qr_code_show.xml
Normal file
84
app/src/main/res/drawable/ic_qr_code_show.xml
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M9.9998,4H3.9998V10H9.9998V4ZM8.9998,9H4.9998V5H8.9998V9Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M6,6.0002H8V8.0002H6V6.0002Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M3.9998,20.0002H9.9998V14.0002H3.9998V20.0002ZM4.9998,15.0002H8.9998V19.0002H4.9998V15.0002Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M6,16H8V18H6V16Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M14.0002,4V10H20.0002V4H14.0002ZM19.0002,9H15.0002V5H19.0002V9Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M16.0002,6.0002H18.0002V8.0002H16.0002V6.0002Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M5.9998,11H3.9998V13H6.9998V12H5.9998V11Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M11.0002,13.0001H13.0002V15.0001H11.0002V13.0001Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M7.0002,11H9.0002V12H7.0002V11Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M13.0002,16H11.0002V17H12.0002V18H13.0002V17V16Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M10.0005,11V12H9.0005V13H11.0005V11H10.0005Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M12,8.0001H13V10.0001H12V8.0001Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M13,12V13H15V11H12V12H13Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M11.0002,10.0001H12.0002V11.0001H11.0002V10.0001Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M12.9998,18.0001H14.9998V20.0001H12.9998V18.0001Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M11.0002,18.0001H12.0002V20.0001H11.0002V18.0001Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M12.9998,15.0001H13.9998V16.0001H12.9998V15.0001Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M13.0002,7V5H12.0002V4H11.0002V8H12.0002V7H13.0002Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M16.0002,18.0001H17.0002V20.0001H16.0002V18.0001Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M16.0002,16H18.0002V17H16.0002V16Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M14.9995,16.9999H15.9995V17.9999H14.9995V16.9999Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M14.0002,16H15.0002V17H14.0002V16Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M18,14.0002V15.0002H19V16.0002H20V14.0002H19H18Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M19,16.9999H18V19.9999H20V17.9999H19V16.9999Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M14.0002,14.0001V15.0001H17.0002V13.0001H15.0002V14.0001H14.0002Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
<path
|
||||
android:pathData="M16.0002,11V12H18.0002V13H20.0002V11H18.0002H16.0002Z"
|
||||
android:fillColor="#1C1C1E"/>
|
||||
</vector>
|
||||
15
app/src/main/res/drawable/ic_warning.xml
Normal file
15
app/src/main/res/drawable/ic_warning.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="30dp"
|
||||
android:height="30dp"
|
||||
android:viewportWidth="30"
|
||||
android:viewportHeight="30">
|
||||
<path
|
||||
android:pathData="M15,1.875C12.4041,1.875 9.8665,2.6448 7.7081,4.087C5.5497,5.5292 3.8675,7.579 2.8741,9.9773C1.8807,12.3756 1.6208,15.0146 2.1272,17.5606C2.6336,20.1066 3.8837,22.4452 5.7192,24.2808C7.5548,26.1163 9.8934,27.3664 12.4394,27.8728C14.9854,28.3792 17.6244,28.1193 20.0227,27.1259C22.421,26.1325 24.4709,24.4503 25.913,22.2919C27.3552,20.1335 28.125,17.5959 28.125,15C28.125,11.519 26.7422,8.1806 24.2808,5.7192C21.8194,3.2578 18.481,1.875 15,1.875ZM15,26.25C12.775,26.25 10.5999,25.5902 8.7498,24.354C6.8998,23.1179 5.4578,21.3609 4.6064,19.3052C3.7549,17.2495 3.5321,14.9875 3.9662,12.8052C4.4003,10.6229 5.4717,8.6184 7.0451,7.0451C8.6184,5.4717 10.623,4.4002 12.8052,3.9662C14.9875,3.5321 17.2495,3.7549 19.3052,4.6064C21.3609,5.4578 23.1179,6.8998 24.354,8.7498C25.5902,10.5999 26.25,12.775 26.25,15C26.25,17.9837 25.0647,20.8452 22.955,22.955C20.8452,25.0647 17.9837,26.25 15,26.25Z"
|
||||
android:fillColor="#FFB71B"/>
|
||||
<path
|
||||
android:pathData="M14.0625,7.5H15.9375V17.8125H14.0625V7.5Z"
|
||||
android:fillColor="#FFB71B"/>
|
||||
<path
|
||||
android:pathData="M15,20.625C14.7219,20.625 14.45,20.7075 14.2187,20.862C13.9875,21.0165 13.8072,21.2361 13.7008,21.4931C13.5944,21.7501 13.5665,22.0328 13.6208,22.3056C13.675,22.5784 13.809,22.829 14.0056,23.0256C14.2023,23.2223 14.4529,23.3562 14.7257,23.4105C14.9984,23.4647 15.2812,23.4369 15.5381,23.3305C15.7951,23.224 16.0147,23.0438 16.1693,22.8125C16.3238,22.5813 16.4062,22.3094 16.4062,22.0312C16.4062,21.6583 16.2581,21.3006 15.9944,21.0369C15.7306,20.7732 15.373,20.625 15,20.625Z"
|
||||
android:fillColor="#FFB71B"/>
|
||||
</vector>
|
||||
16
app/src/main/res/drawable/ic_warning_small.xml
Normal file
16
app/src/main/res/drawable/ic_warning_small.xml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="14dp"
|
||||
android:height="14dp"
|
||||
android:viewportWidth="30"
|
||||
android:viewportHeight="30">
|
||||
<path
|
||||
android:pathData="M15,1.875C12.4041,1.875 9.8665,2.6448 7.7081,4.087C5.5497,5.5292 3.8675,7.579 2.8741,9.9773C1.8807,12.3756 1.6208,15.0146 2.1272,17.5606C2.6336,20.1066 3.8837,22.4452 5.7192,24.2808C7.5548,26.1163 9.8934,27.3664 12.4394,27.8728C14.9854,28.3792 17.6244,28.1193 20.0227,27.1259C22.421,26.1325 24.4709,24.4503 25.913,22.2919C27.3552,20.1335 28.125,17.5959 28.125,15C28.125,11.519 26.7422,8.1806 24.2808,5.7192C21.8194,3.2578 18.481,1.875 15,1.875ZM15,26.25C12.775,26.25 10.5999,25.5902 8.7498,24.354C6.8998,23.1179 5.4578,21.3609 4.6064,19.3052C3.7549,17.2495 3.5321,14.9875 3.9662,12.8052C4.4003,10.6229 5.4717,8.6184 7.0451,7.0451C8.6184,5.4717 10.623,4.4002 12.8052,3.9662C14.9875,3.5321 17.2495,3.7549 19.3052,4.6064C21.3609,5.4578 23.1179,6.8998 24.354,8.7498C25.5902,10.5999 26.25,12.775 26.25,15C26.25,17.9837 25.0647,20.8452 22.955,22.955C20.8452,25.0647 17.9837,26.25 15,26.25Z"
|
||||
android:fillColor="#FFB71B"/>
|
||||
<path
|
||||
android:pathData="M14.0625,7.5H15.9375V17.8125H14.0625V7.5Z"
|
||||
android:fillColor="#FFB71B"/>
|
||||
<path
|
||||
android:pathData="M15,20.625C14.7219,20.625 14.45,20.7075 14.2187,20.862C13.9875,21.0165 13.8072,21.2361 13.7008,21.4931C13.5944,21.7501 13.5665,22.0328 13.6208,22.3056C13.675,22.5784 13.809,22.829 14.0056,23.0256C14.2023,23.2223 14.4529,23.3562 14.7257,23.4105C14.9984,23.4647 15.2812,23.4369 15.5381,23.3305C15.7951,23.224 16.0147,23.0438 16.1693,22.8125C16.3238,22.5813 16.4062,22.3094 16.4062,22.0312C16.4062,21.6583 16.2581,21.3006 15.9944,21.0369C15.7306,20.7732 15.373,20.625 15,20.625Z"
|
||||
android:fillColor="#FFB71B"/>
|
||||
</vector>
|
||||
|
|
@ -70,12 +70,15 @@
|
|||
android:layout_marginBottom="33dp"
|
||||
android:text="@string/home_button_yes"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btn_shop"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_shop"
|
||||
style="@style/TapBlackButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="7dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
|
|
@ -84,6 +87,7 @@
|
|||
app:icon="@drawable/ic_shop"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/btn_yes" />
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/btn_yes" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -1,73 +1,113 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="24dp">
|
||||
android:background="@color/backgroundLightGray"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/app_bar"
|
||||
style="@style/Widget.MaterialComponents.Toolbar.Surface"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navigationIcon="@drawable/ic_baseline_arrow_back_24"
|
||||
app:title="@string/wallet_toolbar_title" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="38dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:elevation="3dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/card_default"
|
||||
app:layout_constraintTop_toBottomOf="@id/toolbar" />
|
||||
android:background="@color/backgroundLightGray"
|
||||
android:fitsSystemWindows="true"
|
||||
app:liftOnScroll="true">
|
||||
|
||||
<include
|
||||
android:id="@+id/l_card_balance"
|
||||
layout="@layout/card_balance"
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:navigationIcon="@drawable/ic_baseline_arrow_back_24"
|
||||
app:title="@string/wallet_toolbar_title" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/srl_wallet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_card" />
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/sv_wallet"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="33dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="38dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:elevation="3dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/card_default"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<include
|
||||
android:id="@+id/l_card_balance"
|
||||
layout="@layout/card_balance"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_card" />
|
||||
|
||||
|
||||
<include
|
||||
android:id="@+id/l_address"
|
||||
layout="@layout/layout_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/l_card_balance" />
|
||||
<include
|
||||
android:id="@+id/l_address"
|
||||
layout="@layout/layout_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/l_card_balance" />
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_scan"
|
||||
style="@style/TapBlackButton"
|
||||
android:layout_width="93dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginBottom="33dp"
|
||||
android:text="@string/wallet_button_scan"
|
||||
app:icon="@drawable/ic_scan"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_scan"
|
||||
style="@style/TapBlackButton"
|
||||
android:layout_width="93dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:text="@string/wallet_button_scan"
|
||||
app:icon="@drawable/ic_scan"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btn_main"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/l_address"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_main"
|
||||
style="@style/TapButtonWithIcon"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="7dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginBottom="33dp"
|
||||
android:text="@string/wallet_button_send"
|
||||
app:icon="@drawable/ic_send"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/btn_scan" />
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_main"
|
||||
style="@style/TapButtonWithIcon"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="7dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:text="@string/wallet_button_send"
|
||||
app:icon="@drawable/ic_send"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/btn_scan"
|
||||
app:layout_constraintTop_toBottomOf="@id/l_address"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/fl_balance"
|
||||
android:id="@+id/fl_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:minWidth="300dp">
|
||||
|
|
@ -19,6 +19,7 @@
|
|||
android:elevation="3dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/cl_address"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
|
@ -57,31 +58,53 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/tv_address" />
|
||||
|
||||
|
||||
<ImageButton
|
||||
<FrameLayout
|
||||
android:id="@+id/btn_copy"
|
||||
android:layout_width="43dp"
|
||||
android:layout_height="43dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/ic_btn_round_background"
|
||||
android:background="@drawable/shape_ellipse"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:elevation="3dp"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_copy"
|
||||
app:layout_constraintEnd_toStartOf="@id/btn_show_qr"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageButton
|
||||
<ImageView
|
||||
android:id="@+id/iv_copy"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:padding="5dp"
|
||||
app:srcCompat="@drawable/ic_copy" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/btn_show_qr"
|
||||
android:layout_width="43dp"
|
||||
android:layout_height="43dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/ic_btn_round_background"
|
||||
android:background="@drawable/shape_ellipse"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:elevation="3dp"
|
||||
android:padding="10dp"
|
||||
android:src="@drawable/ic_qr_code_create"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_qr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:padding="2dp"
|
||||
app:srcCompat="@drawable/ic_qr_code_show" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/v_payid_divider"
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
android:textColor="@color/warning"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="@drawable/ic_baseline_error_outline_24"
|
||||
app:drawableStartCompat="@drawable/ic_warning_small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_currency" />
|
||||
|
||||
|
|
@ -70,17 +70,36 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/tv_amount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:paddingTop="16dp"
|
||||
android:textColor="@color/darkGray6"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
android:gravity="end"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_currency_symbol"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_currency"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="0.43" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_currency_symbol"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textColor="@color/darkGray6"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_amount"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="0.43 BTC" />
|
||||
tools:text="BTC" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_fiat_amount"
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@
|
|||
android:id="@+id/iv_balance_error"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_width="26dp"
|
||||
android:layout_height="26dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:src="@drawable/ic_baseline_error_outline_24" />
|
||||
android:src="@drawable/ic_warning" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_error_title"
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
tools:text="@string/wallet_account_not_created"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="18dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textSize="20sp"
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
tools:text="Load10+ XLM to create account"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="18dp"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="16dp"
|
||||
|
|
|
|||
3
app/src/main/res/transition/fade.xml
Normal file
3
app/src/main/res/transition/fade.xml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<fade xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="@android:integer/config_shortAnimTime"/>
|
||||
4
app/src/main/res/transition/slide_right.xml
Normal file
4
app/src/main/res/transition/slide_right.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<slide xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:slideEdge="right" />
|
||||
|
|
@ -6,7 +6,9 @@
|
|||
<color name="accent">#1ACE80</color>
|
||||
|
||||
<color name="tapButtonColor">@color/accent</color>
|
||||
<color name="tapButtonDisabled">#661ACE80</color>
|
||||
<color name="tapButtonColorBlack">@color/darkGray6</color>
|
||||
<color name="tapButtonBlackDisabled">#661C1C1E</color>
|
||||
|
||||
<color name="success">#5AC461</color>
|
||||
<color name="error">#C4291C</color>
|
||||
|
|
@ -20,6 +22,7 @@
|
|||
<color name="darkGray6">#1C1C1E</color>
|
||||
|
||||
<color name="backgroundGray">#F9F9FA</color>
|
||||
<color name="backgroundLightGray">#F9F9F9</color>
|
||||
<color name="buttonGray">#F4F5F6</color>
|
||||
<color name="textGray">#DE000000</color>
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
<string name="wallet_create_payid">Create PayID</string>
|
||||
<string name="wallet_verified_balance">Verified Balance</string>
|
||||
<string name="wallet_blockchain_is_unreachable">Blockchain is unreachable</string>
|
||||
<string name="wallet_unknown_blockchain">Uh oh!\nYour Tangem card was made to work with a different application. Please see the name and instructions on your card, and install the correct app.</string>
|
||||
<string name="wallet_balance_is_loading">Balance is loading…</string>
|
||||
<string name="wallet_account_not_created">Account is not created</string>
|
||||
<string name="wallet_empty_card">Empty Card</string>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<item name="colorSecondary">@color/colorSecondary</item>
|
||||
<item name="android:textColor">@color/darkGray6</item>
|
||||
<item name="android:windowTranslucentStatus">true</item>
|
||||
<item name="android:statusBarColor">@color/backgroundLightGray</item>
|
||||
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
|
||||
</style>
|
||||
|
||||
|
|
@ -26,20 +27,25 @@
|
|||
<item name="android:insetBottom">0dp</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:textColor">@color/btn_tap_text_color</item>
|
||||
<item name="android:textAllCaps">false</item>
|
||||
<item name="android:letterSpacing">0</item>
|
||||
<item name="android:backgroundTint">@color/tapButtonColor</item>
|
||||
<item name="android:backgroundTint">@color/selector_btn_green</item>
|
||||
<item name="cornerRadius">@dimen/btn_corner_radius</item>
|
||||
<item name="android:fontFamily">@font/saira_semi_condensed_regular</item>
|
||||
<item name="android:layout_width">93dp</item>
|
||||
<item name="android:layout_height">48dp</item>
|
||||
</style>
|
||||
|
||||
<style name="TapButtonWithIcon" parent="TapButton">
|
||||
<item name="android:gravity">start|center_vertical</item>
|
||||
<item name="iconTint">@color/btn_tap_text_color</item>
|
||||
<item name="iconGravity">end</item>
|
||||
<item name="android:layout_width">200dp</item>
|
||||
</style>
|
||||
|
||||
<style name="TapBlackButton" parent="TapButtonWithIcon">
|
||||
<item name="android:backgroundTint">@color/tapButtonColorBlack</item>
|
||||
<item name="android:backgroundTint">@color/selector_btn_black</item>
|
||||
</style>
|
||||
|
||||
<style name="ChipNetworkFee" parent="@style/Widget.MaterialComponents.Chip.Choice">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue