From 265ac86903f6a35fccbc96ec781bad26b0c5c268 Mon Sep 17 00:00:00 2001 From: Zeapo Date: Sat, 9 Aug 2014 01:25:56 +0100 Subject: [PATCH] refresh list after pull and removal --- app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java | 1 + app/src/main/java/com/zeapo/pwdstore/PasswordStore.java | 7 +++++-- .../main/java/com/zeapo/pwdstore/crypto/PgpHandler.java | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java b/app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java index 085798ce..8db11c43 100644 --- a/app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java +++ b/app/src/main/java/com/zeapo/pwdstore/GitAsyncTask.java @@ -59,6 +59,7 @@ public class GitAsyncTask extends AsyncTask { Log.i("GIT_ASYNC", result + ""); this.dialog.dismiss(); if (finishOnEnd) { + this.activity.setResult(Activity.RESULT_OK); this.activity.finish(); } } diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java index 0ff75c3b..e291b8df 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java @@ -102,14 +102,14 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI case R.id.git_push: intent = new Intent(this, GitHandler.class); intent.putExtra("Operation", GitHandler.REQUEST_PUSH); - startActivity(intent); + startActivityForResult(intent, GitHandler.REQUEST_PUSH); this.leftActivity = true; return true; case R.id.git_pull: intent = new Intent(this, GitHandler.class); intent.putExtra("Operation", GitHandler.REQUEST_PULL); - startActivity(intent); + startActivityForResult(intent, GitHandler.REQUEST_PULL); this.leftActivity = true; return true; @@ -253,6 +253,9 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (resultCode == RESULT_CANCELED) + refreshListAdapter(); + if (resultCode == RESULT_OK) { refreshListAdapter(); diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java index 58a150d8..754381cf 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java @@ -452,7 +452,7 @@ public class PgpHandler extends Activity { git.rm().addFilepattern(getIntent().getExtras().getString("FILE_PATH").replace(PasswordRepository.getWorkTree() + "/", "")), git.commit().setMessage("[ANDROID PwdStore] Remove " + getIntent().getExtras().getString("FILE_PATH") + " from store.") ); - setResult(RESULT_OK); + setResult(RESULT_CANCELED); finish(); } })