diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2013-05-10 17:23:00 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2013-05-10 17:23:00 +0200 |
| commit | 4cef505a2c182e5e8b7023d874be266ae9769da5 (patch) | |
| tree | b2de6091d36569ec6fd85193de9f829a0ce4aba3 /main/src | |
| parent | f969d3196b9b62181387ae1dc2522e7742e8e968 (diff) | |
| download | cgeo-4cef505a2c182e5e8b7023d874be266ae9769da5.zip cgeo-4cef505a2c182e5e8b7023d874be266ae9769da5.tar.gz cgeo-4cef505a2c182e5e8b7023d874be266ae9769da5.tar.bz2 | |
refactoring: make handler abstract
* needs overridden methods
* add documentation
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/utils/GeoDirHandler.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/utils/GeoDirHandler.java b/main/src/cgeo/geocaching/utils/GeoDirHandler.java index 21b2562..78455c4 100644 --- a/main/src/cgeo/geocaching/utils/GeoDirHandler.java +++ b/main/src/cgeo/geocaching/utils/GeoDirHandler.java @@ -9,10 +9,19 @@ import android.os.Message; /** * GeoData and Direction handler. Manipulating geodata and direction information - * through a GeoDirHandler ensures that all listeners are registered from a - * {@link android.os.Looper} thread. + * through a GeoDirHandler ensures that all listeners are registered from a {@link android.os.Looper} thread. + * <p> + * To use this class, override at least one of {@link #updateDirection(float)} or {@link #updateGeoData(IGeoData)}. You + * need to start the handler using one of + * <ul> + * <li>{@link #startDir()}</li> + * <li>{@link #startGeo()}</li> + * <li>{@link #startGeoAndDir()}</li> + * </ul> + * A good place might be the {@code onResume} method of the Activity. Stop the Handler accordingly in {@code onPause}. + * </p> */ -public class GeoDirHandler extends Handler implements IObserver<Object> { +public abstract class GeoDirHandler extends Handler implements IObserver<Object> { private static final int OBSERVABLE = 1 << 1; private static final int START_GEO = 1 << 2; @@ -57,7 +66,8 @@ public class GeoDirHandler extends Handler implements IObserver<Object> { /** * Update method called when new IGeoData is available. * - * @param data the new data + * @param data + * the new data */ protected void updateGeoData(final IGeoData data) { // Override this in children @@ -66,7 +76,8 @@ public class GeoDirHandler extends Handler implements IObserver<Object> { /** * Update method called when new direction data is available. * - * @param direction the new direction + * @param direction + * the new direction */ protected void updateDirection(final float direction) { // Override this in children @@ -118,4 +129,3 @@ public class GeoDirHandler extends Handler implements IObserver<Object> { sendEmptyMessage(STOP_GEO | STOP_DIR); } } - |
