From c9b4a5bac45f347cff61d7c35557d44dbbb320d6 Mon Sep 17 00:00:00 2001 From: knuthy Date: Mon, 22 Sep 2014 22:34:34 +0200 Subject: solves the issue where pwd store closes without having bound with openkeychain --- app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/src/main') diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java index cc4e2a4a..3213fd2e 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java @@ -63,6 +63,7 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB private ProgressDialog bindingDialog; + private boolean registered; public static final int REQUEST_CODE_SIGN = 9910; public static final int REQUEST_CODE_ENCRYPT = 9911; @@ -90,6 +91,8 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB accountName = settings.getString("openpgp_account_name", ""); keyIDs = settings.getString("openpgp_key_ids", ""); + registered = false; + if (TextUtils.isEmpty(providerPackageName)) { Toast.makeText(this, "No OpenPGP Provider selected!", Toast.LENGTH_LONG).show(); Intent intent = new Intent(this, UserPreference.class); @@ -110,6 +113,8 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB bindingDialog.setCancelable(false); bindingDialog.show(); + registered = true; + ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); } @@ -118,7 +123,7 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB @Override public void onStop(){ super.onStop(); - if (this.mServiceConnection.isBound()) + if (this.registered && this.mServiceConnection.isBound()) try { this.mServiceConnection.unbindFromService(); } catch (Exception e){ -- cgit v1.2.3