From 9784af6d66fc88651f260f084e28ddee42ea8cab Mon Sep 17 00:00:00 2001 From: zeapo Date: Sat, 23 Aug 2014 19:35:59 +0200 Subject: [PATCH] avoid eternal looping when selecting an openpgp provider --- .../com/zeapo/pwdstore/crypto/PgpHandler.java | 30 +++++++++++-------- app/src/main/res/xml/preference.xml | 3 +- 2 files changed, 19 insertions(+), 14 deletions(-) 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 cbbc0c11..47d21834 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java @@ -89,21 +89,25 @@ public class PgpHandler extends Activity implements OpenPgpServiceConnection.OnB Toast.makeText(this, "No OpenPGP Provider selected!", Toast.LENGTH_LONG).show(); Intent intent = new Intent(this, UserPreference.class); startActivity(intent); + // a small hack to avoid eternal loop later, have to be solved via a startactivityforresult() + setResult(RESULT_CANCELED); + finish(); + } else { + + // bind to service + mServiceConnection = new OpenPgpServiceConnection( + PgpHandler.this, providerPackageName, this); + mServiceConnection.bindToService(); + + bindingDialog = new ProgressDialog(this); + bindingDialog.setMessage("Waiting for OpenKeychain..."); + bindingDialog.setCancelable(false); + bindingDialog.show(); + + ActionBar actionBar = getActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); } - - // bind to service - mServiceConnection = new OpenPgpServiceConnection( - PgpHandler.this, providerPackageName, this ); - mServiceConnection.bindToService(); - - bindingDialog = new ProgressDialog(this); - bindingDialog.setMessage("Waiting for OpenKeychain..."); - bindingDialog.setCancelable(false); - bindingDialog.show(); - - ActionBar actionBar = getActionBar(); - actionBar.setDisplayHomeAsUpEnabled(true); } @Override diff --git a/app/src/main/res/xml/preference.xml b/app/src/main/res/xml/preference.xml index 849be86a..97214ceb 100644 --- a/app/src/main/res/xml/preference.xml +++ b/app/src/main/res/xml/preference.xml @@ -22,7 +22,8 @@ + android:key="openpgp_account_name" + android:inputType="textEmailAddress"/>