Change 'No SSH key' dialog to have options for import or generate. Also add all the strings...

This commit is contained in:
Matthew Wong 2015-07-14 22:43:54 -04:00
parent 56cbade066
commit e0954cd400
2 changed files with 31 additions and 8 deletions

View file

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

View file

@ -47,8 +47,10 @@
<string name="read_only_dialog_text">You are about to use a read-only repository, you will not be able to push to it</string>
<string name="forget_username_dialog_text">Did you forget to specify a username?</string>
<string name="set_information_dialog_text">You have to set the information about the server before synchronizing with the server</string>
<string name="ssh_preferences_dialog_text">Please import your SSH key file in the preferences</string>
<string name="ssh_preferences_dialog_text">Please import or generate your SSH key file in the preferences</string>
<string name="ssh_preferences_dialog_title">No SSH key</string>
<string name="ssh_preferences_dialog_import">Import</string>
<string name="ssh_preferences_dialog_generate">Generate</string>
<string name="passphrase_dialog_title">Authenticate</string>
<string name="passphrase_dialog_text">Please provide the passphrase for your SSH key. Leave it empty if there is no passphrase.</string>
<string name="password_dialog_text">Please provide the password for this repository</string>
@ -95,6 +97,7 @@
<string name="pref_git_username_hint">username</string>
<string name="pref_edit_server_info">Edit git server settings</string>
<string name="pref_ssh_title">Import ssh-key</string>
<string name="pref_ssh_keygen_title">Generate ssh-key</string>
<string name="pref_git_delete_repo">Delete repository</string>
<string name="pref_dialog_delete_title">Clear repository</string>
<string name="pref_dialog_delete_msg">Do you want to delete the current password store directory? This will not clear your configuration.</string>
@ -122,6 +125,10 @@
<string name="pwgen_uppercase">Uppercase</string>
<string name="pwgen_ambiguous">Ambiguous</string>
<!-- ssh keygen fragment -->
<string name="ssh_keygen_copy">Copy</string>
<string name="ssh_keygen_tip">Provide this public key to your Git server.</string>
<!-- Misc -->
<string name="dialog_ok">OK</string>
<string name="dialog_yes">Yes</string>