diff options
Diffstat (limited to 'src/cgeo/geocaching/compatibility')
3 files changed, 77 insertions, 77 deletions
diff --git a/src/cgeo/geocaching/compatibility/AndroidLevel8.java b/src/cgeo/geocaching/compatibility/AndroidLevel8.java index a821502..9c5148a 100644 --- a/src/cgeo/geocaching/compatibility/AndroidLevel8.java +++ b/src/cgeo/geocaching/compatibility/AndroidLevel8.java @@ -3,25 +3,25 @@ package cgeo.geocaching.compatibility; import android.app.Activity; public class AndroidLevel8 { - static { - try { - Class.forName("cgeo.geocaching.compatibility.AndroidLevel8Internal"); - } catch (Exception e) { - throw new RuntimeException(e); - } - } + static { + try { + Class.forName("cgeo.geocaching.compatibility.AndroidLevel8Internal"); + } catch (Exception e) { + throw new RuntimeException(e); + } + } - private AndroidLevel8Internal internal; + private AndroidLevel8Internal internal; - public static void check() { - // nothing - } + public static void check() { + // nothing + } - public AndroidLevel8() { - internal = new AndroidLevel8Internal(); - } + public AndroidLevel8() { + internal = new AndroidLevel8Internal(); + } - public int getRotation(Activity activity) { - return internal.getRotation(activity); - } + public int getRotation(Activity activity) { + return internal.getRotation(activity); + } } diff --git a/src/cgeo/geocaching/compatibility/AndroidLevel8Internal.java b/src/cgeo/geocaching/compatibility/AndroidLevel8Internal.java index c68f20e..45b465b 100644 --- a/src/cgeo/geocaching/compatibility/AndroidLevel8Internal.java +++ b/src/cgeo/geocaching/compatibility/AndroidLevel8Internal.java @@ -5,11 +5,11 @@ import android.view.Display; class AndroidLevel8Internal { - public AndroidLevel8Internal() { - } + public AndroidLevel8Internal() { + } - public static int getRotation(final Activity activity) { - Display display = activity.getWindowManager().getDefaultDisplay(); - return display.getRotation(); - } + public static int getRotation(final Activity activity) { + Display display = activity.getWindowManager().getDefaultDisplay(); + return display.getRotation(); + } } diff --git a/src/cgeo/geocaching/compatibility/Compatibility.java b/src/cgeo/geocaching/compatibility/Compatibility.java index bc58764..2f94915 100644 --- a/src/cgeo/geocaching/compatibility/Compatibility.java +++ b/src/cgeo/geocaching/compatibility/Compatibility.java @@ -9,64 +9,64 @@ import android.view.Surface; public final class Compatibility { - private static AndroidLevel8 level8; - private static boolean initialized = false; + private static AndroidLevel8 level8; + private static boolean initialized = false; - private static AndroidLevel8 getLevel8() { - if (!initialized) { - try { - final int sdk = Integer.valueOf(Build.VERSION.SDK).intValue(); - if (sdk >= 8) { - level8 = new AndroidLevel8(); - } - } catch (Exception e) { - // nothing - } - initialized = true; - } - return level8; - } + private static AndroidLevel8 getLevel8() { + if (!initialized) { + try { + final int sdk = Integer.valueOf(Build.VERSION.SDK).intValue(); + if (sdk >= 8) { + level8 = new AndroidLevel8(); + } + } catch (Exception e) { + // nothing + } + initialized = true; + } + return level8; + } - public static Float getDirectionNow(final Float directionNowPre, - final Activity activity) { - AndroidLevel8 level8 = getLevel8(); + public static Float getDirectionNow(final Float directionNowPre, + final Activity activity) { + AndroidLevel8 level8 = getLevel8(); - if (level8 != null) { - final int rotation = level8.getRotation(activity); - if (rotation == Surface.ROTATION_90) { - return directionNowPre + 90; - } else if (rotation == Surface.ROTATION_180) { - return directionNowPre + 180; - } else if (rotation == Surface.ROTATION_270) { - return directionNowPre + 270; - } - } else { - final Display display = activity.getWindowManager() - .getDefaultDisplay(); - final int rotation = display.getOrientation(); - if (rotation == Configuration.ORIENTATION_LANDSCAPE) { - return directionNowPre + 90; - } - } - return directionNowPre; - } + if (level8 != null) { + final int rotation = level8.getRotation(activity); + if (rotation == Surface.ROTATION_90) { + return directionNowPre + 90; + } else if (rotation == Surface.ROTATION_180) { + return directionNowPre + 180; + } else if (rotation == Surface.ROTATION_270) { + return directionNowPre + 270; + } + } else { + final Display display = activity.getWindowManager() + .getDefaultDisplay(); + final int rotation = display.getOrientation(); + if (rotation == Configuration.ORIENTATION_LANDSCAPE) { + return directionNowPre + 90; + } + } + return directionNowPre; + } - public static Uri getCalendarProviderURI() { - final int sdk = Integer.valueOf(Build.VERSION.SDK).intValue(); - if (sdk >= 8) { - return Uri.parse("content://com.android.calendar/calendars"); - } else { - return Uri.parse("content://calendar/calendars"); - } - } + public static Uri getCalendarProviderURI() { + final int sdk = Integer.valueOf(Build.VERSION.SDK).intValue(); + if (sdk >= 8) { + return Uri.parse("content://com.android.calendar/calendars"); + } else { + return Uri.parse("content://calendar/calendars"); + } + } - public static Uri getCalenderEventsProviderURI() { - final int sdk = Integer.valueOf(Build.VERSION.SDK).intValue(); - if (sdk >= 8) { - return Uri.parse("content://com.android.calendar/events"); - } else { - return Uri.parse("content://calendar/events"); - } - } + public static Uri getCalenderEventsProviderURI() { + final int sdk = Integer.valueOf(Build.VERSION.SDK).intValue(); + if (sdk >= 8) { + return Uri.parse("content://com.android.calendar/events"); + } else { + return Uri.parse("content://calendar/events"); + } + } } |
