Updated on 2026-08-14

This commit is contained in:
Tangem 2022-08-19 15:12:01 +03:00
parent c255d59373
commit c69a6b5a05
2 changed files with 9 additions and 15 deletions

View file

@ -12,12 +12,10 @@ internal class WalletDetailsButtonsRow @JvmOverloads constructor(
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
) : LinearLayout(context, attrs, defStyleAttr) {
private val binding = ViewWalletDetailsButtonsRowBinding.inflate(
LayoutInflater.from(context),
this,
)
var onBuyClick: (() -> Unit)? = null
var onSellClick: (() -> Unit)? = null
var onTradeClick: (() -> Unit)? = null
@ -40,16 +38,12 @@ internal class WalletDetailsButtonsRow @JvmOverloads constructor(
sellAllowed: Boolean,
sendAllowed: Boolean,
) = with(binding) {
if (exchangeServiceFeatureOn) {
btnBuy.isVisible = (buyAllowed && !sellAllowed) || (!buyAllowed && !sellAllowed)
btnBuy.isEnabled = buyAllowed
btnSell.isVisible = !buyAllowed && sellAllowed
btnTrade.isVisible = buyAllowed && sellAllowed
} else {
btnBuy.isVisible = false
btnSell.isVisible = false
btnTrade.isVisible = false
}
containerExchangeButtons.isVisible = exchangeServiceFeatureOn
btnBuy.isVisible = (buyAllowed && !sellAllowed) || (!buyAllowed && !sellAllowed)
btnBuy.isEnabled = buyAllowed
btnSell.isVisible = !buyAllowed && sellAllowed
btnTrade.isVisible = buyAllowed && sellAllowed
btnSend.isEnabled = sendAllowed
}
}

View file

@ -8,6 +8,7 @@
tools:parentTag="android.widget.LinearLayout">
<FrameLayout
android:id="@+id/container_exchange_buttons"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp"
@ -21,7 +22,7 @@
android:text="@string/wallet_button_trade"
android:visibility="gone"
app:icon="@drawable/ic_arrows_up_down"
tools:visibility="visible" />
/>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_buy"
@ -38,7 +39,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/wallet_button_sell"
android:visibility="gone"
android:visibility="visible"
app:icon="@drawable/ic_arrow_down" />
</FrameLayout>
@ -48,7 +49,6 @@
android:id="@+id/btn_send"
style="@style/TapButtonWithIcon"
android:layout_width="0dp"
android:layout_marginStart="6dp"
android:layout_weight="1"
android:text="@string/wallet_button_send"
app:icon="@drawable/ic_send" />