diff options
author | Arne Schwabe <arne@rfc2549.org> | 2014-06-13 15:25:45 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2014-06-13 15:25:45 +0200 |
commit | 05a92d143b21af734d0826ab862e8be030686e09 (patch) | |
tree | 9dd49897248c56ae8f8936c59b81b9f36d5d2ba8 /main/src | |
parent | 00c9c061e2d389432cc52dd133af515b32f45b86 (diff) |
Use GET_CONTENT on every device but not on Samsung where the documentsui seems to unable to handle GET_CONTENT. Also always show SD cards
Diffstat (limited to 'main/src')
-rw-r--r-- | main/src/main/java/de/blinkt/openvpn/fragments/Utils.java | 24 |
1 files changed, 19 insertions, 5 deletions
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 f7038877..6784af93 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/Utils.java @@ -10,16 +10,17 @@ import android.net.Uri; import android.os.Build; import android.provider.OpenableColumns; import android.util.Base64; -import android.util.Log; import android.webkit.MimeTypeMap; -import de.blinkt.openvpn.VpnProfile; -import junit.framework.Assert; -import java.io.*; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; import java.util.List; import java.util.TreeSet; import java.util.Vector; +import de.blinkt.openvpn.VpnProfile; + public class Utils { @@ -99,17 +100,30 @@ public class Utils { i.putExtra(Intent.EXTRA_MIME_TYPES, supportedMimeTypes.toArray(new String[supportedMimeTypes.size()])); + // People don't know that this is actually a system setting. Override it ... + // DocumentsContract.EXTRA_SHOW_ADVANCED is hidden + i.putExtra("android.content.extra.SHOW_ADVANCED", true); + /* 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"); + + //noinspection ConstantConditions - if (true || !isIntentAvailable(c,i)) { + if (!isIntentAvailable(c,i)) { i.setAction(Intent.ACTION_OPEN_DOCUMENT); i.setPackage(null); } + /* + final PackageManager packageManager = c.getPackageManager(); + ResolveInfo list = packageManager.resolveActivity(i, 0); + + Toast.makeText(c, "Starting package: "+ list.activityInfo.packageName + + "with ACTION " + i.getAction(), Toast.LENGTH_LONG).show(); + */ return i; } |