Add support of EDIT from the selection menu

This commit is contained in:
Mohamed Zenadi
2017-07-29 15:15:22 +01:00
committed by Mohamed Zenadi
parent e1ae4978ec
commit 958ea12a88
2 changed files with 11 additions and 4 deletions

View File

@@ -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);
}

View File

@@ -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?) {