mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-09-03 07:45:08 +00:00
Add support of EDIT from the selection menu
This commit is contained in:
committed by
Mohamed Zenadi
parent
e1ae4978ec
commit
958ea12a88
@@ -425,10 +425,12 @@ public class PasswordStore extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void editPassword(PasswordItem item) {
|
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("NAME", item.toString());
|
||||||
intent.putExtra("FILE_PATH", item.getFile().getAbsolutePath());
|
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);
|
startActivityForResult(intent, PgpHandler.REQUEST_CODE_EDIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -76,7 +76,7 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
|
|||||||
}
|
}
|
||||||
|
|
||||||
when (operation) {
|
when (operation) {
|
||||||
"DECRYPT" -> {
|
"DECRYPT", "EDIT" -> {
|
||||||
setContentView(R.layout.decrypt_layout)
|
setContentView(R.layout.decrypt_layout)
|
||||||
crypto_password_category_decrypt.text = "$cat/"
|
crypto_password_category_decrypt.text = "$cat/"
|
||||||
crypto_password_file.text = name
|
crypto_password_file.text = name
|
||||||
@@ -168,6 +168,11 @@ class PgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBound {
|
|||||||
|
|
||||||
passwordEntry = entry
|
passwordEntry = entry
|
||||||
|
|
||||||
|
if (operation == "EDIT") {
|
||||||
|
editPassword()
|
||||||
|
return@executeApiAsync
|
||||||
|
}
|
||||||
|
|
||||||
crypto_password_show.typeface = monoTypeface
|
crypto_password_show.typeface = monoTypeface
|
||||||
crypto_password_show.text = entry.password
|
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
|
* The action to take when the PGP service is bound
|
||||||
*/
|
*/
|
||||||
override fun onBound(service: IOpenPgpService2?) {
|
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?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
|
Reference in New Issue
Block a user