summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/views/FileSelectLayout.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/views/FileSelectLayout.java b/main/src/main/java/de/blinkt/openvpn/views/FileSelectLayout.java
index 1addd831..401eaa2a 100644
--- a/main/src/main/java/de/blinkt/openvpn/views/FileSelectLayout.java
+++ b/main/src/main/java/de/blinkt/openvpn/views/FileSelectLayout.java
@@ -32,23 +32,22 @@ public class FileSelectLayout extends LinearLayout implements OnClickListener {
public void parseResponse(Intent data, Context c) {
- if (VERSION.SDK_INT < VERSION_CODES.KITKAT) {
- String fileData = data.getStringExtra(FileSelect.RESULT_DATA);
- setData(fileData, c);
- } else if (data != null) {
+
try {
String newData = Utils.getFilePickerResult(fileType, data, c);
if (newData!=null)
setData(newData, c);
+ if (newData == null) {
+ String fileData = data.getStringExtra(FileSelect.RESULT_DATA);
+ setData(fileData, c);
+ }
+
} catch (IOException e) {
VpnStatus.logException(e);
} catch (SecurityException e) {
VpnStatus.logException(e);
}
-
-
- }
}
public interface FileSelectCallback {
@@ -166,8 +165,12 @@ public class FileSelectLayout extends LinearLayout implements OnClickListener {
@Override
public void onClick(View v) {
if (v == mSelectButton) {
+ Intent startFilePicker=null;
if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
- Intent startFilePicker = Utils.getFilePickerIntent(getContext(),fileType);
+ startFilePicker = Utils.getFilePickerIntent(getContext(), fileType);
+ }
+
+ if (startFilePicker != null) {
mFragment.startActivityForResult(startFilePicker, mTaskId);
} else {
getCertificateFileDialog();