Updated on 2026-08-14

This commit is contained in:
Tangem 2020-06-17 09:55:24 +00:00
commit f7ca9c16ae
6 changed files with 20 additions and 11 deletions

View file

@ -2,6 +2,8 @@ package com.tangem.data;
import com.tangem.tangem_sdk.R;
import java.util.EnumSet;
/**
* Created by dvol on 06.08.2017.
*/
@ -36,6 +38,8 @@ public enum Blockchain {
FlowDemo("FLOW/demo", "", 1.0, R.drawable.tangem2, "Flow demo"),
TokenEmv("TTW", "ETH", 1.0, R.drawable.ic_logo_ethereum, "Ethereum");
static private EnumSet<Blockchain> payIdSupported = EnumSet.of(Blockchain.Ripple, Blockchain.Ethereum, Blockchain.Bitcoin);
Blockchain(String ID, String currency, double multiplier, int imageResource, String officialName) {
mID = ID;
mCurrency = currency;
@ -126,4 +130,8 @@ public enum Blockchain {
return scheme;
}
public Boolean isPayIdSupported() {
return payIdSupported.contains(this);
}
}

View file

@ -66,7 +66,6 @@ class LoadedWalletFragment : BaseFragment(), NavigationResultListener, NfcAdapte
companion object {
val TAG: String = LoadedWalletFragment::class.java.simpleName
const val PAY_ID_TANGEM = "\$payid.tangem.com"
val payIdSupported = setOf(Blockchain.Ripple, Blockchain.Ethereum, Blockchain.Bitcoin)
}
override val layoutId = R.layout.fr_loaded_wallet
@ -156,7 +155,7 @@ class LoadedWalletFragment : BaseFragment(), NavigationResultListener, NfcAdapte
getString(R.string.loaded_wallet_load_via_qr)
)
if (payIdSupported.contains(ctx.blockchain)) {
if (ctx.blockchain.isPayIdSupported) {
ivPayId.visibility = View.VISIBLE
ivPayId.imageAlpha = 100
ivPayId.setOnClickListener { createPayIdDialog() }

View file

@ -17,7 +17,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center">
android:gravity="center"
android:layout_marginTop="40dp">
<EditText
android:id="@+id/etPayId"

View file

@ -148,6 +148,7 @@
android:id="@+id/ivPayId"
android:layout_width="80dp"
android:layout_height="30dp"
android:layout_marginBottom="0.5dp"
android:layout_marginStart="24dp"
android:src="@drawable/ic_payid_logo_dark"
android:visibility="gone"/>

View file

@ -116,11 +116,11 @@
<string name="loaded_wallet_load_via_qr">Show QR-code</string>
<string name="loaded_wallet_dialog_show_qr">LOAD</string>
<string name="loaded_wallet_create_pay_id">Create Pay ID</string>
<string name="loaded_wallet_create_pay_id">Create PayID</string>
<string name="create_pay_id_create">Create</string>
<string name="create_pay_id_empty">Enter Pay ID first</string>
<string name="create_pay_id_success">New Pay ID was created</string>
<string name="create_pay_id_error">Error creating Pay ID</string>
<string name="create_pay_id_empty">Enter PayID first</string>
<string name="create_pay_id_success">New PayID was created</string>
<string name="create_pay_id_error">Error creating PayID</string>
<!-- LoadedWallet Blockchain Engines -->
@ -189,6 +189,7 @@
<!-- PrepareTransaction -->
<string name="prepare_transaction_hint_enter_address">enter wallet address</string>
<string name="prepare_transaction_hint_address_or_pay_id">Address or PayID</string>
<string name="prepare_transaction_hint_enter_amount">enter amount</string>
<string name="prepare_transaction_btn_verify">Verify</string>
<string name="prepare_transaction_error_not_enough_funds">Not enough funds</string>

View file

@ -2,7 +2,6 @@ package com.tangem.ui
import android.app.Activity
import android.content.Context
import android.net.Uri
import android.nfc.NfcAdapter
import android.nfc.Tag
import android.os.Build
@ -13,7 +12,6 @@ import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import android.widget.Toast
import com.tangem.Constant
import com.tangem.data.Blockchain
import com.tangem.ui.activity.MainActivity
import com.tangem.ui.fragment.BaseFragment
import com.tangem.ui.fragment.qr.CameraPermissionManager
@ -24,7 +22,6 @@ import com.tangem.wallet.R
import com.tangem.wallet.TangemContext
import kotlinx.android.synthetic.tangemAccess.fragment_prepare_transaction.*
import java.io.IOException
import java.util.*
class PrepareTransactionFragment : BaseFragment(), NavigationResultListener, NfcAdapter.ReaderCallback {
companion object {
@ -48,6 +45,8 @@ class PrepareTransactionFragment : BaseFragment(), NavigationResultListener, Nfc
Html.fromHtml(engine!!.balanceHTML)
tvBalance.text = html
if (ctx.blockchain.isPayIdSupported) etWallet.hint = getString(R.string.prepare_transaction_hint_address_or_pay_id)
if (!engine.allowSelectFeeInclusion()) {
rgIncFee.visibility = View.INVISIBLE
} else {
@ -86,7 +85,7 @@ class PrepareTransactionFragment : BaseFragment(), NavigationResultListener, Nfc
}
btnVerify.setOnClickListener {
if (!UtilHelper.isOnline(context!!)) {
if (!UtilHelper.isOnline(requireContext())) {
Toast.makeText(context, R.string.general_error_no_connection, Toast.LENGTH_LONG).show()
return@setOnClickListener
}