Updated on 2026-08-14

This commit is contained in:
Tangem 2019-09-11 11:34:58 +00:00
commit 50d58c326d
5 changed files with 27 additions and 40 deletions

2
.idea/navEditor.xml generated
View file

@ -313,7 +313,7 @@
</option>
<option name="myPositions">
<map>
<entry key="action_purgeFragment_to_loadedWalletFragment">
<entry key="action_purgeFragment_to_mainFragment">
<value>
<LayoutPositions />
</value>

View file

@ -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) {

View file

@ -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)
}
}

View file

@ -168,11 +168,6 @@ class MainFragment : BaseFragment(), NavigationResultListener, NfcAdapter.Reader
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 +197,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.general_notification_scan_again, Toast.LENGTH_SHORT).show()
context?.let { Toast.makeText(it, R.string.general_notification_scan_again, Toast.LENGTH_SHORT).show() }
unsuccessReadCount++
if (cardProtocol.error is CardProtocol.TangemException_InvalidPIN) {

View file

@ -508,7 +508,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) {