Updated on 2026-08-14
This commit is contained in:
commit
4425e51496
5 changed files with 28 additions and 40 deletions
2
.idea/navEditor.xml
generated
2
.idea/navEditor.xml
generated
|
|
@ -313,7 +313,7 @@
|
|||
</option>
|
||||
<option name="myPositions">
|
||||
<map>
|
||||
<entry key="action_purgeFragment_to_loadedWalletFragment">
|
||||
<entry key="action_purgeFragment_to_mainFragment">
|
||||
<value>
|
||||
<LayoutPositions />
|
||||
</value>
|
||||
|
|
|
|||
|
|
@ -79,6 +79,9 @@ public class WaitSecurityDelayDialog extends DialogFragment {
|
|||
}
|
||||
|
||||
public static void onReadBeforeRequest(final FragmentActivity activity, final int timeout) {
|
||||
if (activity == null) return;
|
||||
|
||||
Log.e(TAG, "onReadBeforeRequest callback(" + timeout + ")");
|
||||
activity.runOnUiThread(() -> {
|
||||
if (timerToShowDelayDialog != null || timeout < delayBeforeShowDialog + minRemainingDelayToShowDialog)
|
||||
return;
|
||||
|
|
@ -98,44 +101,31 @@ public class WaitSecurityDelayDialog extends DialogFragment {
|
|||
}
|
||||
|
||||
public static void onReadAfterRequest(final Activity activity) {
|
||||
activity.runOnUiThread(() -> {
|
||||
if (timerToShowDelayDialog == null) return;
|
||||
timerToShowDelayDialog.cancel();
|
||||
timerToShowDelayDialog = null;
|
||||
});
|
||||
if (timerToShowDelayDialog == null) return;
|
||||
timerToShowDelayDialog.cancel();
|
||||
timerToShowDelayDialog = null;
|
||||
}
|
||||
|
||||
public static void onReadWait(final FragmentActivity activity, final int msec) {
|
||||
Log.e(TAG, "onReadWait callback(" + msec + ")");
|
||||
if (timerToShowDelayDialog != null) {
|
||||
timerToShowDelayDialog.cancel();
|
||||
timerToShowDelayDialog = null;
|
||||
}
|
||||
|
||||
if (msec == 0 && instance != null) {
|
||||
try {
|
||||
instance.dismissAllowingStateLoss();
|
||||
instance = null;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
if (activity == null) return;
|
||||
|
||||
activity.runOnUiThread(() -> {
|
||||
Log.e(TAG, "onReadWait on ui thread(" + msec + ")");
|
||||
if (timerToShowDelayDialog != null) {
|
||||
timerToShowDelayDialog.cancel();
|
||||
timerToShowDelayDialog = null;
|
||||
}
|
||||
|
||||
if (msec == 0) {
|
||||
if (instance != null) {
|
||||
if (instance.isAdded()) {
|
||||
instance.dismissAllowingStateLoss();
|
||||
instance = null;
|
||||
} else {
|
||||
Log.e(TAG, "onReadWait(0) with not added dialog");
|
||||
// instance.progressBar.postDelayed(() -> {
|
||||
// Log.e(TAG, "onReadWait(0) dismiss delayed");
|
||||
try {
|
||||
instance.dismissAllowingStateLoss();
|
||||
instance = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
// }, 10000);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (instance == null) {
|
||||
if (msec > delayBeforeShowDialog + minRemainingDelayToShowDialog) {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,8 @@ abstract class BaseFragment : Fragment() {
|
|||
findNavController(this).navigate(destination, data)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
Log.w(this::class.java.simpleName, e.message)
|
||||
} catch (e: IllegalStateException) {
|
||||
Log.w(this::class.java.simpleName, e.message)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -162,17 +162,13 @@ class MainFragment : BaseFragment(), NavigationResultListener, NfcAdapter.Reader
|
|||
cardInfo.getBundle(EXTRA_TANGEM_CARD)?.let { card.loadFromBundle(it) }
|
||||
|
||||
val ctx = TangemContext(card)
|
||||
|
||||
when {
|
||||
card.status == TangemCard.Status.Loaded -> lastTag?.let {
|
||||
val engineCoin = CoinEngineFactory.create(ctx)
|
||||
if (engineCoin != null) {
|
||||
engineCoin.defineWallet()
|
||||
|
||||
// val bundle = Bundle()
|
||||
// bundle.putParcelable(Constant.EXTRA_LAST_DISCOVERED_TAG, lastTag)
|
||||
// ctx.saveToBundle(bundle)
|
||||
// (activity as MainActivity).navController.navigate(R.id.loadedWallet, bundle)
|
||||
|
||||
val bundle = Bundle()
|
||||
bundle.putParcelable(Constant.EXTRA_LAST_DISCOVERED_TAG, lastTag)
|
||||
ctx.saveToBundle(bundle)
|
||||
|
|
@ -202,7 +198,7 @@ class MainFragment : BaseFragment(), NavigationResultListener, NfcAdapter.Reader
|
|||
} else {
|
||||
// remove last UIDs because of error and no card read
|
||||
rlProgressBar.post {
|
||||
Toast.makeText(context, R.string.try_to_scan_again, Toast.LENGTH_SHORT).show()
|
||||
context?.let { Toast.makeText(it, R.string.try_to_scan_again, Toast.LENGTH_SHORT).show() }
|
||||
unsuccessReadCount++
|
||||
|
||||
if (cardProtocol.error is CardProtocol.TangemException_InvalidPIN) {
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@ class LoadedWalletFragment : BaseFragment(), NavigationResultListener, NfcAdapte
|
|||
}
|
||||
|
||||
override fun onReadStart(cardProtocol: CardProtocol) {
|
||||
rlProgressBar?.post { rlProgressBar.visibility = View.VISIBLE }
|
||||
rlProgressBar?.post { rlProgressBar?.visibility = View.VISIBLE }
|
||||
}
|
||||
|
||||
override fun onReadProgress(protocol: CardProtocol, progress: Int) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue