From 44abb99a9f0a66c56882b628532523b9a2d59fe0 Mon Sep 17 00:00:00 2001 From: Tangem Date: Tue, 24 Jul 2018 13:38:42 +0300 Subject: [PATCH] Updated on 2026-08-14 --- .../activity/CreateNewWalletActivity.java | 2 +- .../activity/EmptyWalletActivity.java | 4 +- .../presentation/activity/PurgeActivity.java | 4 +- .../presentation/activity/QRScanActivity.java | 7 +- .../activity/SignPaymentActivity.java | 2 +- .../activity/SwapPINActivity.java | 87 +------------------ .../dialog/NoExtendedLengthSupportDialog.java | 4 +- .../presentation/fragment/LoadedWallet.kt | 5 +- .../tangem/presentation/fragment/Main.java | 2 +- .../presentation/fragment/VerifyCard.java | 2 +- app/src/main/res/values/strings.xml | 2 + 11 files changed, 18 insertions(+), 103 deletions(-) diff --git a/app/src/main/java/com/tangem/presentation/activity/CreateNewWalletActivity.java b/app/src/main/java/com/tangem/presentation/activity/CreateNewWalletActivity.java index 1e48bb63a7..461deccd2e 100644 --- a/app/src/main/java/com/tangem/presentation/activity/CreateNewWalletActivity.java +++ b/app/src/main/java/com/tangem/presentation/activity/CreateNewWalletActivity.java @@ -158,7 +158,7 @@ public class CreateNewWalletActivity extends AppCompatActivity implements NfcAda } else { progressBar.post(() -> { if (cardProtocol.getError() instanceof CardProtocol.TangemException_ExtendedLengthNotSupported) { - if (!NoExtendedLengthSupportDialog.allreadyShowed) { + if (!NoExtendedLengthSupportDialog.allReadyShowed) { new NoExtendedLengthSupportDialog().show(getFragmentManager(), NoExtendedLengthSupportDialog.TAG); } } else { diff --git a/app/src/main/java/com/tangem/presentation/activity/EmptyWalletActivity.java b/app/src/main/java/com/tangem/presentation/activity/EmptyWalletActivity.java index 42f770a0c7..5a998dc7b0 100644 --- a/app/src/main/java/com/tangem/presentation/activity/EmptyWalletActivity.java +++ b/app/src/main/java/com/tangem/presentation/activity/EmptyWalletActivity.java @@ -85,7 +85,7 @@ public class EmptyWalletActivity extends AppCompatActivity implements NfcAdapter if (mCard.getPauseBeforePIN2() > 0 && (mCard.useDefaultPIN2() || !mCard.useSmartSecurityDelay())) { ivPIN2orSecurityDelay.setImageResource(R.drawable.timer); - ivPIN2orSecurityDelay.setOnClickListener(v -> Toast.makeText(EmptyWalletActivity.this, String.format("This banknote will enforce %.0f seconds security delay for all operations requiring PIN2 code", mCard.getPauseBeforePIN2() / 1000.0), Toast.LENGTH_LONG).show()); + ivPIN2orSecurityDelay.setOnClickListener(v -> Toast.makeText(EmptyWalletActivity.this, String.format(getString(R.string.this_banknote_will_enforce), mCard.getPauseBeforePIN2() / 1000.0), Toast.LENGTH_LONG).show()); } else if (mCard.useDefaultPIN2()) { ivPIN2orSecurityDelay.setImageResource(R.drawable.unlock_pin2); @@ -232,7 +232,7 @@ public class EmptyWalletActivity extends AppCompatActivity implements NfcAdapter progressBar.post(() -> { lastReadSuccess = false; if (cardProtocol.getError() instanceof CardProtocol.TangemException_ExtendedLengthNotSupported) { - if (!NoExtendedLengthSupportDialog.allreadyShowed) { + if (!NoExtendedLengthSupportDialog.allReadyShowed) { new NoExtendedLengthSupportDialog().show(getFragmentManager(), NoExtendedLengthSupportDialog.TAG); } } else { diff --git a/app/src/main/java/com/tangem/presentation/activity/PurgeActivity.java b/app/src/main/java/com/tangem/presentation/activity/PurgeActivity.java index 7578d18193..e0cfdd1076 100644 --- a/app/src/main/java/com/tangem/presentation/activity/PurgeActivity.java +++ b/app/src/main/java/com/tangem/presentation/activity/PurgeActivity.java @@ -179,7 +179,7 @@ public class PurgeActivity extends AppCompatActivity implements NfcAdapter.Reade purgeTask = new PurgeTask(this, mCard, mNfcManager, isoDep, this); purgeTask.start(); } else { - Log.d(TAG, "Mismatch card UID (" + sUID + " instead of " + mCard.getUID() + ")"); +// Log.d(TAG, "Mismatch card UID (" + sUID + " instead of " + mCard.getUID() + ")"); mNfcManager.ignoreTag(isoDep.getTag()); return; } @@ -252,7 +252,7 @@ public class PurgeActivity extends AppCompatActivity implements NfcAdapter.Reade } else { progressBar.post(() -> { if (cardProtocol.getError() instanceof CardProtocol.TangemException_ExtendedLengthNotSupported) { - if (!NoExtendedLengthSupportDialog.allreadyShowed) { + if (!NoExtendedLengthSupportDialog.allReadyShowed) { new NoExtendedLengthSupportDialog().show(getFragmentManager(), NoExtendedLengthSupportDialog.TAG); } } else diff --git a/app/src/main/java/com/tangem/presentation/activity/QRScanActivity.java b/app/src/main/java/com/tangem/presentation/activity/QRScanActivity.java index 184b31243a..6d67c641da 100644 --- a/app/src/main/java/com/tangem/presentation/activity/QRScanActivity.java +++ b/app/src/main/java/com/tangem/presentation/activity/QRScanActivity.java @@ -7,7 +7,6 @@ import android.content.pm.PackageManager; import android.os.Bundle; import android.support.v4.app.ActivityCompat; import android.support.v7.app.AppCompatActivity; -import android.util.Log; import com.google.zxing.Result; @@ -22,7 +21,7 @@ public class QRScanActivity extends AppCompatActivity implements ZXingScannerVie super.onCreate(savedInstanceState); //setContentView(R.layout.activity_qrscan); if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { - Log.e("QRScanActivity", "User hasn't granted permission to use camera"); +// Log.e("QRScanActivity", "User hasn't granted permission to use camera"); ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.CAMERA}, 1); } else { runScanner(); @@ -44,13 +43,13 @@ public class QRScanActivity extends AppCompatActivity implements ZXingScannerVie if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - Log.i("QRScanActivity", "permission was granted"); +// Log.i("QRScanActivity", "permission was granted"); // permission was granted, yay! Do the // contacts-related task you need to do. runScanner(); } else { - Log.e("QRScanActivity", "permission denied"); +// Log.e("QRScanActivity", "permission denied"); setResult(Activity.RESULT_CANCELED); finish(); diff --git a/app/src/main/java/com/tangem/presentation/activity/SignPaymentActivity.java b/app/src/main/java/com/tangem/presentation/activity/SignPaymentActivity.java index e2a789bded..9b917748fe 100644 --- a/app/src/main/java/com/tangem/presentation/activity/SignPaymentActivity.java +++ b/app/src/main/java/com/tangem/presentation/activity/SignPaymentActivity.java @@ -1 +1 @@ -package com.tangem.presentation.activity; import android.app.Activity; import android.content.Intent; import android.content.res.ColorStateList; import android.graphics.Color; import android.nfc.NfcAdapter; import android.nfc.Tag; import android.nfc.tech.IsoDep; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.tangem.data.nfc.SignPaymentTask; import com.tangem.domain.cardReader.CardProtocol; import com.tangem.domain.cardReader.NfcManager; import com.tangem.domain.wallet.TangemCard; import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog; import com.tangem.presentation.dialog.WaitSecurityDelayDialog; import com.tangem.util.Util; import com.tangem.wallet.R; public class SignPaymentActivity extends AppCompatActivity implements NfcAdapter.ReaderCallback, CardProtocol.Notifications { public static final String EXTRA_AMOUNT = "Amount"; public static final int REQUEST_CODE_SEND_PAYMENT = 1; public static final int RESULT_INVALID_PIN = Activity.RESULT_FIRST_USER; private TangemCard mCard; private TextView tvCardID; private NfcManager mNfcManager; private static final String logTag = "SignPayment"; private ProgressBar progressBar; private SignPaymentTask signPaymentTask; private String amountStr; private String feeStr; private String outAddressStr; private boolean lastReadSuccess = true; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_payment); MainActivity.commonInit(getApplicationContext()); mCard = new TangemCard(getIntent().getStringExtra("UID")); mCard.LoadFromBundle(getIntent().getExtras().getBundle("Card")); amountStr = getIntent().getStringExtra(EXTRA_AMOUNT); feeStr = getIntent().getStringExtra("Fee"); outAddressStr = getIntent().getStringExtra("Wallet"); tvCardID = findViewById(R.id.tvCardID); tvCardID.setText(mCard.getCIDDescription()); mNfcManager = new NfcManager(this, this); progressBar = findViewById(R.id.progressBar); progressBar.setProgressTintList(ColorStateList.valueOf(Color.DKGRAY)); progressBar.setVisibility(View.INVISIBLE); } @Override public void onTagDiscovered(Tag tag) { try { // get IsoDep handle and run cardReader thread final IsoDep isoDep = IsoDep.get(tag); if (isoDep == null) { throw new CardProtocol.TangemException(getString(R.string.wrong_tag_err)); } byte UID[] = tag.getId(); String sUID = Util.byteArrayToHexString(UID); Log.v(logTag, "UID: " + sUID); if (sUID.equals(mCard.getUID())) { if (lastReadSuccess) { isoDep.setTimeout(mCard.getPauseBeforePIN2() + 5000); } else { isoDep.setTimeout(mCard.getPauseBeforePIN2() + 65000); } signPaymentTask = new SignPaymentTask(this, mCard, mNfcManager, isoDep, this, amountStr, feeStr, outAddressStr); signPaymentTask.start(); } else { Log.d(logTag, "Mismatch card UID (" + sUID + " instead of " + mCard.getUID() + ")"); mNfcManager.ignoreTag(isoDep.getTag()); return; } } catch (Exception e) { e.printStackTrace(); } } @Override public void onResume() { super.onResume(); mNfcManager.onResume(); } @Override public void onPause() { mNfcManager.onPause(); if (signPaymentTask != null) { signPaymentTask.cancel(true); } super.onPause(); } @Override public void onStop() { // dismiss enable NFC dialog mNfcManager.onStop(); if (signPaymentTask != null) { signPaymentTask.cancel(true); } super.onStop(); } public void OnReadStart(CardProtocol cardProtocol) { progressBar.post(() -> { progressBar.setVisibility(View.VISIBLE); progressBar.setProgress(5); }); } public void OnReadFinish(final CardProtocol cardProtocol) { signPaymentTask = null; if (cardProtocol != null) { if (cardProtocol.getError() == null) { progressBar.post(() -> { progressBar.setProgress(100); progressBar.setProgressTintList(ColorStateList.valueOf(Color.GREEN)); }); } else { lastReadSuccess = false; if (cardProtocol.getError().getClass().equals(CardProtocol.TangemException_InvalidPIN.class)) { progressBar.post(() -> { progressBar.setProgress(100); progressBar.setProgressTintList(ColorStateList.valueOf(Color.RED)); }); progressBar.postDelayed(() -> { try { progressBar.setProgress(0); progressBar.setProgressTintList(ColorStateList.valueOf(Color.DKGRAY)); progressBar.setVisibility(View.INVISIBLE); Intent intent = new Intent(); intent.putExtra("message", "Cannot sign transaction. Make sure you enter correct PIN2!"); intent.putExtra("UID", cardProtocol.getCard().getUID()); intent.putExtra("Card", cardProtocol.getCard().getAsBundle()); setResult(RESULT_INVALID_PIN, intent); finish(); } catch (Exception e) { e.printStackTrace(); } }, 500); return; } else { progressBar.post(() -> { if (cardProtocol.getError() instanceof CardProtocol.TangemException_ExtendedLengthNotSupported) { if (!NoExtendedLengthSupportDialog.allreadyShowed) { new NoExtendedLengthSupportDialog().show(getFragmentManager(), NoExtendedLengthSupportDialog.TAG); } } else { Toast.makeText(getBaseContext(), R.string.try_to_scan_again, Toast.LENGTH_LONG).show(); } progressBar.setProgress(100); progressBar.setProgressTintList(ColorStateList.valueOf(Color.RED)); }); } } } progressBar.postDelayed(() -> { try { progressBar.setProgress(0); progressBar.setProgressTintList(ColorStateList.valueOf(Color.DKGRAY)); progressBar.setVisibility(View.INVISIBLE); } catch (Exception e) { e.printStackTrace(); } }, 500); } public void OnReadProgress(CardProtocol protocol, final int progress) { progressBar.post(() -> progressBar.setProgress(progress)); } public void OnReadCancel() { signPaymentTask = null; progressBar.postDelayed(() -> { try { progressBar.setProgress(0); progressBar.setProgressTintList(ColorStateList.valueOf(Color.DKGRAY)); progressBar.setVisibility(View.INVISIBLE); } catch (Exception e) { e.printStackTrace(); } }, 500); } @Override public void OnReadWait(final int msec) { WaitSecurityDelayDialog.OnReadWait(this, msec); } @Override public void OnReadBeforeRequest(int timeout) { WaitSecurityDelayDialog.onReadBeforeRequest(this, timeout); } @Override public void OnReadAfterRequest() { WaitSecurityDelayDialog.onReadAfterRequest(this); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: Intent intent = new Intent(); // intent.putExtra("message", "Operation canceled"); setResult(Activity.RESULT_CANCELED, intent); finish(); return true; } return super.onKeyDown(keyCode, event); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_SEND_PAYMENT) { setResult(resultCode, data); finish(); return; } super.onActivityResult(requestCode, resultCode, data); } } \ No newline at end of file +package com.tangem.presentation.activity; import android.app.Activity; import android.content.Intent; import android.content.res.ColorStateList; import android.graphics.Color; import android.nfc.NfcAdapter; import android.nfc.Tag; import android.nfc.tech.IsoDep; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.KeyEvent; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import com.tangem.data.nfc.SignPaymentTask; import com.tangem.domain.cardReader.CardProtocol; import com.tangem.domain.cardReader.NfcManager; import com.tangem.domain.wallet.TangemCard; import com.tangem.presentation.dialog.NoExtendedLengthSupportDialog; import com.tangem.presentation.dialog.WaitSecurityDelayDialog; import com.tangem.util.Util; import com.tangem.wallet.R; public class SignPaymentActivity extends AppCompatActivity implements NfcAdapter.ReaderCallback, CardProtocol.Notifications { public static final String EXTRA_AMOUNT = "Amount"; public static final int REQUEST_CODE_SEND_PAYMENT = 1; public static final int RESULT_INVALID_PIN = Activity.RESULT_FIRST_USER; private TangemCard mCard; private TextView tvCardID; private NfcManager mNfcManager; private static final String logTag = "SignPayment"; private ProgressBar progressBar; private SignPaymentTask signPaymentTask; private String amountStr; private String feeStr; private String outAddressStr; private boolean lastReadSuccess = true; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sign_payment); MainActivity.commonInit(getApplicationContext()); mCard = new TangemCard(getIntent().getStringExtra("UID")); mCard.LoadFromBundle(getIntent().getExtras().getBundle("Card")); amountStr = getIntent().getStringExtra(EXTRA_AMOUNT); feeStr = getIntent().getStringExtra("Fee"); outAddressStr = getIntent().getStringExtra("Wallet"); tvCardID = findViewById(R.id.tvCardID); tvCardID.setText(mCard.getCIDDescription()); mNfcManager = new NfcManager(this, this); progressBar = findViewById(R.id.progressBar); progressBar.setProgressTintList(ColorStateList.valueOf(Color.DKGRAY)); progressBar.setVisibility(View.INVISIBLE); } @Override public void onTagDiscovered(Tag tag) { try { // get IsoDep handle and run cardReader thread final IsoDep isoDep = IsoDep.get(tag); if (isoDep == null) { throw new CardProtocol.TangemException(getString(R.string.wrong_tag_err)); } byte UID[] = tag.getId(); String sUID = Util.byteArrayToHexString(UID); Log.v(logTag, "UID: " + sUID); if (sUID.equals(mCard.getUID())) { if (lastReadSuccess) { isoDep.setTimeout(mCard.getPauseBeforePIN2() + 5000); } else { isoDep.setTimeout(mCard.getPauseBeforePIN2() + 65000); } signPaymentTask = new SignPaymentTask(this, mCard, mNfcManager, isoDep, this, amountStr, feeStr, outAddressStr); signPaymentTask.start(); } else { Log.d(logTag, "Mismatch card UID (" + sUID + " instead of " + mCard.getUID() + ")"); mNfcManager.ignoreTag(isoDep.getTag()); return; } } catch (Exception e) { e.printStackTrace(); } } @Override public void onResume() { super.onResume(); mNfcManager.onResume(); } @Override public void onPause() { mNfcManager.onPause(); if (signPaymentTask != null) { signPaymentTask.cancel(true); } super.onPause(); } @Override public void onStop() { // dismiss enable NFC dialog mNfcManager.onStop(); if (signPaymentTask != null) { signPaymentTask.cancel(true); } super.onStop(); } public void OnReadStart(CardProtocol cardProtocol) { progressBar.post(() -> { progressBar.setVisibility(View.VISIBLE); progressBar.setProgress(5); }); } public void OnReadFinish(final CardProtocol cardProtocol) { signPaymentTask = null; if (cardProtocol != null) { if (cardProtocol.getError() == null) { progressBar.post(() -> { progressBar.setProgress(100); progressBar.setProgressTintList(ColorStateList.valueOf(Color.GREEN)); }); } else { lastReadSuccess = false; if (cardProtocol.getError().getClass().equals(CardProtocol.TangemException_InvalidPIN.class)) { progressBar.post(() -> { progressBar.setProgress(100); progressBar.setProgressTintList(ColorStateList.valueOf(Color.RED)); }); progressBar.postDelayed(() -> { try { progressBar.setProgress(0); progressBar.setProgressTintList(ColorStateList.valueOf(Color.DKGRAY)); progressBar.setVisibility(View.INVISIBLE); Intent intent = new Intent(); intent.putExtra("message", "Cannot sign transaction. Make sure you enter correct PIN2!"); intent.putExtra("UID", cardProtocol.getCard().getUID()); intent.putExtra("Card", cardProtocol.getCard().getAsBundle()); setResult(RESULT_INVALID_PIN, intent); finish(); } catch (Exception e) { e.printStackTrace(); } }, 500); return; } else { progressBar.post(() -> { if (cardProtocol.getError() instanceof CardProtocol.TangemException_ExtendedLengthNotSupported) { if (!NoExtendedLengthSupportDialog.allReadyShowed) { new NoExtendedLengthSupportDialog().show(getFragmentManager(), NoExtendedLengthSupportDialog.TAG); } } else { Toast.makeText(getBaseContext(), R.string.try_to_scan_again, Toast.LENGTH_LONG).show(); } progressBar.setProgress(100); progressBar.setProgressTintList(ColorStateList.valueOf(Color.RED)); }); } } } progressBar.postDelayed(() -> { try { progressBar.setProgress(0); progressBar.setProgressTintList(ColorStateList.valueOf(Color.DKGRAY)); progressBar.setVisibility(View.INVISIBLE); } catch (Exception e) { e.printStackTrace(); } }, 500); } public void OnReadProgress(CardProtocol protocol, final int progress) { progressBar.post(() -> progressBar.setProgress(progress)); } public void OnReadCancel() { signPaymentTask = null; progressBar.postDelayed(() -> { try { progressBar.setProgress(0); progressBar.setProgressTintList(ColorStateList.valueOf(Color.DKGRAY)); progressBar.setVisibility(View.INVISIBLE); } catch (Exception e) { e.printStackTrace(); } }, 500); } @Override public void OnReadWait(final int msec) { WaitSecurityDelayDialog.OnReadWait(this, msec); } @Override public void OnReadBeforeRequest(int timeout) { WaitSecurityDelayDialog.onReadBeforeRequest(this, timeout); } @Override public void OnReadAfterRequest() { WaitSecurityDelayDialog.onReadAfterRequest(this); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_BACK: Intent intent = new Intent(); // intent.putExtra("message", "Operation canceled"); setResult(Activity.RESULT_CANCELED, intent); finish(); return true; } return super.onKeyDown(keyCode, event); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_SEND_PAYMENT) { setResult(resultCode, data); finish(); return; } super.onActivityResult(requestCode, resultCode, data); } } \ No newline at end of file diff --git a/app/src/main/java/com/tangem/presentation/activity/SwapPINActivity.java b/app/src/main/java/com/tangem/presentation/activity/SwapPINActivity.java index 1620b95269..809e2ad6a7 100644 --- a/app/src/main/java/com/tangem/presentation/activity/SwapPINActivity.java +++ b/app/src/main/java/com/tangem/presentation/activity/SwapPINActivity.java @@ -110,91 +110,6 @@ public class SwapPINActivity extends AppCompatActivity implements NfcAdapter.Rea super.onStop(); } -// private class SwapPINTask extends Thread { -// -// IsoDep mIsoDep; -// CardProtocol.Notifications mNotifications; -// private boolean isCancelled = false; -// -// SwapPINTask(IsoDep isoDep, CardProtocol.Notifications notifications) { -// mIsoDep = isoDep; -// mNotifications = notifications; -// } -// -// @Override -// public void run() { -// if (mIsoDep == null) { -// return; -// } -// CardProtocol protocol = new CardProtocol(getBaseContext(), mIsoDep, mCard, mNotifications); -// -// mNotifications.OnReadStart(protocol); -// try { -// -// // for Samsung's bugs - -// // Workaround for the Samsung Galaxy S5 (since the -// // first connection always hangs on transceive). -// int timeout = mIsoDep.getTimeout(); -// mIsoDep.connect(); -// mIsoDep.close(); -// mIsoDep.connect(); -// mIsoDep.setTimeout(timeout); -// try { -// -// mNotifications.OnReadProgress(protocol, 5); -// -// Log.i("SwapTask", "[-- Start swap pin --]"); -// -// if (isCancelled) return; -// -// if (mCard.getPauseBeforePIN2() > 0) { -// mNotifications.OnReadWait(mCard.getPauseBeforePIN2()); -// } -// -//// try { -// protocol.run_SwapPIN(PINStorage.getPIN2(), newPIN, newPIN2, false); -// protocol.setPIN(newPIN); -// mCard.setPIN(newPIN); -//// } finally { -//// mNotifications.OnReadWait(0); -//// } -// -// mNotifications.OnReadProgress(protocol, 50); -// -// protocol.run_Read(); -// -// mNotifications.OnReadProgress(protocol, 100); -// -// } finally { -// mNfcManager.ignoreTag(mIsoDep.getTag()); -// } -// } catch (Exception e) { -// e.printStackTrace(); -// protocol.setError(e); -// -// } finally { -// Log.i("SwapPINTask", "[-- Finish purge --]"); -// mNotifications.OnReadFinish(protocol); -// } -// } -// -// public void cancel(Boolean AllowInterrupt) { -// try { -// if (this.isAlive()) { -// isCancelled = true; -// join(500); -// } -// if (this.isAlive() && AllowInterrupt) { -// interrupt(); -// mNotifications.OnReadCancel(); -// } -// } catch (Exception e) { -// e.printStackTrace(); -// } -// } -// -// } - public void OnReadStart(CardProtocol cardProtocol) { progressBar.post(() -> { progressBar.setVisibility(View.VISIBLE); @@ -242,7 +157,7 @@ public class SwapPINActivity extends AppCompatActivity implements NfcAdapter.Rea progressBar.post(() -> { if (cardProtocol.getError() instanceof CardProtocol.TangemException_ExtendedLengthNotSupported) { - if (!NoExtendedLengthSupportDialog.allreadyShowed) { + if (!NoExtendedLengthSupportDialog.allReadyShowed) { new NoExtendedLengthSupportDialog().show(getFragmentManager(), NoExtendedLengthSupportDialog.TAG); } } else { diff --git a/app/src/main/java/com/tangem/presentation/dialog/NoExtendedLengthSupportDialog.java b/app/src/main/java/com/tangem/presentation/dialog/NoExtendedLengthSupportDialog.java index 409333d558..f3ecbbb069 100644 --- a/app/src/main/java/com/tangem/presentation/dialog/NoExtendedLengthSupportDialog.java +++ b/app/src/main/java/com/tangem/presentation/dialog/NoExtendedLengthSupportDialog.java @@ -11,7 +11,7 @@ import com.tangem.wallet.R; public class NoExtendedLengthSupportDialog extends DialogFragment { public static final String TAG = NoExtendedLengthSupportDialog.class.getSimpleName(); - public static boolean allreadyShowed = false; + public static boolean allReadyShowed = false; @Override public Dialog onCreateDialog(Bundle savedInstanceState) { @@ -19,7 +19,7 @@ public class NoExtendedLengthSupportDialog extends DialogFragment { .setIcon(R.drawable.tangem_logo_small_new) .setTitle(R.string.warning) .setMessage(R.string.the_nfc_adapter_length_apdu) - .setPositiveButton(R.string.got_it, (dialog, whichButton) -> NoExtendedLengthSupportDialog.allreadyShowed = true) + .setPositiveButton(R.string.got_it, (dialog, whichButton) -> NoExtendedLengthSupportDialog.allReadyShowed = true) .create(); } diff --git a/app/src/main/java/com/tangem/presentation/fragment/LoadedWallet.kt b/app/src/main/java/com/tangem/presentation/fragment/LoadedWallet.kt index b43633b534..cdcdbf070b 100644 --- a/app/src/main/java/com/tangem/presentation/fragment/LoadedWallet.kt +++ b/app/src/main/java/com/tangem/presentation/fragment/LoadedWallet.kt @@ -537,7 +537,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific rlProgressBar.post { lastReadSuccess = false if (cardProtocol.error is CardProtocol.TangemException_ExtendedLengthNotSupported) - if (!NoExtendedLengthSupportDialog.allreadyShowed) + if (!NoExtendedLengthSupportDialog.allReadyShowed) NoExtendedLengthSupportDialog().show(activity!!.fragmentManager, NoExtendedLengthSupportDialog.TAG) else Toast.makeText(context, R.string.try_to_scan_again, Toast.LENGTH_SHORT).show() @@ -674,7 +674,7 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific if (mCard!!.pauseBeforePIN2 > 0 && (mCard!!.useDefaultPIN2()!! || !mCard!!.useSmartSecurityDelay())) { ivPIN2orSecurityDelay.setImageResource(R.drawable.timer) - ivPIN2orSecurityDelay.setOnClickListener { Toast.makeText(context, String.format("This banknote will enforce %.0f seconds security delay for all operations requiring PIN2 code", mCard!!.pauseBeforePIN2 / 1000.0), Toast.LENGTH_LONG).show() } + ivPIN2orSecurityDelay.setOnClickListener { Toast.makeText(context, String.format(getString(R.string.this_banknote_will_enforce), mCard!!.pauseBeforePIN2 / 1000.0), Toast.LENGTH_LONG).show()} } else if (mCard!!.useDefaultPIN2()!!) { ivPIN2orSecurityDelay.setImageResource(R.drawable.unlock_pin2) @@ -691,7 +691,6 @@ class LoadedWallet : Fragment(), NfcAdapter.ReaderCallback, CardProtocol.Notific } else ivDeveloperVersion.visibility = View.INVISIBLE - btnExtract!!.isEnabled = mCard!!.hasBalanceInfo() tvIssuer.text = mCard!!.issuerDescription diff --git a/app/src/main/java/com/tangem/presentation/fragment/Main.java b/app/src/main/java/com/tangem/presentation/fragment/Main.java index a81bb7ebdb..7646bfb76f 100644 --- a/app/src/main/java/com/tangem/presentation/fragment/Main.java +++ b/app/src/main/java/com/tangem/presentation/fragment/Main.java @@ -316,7 +316,7 @@ public class Main extends Fragment implements NfcAdapter.ReaderCallback, CardLis doEnterPIN(); } else { if (cardProtocol.getError() instanceof CardProtocol.TangemException_ExtendedLengthNotSupported) { - if (!NoExtendedLengthSupportDialog.allreadyShowed) { + if (!NoExtendedLengthSupportDialog.allReadyShowed) { new NoExtendedLengthSupportDialog().show(Objects.requireNonNull(getActivity()).getFragmentManager(), NoExtendedLengthSupportDialog.TAG); } } diff --git a/app/src/main/java/com/tangem/presentation/fragment/VerifyCard.java b/app/src/main/java/com/tangem/presentation/fragment/VerifyCard.java index afe07f06b7..555a123e02 100644 --- a/app/src/main/java/com/tangem/presentation/fragment/VerifyCard.java +++ b/app/src/main/java/com/tangem/presentation/fragment/VerifyCard.java @@ -436,7 +436,7 @@ public class VerifyCard extends Fragment implements NfcAdapter.ReaderCallback { if (mCard.getPauseBeforePIN2() > 0 && (mCard.useDefaultPIN2() || !mCard.useSmartSecurityDelay())) { ivPIN2orSecurityDelay.setImageResource(R.drawable.timer); - ivPIN2orSecurityDelay.setOnClickListener(v -> Toast.makeText(getContext(), String.format("This banknote will enforce %.0f seconds security delay for all operations requiring PIN2 code", mCard.getPauseBeforePIN2() / 1000.0), Toast.LENGTH_LONG).show()); + ivPIN2orSecurityDelay.setOnClickListener(v -> Toast.makeText(getContext(), String.format(getString(R.string.this_banknote_will_enforce), mCard.getPauseBeforePIN2() / 1000.0), Toast.LENGTH_LONG).show()); } else if (mCard.useDefaultPIN2()) { ivPIN2orSecurityDelay.setImageResource(R.drawable.unlock_pin2); ivPIN2orSecurityDelay.setOnClickListener(v -> Toast.makeText(getContext(), R.string.this_banknote_protected_default_PIN2_code, Toast.LENGTH_LONG).show()); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ef40669a92..206d94aaeb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -116,11 +116,13 @@ This banknote is protected by default PIN2 code This banknote is protected by user\'s PIN2 code Unlocked banknote, only for development use + This banknote will enforce %.0f seconds security delay for all operations requiring PIN2 code Share wallet address with: Copied to clipboard EXTRACT LOAD + BETA