@@ -77,7 +77,7 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne
7777 public static final int REQUEST_CODE_EDIT = 9916 ;
7878 public static final int REQUEST_CODE_SELECT_FOLDER = 9917 ;
7979
80- private String decodedPassword = "" ;
80+ private PasswordEntry passwordEntry = null ;
8181
8282 public final class Constants {
8383 public static final String TAG = "Keychain" ;
@@ -237,6 +237,7 @@ public void shareAsPlaintext() {
237237 if (findViewById (R .id .share_password_as_plaintext ) == null )
238238 return ;
239239
240+ final String decodedPassword = passwordEntry != null ? passwordEntry .getPassword () : "" ;
240241 Intent sendIntent = new Intent ();
241242 sendIntent .setAction (Intent .ACTION_SEND );
242243 sendIntent .putExtra (Intent .EXTRA_TEXT , decodedPassword );
@@ -251,6 +252,7 @@ public void copyPasswordToClipBoard() {
251252
252253 setTimer ();
253254
255+ final String decodedPassword = passwordEntry != null ? passwordEntry .getPassword () : "" ;
254256 ClipData clip = ClipData .newPlainText ("pgp_handler_result_pm" , decodedPassword );
255257 clipboard .setPrimaryClip (clip );
256258
@@ -367,7 +369,7 @@ public void run() {
367369 }
368370 }
369371 }
370- decodedPassword = "" ;
372+ passwordEntry = null ;
371373 if (findViewById (R .id .crypto_password_show ) != null ) {
372374 // clear password; if decrypt changed to encrypt layout via edit button, no need
373375 ((TextView ) findViewById (R .id .crypto_password_show )).setText ("" );
@@ -495,6 +497,7 @@ public void onReturn(Intent result) {
495497
496498 Typeface monoTypeface = Typeface .createFromAsset (getAssets (), "fonts/sourcecodepro.ttf" );
497499 final PasswordEntry entry = new PasswordEntry (os );
500+ passwordEntry = entry ;
498501 textViewPassword .setTypeface (monoTypeface );
499502 textViewPassword .setText (entry .getPassword ());
500503
@@ -586,11 +589,11 @@ public void onClick(View v) {
586589
587590 Typeface monoTypeface = Typeface .createFromAsset (getAssets (), "fonts/sourcecodepro.ttf" );
588591 final PasswordEntry entry = new PasswordEntry (os );
589- decodedPassword = entry . getPassword () ;
592+ passwordEntry = entry ;
590593 textViewPassword
591594 .setTypeface (monoTypeface );
592595 textViewPassword
593- .setText (decodedPassword );
596+ .setText (entry . getPassword () );
594597
595598 String extraContent = os .toString ("UTF-8" ).replaceFirst (".*\n " , "" );
596599 if (extraContent .length () != 0 ) {
0 commit comments