Updated on 2026-08-14

This commit is contained in:
Tangem 2019-09-11 14:29:27 +03:00
parent 858f609667
commit 9bb8931709
84 changed files with 619 additions and 659 deletions

View file

@ -67,7 +67,7 @@ public class WaitSecurityDelayDialog extends DialogFragment {
}, 1000, 1000);
return new AlertDialog.Builder(getActivity())
.setIcon(R.drawable.tangem_logo_small_new)
.setTitle(R.string.security_delay)
.setTitle(R.string.dialog_security_delay)
.setView(v)
.setCancelable(false)
.create();
@ -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) {