mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-09-01 06:45:19 +00:00
backport the fix of ssh key import
This commit is contained in:
@@ -241,23 +241,21 @@ class UserPreference : AppCompatActivity() {
|
|||||||
* Opens a file explorer to import the private key
|
* Opens a file explorer to import the private key
|
||||||
*/
|
*/
|
||||||
fun getSshKey(useDefaultPicker: Boolean) {
|
fun getSshKey(useDefaultPicker: Boolean) {
|
||||||
if (useDefaultPicker) {
|
val intent = if (useDefaultPicker) {
|
||||||
val intent = Intent(Intent.ACTION_GET_CONTENT)
|
val intent = Intent(Intent.ACTION_GET_CONTENT)
|
||||||
intent.type = "*/*"
|
intent.setType("*/*")
|
||||||
startActivityForResult(intent, IMPORT_SSH_KEY)
|
|
||||||
} else {
|
} else {
|
||||||
// This always works
|
// This always works
|
||||||
val i = Intent(applicationContext, FilePickerActivity::class.java)
|
val intent = Intent(applicationContext, FilePickerActivity::class.java)
|
||||||
// This works if you defined the intent filter
|
|
||||||
// Intent i = new Intent(Intent.ACTION_GET_CONTENT);
|
|
||||||
|
|
||||||
// Set these depending on your use case. These are the defaults.
|
// Set these depending on your use case. These are the defaults.
|
||||||
i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false)
|
intent.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false)
|
||||||
i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false)
|
intent.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false)
|
||||||
i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_FILE)
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user