summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2017-05-18 16:51:23 +0200
committerArne Schwabe <arne@rfc2549.org>2017-05-18 16:51:23 +0200
commit20bce1501a2b41313ce85ae99d06e7a5f3f08437 (patch)
tree5dbd4bdb720cbf7489116a4f56c07c47296eec21 /main
parentfd72bd2cebbf6cd7bb6f37ea13e6d3398590cde6 (diff)
Fix fallback to old file select on newer devices (closes #660)
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/activities/FileSelect.java2
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java12
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/Utils.java5
3 files changed, 13 insertions, 6 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/activities/FileSelect.java b/main/src/main/java/de/blinkt/openvpn/activities/FileSelect.java
index b0b94e66..573fdd62 100644
--- a/main/src/main/java/de/blinkt/openvpn/activities/FileSelect.java
+++ b/main/src/main/java/de/blinkt/openvpn/activities/FileSelect.java
@@ -111,6 +111,8 @@ public class FileSelect extends BaseActivity {
if (grantResults[0] == PackageManager.PERMISSION_DENIED) {
setResult(RESULT_CANCELED);
finish();
+ } else {
+ mFSFragment.refresh();
}
}
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java b/main/src/main/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java
index f59094bf..0a9384f9 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java
@@ -133,6 +133,10 @@ public class FileSelectionFragment extends ListFragment {
getDir(mStartPath);
}
+ public void refresh() {
+ getDir(currentPath);
+ }
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -153,11 +157,6 @@ public class FileSelectionFragment extends ListFragment {
}
- /**
- * Monta a estrutura de arquivos e diretorios filhos do diretorio fornecido.
- *
- * @param dirPath Diretorio pai.
- */
private void getDirImpl(final String dirPath) {
currentPath = dirPath;
@@ -172,6 +171,9 @@ public class FileSelectionFragment extends ListFragment {
currentPath = ROOT;
f = new File(currentPath);
files = f.listFiles();
+
+ if (files == null)
+ files = new File [] {};
}
myPath.setText(getText(R.string.location) + ": " + currentPath);
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java b/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java
index 1344b1e6..4b8f8d93 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java
@@ -91,6 +91,7 @@ public class Utils {
case CRL_FILE:
supportedMimeTypes.add("application/x-pkcs7-crl");
supportedMimeTypes.add("application/pkix-crl");
+ extensions.add("crl");
break;
case USERPW_FILE:
@@ -118,7 +119,9 @@ public class Utils {
/* Samsung has decided to do something strange, on stock Android GET_CONTENT opens the document UI */
/* fist try with documentsui */
- i.setPackage("com.android.documentsui");
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.N)
+ i.setPackage("com.android.documentsui");
+