aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorMatthew Wong <wongma@protonmail.ch>2015-07-14 22:43:54 -0400
committerMatthew Wong <wongma@protonmail.ch>2015-07-14 22:43:54 -0400
commite0954cd400aa2f8799b92b979cb98aa583938144 (patch)
treea3dfa2706ebff790433d3c4a15c83102da83c702 /app/src/main/java
parent56cbade066eb21817a1f7f9a3b1a4c57f808828f (diff)
Change 'No SSH key' dialog to have options for import or generate. Also add all the strings...
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/GitOperation.java30
1 files changed, 23 insertions, 7 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.java b/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.java
index c7b70ca4..c4d7eea4 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.java
+++ b/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.java
@@ -92,7 +92,7 @@ public abstract class GitOperation {
new AlertDialog.Builder(callingActivity)
.setMessage(callingActivity.getResources().getString(R.string.ssh_preferences_dialog_text))
.setTitle(callingActivity.getResources().getString(R.string.ssh_preferences_dialog_title))
- .setPositiveButton(callingActivity.getResources().getString(R.string.dialog_ok), new DialogInterface.OnClickListener() {
+ .setPositiveButton(callingActivity.getResources().getString(R.string.ssh_preferences_dialog_import), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
try {
@@ -106,12 +106,28 @@ public abstract class GitOperation {
e.printStackTrace();
}
}
- }).setNegativeButton(callingActivity.getResources().getString(R.string.dialog_cancel), new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int id) {
- // Do nothing...
- }
- }).show();
+ })
+ .setNegativeButton(callingActivity.getResources().getString(R.string.ssh_preferences_dialog_generate), new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ try {
+ // Duplicated code
+ Intent intent = new Intent(callingActivity.getApplicationContext(), UserPreference.class);
+ intent.putExtra("operation", "make_ssh_key");
+ callingActivity.startActivityForResult(intent, GET_SSH_KEY_FROM_CLONE);
+ } catch (Exception e) {
+ System.out.println("Exception caught :(");
+ e.printStackTrace();
+ }
+ }
+ })
+ .setNeutralButton(callingActivity.getResources().getString(R.string.dialog_cancel), new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int id) {
+ // Finish the blank GitActivity so user doesn't have to press back
+ callingActivity.finish();
+ }
+ }).show();
} else {
final EditText passphrase = new EditText(callingActivity);
passphrase.setHint("Passphrase");