diff options
author | Mohamed Zenadi <mohamed@zenadi.com> | 2017-07-29 15:15:22 +0100 |
---|---|---|
committer | Mohamed Zenadi <zeapo@users.noreply.github.com> | 2017-08-10 11:10:29 +0200 |
commit | 958ea12a885130691519348e06bc8153b064c057 (patch) | |
tree | 8a1fd8189122471eddc1ab75a8f4411681d4912e /app | |
parent | e1ae4978ec1c9842448f21a00be2359121a3c73b (diff) |
Add support of EDIT from the selection menu
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/PasswordStore.java | 6 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java index 665e1676..0013bc66 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java @@ -425,10 +425,12 @@ public class PasswordStore extends AppCompatActivity { } public void editPassword(PasswordItem item) { - Intent intent = new Intent(this, PgpHandler.class); + Intent intent = new Intent(this, PgpActivity.class); intent.putExtra("NAME", item.toString()); intent.putExtra("FILE_PATH", item.getFile().getAbsolutePath()); - intent.putExtra("Operation", "EDIT"); + intent.putExtra("PARENT_PATH", getCurrentDir().getAbsolutePath()); + intent.putExtra("REPO_PATH", PasswordRepository.getRepositoryDirectory(getApplicationContext()).getAbsolutePath()); + intent.putExtra("OPERATION", "EDIT"); startActivityForResult(intent, PgpHandler.REQUEST_CODE_EDIT); } diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt index 749d0be3..dabf9f81 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpActivity.kt @@ -76,7 +76,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { } when (operation) { - "DECRYPT" -> { + "DECRYPT", "EDIT" -> { setContentView(R.layout.decrypt_layout) crypto_password_category_decrypt.text = "$cat/" crypto_password_file.text = name @@ -168,6 +168,11 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { passwordEntry = entry + if (operation == "EDIT") { + editPassword() + return@executeApiAsync + } + crypto_password_show.typeface = monoTypeface crypto_password_show.text = entry.password @@ -343,7 +348,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound { * The action to take when the PGP service is bound */ override fun onBound(service: IOpenPgpService2?) { - if (operation == "DECRYPT") decryptAndVerify() + if (operation in arrayOf("EDIT", "DECRYPT")) decryptAndVerify() } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { |