summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java9
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java6
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/Settings_Authentication.java4
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/Settings_Basic.java1
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/Utils.java9
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java2
-rw-r--r--main/src/main/java/de/blinkt/openvpn/views/FileSelectLayout.java6
-rw-r--r--main/src/main/res/xml/general_settings.xml6
8 files changed, 35 insertions, 8 deletions
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 36e1b621..9d12b83d 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/FileSelectionFragment.java
@@ -203,8 +203,11 @@ public class FileSelectionFragment extends ListFragment {
// add default locations
for (String dir: getExternalStorages()) {
- dirsMap.put(dir, dir);
- dirsPathMap.put(dir, dir);
+ // You got to love the P8 Lite to have null in this list ....
+ if (dir!=null) {
+ dirsMap.put(dir, dir);
+ dirsPathMap.put(dir, dir);
+ }
}
for (File file : files) {
@@ -289,6 +292,8 @@ public class FileSelectionFragment extends ListFragment {
}
}
+
+
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java b/main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java
index 18e5f87f..2d544ee5 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/GeneralSettings.java
@@ -64,6 +64,12 @@ public class GeneralSettings extends PreferenceFragment implements OnPreferenceC
devHacks.removePreference(cm9hack);
}
+ CheckBoxPreference useInternalFS = (CheckBoxPreference) findPreference("useInternalFileSelector");
+ if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT)
+ {
+ devHacks.removePreference(useInternalFS);
+ }
+
mExtapp = new ExternalAppDatabase(getActivity());
Preference clearapi = findPreference("clearapi");
clearapi.setOnPreferenceClickListener(this);
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Authentication.java b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Authentication.java
index b718de3a..1fc7337c 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Authentication.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Authentication.java
@@ -186,7 +186,7 @@ public class Settings_Authentication extends OpenVpnPreferencesFragment implemen
void startFileDialog() {
Intent startFC = null;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && ! Utils.alwaysUseOldFileChooser(getActivity())) {
startFC = Utils.getFilePickerIntent(getActivity(), Utils.FileType.TLS_AUTH_FILE);
startActivityForResult(startFC, SELECT_TLS_FILE_KITKAT);
}
@@ -209,7 +209,7 @@ public class Settings_Authentication extends OpenVpnPreferencesFragment implemen
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
- if(requestCode== SELECT_TLS_FILE_LEGACY_DIALOG && resultCode == Activity.RESULT_OK){
+ if(requestCode == SELECT_TLS_FILE_LEGACY_DIALOG && resultCode == Activity.RESULT_OK){
String result = data.getStringExtra(FileSelect.RESULT_DATA);
mTlsAuthFileData=result;
setTlsAuthSummary(result);
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Basic.java b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Basic.java
index 7188aca1..b6c6aad2 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Basic.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Basic.java
@@ -145,6 +145,7 @@ public class Settings_Basic extends Settings_Fragment implements View.OnClickLis
addFileSelectLayout(mpkcs12, Utils.FileType.PKCS12);
addFileSelectLayout(mCrlFile, Utils.FileType.CRL_FILE);
mCaCert.setShowClear();
+ mCrlFile.setShowClear();
mType.setOnItemSelectedListener(this);
mAuthRetry.setOnItemSelectedListener(this);
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 4b8f8d93..0fa89540 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java
@@ -6,8 +6,10 @@
package de.blinkt.openvpn.fragments;
import android.annotation.TargetApi;
+import android.app.Activity;
import android.content.Context;
import android.content.Intent;
+import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.database.Cursor;
@@ -25,6 +27,7 @@ import java.util.TreeSet;
import java.util.Vector;
import de.blinkt.openvpn.VpnProfile;
+import de.blinkt.openvpn.core.Preferences;
public class Utils {
@@ -148,6 +151,12 @@ public class Utils {
return i;
}
+ public static boolean alwaysUseOldFileChooser(Context c)
+ {
+ SharedPreferences prefs = Preferences.getDefaultSharedPreferences(c);
+
+ return prefs.getBoolean("useInternalFileSelector", false);
+ }
public static boolean isIntentAvailable(Context context, Intent i) {
final PackageManager packageManager = context.getPackageManager();
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java b/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java
index 5a786afd..a0aac73d 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/VPNProfileList.java
@@ -480,7 +480,7 @@ public class VPNProfileList extends ListFragment implements OnClickListener, Vpn
private boolean startImportConfigFilePicker() {
boolean startOldFileDialog = true;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && !Utils.alwaysUseOldFileChooser(getActivity() ))
startOldFileDialog = !startFilePicker();
if (startOldFileDialog)
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 01ea9a14..bc3bd5cd 100644
--- a/main/src/main/java/de/blinkt/openvpn/views/FileSelectLayout.java
+++ b/main/src/main/java/de/blinkt/openvpn/views/FileSelectLayout.java
@@ -169,10 +169,10 @@ public class FileSelectLayout extends LinearLayout implements OnClickListener {
startFilePicker = Utils.getFilePickerIntent(getContext(), fileType);
}
- if (startFilePicker != null) {
- mFragment.startActivityForResult(startFilePicker, mTaskId);
- } else {
+ if (startFilePicker == null || Utils.alwaysUseOldFileChooser(v.getContext())) {
getCertificateFileDialog();
+ } else {
+ mFragment.startActivityForResult(startFilePicker, mTaskId);
}
} else if (v == mShowClearButton) {
setData(null, getContext());
diff --git a/main/src/main/res/xml/general_settings.xml b/main/src/main/res/xml/general_settings.xml
index 928fa583..f0b9e9d9 100644
--- a/main/src/main/res/xml/general_settings.xml
+++ b/main/src/main/res/xml/general_settings.xml
@@ -79,6 +79,12 @@
android:key="loadTunModule"
android:summary="@string/setting_loadtun_summary"
android:title="@string/setting_loadtun"/>
+ <CheckBoxPreference
+ android:defaultValue="false"
+ android:title="Use internal file browser"
+ android:summary="Always use the very basic file browser instead of the Android file browser. Use this option if you have problems selecting files."
+ android:key="useInternalFileSelector">
+ </CheckBoxPreference>
</PreferenceCategory>
</PreferenceScreen> \ No newline at end of file