Updated on 2026-08-14
This commit is contained in:
parent
01e4ad8abb
commit
b840d3c5eb
33 changed files with 404 additions and 155 deletions
|
|
@ -16,6 +16,7 @@ import com.tangem.tap.common.redux.NotificationsHandler
|
|||
import com.tangem.tap.common.redux.navigation.AppScreen
|
||||
import com.tangem.tap.common.redux.navigation.NavigationAction
|
||||
import com.tangem.tap.domain.TangemSdkManager
|
||||
import com.tangem.tap.features.home.redux.HomeAction
|
||||
import com.tangem.wallet.R
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.coroutines.CoroutineExceptionHandler
|
||||
|
|
@ -67,9 +68,8 @@ class MainActivity : AppCompatActivity() {
|
|||
super.onResume()
|
||||
notificationsHandler = NotificationsHandler(fragment_container)
|
||||
if (supportFragmentManager.backStackEntryCount == 0) {
|
||||
store.dispatch(
|
||||
NavigationAction.NavigateTo(AppScreen.Home)
|
||||
)
|
||||
store.dispatch(HomeAction.CheckIfFirstLaunch)
|
||||
store.dispatch(NavigationAction.NavigateTo(AppScreen.Home))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,10 @@ lateinit var preferencesStorage: PreferencesStorage
|
|||
class TapApplication : Application() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
preferencesStorage = PreferencesStorage(this)
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
Timber.plant(Timber.DebugTree())
|
||||
}
|
||||
NetworkConnectivity.createInstance(store, this)
|
||||
preferencesStorage = PreferencesStorage(this)
|
||||
}
|
||||
}
|
||||
|
|
@ -48,6 +48,10 @@ fun BigDecimal.toFormattedString(decimals: Int): String {
|
|||
return df.format(bd)
|
||||
}
|
||||
|
||||
fun BigDecimal.toFormattedCurrencyString(decimals: Int, currency: String): String {
|
||||
return "${this.toFormattedString(decimals)} $currency"
|
||||
}
|
||||
|
||||
fun BigDecimal.toFiatString(rateValue: BigDecimal, fiatCurrencyName: FiatCurrencyName): String? {
|
||||
var fiatValue = rateValue.multiply(this)
|
||||
fiatValue = fiatValue.setScale(2, RoundingMode.DOWN)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,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.features.send.redux.reducers.SendScreenReducer
|
||||
import com.tangem.tap.features.details.redux.DetailsReducer
|
||||
import com.tangem.tap.features.home.redux.HomeReducer
|
||||
import com.tangem.tap.features.send.redux.reducers.SendScreenReducer
|
||||
import com.tangem.tap.features.wallet.redux.WalletReducer
|
||||
import org.rekotlin.Action
|
||||
|
||||
|
|
@ -14,6 +15,7 @@ fun appReducer(action: Action, state: AppState?): AppState {
|
|||
return AppState(
|
||||
navigationState = NavigationReducer.reduce(action, state),
|
||||
globalState = globalReducer(action, state),
|
||||
homeState = HomeReducer.reduce(action, state),
|
||||
walletState = WalletReducer.reduce(action, state),
|
||||
sendState = SendScreenReducer.reduce(action, state.sendState),
|
||||
detailsState = DetailsReducer.reduce(action, state)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.tangem.tap.common.redux.navigation.NavigationState
|
|||
import com.tangem.tap.common.redux.navigation.navigationMiddleware
|
||||
import com.tangem.tap.features.details.redux.DetailsMiddleware
|
||||
import com.tangem.tap.features.details.redux.DetailsState
|
||||
import com.tangem.tap.features.home.redux.HomeState
|
||||
import com.tangem.tap.features.home.redux.homeMiddleware
|
||||
import com.tangem.tap.features.send.redux.middlewares.sendMiddleware
|
||||
import com.tangem.tap.features.send.redux.states.SendState
|
||||
|
|
@ -17,6 +18,7 @@ import org.rekotlin.StateType
|
|||
data class AppState(
|
||||
val navigationState: NavigationState = NavigationState(),
|
||||
val globalState: GlobalState = GlobalState(),
|
||||
val homeState: HomeState = HomeState(),
|
||||
val walletState: WalletState = WalletState(),
|
||||
val sendState: SendState = SendState(),
|
||||
val detailsState: DetailsState = DetailsState()
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.tangem.tap.common.redux.global.CryptoCurrencyName
|
|||
import com.tangem.tap.common.redux.global.FiatCurrencyName
|
||||
import com.tangem.tap.common.redux.global.GlobalAction
|
||||
import com.tangem.tap.domain.tasks.ScanNoteResponse
|
||||
import com.tangem.tap.features.wallet.redux.Artwork
|
||||
import com.tangem.tap.features.wallet.redux.PayIdState
|
||||
import com.tangem.tap.features.wallet.redux.WalletAction
|
||||
import com.tangem.tap.network.NetworkConnectivity
|
||||
|
|
@ -43,8 +44,8 @@ class TapWalletManager {
|
|||
when (result) {
|
||||
is Result.Success -> {
|
||||
store.dispatch(WalletAction.LoadArtwork.Success(
|
||||
artworkId, result.data.byteStream().readBytes())
|
||||
)
|
||||
Artwork(artworkId, result.data.byteStream().readBytes())
|
||||
))
|
||||
}
|
||||
is Result.Failure -> store.dispatch(WalletAction.LoadArtwork.Failure)
|
||||
}
|
||||
|
|
@ -74,21 +75,22 @@ class TapWalletManager {
|
|||
suspend fun onCardScanned(data: ScanNoteResponse) {
|
||||
withContext(Dispatchers.Main) {
|
||||
store.dispatch(GlobalAction.SaveScanNoteResponse(data))
|
||||
val artworkId = data.verifyResponse?.artworkInfo?.id
|
||||
if (data.walletManager != null) {
|
||||
if (!NetworkConnectivity.getInstance().isOnlineOrConnecting()) {
|
||||
store.dispatch(WalletAction.LoadData.Failure(TapError.NoInternetConnection))
|
||||
return@withContext
|
||||
}
|
||||
data.verifyResponse?.artworkInfo?.id?.let {
|
||||
store.dispatch(WalletAction.LoadArtwork(data.card, it))
|
||||
}
|
||||
store.dispatch(WalletAction.LoadWallet)
|
||||
store.dispatch(WalletAction.LoadArtwork(data.card, artworkId))
|
||||
store.dispatch(WalletAction.LoadFiatRate)
|
||||
store.dispatch(WalletAction.LoadPayId)
|
||||
} else if (data.card.status == CardStatus.Empty) {
|
||||
store.dispatch(WalletAction.EmptyWallet)
|
||||
store.dispatch(WalletAction.LoadArtwork(data.card, artworkId))
|
||||
} else {
|
||||
store.dispatch(WalletAction.LoadData.Failure(TapError.UnknownBlockchain))
|
||||
store.dispatch(WalletAction.LoadArtwork(data.card, artworkId))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,24 +2,16 @@ package com.tangem.tap.domain.tasks
|
|||
|
||||
import com.tangem.CardSession
|
||||
import com.tangem.CardSessionRunnable
|
||||
import com.tangem.commands.ReadCommand
|
||||
import com.tangem.commands.CreateWalletCommand
|
||||
import com.tangem.common.CompletionResult
|
||||
import com.tangem.tasks.CreateWalletTask
|
||||
|
||||
class CreateWalletAndRescanTask : CardSessionRunnable<ScanNoteResponse> {
|
||||
override val requiresPin2 = false
|
||||
|
||||
override fun run(session: CardSession, callback: (result: CompletionResult<ScanNoteResponse>) -> Unit) {
|
||||
CreateWalletTask().run(session) { result ->
|
||||
CreateWalletCommand().run(session) { result ->
|
||||
when (result) {
|
||||
is CompletionResult.Success -> ReadCommand().run(session) { readResult ->
|
||||
when (readResult) {
|
||||
is CompletionResult.Success -> {
|
||||
callback(readResult.data.toScanNoteCompletionResult())
|
||||
}
|
||||
is CompletionResult.Failure -> callback(CompletionResult.Failure(readResult.error))
|
||||
}
|
||||
}
|
||||
is CompletionResult.Success -> ScanNoteTask().run(session, callback)
|
||||
|
||||
is CompletionResult.Failure -> callback(CompletionResult.Failure(result.error))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.tangem.commands.CommandResponse
|
|||
import com.tangem.commands.verifycard.VerifyCardCommand
|
||||
import com.tangem.commands.verifycard.VerifyCardResponse
|
||||
import com.tangem.common.CompletionResult
|
||||
import com.tangem.tasks.ScanTask
|
||||
|
||||
data class ScanNoteResponse(
|
||||
val walletManager: WalletManager?,
|
||||
|
|
@ -21,26 +22,32 @@ class ScanNoteTask : CardSessionRunnable<ScanNoteResponse> {
|
|||
override val requiresPin2 = false
|
||||
|
||||
override fun run(session: CardSession, callback: (result: CompletionResult<ScanNoteResponse>) -> Unit) {
|
||||
val card = session.environment.card
|
||||
card ?: return callback(CompletionResult.Failure(TangemSdkError.CardError()))
|
||||
val walletManager = try {
|
||||
WalletManagerFactory.makeWalletManager(card)
|
||||
} catch (exception: Exception) {
|
||||
return callback(CompletionResult.Success(ScanNoteResponse(null, card)))
|
||||
}
|
||||
VerifyCardCommand(true).run(session) { result ->
|
||||
ScanTask().run(session) { result ->
|
||||
when (result) {
|
||||
is CompletionResult.Failure -> callback(CompletionResult.Failure(result.error))
|
||||
|
||||
is CompletionResult.Success -> {
|
||||
callback(CompletionResult.Success(ScanNoteResponse(
|
||||
walletManager, card, result.data
|
||||
)))
|
||||
}
|
||||
is CompletionResult.Failure -> {
|
||||
callback(CompletionResult.Failure(TangemSdkError.VerificationFailed()))
|
||||
val card = result.data
|
||||
val walletManager = try {
|
||||
WalletManagerFactory.makeWalletManager(card)
|
||||
} catch (exception: Exception) {
|
||||
return@run callback(CompletionResult.Success(ScanNoteResponse(null, card)))
|
||||
}
|
||||
VerifyCardCommand(true).run(session) { verifyResult ->
|
||||
when (verifyResult) {
|
||||
is CompletionResult.Success -> {
|
||||
callback(CompletionResult.Success(ScanNoteResponse(
|
||||
walletManager, card, verifyResult.data
|
||||
)))
|
||||
}
|
||||
is CompletionResult.Failure -> {
|
||||
callback(CompletionResult.Failure(TangemSdkError.VerificationFailed()))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,43 @@ 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.features.home.redux.HomeState
|
||||
import com.tangem.tap.store
|
||||
import com.tangem.wallet.R
|
||||
import kotlinx.android.synthetic.main.fragment_home.*
|
||||
import org.rekotlin.StoreSubscriber
|
||||
|
||||
class HomeFragment : Fragment(R.layout.fragment_home), StoreSubscriber<HomeState> {
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
store.subscribe(this) { state ->
|
||||
state.skipRepeats { oldState, newState ->
|
||||
oldState.homeState == newState.homeState
|
||||
}.select { it.homeState }
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
store.unsubscribe(this)
|
||||
}
|
||||
|
||||
|
||||
override fun newState(state: HomeState) {
|
||||
if (activity == null) return
|
||||
requireContext().cacheDir
|
||||
if (state.firstLaunch) {
|
||||
tv_home_description.text = getText(R.string.home_do_you_have_card)
|
||||
btn_shop.text = getText(R.string.home_button_no_card)
|
||||
btn_yes.text = getText(R.string.home_button_yes)
|
||||
} else {
|
||||
tv_home_description.text = getText(R.string.home_welcome_back)
|
||||
btn_shop.text = getText(R.string.home_button_shop)
|
||||
btn_yes.text = getText(R.string.home_button_scan)
|
||||
}
|
||||
}
|
||||
|
||||
class HomeFragment : Fragment(R.layout.fragment_home) {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
|
|
|||
|
|
@ -6,4 +6,7 @@ import org.rekotlin.Action
|
|||
sealed class HomeAction : Action {
|
||||
object ReadCard : HomeAction()
|
||||
data class GoToShop(val context: Context) : HomeAction()
|
||||
object CheckIfFirstLaunch : HomeAction() {
|
||||
data class Result(val firstLaunch: Boolean) : HomeAction()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.tangem.tap.common.redux.AppState
|
|||
import com.tangem.tap.common.redux.global.GlobalAction
|
||||
import com.tangem.tap.common.redux.navigation.AppScreen
|
||||
import com.tangem.tap.common.redux.navigation.NavigationAction
|
||||
import com.tangem.tap.preferencesStorage
|
||||
import com.tangem.tap.scope
|
||||
import com.tangem.tap.store
|
||||
import com.tangem.tap.tangemSdkManager
|
||||
|
|
@ -20,6 +21,11 @@ val homeMiddleware: Middleware<AppState> = { dispatch, state ->
|
|||
{ next ->
|
||||
{ action ->
|
||||
when (action) {
|
||||
is HomeAction.CheckIfFirstLaunch -> {
|
||||
store.dispatch(
|
||||
HomeAction.CheckIfFirstLaunch.Result(preferencesStorage.isFirstLaunch())
|
||||
)
|
||||
}
|
||||
is HomeAction.ReadCard -> {
|
||||
scope.launch {
|
||||
val result = tangemSdkManager.scanNote()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.tangem.tap.features.home.redux
|
||||
|
||||
import com.tangem.tap.common.redux.AppState
|
||||
import org.rekotlin.Action
|
||||
|
||||
class HomeReducer {
|
||||
companion object {
|
||||
fun reduce(action: Action, state: AppState): HomeState = internalReduce(action, state)
|
||||
}
|
||||
}
|
||||
|
||||
private fun internalReduce(action: Action, state: AppState): HomeState {
|
||||
|
||||
if (action !is HomeAction) return state.homeState
|
||||
|
||||
var homeState = state.homeState
|
||||
when (action) {
|
||||
is HomeAction.CheckIfFirstLaunch.Result -> {
|
||||
homeState = homeState.copy(firstLaunch = action.firstLaunch)
|
||||
}
|
||||
}
|
||||
|
||||
return homeState
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package com.tangem.tap.features.home.redux
|
||||
|
||||
import org.rekotlin.StateType
|
||||
|
||||
data class HomeState(
|
||||
val firstLaunch: Boolean = true
|
||||
) : StateType
|
||||
|
|
@ -35,8 +35,8 @@ sealed class WalletAction : Action {
|
|||
object Failure : WalletAction()
|
||||
}
|
||||
|
||||
data class LoadArtwork(val card: Card, val artworkId: String) : WalletAction() {
|
||||
data class Success(val artworkId: String, val artwork: ByteArray) : WalletAction()
|
||||
data class LoadArtwork(val card: Card, val artworkId: String?) : WalletAction() {
|
||||
data class Success(val artwork: Artwork) : WalletAction()
|
||||
object Failure : WalletAction()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import com.tangem.tap.network.NetworkStateChanged
|
|||
import com.tangem.tap.scope
|
||||
import com.tangem.tap.store
|
||||
import com.tangem.tap.tangemSdkManager
|
||||
import com.tangem.wallet.R
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
|
@ -46,11 +47,19 @@ val walletMiddleware: Middleware<AppState> = { dispatch, state ->
|
|||
}
|
||||
}
|
||||
is WalletAction.LoadArtwork -> {
|
||||
scope.launch {
|
||||
store.state.globalState.tapWalletManager.loadArtwork(
|
||||
action.card, action.artworkId
|
||||
)
|
||||
if (action.artworkId != null) {
|
||||
scope.launch {
|
||||
store.state.globalState.tapWalletManager.loadArtwork(
|
||||
action.card, action.artworkId
|
||||
)
|
||||
}
|
||||
} else {
|
||||
val artworkRes = R.drawable.card_default
|
||||
store.dispatch(WalletAction.LoadArtwork.Success(Artwork(
|
||||
artworkId = artworkRes.toString(), artworkResId = artworkRes
|
||||
)))
|
||||
}
|
||||
|
||||
}
|
||||
is WalletAction.CreateWallet -> {
|
||||
scope.launch {
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ package com.tangem.tap.features.wallet.redux
|
|||
|
||||
import com.tangem.blockchain.common.AmountType
|
||||
import com.tangem.common.extensions.isZero
|
||||
import com.tangem.tap.common.extensions.toBitmap
|
||||
import com.tangem.tap.common.extensions.toFiatString
|
||||
import com.tangem.tap.common.extensions.toFormattedCurrencyString
|
||||
import com.tangem.tap.common.extensions.toFormattedString
|
||||
import com.tangem.tap.common.extensions.toQrCode
|
||||
import com.tangem.tap.common.redux.AppState
|
||||
|
|
@ -98,6 +98,9 @@ private fun internalReduce(action: Action, state: AppState): WalletState {
|
|||
null
|
||||
}
|
||||
val amount = action.wallet.amounts[AmountType.Coin]?.value
|
||||
val formattedAmount = amount?.toFormattedCurrencyString(
|
||||
action.wallet.blockchain.decimals(),
|
||||
action.wallet.blockchain.currency)
|
||||
val fiatRate = state.globalState.conversionRates.getRate(action.wallet.blockchain.currency)
|
||||
val fiatAmount = fiatRate?.let { amount?.toFiatString(it, fiatCurrencySymbol) }
|
||||
|
||||
|
|
@ -110,7 +113,7 @@ private fun internalReduce(action: Action, state: AppState): WalletState {
|
|||
currencyData = BalanceWidgetData(
|
||||
BalanceStatus.VerifiedOnline, action.wallet.blockchain.fullName,
|
||||
currencySymbol = action.wallet.blockchain.currency,
|
||||
amount?.toFormattedString(action.wallet.blockchain.decimals()),
|
||||
formattedAmount,
|
||||
token = tokenData,
|
||||
fiatAmount = fiatAmount
|
||||
),
|
||||
|
|
@ -163,13 +166,14 @@ private fun internalReduce(action: Action, state: AppState): WalletState {
|
|||
))
|
||||
}
|
||||
is WalletAction.LoadArtwork.Success -> {
|
||||
newState = newState.copy(cardImage = Artwork(action.artworkId, action.artwork.toBitmap()))
|
||||
newState = newState.copy(cardImage = action.artwork)
|
||||
}
|
||||
is WalletAction.ShowQrCode -> {
|
||||
newState = newState.copy(
|
||||
walletDialog = WalletDialog.QrDialog(
|
||||
newState.addressData?.shareUrl?.toQrCode(),
|
||||
newState.addressData?.shareUrl
|
||||
newState.addressData?.shareUrl,
|
||||
newState.currencyData.currency
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import android.graphics.Bitmap
|
|||
import com.tangem.blockchain.common.Amount
|
||||
import com.tangem.blockchain.common.Wallet
|
||||
import com.tangem.tap.common.entities.Button
|
||||
import com.tangem.tap.common.extensions.toBitmap
|
||||
import com.tangem.tap.common.redux.global.CryptoCurrencyName
|
||||
import com.tangem.tap.features.wallet.models.PendingTransaction
|
||||
import com.tangem.tap.features.wallet.ui.BalanceWidgetData
|
||||
import org.rekotlin.StateType
|
||||
|
|
@ -22,7 +24,10 @@ data class WalletState(
|
|||
) : StateType
|
||||
|
||||
sealed class WalletDialog {
|
||||
data class QrDialog(val qrCode: Bitmap?, val shareUrl: String?) : WalletDialog()
|
||||
data class QrDialog(
|
||||
val qrCode: Bitmap?, val shareUrl: String?, val currencyName: CryptoCurrencyName?
|
||||
) : WalletDialog()
|
||||
|
||||
data class CreatePayIdDialog(val creatingPayIdState: CreatingPayIdState?) : WalletDialog()
|
||||
data class SelectAmountToSendDialog(val amounts: List<Amount>?) : WalletDialog()
|
||||
}
|
||||
|
|
@ -54,5 +59,8 @@ data class AddressData(
|
|||
|
||||
data class Artwork(
|
||||
val artworkId: String,
|
||||
val artwork: Bitmap
|
||||
)
|
||||
val artwork: Bitmap? = null,
|
||||
val artworkResId: Int? = null
|
||||
) {
|
||||
constructor(artworkId: String, artworkBytes: ByteArray) : this(artworkId, artworkBytes.toBitmap())
|
||||
}
|
||||
|
|
@ -52,7 +52,6 @@ class BalanceWidget(
|
|||
fragment.l_token.hide()
|
||||
|
||||
fragment.tv_currency.text = data.currency
|
||||
fragment.tv_currency_symbol.text = "-"
|
||||
fragment.tv_amount.text = ""
|
||||
|
||||
showStatus(R.id.tv_status_loading)
|
||||
|
|
@ -62,7 +61,6 @@ 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)
|
||||
|
|
@ -83,7 +81,6 @@ class BalanceWidget(
|
|||
fragment.tv_fiat_amount.hide()
|
||||
|
||||
fragment.tv_currency.text = data.currency
|
||||
fragment.tv_currency_symbol.text = "-"
|
||||
fragment.tv_amount.text = ""
|
||||
fragment.tv_status_error_message.text = data.errorMessage
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
package com.tangem.tap.features.wallet.ui
|
||||
|
||||
import android.app.Dialog
|
||||
import android.graphics.Bitmap
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.view.animation.AlphaAnimation
|
||||
import android.view.animation.Animation
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.fragment.app.Fragment
|
||||
|
|
@ -35,6 +36,7 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
|
|||
|
||||
private var dialog: Dialog? = null
|
||||
private var snackbar: Snackbar? = null
|
||||
private var artworkId: String? = null
|
||||
|
||||
private lateinit var viewAdapter: PendingTransactionsAdapter
|
||||
|
||||
|
|
@ -99,7 +101,7 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
|
|||
|
||||
setupButtons(state)
|
||||
setupAddressCard(state)
|
||||
setupCardImage(state.cardImage?.artwork)
|
||||
setupCardImage(state.cardImage)
|
||||
|
||||
viewAdapter.submitList(state.pendingTransactions)
|
||||
|
||||
|
|
@ -179,20 +181,36 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
|
|||
}
|
||||
}
|
||||
|
||||
private fun setupCardImage(cardImage: Bitmap?) {
|
||||
if (cardImage != null) {
|
||||
iv_card.setImageBitmap(cardImage)
|
||||
} else {
|
||||
iv_card.setImageDrawable(getDrawable(R.drawable.card_default))
|
||||
private fun setupCardImage(cardImage: Artwork?) {
|
||||
if (cardImage?.artwork != null) {
|
||||
if (cardImage.artworkId != this.artworkId) {
|
||||
prepareShowingCardImage(cardImage.artworkId)
|
||||
iv_card.setImageBitmap(cardImage.artwork)
|
||||
}
|
||||
} else if (cardImage?.artworkResId != null) {
|
||||
if (cardImage.artworkId != this.artworkId) {
|
||||
prepareShowingCardImage(cardImage.artworkId)
|
||||
iv_card.setImageDrawable(getDrawable(cardImage.artworkResId))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun prepareShowingCardImage(artworkId: String) {
|
||||
this.artworkId = artworkId
|
||||
val fadeInAnimation: Animation = AlphaAnimation(0.0f, 1.0f)
|
||||
fadeInAnimation.duration = 400
|
||||
iv_card.startAnimation(fadeInAnimation)
|
||||
iv_card_tangem_logo.hide()
|
||||
}
|
||||
|
||||
private fun handleDialogs(walletDialog: WalletDialog?) {
|
||||
when (walletDialog) {
|
||||
is WalletDialog.QrDialog -> {
|
||||
if (walletDialog.qrCode != null && walletDialog.shareUrl != null) {
|
||||
if (dialog == null) dialog = QrDialog(requireContext()).apply {
|
||||
this.showQr(walletDialog.qrCode, walletDialog.shareUrl)
|
||||
this.showQr(
|
||||
walletDialog.qrCode, walletDialog.shareUrl, walletDialog.currencyName
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package com.tangem.tap.features.wallet.ui.dialogs
|
|||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import com.tangem.tap.common.extensions.hide
|
||||
import com.tangem.tap.common.extensions.show
|
||||
import com.tangem.tap.common.redux.global.CryptoCurrencyName
|
||||
import com.tangem.tap.features.wallet.redux.WalletAction
|
||||
import com.tangem.tap.store
|
||||
import com.tangem.wallet.R
|
||||
|
|
@ -14,12 +17,20 @@ class QrDialog(context: Context) : Dialog(context) {
|
|||
this.setContentView(R.layout.dialog_qrcode)
|
||||
}
|
||||
|
||||
fun showQr(qrCode: Bitmap, shareUrl: String) {
|
||||
fun showQr(qrCode: Bitmap, shareUrl: String, currencyName: CryptoCurrencyName?) {
|
||||
this.setOnDismissListener { store.dispatch(WalletAction.HideQrCode) }
|
||||
this.btn_done?.setOnClickListener { store.dispatch(WalletAction.HideQrCode) }
|
||||
|
||||
this.tv_qr_dialog_address?.text = shareUrl
|
||||
this.iv_qrcode?.setImageBitmap(qrCode)
|
||||
if (currencyName == null) {
|
||||
this.tv_qr_dialog_header.hide()
|
||||
} else {
|
||||
this.tv_qr_dialog_header.show()
|
||||
this.tv_qr_dialog_header.text = context.getString(
|
||||
R.string.wallet_dialog_qr_code_header, currencyName
|
||||
)
|
||||
}
|
||||
super.show()
|
||||
}
|
||||
}
|
||||
|
|
@ -45,10 +45,18 @@ class PreferencesStorage(applicationContext: Application) {
|
|||
return preferences.edit().putString(FIAT_CURRENCIES_KEY, json).apply()
|
||||
}
|
||||
|
||||
fun isFirstLaunch(): Boolean {
|
||||
val isFirst = preferences.contains(FIRST_LAUNCH_CHECK_KEY)
|
||||
if (isFirst) preferences.edit().putInt(FIRST_LAUNCH_CHECK_KEY, System.currentTimeMillis().toInt()).apply()
|
||||
|
||||
return isFirst
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val PREFERENCES_NAME = "tapPrefs"
|
||||
private const val APP_CURRENCY_KEY = "appCurrency"
|
||||
private const val FIAT_CURRENCIES_KEY = "fiatCurrencies"
|
||||
private const val FIRST_LAUNCH_CHECK_KEY = "firstLaunchCheck"
|
||||
}
|
||||
|
||||
}
|
||||
19
app/src/main/res/drawable/card_placeholder.xml
Normal file
19
app/src/main/res/drawable/card_placeholder.xml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle"
|
||||
>
|
||||
|
||||
<corners
|
||||
android:radius="12dp"
|
||||
/>
|
||||
<size
|
||||
android:height="174dp"
|
||||
android:width="328dp"/>
|
||||
<gradient
|
||||
android:startColor="#FFFFFF"
|
||||
android:endColor="#FFFFFF"
|
||||
/>
|
||||
|
||||
|
||||
</shape>
|
||||
51
app/src/main/res/drawable/ic_tangem_pale.xml
Normal file
51
app/src/main/res/drawable/ic_tangem_pale.xml
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="85dp"
|
||||
android:height="23dp"
|
||||
android:viewportWidth="85"
|
||||
android:viewportHeight="23">
|
||||
<path
|
||||
android:pathData="M8.8582,9.0851L8.8582,17.943L12.8198,17.943C12.9734,17.9413 13.1202,17.881 13.2288,17.7752C13.3374,17.6693 13.399,17.5262 13.4008,17.3764L13.4008,9.0851L8.8582,9.0851Z"
|
||||
android:strokeAlpha="0.2"
|
||||
android:fillColor="#000000"
|
||||
android:fillAlpha="0.2"/>
|
||||
<path
|
||||
android:pathData="M-0.0001,17.3764C0.0017,17.5262 0.0633,17.6693 0.1719,17.7752C0.2805,17.881 0.4273,17.9413 0.5809,17.943L4.5425,17.943L4.5425,9.0851L-0.0001,9.0851L-0.0001,17.3764Z"
|
||||
android:strokeAlpha="0.2"
|
||||
android:fillColor="#000000"
|
||||
android:fillAlpha="0.2"/>
|
||||
<path
|
||||
android:pathData="M13.4008,4.5425L13.4008,0.581C13.4008,0.4269 13.3407,0.279 13.2335,0.1701C13.1264,0.0611 12.981,-0 12.8295,-0L0.5716,-0C0.42,-0 0.2748,0.0611 0.1677,0.1701C0.0605,0.279 0.0003,0.4269 0.0003,0.5809L0.0003,4.5425L13.4008,4.5425Z"
|
||||
android:strokeAlpha="0.2"
|
||||
android:fillColor="#000000"
|
||||
android:fillAlpha="0.2"/>
|
||||
<path
|
||||
android:pathData="M34.5977,5.9099C33.7766,5.5658 32.887,5.4118 31.9966,5.4597C30.8197,5.4566 29.6463,5.584 28.4982,5.8393L28.4982,7.8524C29.4135,7.7443 30.3337,7.682 31.2553,7.6659C31.7495,7.6437 32.2444,7.6913 32.725,7.8074C32.8787,7.8529 33.0185,7.9357 33.132,8.048C33.2455,8.1602 33.3292,8.2985 33.3752,8.4506C33.5201,8.9915 33.5814,9.5511 33.5572,10.1101L33.5572,10.7019C32.4712,10.644 31.6064,10.6119 31.0147,10.6119C30.3834,10.5812 29.7541,10.7026 29.1808,10.9657C28.7296,11.2195 28.3926,11.6333 28.238,12.1235C28.0236,12.839 27.9271,13.5838 27.9519,14.3297C27.872,15.29 28.0995,16.2509 28.6022,17.0762C28.8683,17.3789 29.2035,17.6145 29.5801,17.7632C29.9567,17.912 30.3639,17.9698 30.7676,17.9317C31.2423,17.9317 32.7184,17.8931 33.3687,17.044C33.4763,16.909 33.5679,16.7623 33.6418,16.6067L33.7132,17.7387L36.1064,17.7387L36.1064,10.2516C36.1413,9.283 36.0339,8.3146 35.7877,7.3765C35.7005,7.0649 35.5499,6.7742 35.3453,6.522C35.1407,6.2699 34.8863,6.0616 34.5977,5.9099ZM33.5313,13.1397C33.5986,13.8201 33.4818,14.5061 33.1931,15.1273C33.0521,15.3063 32.8592,15.4387 32.6403,15.5068C32.3929,15.576 32.1366,15.6084 31.8796,15.6032C31.4778,15.6542 31.0719,15.5481 30.7481,15.3074C30.5304,14.9384 30.4391,14.5096 30.4879,14.0852C30.4736,13.7432 30.5087,13.4011 30.592,13.069C30.6174,12.9729 30.6628,12.8831 30.7256,12.8055C30.7883,12.7279 30.8668,12.6643 30.9561,12.6188C31.2016,12.5217 31.4661,12.4799 31.73,12.4964L33.5313,12.4964L33.5313,13.1397Z"
|
||||
android:strokeAlpha="0.2"
|
||||
android:fillColor="#000000"
|
||||
android:fillAlpha="0.2"/>
|
||||
<path
|
||||
android:pathData="M55.3049,6.594C55.2553,6.5079 55.2005,6.4253 55.1409,6.3463C54.3521,5.3031 52.4719,5.4595 52.4719,5.4595C51.8508,5.4392 51.24,5.6267 50.7304,5.9942C50.2157,6.4911 49.8835,7.1569 49.7902,7.8784C49.4203,10.4024 49.4203,12.9696 49.7902,15.4937C49.8799,16.2069 50.2027,16.8672 50.7051,17.365C51.2537,17.7733 51.9237,17.9695 52.598,17.9192C52.598,17.9192 52.6358,17.9192 52.661,17.9192C52.661,17.9192 54.3583,18.0561 55.1849,17.1824C55.2012,17.8959 55.1547,18.6096 55.0461,19.3144C55.0182,19.5023 54.9462,19.6802 54.8361,19.8326C54.7261,19.9849 54.5815,20.1071 54.4151,20.1882C53.8897,20.3724 53.3349,20.4498 52.781,20.4163L50.175,20.3707L50.175,22.4114C50.6552,22.5038 51.1396,22.5713 51.6263,22.6136C52.2257,22.6723 52.7936,22.6983 53.3362,22.6983C54.3463,22.7747 55.3564,22.5483 56.245,22.0463C56.5559,21.8246 56.8204,21.5408 57.0231,21.2115C57.2258,20.8822 57.3624,20.5143 57.4249,20.1294C57.627,18.8758 57.7136,17.6052 57.6835,16.3348L57.6835,5.6486L55.3616,5.6486L55.3049,6.594ZM55.0145,14.5093C54.9758,14.8374 54.8179,15.1378 54.5729,15.3502C54.2865,15.5292 53.9541,15.6134 53.6201,15.5916C53.2468,15.6231 52.8725,15.5439 52.5412,15.3633C52.2828,15.0989 52.1337,14.7413 52.1248,14.3657C51.9818,12.5997 51.9818,10.8245 52.1248,9.0585C52.1338,8.6951 52.2784,8.3493 52.5286,8.0936C52.8663,7.9194 53.244,7.8449 53.6201,7.8784C53.9759,7.8488 54.3306,7.9479 54.6234,8.1587C54.884,8.4425 55.0402,8.8116 55.0651,9.202C55.1605,10.0392 55.1984,10.8825 55.1786,11.7253C55.2099,12.6565 55.1549,13.5888 55.0145,14.5093Z"
|
||||
android:strokeAlpha="0.2"
|
||||
android:fillColor="#000000"
|
||||
android:fillAlpha="0.2"/>
|
||||
<path
|
||||
android:pathData="M67.37,5.8543C66.5472,5.3764 65.602,5.1622 64.6578,5.2394C63.6765,5.1698 62.6971,5.3974 61.8428,5.8936C61.2207,6.3502 60.8022,7.0395 60.6795,7.8102C60.4764,9.0681 60.3902,10.3429 60.4223,11.6173C60.3887,12.8945 60.4792,14.172 60.6923,15.431C60.7581,15.8119 60.899,16.1751 61.1067,16.499C61.3144,16.8228 61.5844,17.1004 61.9005,17.3149C62.8018,17.7881 63.8132,18.0007 64.8249,17.9297C65.4691,17.9282 66.1127,17.8911 66.753,17.8186C67.2841,17.7691 67.8106,17.6773 68.3276,17.5439L68.3276,15.4963C67.145,15.6206 66.1745,15.6861 65.4161,15.6861C64.8559,15.7195 64.2945,15.6508 63.758,15.4833C63.5929,15.4116 63.4476,15.2995 63.3355,15.1568C63.2233,15.0141 63.1477,14.8453 63.1153,14.6656C62.9999,13.9435 62.9526,13.212 62.974,12.4808L68.5847,12.4808L68.5847,11.5911C68.6155,10.2796 68.5489,8.9676 68.3855,7.6663C68.2935,6.9501 67.9288,6.2994 67.37,5.8543ZM66.1489,10.5446L62.974,10.5446C62.9735,9.8663 63.0186,9.1887 63.1089,8.5167C63.1214,8.3568 63.1667,8.2014 63.242,8.0606C63.3173,7.9197 63.4208,7.7965 63.5459,7.699C64.2058,7.429 64.9426,7.429 65.6025,7.699C65.7245,7.7998 65.8251,7.9249 65.898,8.0666C65.9709,8.2084 66.0148,8.3637 66.0268,8.5232C66.1267,9.1919 66.1675,9.8685 66.1489,10.5446Z"
|
||||
android:strokeAlpha="0.2"
|
||||
android:fillColor="#000000"
|
||||
android:fillAlpha="0.2"/>
|
||||
<path
|
||||
android:pathData="M84.4694,7.2678C84.361,6.7352 84.0719,6.2549 83.6499,5.9063C83.1446,5.5763 82.544,5.4184 81.9394,5.4568C81.9394,5.4568 81.8808,5.4568 81.8418,5.4568C81.8418,5.4568 79.8906,5.3477 79.0841,6.3367C78.9963,6.4479 78.9181,6.5659 78.85,6.6898C78.72,6.3567 78.4938,6.0688 78.1996,5.8615C77.6917,5.5696 77.1082,5.4311 76.5215,5.4633C76.5215,5.4633 74.5703,5.3477 73.7638,6.3431C73.6737,6.4527 73.5952,6.5709 73.5296,6.6962L73.4646,5.6559L71.0905,5.6559L71.0905,17.716L73.6922,17.716L73.6922,11.4291C73.6786,10.6746 73.7069,9.92 73.7768,9.1686C73.7935,8.7987 73.9328,8.4444 74.1735,8.1604C74.4611,7.9273 74.8308,7.8164 75.2011,7.8521C75.5304,7.826 75.8607,7.8881 76.1572,8.032C76.2668,8.136 76.3543,8.2605 76.4146,8.3983C76.4749,8.5362 76.5069,8.6846 76.5085,8.8347C76.5769,9.5776 76.6051,10.3236 76.5929,11.0694L76.5929,17.716L79.1946,17.716L79.1946,11.4291C79.1946,10.3823 79.1946,9.631 79.2727,9.1686C79.2901,8.7965 79.4345,8.4411 79.6824,8.1604C79.9763,7.9296 80.349,7.8192 80.7231,7.8521C81.0545,7.8261 81.3868,7.8882 81.6857,8.032C81.7941,8.1366 81.8804,8.2613 81.9396,8.3991C81.9988,8.5369 82.0296,8.685 82.0304,8.8347C82.1023,9.5774 82.1304,10.3235 82.1149,11.0694L82.1149,17.716L84.7165,17.716L84.7165,9.7722C84.7311,8.9308 84.6482,8.0906 84.4694,7.2678Z"
|
||||
android:strokeAlpha="0.2"
|
||||
android:fillColor="#000000"
|
||||
android:fillAlpha="0.2"/>
|
||||
<path
|
||||
android:pathData="M46.1586,5.9208C45.6159,5.5766 44.9731,5.4142 44.3272,5.4583C44.3272,5.4583 44.2744,5.4583 44.2481,5.4583C44.2481,5.4583 42.2715,5.3555 41.4612,6.3385C41.4035,6.4077 41.3506,6.4806 41.303,6.5568L41.2437,5.651L38.839,5.651L38.839,17.716L41.4744,17.716L41.4744,11.4265C41.4604,10.676 41.4889,9.9254 41.5599,9.178C41.5794,8.8049 41.7282,8.4493 41.9817,8.1693C42.2996,7.9274 42.7,7.8126 43.1017,7.8481C43.4522,7.8233 43.8035,7.8852 44.1229,8.028C44.2415,8.1308 44.3372,8.2563 44.4041,8.3966C44.4709,8.5369 44.5074,8.6892 44.5115,8.8439C44.5869,9.5825 44.6178,10.3247 44.6039,11.0667L44.6039,17.716L47.2392,17.716L47.2392,9.8847C47.26,9.0231 47.1871,8.1617 47.0218,7.315C46.9141,6.7647 46.6079,6.27 46.1586,5.9208Z"
|
||||
android:strokeAlpha="0.2"
|
||||
android:fillColor="#000000"
|
||||
android:fillAlpha="0.2"/>
|
||||
<path
|
||||
android:pathData="M24.7705,2.0442L22.1017,2.0442L22.1017,5.5032L20.4412,5.5032L20.4412,7.7142L22.1017,7.7142L22.1017,17.7159L24.7705,17.7159L24.7705,7.7142L26.8008,7.7142L26.8008,5.5032L24.7705,5.5032L24.7705,2.0442Z"
|
||||
android:strokeAlpha="0.2"
|
||||
android:fillColor="#000000"
|
||||
android:fillAlpha="0.2"/>
|
||||
</vector>
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
android:paddingTop="12dp"
|
||||
android:text="@string/wallet_pay_id_address"
|
||||
android:textColor="@color/darkGray4"
|
||||
android:textSize="13sp"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/til_payid"
|
||||
app:layout_constraintStart_toEndOf="@id/til_payid"
|
||||
app:layout_constraintTop_toTopOf="@id/til_payid" />
|
||||
|
|
@ -65,7 +65,7 @@
|
|||
android:paddingStart="24dp"
|
||||
android:paddingEnd="24dp"
|
||||
android:text="@string/wallet_dialog_pay_id_description"
|
||||
android:textColor="@color/darkGray4"
|
||||
android:textColor="@color/darkGray1"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
android:paddingBottom="8dp"
|
||||
android:text="@string/wallet_dialog_pay_id_button"
|
||||
android:textColor="@color/blue"
|
||||
android:textSize="16sp"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="280dp"
|
||||
android:layout_height="280dp"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_qr_dialog_header"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Bitcoin wallet"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingEnd="24dp"
|
||||
android:textColor="@color/textGray"
|
||||
android:textSize="17sp"
|
||||
android:textStyle="bold"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_qrcode"
|
||||
android:layout_width="162dp"
|
||||
android:layout_height="162dp"
|
||||
android:layout_width="206dp"
|
||||
android:layout_height="206dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="24dp" />
|
||||
android:layout_marginTop="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_qr_dialog_address"
|
||||
|
|
@ -18,11 +32,9 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:textSize="12sp"
|
||||
android:textColor="@color/darkGray6"
|
||||
android:ellipsize="middle"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="24dp"
|
||||
android:singleLine="true"/>
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="24dp"/>
|
||||
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
|
|
@ -38,9 +50,8 @@
|
|||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="@string/generic_done"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/blue"
|
||||
android:textSize="16sp" />
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -4,7 +4,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_home_card"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -16,7 +15,6 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_home_circle"
|
||||
android:layout_width="374dp"
|
||||
|
|
@ -62,32 +60,39 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/iv_home_card" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_yes"
|
||||
style="@style/TapButton"
|
||||
android:layout_width="93dp"
|
||||
android:id="@+id/btn_shop"
|
||||
style="@style/TapBlackButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="30dp"
|
||||
android:layout_marginBottom="33dp"
|
||||
android:text="@string/home_button_yes"
|
||||
android:text="@string/home_button_no_card"
|
||||
app:icon="@drawable/ic_shop"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/btn_shop"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintGuide_percent="0.37" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_shop"
|
||||
style="@style/TapBlackButton"
|
||||
android:layout_width="200dp"
|
||||
android:id="@+id/btn_yes"
|
||||
style="@style/TapButtonWithIcon"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="7dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginBottom="33dp"
|
||||
android:text="@string/home_button_shop"
|
||||
app:icon="@drawable/ic_shop"
|
||||
android:text="@string/home_button_yes"
|
||||
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_yes" />
|
||||
app:layout_constraintStart_toEndOf="@+id/guideline" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -73,32 +73,37 @@
|
|||
android:layout_marginBottom="24dp"
|
||||
tools:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/llBottomButtonContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="18dp"
|
||||
android:layout_marginEnd="18dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Space
|
||||
android:layout_width="100.5dp"
|
||||
android:layout_height="wrap_content" />
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintGuide_percent="0.37" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/flSendButtonContainer"
|
||||
android:layout_width="wrap_content"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:layout_width="0dp"
|
||||
android:paddingBottom="33dp"
|
||||
android:clipToPadding="false"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toEndOf="@+id/guideline"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginEnd="30dp"
|
||||
android:layout_marginStart="8dp">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btnSend"
|
||||
style="@style/TapButtonWithIcon"
|
||||
android:layout_width="200dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:fontFamily="@font/saira_semi_condensed_regular"
|
||||
android:text="@string/send_btn_send"
|
||||
|
|
@ -115,7 +120,7 @@
|
|||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -49,14 +49,28 @@
|
|||
android:id="@+id/iv_card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxHeight="215dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="38dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:elevation="3dp"
|
||||
android:elevation="4dp"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/card_default"
|
||||
android:src="@drawable/card_placeholder"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_card_tangem_logo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_tangem_pale"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_card"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_card"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_card"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_card"
|
||||
android:elevation="6dp"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_pending_transaction"
|
||||
|
|
@ -86,34 +100,41 @@
|
|||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_scan"
|
||||
style="@style/TapBlackButton"
|
||||
android:layout_width="93dp"
|
||||
android:layout_width="0dp"
|
||||
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_confirm"
|
||||
app:layout_constraintEnd_toStartOf="@+id/guideline"
|
||||
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" />
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/guideline"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintGuide_percent="0.37" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_confirm"
|
||||
style="@style/TapButtonWithIcon"
|
||||
android:layout_width="200dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginStart="7dp"
|
||||
android:layout_marginStart="8dp"
|
||||
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_constraintStart_toEndOf="@+id/guideline"
|
||||
app:layout_constraintTop_toBottomOf="@id/l_address"
|
||||
app:layout_constraintVertical_bias="1" />
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
android:paddingEnd="16dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/darkGray1"
|
||||
android:textSize="12sp"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintEnd_toStartOf="@id/btn_copy"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -48,10 +48,10 @@
|
|||
android:paddingStart="16dp"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingBottom="30dp"
|
||||
android:paddingBottom="25dp"
|
||||
android:text="@string/wallet_explore_address"
|
||||
android:textColor="@color/darkGray6"
|
||||
android:textSize="12sp"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
app:drawableEndCompat="@drawable/ic_angle_bracket_right"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -111,10 +111,9 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="83dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@color/lightGray5"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_explore" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_payid_icon"
|
||||
|
|
@ -133,7 +132,7 @@
|
|||
android:padding="16dp"
|
||||
android:text="@string/wallet_create_payid"
|
||||
android:textColor="@color/darkGray6"
|
||||
android:textSize="12sp"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
app:drawableEndCompat="@drawable/ic_angle_bracket_right"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
|
@ -147,7 +146,7 @@
|
|||
android:padding="16dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/darkGray1"
|
||||
android:textSize="12sp"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintHorizontal_bias="1"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_payid_icon"
|
||||
android:textAlignment="textEnd"
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
android:paddingEnd="16dp"
|
||||
android:text="@string/wallet_verified_balance"
|
||||
android:textColor="@color/accent"
|
||||
android:textSize="12sp"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="@drawable/ic_ok"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -47,7 +47,7 @@
|
|||
android:paddingEnd="16dp"
|
||||
android:text="@string/wallet_blockchain_is_unreachable"
|
||||
android:textColor="@color/warning"
|
||||
android:textSize="12sp"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone"
|
||||
app:drawableStartCompat="@drawable/ic_warning_small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
|
@ -61,7 +61,7 @@
|
|||
android:paddingTop="4dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textColor="@color/darkGray2"
|
||||
android:textSize="12sp"
|
||||
android:textSize="14sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_status_error" />
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
android:paddingEnd="16dp"
|
||||
android:text="@string/wallet_balance_is_loading"
|
||||
android:textColor="@color/darkGray6"
|
||||
android:textSize="12sp"
|
||||
android:textSize="13sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_currency" />
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
android:id="@+id/tv_amount"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="end|bottom"
|
||||
android:maxLines="1"
|
||||
|
|
@ -104,27 +104,12 @@
|
|||
app:autoSizeMinTextSize="12sp"
|
||||
app:autoSizeStepGranularity="1sp"
|
||||
app:autoSizeTextType="uniform"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_currency_symbol"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintStart_toEndOf="@id/tv_currency"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_currency_symbol"
|
||||
tools:text="0.43" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_currency_symbol"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:paddingTop="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="BTC" />
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_currency"
|
||||
tools:text="0.43 BTC" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_fiat_amount"
|
||||
|
|
@ -134,11 +119,24 @@
|
|||
android:paddingTop="4dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textColor="@color/darkGray2"
|
||||
android:textSize="12sp"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_amount"
|
||||
tools:text="USD 3 588" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_placeholder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_amount"
|
||||
tools:text="USD 3 588"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
|
||||
<include
|
||||
android:id="@+id/l_token"
|
||||
|
|
|
|||
|
|
@ -12,17 +12,17 @@
|
|||
android:layout_marginBottom="2dp"
|
||||
android:text="@string/wallet_tokens"
|
||||
android:textColor="@color/darkGray1"
|
||||
android:textSize="12sp"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<View
|
||||
android:id="@+id/v_token_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_height="0dp"
|
||||
android:background="@color/backgroundGray"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_token_title" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_token_title"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tv_token_fiat_amount"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_token_symbol"
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:textColor="@color/darkGray6"
|
||||
android:textSize="13sp"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toStartOf="@id/v_token_background"
|
||||
app:layout_constraintTop_toTopOf="@id/v_token_background"
|
||||
tools:text="Noddle" />
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:textColor="@color/darkGray6"
|
||||
android:textSize="13sp"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="@id/v_token_background"
|
||||
app:layout_constraintTop_toTopOf="@id/v_token_background"
|
||||
tools:text="12.345 NDL" />
|
||||
|
|
@ -57,9 +57,9 @@
|
|||
android:paddingStart="16dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:textColor="@color/darkGray2"
|
||||
android:textSize="12sp"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="@id/v_token_background"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_token_amount"
|
||||
tools:text="USD 3 588" />
|
||||
|
|
|
|||
|
|
@ -12,8 +12,11 @@
|
|||
<string name="notification_no_internet_retry">@string/generic_retry</string>
|
||||
|
||||
<string name="home_do_you_have_card">Welcome to Tangem.\nDo you have one of our cards?</string>
|
||||
<string name="home_welcome_back">Welcome back to Tangem Tap. \nScan your card to start.</string>
|
||||
<string name="home_button_yes">Yes!</string>
|
||||
<string name="home_button_shop">No. Go to shop</string>
|
||||
<string name="home_button_scan">Scan card</string>
|
||||
<string name="home_button_shop">Shop</string>
|
||||
<string name="home_button_no_card">No</string>
|
||||
|
||||
<string name="wallet_toolbar_title" translatable="false">Tangem Tap</string>
|
||||
<string name="wallet_button_scan">Scan</string>
|
||||
|
|
@ -40,6 +43,7 @@
|
|||
<string name="wallet_dialog_pay_id_hint">PayID name</string>
|
||||
<string name="wallet_pay_id_address" translatable="false">$payid.tangem.com</string>
|
||||
<string name="wallet_dialog_pay_id_description">Your PayID is information unique to you, like your phone number, email or ABN.</string>
|
||||
<string name="wallet_dialog_qr_code_header">%s wallet</string>
|
||||
|
||||
|
||||
<string name="error_payid_already_created">This PayID already exists. Try a different one.</string>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
<style name="TapButton">
|
||||
<item name="android:insetTop">0dp</item>
|
||||
<item name="android:insetBottom">0dp</item>
|
||||
<item name="android:textSize">14sp</item>
|
||||
<item name="android:textSize">15sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
<item name="android:textColor">@color/btn_tap_text_color</item>
|
||||
<item name="android:textAllCaps">false</item>
|
||||
|
|
@ -35,6 +35,7 @@
|
|||
<item name="android:fontFamily">@font/saira_semi_condensed_regular</item>
|
||||
<item name="android:layout_width">93dp</item>
|
||||
<item name="android:layout_height">48dp</item>
|
||||
<item name="elevation">3dp</item>
|
||||
</style>
|
||||
|
||||
<style name="TapButtonWithIcon" parent="TapButton">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue