Updated on 2026-08-14

This commit is contained in:
Tangem 2020-09-22 12:15:12 +03:00
parent c2876c2fed
commit 9a14c11e33
2 changed files with 14 additions and 5 deletions

View file

@ -21,7 +21,11 @@ data class WalletState(
val payIdData: PayIdData = PayIdData(),
val walletDialog: WalletDialog? = null,
val mainButton: WalletMainButton = WalletMainButton.SendButton(false)
) : StateType
) : StateType {
val showDetails: Boolean =
currencyData.status != com.tangem.tap.features.wallet.ui.BalanceStatus.EmptyCard &&
currencyData.status != com.tangem.tap.features.wallet.ui.BalanceStatus.UnknownBlockchain
}
sealed class WalletDialog {
data class QrDialog(

View file

@ -3,18 +3,17 @@ package com.tangem.tap.features.wallet.ui
import android.app.Dialog
import android.os.Bundle
import android.view.Menu
import android.view.Menu.NONE
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
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.transition.TransitionInflater
import com.google.android.material.snackbar.Snackbar
import com.tangem.tap.common.extensions.getDrawable
import com.squareup.picasso.Picasso
import com.tangem.tap.common.extensions.hide
import com.tangem.tap.common.extensions.show
import com.tangem.tap.common.redux.navigation.AppScreen
@ -93,6 +92,12 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
override fun newState(state: WalletState) {
if (activity == null) return
if (!state.showDetails) {
toolbar.menu.removeItem(R.id.details_menu)
} else if (toolbar.menu.findItem(R.id.details_menu) == null) {
toolbar.menu.add(R.menu.wallet, R.id.details_menu, NONE, R.string.details_toolbar_title)
}
srl_wallet.setOnRefreshListener {
store.dispatch(WalletAction.LoadData)
}
@ -255,7 +260,7 @@ class WalletFragment : Fragment(R.layout.fragment_wallet), StoreSubscriber<Walle
}
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
inflater.inflate(R.menu.wallet, menu)
if (store.state.walletState.showDetails) inflater.inflate(R.menu.wallet, menu)
}
}