aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/compatibility
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/compatibility')
-rw-r--r--main/src/cgeo/geocaching/compatibility/AndroidLevel11.java17
-rw-r--r--main/src/cgeo/geocaching/compatibility/AndroidLevel11Emulation.java15
-rw-r--r--main/src/cgeo/geocaching/compatibility/AndroidLevel11Interface.java8
-rw-r--r--main/src/cgeo/geocaching/compatibility/Compatibility.java24
4 files changed, 11 insertions, 53 deletions
diff --git a/main/src/cgeo/geocaching/compatibility/AndroidLevel11.java b/main/src/cgeo/geocaching/compatibility/AndroidLevel11.java
deleted file mode 100644
index a425ee5..0000000
--- a/main/src/cgeo/geocaching/compatibility/AndroidLevel11.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package cgeo.geocaching.compatibility;
-
-import android.annotation.TargetApi;
-import android.app.Activity;
-
-/**
- * Android level 11 support
- */
-@TargetApi(11)
-public class AndroidLevel11 implements AndroidLevel11Interface {
-
- @Override
- public void invalidateOptionsMenu(final Activity activity) {
- activity.invalidateOptionsMenu();
- }
-
-}
diff --git a/main/src/cgeo/geocaching/compatibility/AndroidLevel11Emulation.java b/main/src/cgeo/geocaching/compatibility/AndroidLevel11Emulation.java
deleted file mode 100644
index 6a23ed5..0000000
--- a/main/src/cgeo/geocaching/compatibility/AndroidLevel11Emulation.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package cgeo.geocaching.compatibility;
-
-import android.app.Activity;
-
-/**
- * implement level 11 API using older methods
- */
-public class AndroidLevel11Emulation implements AndroidLevel11Interface {
-
- @Override
- public void invalidateOptionsMenu(final Activity activity) {
- // do nothing
- }
-
-}
diff --git a/main/src/cgeo/geocaching/compatibility/AndroidLevel11Interface.java b/main/src/cgeo/geocaching/compatibility/AndroidLevel11Interface.java
deleted file mode 100644
index 236e92d..0000000
--- a/main/src/cgeo/geocaching/compatibility/AndroidLevel11Interface.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package cgeo.geocaching.compatibility;
-
-import android.app.Activity;
-
-public interface AndroidLevel11Interface {
- public void invalidateOptionsMenu(final Activity activity);
-
-}
diff --git a/main/src/cgeo/geocaching/compatibility/Compatibility.java b/main/src/cgeo/geocaching/compatibility/Compatibility.java
index a293cfd..54e2966 100644
--- a/main/src/cgeo/geocaching/compatibility/Compatibility.java
+++ b/main/src/cgeo/geocaching/compatibility/Compatibility.java
@@ -8,35 +8,33 @@ import android.os.Build;
public final class Compatibility {
- private final static int sdkVersion = Build.VERSION.SDK_INT;
+ private static final int SDK_VERSION = Build.VERSION.SDK_INT;
- private final static AndroidLevel11Interface level11;
- private final static AndroidLevel13Interface level13;
- private final static AndroidLevel19Interface level19;
+ private static final AndroidLevel13Interface LEVEL_13;
+ private static final AndroidLevel19Interface LEVEL_19;
static {
- level11 = sdkVersion >= 11 ? new AndroidLevel11() : new AndroidLevel11Emulation();
- level13 = sdkVersion >= 13 ? new AndroidLevel13() : new AndroidLevel13Emulation();
- level19 = sdkVersion >= 19 ? new AndroidLevel19() : new AndroidLevel19Emulation();
+ LEVEL_13 = SDK_VERSION >= 13 ? new AndroidLevel13() : new AndroidLevel13Emulation();
+ LEVEL_19 = SDK_VERSION >= 19 ? new AndroidLevel19() : new AndroidLevel19Emulation();
}
- public static void invalidateOptionsMenu(final Activity activity) {
- level11.invalidateOptionsMenu(activity);
+ private Compatibility() {
+ // utility class
}
public static int getDisplayWidth() {
- return level13.getDisplayWidth();
+ return LEVEL_13.getDisplayWidth();
}
public static Point getDisplaySize() {
- return level13.getDisplaySize();
+ return LEVEL_13.getDisplaySize();
}
public static void importGpxFromStorageAccessFramework(final @NonNull Activity activity, int requestCodeImportGpx) {
- level19.importGpxFromStorageAccessFramework(activity, requestCodeImportGpx);
+ LEVEL_19.importGpxFromStorageAccessFramework(activity, requestCodeImportGpx);
}
public static boolean isStorageAccessFrameworkAvailable() {
- return sdkVersion >= 19;
+ return SDK_VERSION >= 19;
}
}