summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2015-02-05 14:07:13 +0100
committerArne Schwabe <arne@rfc2549.org>2015-02-05 14:07:13 +0100
commitf90a247d76d057701ec7e567e2a7861bf6199d08 (patch)
treef2e2c5cf98cf94186de0729804ea25c6ccdde8d8 /main
parentf1e5a2c7a4ef8e7c5e8df3a9ed8861548a8019f8 (diff)
Fall back on old file dialog for all file dialogs (fixes Android TV)
Diffstat (limited to 'main')
-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();