diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2013-05-30 16:23:22 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2013-05-30 16:23:22 +0200 |
| commit | 016a2b348ead0483be8d760c20bcd57e84c0f12b (patch) | |
| tree | f5b975617fbc216046dde1818730384830c25d31 /main/src | |
| parent | 458f962131c42fecae2b070f6d2d75b4167ca3e1 (diff) | |
| download | cgeo-016a2b348ead0483be8d760c20bcd57e84c0f12b.zip cgeo-016a2b348ead0483be8d760c20bcd57e84c0f12b.tar.gz cgeo-016a2b348ead0483be8d760c20bcd57e84c0f12b.tar.bz2 | |
refactoring: avoid more compiler warnings
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/DirectionProvider.java | 7 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/compatibility/AndroidLevel8Emulation.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/utils/ClipboardUtils.java | 4 |
3 files changed, 10 insertions, 5 deletions
diff --git a/main/src/cgeo/geocaching/DirectionProvider.java b/main/src/cgeo/geocaching/DirectionProvider.java index c1f83ac..37b184a 100644 --- a/main/src/cgeo/geocaching/DirectionProvider.java +++ b/main/src/cgeo/geocaching/DirectionProvider.java @@ -14,7 +14,7 @@ public class DirectionProvider extends MemorySubject<Float> implements SensorEve private final SensorManager sensorManager; - // Previous values signaled to observers to avoid resending the same value when the + // Previous values signaled to observers to avoid re-sending the same value when the // device doesn't change orientation. The orientation is usually given with a 1 degree // precision by Android, so it is not uncommon to obtain exactly the same value several // times. @@ -27,7 +27,8 @@ public class DirectionProvider extends MemorySubject<Float> implements SensorEve @Override protected void onFirstObserver() { - sensorManager.registerListener(this, sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), SensorManager.SENSOR_DELAY_NORMAL); + final Sensor defaultSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION); + sensorManager.registerListener(this, defaultSensor, SensorManager.SENSOR_DELAY_NORMAL); } @Override @@ -43,7 +44,7 @@ public class DirectionProvider extends MemorySubject<Float> implements SensorEve * this event leads to the log being flooded with multiple entries _per second_, * which I experienced when running cgeo in a building (with GPS and network being * unreliable). - * + * * See for example https://code.google.com/p/android/issues/detail?id=14792 */ diff --git a/main/src/cgeo/geocaching/compatibility/AndroidLevel8Emulation.java b/main/src/cgeo/geocaching/compatibility/AndroidLevel8Emulation.java index a60b48d..6d5781f 100644 --- a/main/src/cgeo/geocaching/compatibility/AndroidLevel8Emulation.java +++ b/main/src/cgeo/geocaching/compatibility/AndroidLevel8Emulation.java @@ -19,7 +19,11 @@ public class AndroidLevel8Emulation implements AndroidLevel8Interface { @Override public int getRotationOffset(Activity activity) { final Display display = activity.getWindowManager().getDefaultDisplay(); + + // the non deprecated method is available in API 8+ only, so we cannot deal better with this + @SuppressWarnings("deprecation") final int rotation = display.getOrientation(); + if (rotation == Configuration.ORIENTATION_LANDSCAPE) { return 90; } diff --git a/main/src/cgeo/geocaching/utils/ClipboardUtils.java b/main/src/cgeo/geocaching/utils/ClipboardUtils.java index e6779ad..9343576 100644 --- a/main/src/cgeo/geocaching/utils/ClipboardUtils.java +++ b/main/src/cgeo/geocaching/utils/ClipboardUtils.java @@ -3,7 +3,6 @@ package cgeo.geocaching.utils; import cgeo.geocaching.cgeoapplication; import android.content.Context; -import android.text.ClipboardManager; /** * Clipboard Utilities. Functions to copy data to the Android clipboard. @@ -20,7 +19,8 @@ public final class ClipboardUtils { * The text to place in the clipboard. */ public static void copyToClipboard(final CharSequence text) { - final ClipboardManager clipboard = (ClipboardManager) cgeoapplication.getInstance().getSystemService(Context.CLIPBOARD_SERVICE); + // fully qualified name used here to avoid buggy deprecation warning (of javac) on the import statement + final android.text.ClipboardManager clipboard = (android.text.ClipboardManager) cgeoapplication.getInstance().getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setText(text); } |
