diff options
author | zeapo <mohamed@zenadi.com> | 2017-08-09 14:27:07 +0200 |
---|---|---|
committer | Mohamed Zenadi <zeapo@users.noreply.github.com> | 2017-08-10 11:10:29 +0200 |
commit | 7bdeb800115d8d87bfdc8b0eb9963d4acd6421ae (patch) | |
tree | 7367f64e7143d3fc5c247d1e3f4a68c124d4ae81 | |
parent | 6b967923fd08b1b692a320a3a79560204cdf35a5 (diff) |
backport the fix of ssh key import
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/UserPreference.kt | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt index 099f004c..f3c33dd3 100644 --- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt +++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.kt @@ -241,23 +241,21 @@ class UserPreference : AppCompatActivity() { * Opens a file explorer to import the private key */ fun getSshKey(useDefaultPicker: Boolean) { - if (useDefaultPicker) { + val intent = if (useDefaultPicker) { val intent = Intent(Intent.ACTION_GET_CONTENT) - intent.type = "*/*" - startActivityForResult(intent, IMPORT_SSH_KEY) + intent.setType("*/*") } else { // This always works - val i = Intent(applicationContext, FilePickerActivity::class.java) - // This works if you defined the intent filter - // Intent i = new Intent(Intent.ACTION_GET_CONTENT); + val intent = Intent(applicationContext, FilePickerActivity::class.java) // Set these depending on your use case. These are the defaults. - i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false) - i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false) - i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE) + intent.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false) + intent.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false) + intent.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE) - i.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().path) + intent.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().path) } + startActivityForResult(intent, IMPORT_SSH_KEY) } /** |