From db0a4fb12caf8744bbb5f7f6fbf9763368af8335 Mon Sep 17 00:00:00 2001 From: Bananeweizen Date: Fri, 3 Jan 2014 14:50:10 +0100 Subject: new: GPX import from Android storage access framework Only works on Kitkat. Now you can import directly from dropbox and related services. --- .../geocaching/compatibility/AndroidLevel19.java | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 main/src/cgeo/geocaching/compatibility/AndroidLevel19.java (limited to 'main/src/cgeo/geocaching/compatibility/AndroidLevel19.java') diff --git a/main/src/cgeo/geocaching/compatibility/AndroidLevel19.java b/main/src/cgeo/geocaching/compatibility/AndroidLevel19.java new file mode 100644 index 0000000..ed4849f --- /dev/null +++ b/main/src/cgeo/geocaching/compatibility/AndroidLevel19.java @@ -0,0 +1,25 @@ +package cgeo.geocaching.compatibility; + +import android.annotation.TargetApi; +import android.app.Activity; +import android.content.Intent; + +@TargetApi(19) +public class AndroidLevel19 implements AndroidLevel19Interface { + + @Override + public void importGpxFromStorageAccessFramework(final Activity activity, final int requestCode) { + // ACTION_OPEN_DOCUMENT is the intent to choose a file via the system's file browser. + Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); + + // Filter to only show results that can be "opened", such as a file (as opposed to a list + // of contacts or timezones) + intent.addCategory(Intent.CATEGORY_OPENABLE); + + // Mime type based filter, we use "*/*" as GPX does not have a good mime type anyway + intent.setType("*/*"); + + activity.startActivityForResult(intent, requestCode); + } + +} -- cgit v1.1