From 71c26c0ddfd0dd704bb6f72db2cf633080cb321a Mon Sep 17 00:00:00 2001 From: dtvv Date: Thu, 25 Oct 2018 02:24:15 -0500 Subject: [PATCH] -Add listener to the class PatternRequestActivity to reuse the on success or fail password event -Add listener to the class PinRequestActivity to reuse the on success or fail password event --- .../application/CrystalSecurityMonitor.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/application/CrystalSecurityMonitor.java b/app/src/main/java/cy/agorise/crystalwallet/application/CrystalSecurityMonitor.java index e027107..0d2da76 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/application/CrystalSecurityMonitor.java +++ b/app/src/main/java/cy/agorise/crystalwallet/application/CrystalSecurityMonitor.java @@ -16,6 +16,8 @@ import java.util.List; import cy.agorise.crystalwallet.activities.PatternRequestActivity; import cy.agorise.crystalwallet.activities.PinRequestActivity; import cy.agorise.crystalwallet.activities.PocketRequestActivity; +import cy.agorise.crystalwallet.fragments.PatternSecurityFragment; +import cy.agorise.crystalwallet.interfaces.OnResponse; import cy.agorise.crystalwallet.models.GeneralSetting; import cy.agorise.crystalwallet.notifiers.CrystalWalletNotifier; import cy.agorise.crystalwallet.viewmodels.GeneralSettingListViewModel; @@ -129,7 +131,7 @@ public class CrystalSecurityMonitor implements Application.ActivityLifecycleCall public void onActivityStarted(Activity activity) { if (numStarted == 0) { if (!actualSecurity().equals("")){ - callPasswordRequest(activity); + callPasswordRequest(activity,null); } } numStarted++; @@ -140,17 +142,33 @@ public class CrystalSecurityMonitor implements Application.ActivityLifecycleCall numStarted--; if (numStarted == 0) { if (!actualSecurity().equals("")){ - callPasswordRequest(activity); + callPasswordRequest(activity,null); } } } - public void callPasswordRequest(Activity activity){ + public void callPasswordRequest(Activity activity, final OnResponse onResponsePattern){ if ((!activity.getIntent().hasExtra("ACTIVITY_TYPE")) || (!activity.getIntent().getStringExtra("ACTIVITY_TYPE").equals("PASSWORD_REQUEST"))) { Intent intent = null; if ((this.passwordEncrypted != null) && (!this.passwordEncrypted.equals(""))) { intent = new Intent(activity, PinRequestActivity.class); + + /* + * Connect error and success listeners + * */ + if(onResponsePattern != null){ + PinRequestActivity.setOnResponse(onResponsePattern); + } + } else if ((this.patternEncrypted != null) && (!this.patternEncrypted.equals(""))) { + + /* + * Connect error and success listeners + * */ + if(onResponsePattern != null){ + PatternRequestActivity.setOnResponse(onResponsePattern); + } + intent = new Intent(activity, PatternRequestActivity.class); } if (intent != null) {