summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordStore.java9
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java16
2 files changed, 21 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 6faecf86..c207f382 100644
--- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
+++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
@@ -177,7 +177,7 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
intent.putExtra("NAME", item.getName());
intent.putExtra("FILE_PATH", item.getFile().getAbsolutePath());
intent.putExtra("Operation", "DECRYPT");
- startActivity(intent);
+ startActivityForResult(intent, 0);
} catch (IOException e) {
e.printStackTrace();
@@ -201,9 +201,16 @@ public class PasswordStore extends Activity implements ToCloneOrNot.OnFragmentI
intent.putExtra("NAME", "test.gpg");
intent.putExtra("FILE_PATH", this.currentDir.getAbsolutePath());
intent.putExtra("Operation", "ENCRYPT");
+ // TODO Define different operations here
startActivityForResult(intent, 0);
} catch (Exception e) {
e.printStackTrace();
}
}
+
+ protected void onActivityResult(int requestCode, int resultCode,
+ Intent data) {
+ System.out.println(resultCode);
+ checkLocalRepository(this.currentDir);
+ }
}
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 11c2985e..9e44cdf2 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java
@@ -92,6 +92,11 @@ public class PgpHandler extends Activity {
mServiceConnection = new OpenPgpServiceConnection(
PgpHandler.this, providerPackageName);
mServiceConnection.bindToService();
+
+ ActionBar actionBar = getActionBar();
+// actionBar.setHomeButtonEnabled(true);
+// actionBar.setDisplayShowHomeEnabled(true);
+ actionBar.setDisplayHomeAsUpEnabled(true);
}
@@ -108,8 +113,10 @@ public class PgpHandler extends Activity {
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
- if (id == R.id.action_settings) {
- return true;
+ switch (id) {
+ case android.R.id.home:
+ finish();
+ return true;
}
return super.onOptionsItemSelected(item);
}
@@ -123,6 +130,7 @@ public class PgpHandler extends Activity {
encrypt(new Intent());
break;
case R.id.crypto_cancel_add:
+ finish();
break;
default:
// should not happen
@@ -257,11 +265,12 @@ public class PgpHandler extends Activity {
+ ".gpg";
OutputStream outputStream = FileUtils.openOutputStream(new File(path));
outputStream.write(os.toByteArray());
- finishActivity(0);
} else {
showToast(os.toString());
}
+ setResult(998);
+ finish();
} catch (Exception e) {
Log.e(Constants.TAG, "UnsupportedEncodingException", e);
}
@@ -330,6 +339,7 @@ public class PgpHandler extends Activity {
public void encrypt(Intent data) {
data.setAction(OpenPgpApi.ACTION_ENCRYPT);
+ // TODO add preference so that the user sets his account name
data.putExtra(OpenPgpApi.EXTRA_USER_IDS, new String[] {"default"});
data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);