From f3957386eb230ab85fa7d727c96d9ca6fe122ee3 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Tue, 21 Jan 2014 20:37:05 +0100 Subject: Move to common code for selecting and embedding files --HG-- extra : rebase_source : 7e0aa4672ca93e4e3b6a7c056e1004edd12f2fbc --- .../blinkt/openvpn/fragments/VPNProfileList.java | 32 +--------------------- 1 file changed, 1 insertion(+), 31 deletions(-) (limited to 'src/de/blinkt/openvpn/fragments/VPNProfileList.java') diff --git a/src/de/blinkt/openvpn/fragments/VPNProfileList.java b/src/de/blinkt/openvpn/fragments/VPNProfileList.java index 1fd875b0..b26f3505 100644 --- a/src/de/blinkt/openvpn/fragments/VPNProfileList.java +++ b/src/de/blinkt/openvpn/fragments/VPNProfileList.java @@ -220,37 +220,7 @@ public class VPNProfileList extends ListFragment { @TargetApi(Build.VERSION_CODES.KITKAT) private void startFilePicker() { - - - - Intent i = new Intent(Intent.ACTION_OPEN_DOCUMENT); - i.addCategory(Intent.CATEGORY_OPENABLE); - i.setType("application/x-openvpn-profile"); - - - TreeSet supportedMimeTypes = new TreeSet(); - supportedMimeTypes.add("application/x-openvpn-profile"); - supportedMimeTypes.add("application/openvpn-profile"); - supportedMimeTypes.add("application/ovpn"); - - - // Webservers unfortunately report this for .conf files sometimes - supportedMimeTypes.add("text/plain"); - supportedMimeTypes.add("application/conf"); - - MimeTypeMap mtm = MimeTypeMap.getSingleton(); - - for(String ext: new String[] {"ovpn", "conf"}) { - String mimeType = mtm.getMimeTypeFromExtension(ext); - if(mimeType!=null) - supportedMimeTypes.add(mimeType); - else - supportedMimeTypes.add("application/octet-stream"); - } - - - - i.putExtra(Intent.EXTRA_MIME_TYPES, supportedMimeTypes.toArray(new String[supportedMimeTypes.size()])); + Intent i = Utils.getFilePickerIntent(Utils.FileType.OVPN_CONFIG); startActivityForResult(i, FILE_PICKER_RESULT); } -- cgit v1.2.3