Offer #135 behaviour: if show time set to 0, don't clear clipboard or hide password for the user

This commit is contained in:
Matthew Wong 2015-10-18 22:50:08 -04:00
parent 91c7f8f558
commit 6abcebef18

View file

@ -272,12 +272,17 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
TextView extraText = (TextView) findViewById(R.id.crypto_extra_show); TextView extraText = (TextView) findViewById(R.id.crypto_extra_show);
if (extraText.getText().length() != 0) if (extraText.getText().length() != 0)
((LinearLayout) findViewById(R.id.crypto_extra_show_layout)).setVisibility(View.VISIBLE); findViewById(R.id.crypto_extra_show_layout).setVisibility(View.VISIBLE);
if (SHOW_TIME == 0) {
// treat 0 as forever, and the user must exit and/or clear clipboard on their own
cancel(true);
} else {
this.pb = (ProgressBar) findViewById(R.id.pbLoading); this.pb = (ProgressBar) findViewById(R.id.pbLoading);
this.pb.setMax(SHOW_TIME); this.pb.setMax(SHOW_TIME);
} }
} }
}
@Override @Override
protected Boolean doInBackground(Void... params) { protected Boolean doInBackground(Void... params) {
@ -302,8 +307,7 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
} }
} }
if (showPassword && findViewById(R.id.crypto_password_show) != null) { if (showPassword && findViewById(R.id.crypto_password_show) != null) {
//clear password // clear password; if decrypt changed to encrypt layout via edit button, no need
// 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_password_show)).setText("");
((TextView) findViewById(R.id.crypto_extra_show)).setText(""); ((TextView) findViewById(R.id.crypto_extra_show)).setText("");
findViewById(R.id.crypto_extra_show_layout).setVisibility(View.INVISIBLE); findViewById(R.id.crypto_extra_show_layout).setVisibility(View.INVISIBLE);
@ -406,6 +410,7 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
new DelayShow().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new DelayShow().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
if (!showPassword) { if (!showPassword) {
// stop here, but still need DelayShow to clear clipboard
activity.setResult(RESULT_CANCELED); activity.setResult(RESULT_CANCELED);
activity.finish(); activity.finish();
} }