aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/compatibility/Compatibility.java
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2014-01-03 14:50:10 +0100
committerBananeweizen <bananeweizen@gmx.de>2014-01-03 14:50:10 +0100
commitdb0a4fb12caf8744bbb5f7f6fbf9763368af8335 (patch)
treeee234a16e55311e109e01a1034cef5bb02c0397d /main/src/cgeo/geocaching/compatibility/Compatibility.java
parentccc7e82afed6c4ae6f8334a2ab05ff8acf543483 (diff)
downloadcgeo-db0a4fb12caf8744bbb5f7f6fbf9763368af8335.zip
cgeo-db0a4fb12caf8744bbb5f7f6fbf9763368af8335.tar.gz
cgeo-db0a4fb12caf8744bbb5f7f6fbf9763368af8335.tar.bz2
new: GPX import from Android storage access framework
Only works on Kitkat. Now you can import directly from dropbox and related services.
Diffstat (limited to 'main/src/cgeo/geocaching/compatibility/Compatibility.java')
-rw-r--r--main/src/cgeo/geocaching/compatibility/Compatibility.java37
1 files changed, 17 insertions, 20 deletions
diff --git a/main/src/cgeo/geocaching/compatibility/Compatibility.java b/main/src/cgeo/geocaching/compatibility/Compatibility.java
index 48454ef..31c9e31 100644
--- a/main/src/cgeo/geocaching/compatibility/Compatibility.java
+++ b/main/src/cgeo/geocaching/compatibility/Compatibility.java
@@ -5,6 +5,7 @@ import cgeo.geocaching.utils.AngleUtils;
import cgeo.geocaching.utils.Log;
import org.apache.commons.lang3.reflect.MethodUtils;
+import org.eclipse.jdt.annotation.NonNull;
import android.app.Activity;
import android.content.Intent;
@@ -24,33 +25,22 @@ public final class Compatibility {
private final static AndroidLevel8Interface level8;
private final static AndroidLevel11Interface level11;
private final static AndroidLevel13Interface level13;
+ private final static AndroidLevel19Interface level19;
static {
- if (isLevel8) {
- level8 = new AndroidLevel8();
- }
- else {
- level8 = new AndroidLevel8Emulation();
- }
- if (sdkVersion >= 11) {
- level11 = new AndroidLevel11();
- }
- else {
- level11 = new AndroidLevel11Emulation();
- }
- if (sdkVersion >= 13) {
- level13 = new AndroidLevel13();
- }
- else {
- level13 = new AndroidLevel13Emulation();
- }
+ level8 = isLevel8 ? new AndroidLevel8() : new AndroidLevel8Emulation();
+ level11 = sdkVersion >= 11 ? new AndroidLevel11() : new AndroidLevel11Emulation();
+ level13 = sdkVersion >= 13 ? new AndroidLevel13() : new AndroidLevel13Emulation();
+ level19 = sdkVersion >= 19 ? new AndroidLevel19() : new AndroidLevel19Emulation();
}
/**
* Add 90, 180 or 270 degrees to the given rotation.
*
- * @param directionNowPre the direction in degrees before adjustment
- * @param activity the activity whose rotation is used to adjust the direction
+ * @param directionNowPre
+ * the direction in degrees before adjustment
+ * @param activity
+ * the activity whose rotation is used to adjust the direction
* @return the adjusted direction, in the [0, 360[ range
*/
public static float getDirectionNow(final float directionNowPre, final Activity activity) {
@@ -110,4 +100,11 @@ public final class Compatibility {
return level8.getExternalPictureDir();
}
+ public static void importGpxFromStorageAccessFramework(final @NonNull Activity activity, int requestCodeImportGpx) {
+ level19.importGpxFromStorageAccessFramework(activity, requestCodeImportGpx);
+ }
+
+ public static boolean isStorageAccessFrameworkAvailable() {
+ return sdkVersion >= 19;
+ }
}