From 540349542bac3bcce15a0d9fed74caff76807130 Mon Sep 17 00:00:00 2001 From: Matthew Wong Date: Wed, 26 Aug 2015 03:25:55 -0400 Subject: Revert asynctask cancelling; allow parallel asynctasks --- .../main/java/com/zeapo/pwdstore/crypto/PgpHandler.java | 14 +++----------- 1 file changed, 3 insertions(+), 11 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 fa46fb3c..67311774 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java @@ -56,7 +56,6 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne SharedPreferences settings; private Activity activity; ClipboardManager clipboard; - AsyncTask delayShowTask; private boolean registered; @@ -141,10 +140,6 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne break; case R.id.edit_password: editPassword(); - if (delayShowTask != null) { - delayShowTask.cancel(true); - delayShowTask = null; - } } return super.onOptionsItemSelected(item); } @@ -285,9 +280,6 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne if (showPassword) { publishProgress(current); } - if (isCancelled()) { - return false; - } } return true; } @@ -302,8 +294,9 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne clipboard.setPrimaryClip(clip); } } - if (showPassword) { + if (showPassword && findViewById(R.id.crypto_password_show) != null) { //clear password + // if decrypt layout changed to encrypt layout via edit button, no need for this ((TextView) findViewById(R.id.crypto_password_show)).setText(""); ((TextView) findViewById(R.id.crypto_extra_show)).setText(""); findViewById(R.id.crypto_extra_show_layout).setVisibility(View.INVISIBLE); @@ -313,7 +306,6 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne } } - @Override protected void onProgressUpdate(Integer... values) { if (showPassword) { @@ -401,7 +393,7 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne copyToClipBoard(); } - delayShowTask = new DelayShow().execute(); + new DelayShow().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); if (!showPassword) { activity.setResult(RESULT_CANCELED); activity.finish(); -- cgit v1.2.3