diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2014-01-26 14:59:12 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2014-01-26 14:59:12 +0100 |
| commit | 4b2098fbe2c24b423dcf619981d7a9f3faeebb67 (patch) | |
| tree | 6c211056f6c32cb2141f79cad88d8bf67f38a6f9 | |
| parent | ea517a87057d62c068585203bf613f890ad0ce31 (diff) | |
| download | cgeo-4b2098fbe2c24b423dcf619981d7a9f3faeebb67.zip cgeo-4b2098fbe2c24b423dcf619981d7a9f3faeebb67.tar.gz cgeo-4b2098fbe2c24b423dcf619981d7a9f3faeebb67.tar.bz2 | |
refactoring: do not start a thread to display a point
Displaying a point can be done on the UI thread directly.
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index d1ef0a3..bcc99a2 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -995,7 +995,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto public synchronized void startTimer() { if (coordsIntent != null) { // display just one point - (new DisplayPointThread()).start(); + displayPoint(coordsIntent); } else { // start timer stopTimer(); @@ -1272,32 +1272,16 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto } } - /** - * Thread to display one point. Started on opening if in single mode. - */ - private class DisplayPointThread extends Thread { - - @Override - public void run() { - if (mapView == null || caches == null) { - return; - } - - if (coordsIntent != null) { - final Waypoint waypoint = new Waypoint("some place", waypointTypeIntent != null ? waypointTypeIntent : WaypointType.WAYPOINT, false); - waypoint.setCoords(coordsIntent); - - final CachesOverlayItemImpl item = getWaypointItem(waypoint); - overlayCaches.updateItems(item); - displayHandler.sendEmptyMessage(INVALIDATE_MAP); + private void displayPoint(final Geopoint coords) { + final Waypoint waypoint = new Waypoint("some place", waypointTypeIntent != null ? waypointTypeIntent : WaypointType.WAYPOINT, false); + waypoint.setCoords(coords); - cachesCnt = 1; - } else { - cachesCnt = 0; - } + final CachesOverlayItemImpl item = getWaypointItem(waypoint); + overlayCaches.updateItems(item); + displayHandler.sendEmptyMessage(INVALIDATE_MAP); + displayHandler.sendEmptyMessage(UPDATE_TITLE); - displayHandler.sendEmptyMessage(UPDATE_TITLE); - } + cachesCnt = 1; } private static abstract class DoRunnable implements Runnable { |
