aboutsummaryrefslogtreecommitdiff
path: root/src/net/cbaines/suma/BusStopOverlay.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/cbaines/suma/BusStopOverlay.java')
-rw-r--r--src/net/cbaines/suma/BusStopOverlay.java63
1 files changed, 22 insertions, 41 deletions
diff --git a/src/net/cbaines/suma/BusStopOverlay.java b/src/net/cbaines/suma/BusStopOverlay.java
index 6ef956b..06a1729 100644
--- a/src/net/cbaines/suma/BusStopOverlay.java
+++ b/src/net/cbaines/suma/BusStopOverlay.java
@@ -180,7 +180,8 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants {
Log.e(TAG, "Unknown route code");
}
- canvas.drawRect(rectLeft, mCurScreenCoords.y + ((yOfsetPerMarker * makersPlaced) - (45 * scale)), rectRight, mCurScreenCoords.y
+ canvas.drawRect(rectLeft, mCurScreenCoords.y
+ + ((yOfsetPerMarker * makersPlaced) - (45 * scale)), rectRight, mCurScreenCoords.y
+ (yOfsetPerMarker * makersPlaced) - ((45 * scale) - markerYSize), paint);
makersPlaced++;
@@ -190,30 +191,20 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants {
}
}
- public boolean onTouchEvent(final MotionEvent event, final MapView mapView) {
- // Log.i(TAG, "Touch Event " + event.getPointerCount() + " " + event.getAction());
- return false;
- }
-
@Override
- public boolean onSingleTapUp(final MotionEvent event, final MapView mapView) {
-
- Log.v(TAG, "Pointer count for onSingleTapUp is " + event.getPointerCount() + " " + event.getAction());
- if (event.getPointerCount() != 1) {
- Log.v(TAG, "Pointer count for onSingleTapUp not 1, ignoring");
- return false;
- }
+ public boolean onSingleTapConfirmed(final MotionEvent event, final MapView mapView) {
BusStop busStop = getSelectedItem(event, mapView);
if (busStop == null) {
- Log.i(TAG, "No busStop pressed");
+ // Log.v(TAG, "No busStop pressed");
return false;
} else {
Log.i(TAG, "busStop Pressed " + busStop.id);
if (context.activityToast == null) {
- context.activityToast = Toast.makeText(context, busStop.description + " (" + busStop.id + ")", Toast.LENGTH_SHORT);
+ context.activityToast = Toast.makeText(context, busStop.description + " (" + busStop.id + ")",
+ Toast.LENGTH_SHORT);
} else {
context.activityToast.setDuration(Toast.LENGTH_SHORT);
context.activityToast.setText(busStop.description + " (" + busStop.id + ")");
@@ -226,17 +217,10 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants {
public boolean onDoubleTap(final MotionEvent event, final MapView mapView) {
- Log.v(TAG, "Pointer count for onDoubleTap is " + event.getPointerCount() + " " + event.getAction() + " " + event.describeContents());
- if (event.getPointerCount() != 1) {
- Log.v(TAG, "Pointer count for onDoubleTap not 1, ignoring");
- return false;
- }
-
BusStop busStop = getSelectedItem(event, mapView);
if (busStop == null) {
- Log.i(TAG, "No busStop pressed");
-
+ // Log.v(TAG, "No busStop pressed");
return false;
} else {
Log.i(TAG, "Pressed " + busStop.id);
@@ -254,16 +238,10 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants {
@Override
public boolean onLongPress(final MotionEvent event, final MapView mapView) {
- Log.v(TAG, "Pointer count for onLongPress is " + event.getPointerCount() + " " + event.getAction() + " " + event.describeContents());
- if (event.getPointerCount() != 1) {
- Log.v(TAG, "Pointer count for onLongPress not 1, ignoring");
- return false;
- }
-
BusStop busStop = getSelectedItem(event, mapView);
if (busStop == null) {
- Log.i(TAG, "No busStop pressed");
+ // Log.v(TAG, "No busStop pressed");
return false;
} else {
Log.i(TAG, "Pressed " + busStop.id);
@@ -272,7 +250,8 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants {
busStop.favourite = false;
if (context.activityToast == null) {
- context.activityToast = Toast.makeText(context, busStop.id + " removed from favourites", Toast.LENGTH_SHORT);
+ context.activityToast = Toast.makeText(context, busStop.id + " removed from favourites",
+ Toast.LENGTH_SHORT);
} else {
context.activityToast.setDuration(Toast.LENGTH_SHORT);
context.activityToast.setText(busStop.id + " removed from favourites");
@@ -280,7 +259,8 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants {
context.activityToast.show();
} else {
if (context.activityToast == null) {
- context.activityToast = Toast.makeText(context, busStop.id + " made a favourite", Toast.LENGTH_SHORT);
+ context.activityToast = Toast.makeText(context, busStop.id + " made a favourite",
+ Toast.LENGTH_SHORT);
} else {
context.activityToast.setDuration(Toast.LENGTH_SHORT);
context.activityToast.setText(busStop.id + " made a favourite");
@@ -302,7 +282,6 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants {
return true;
}
-
}
public void refresh() {
@@ -349,17 +328,19 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants {
pj.toPixels(busStop.point, mItemPoint);
if (marker.getBounds().contains(mTouchScreenPoint.x - mItemPoint.x, mTouchScreenPoint.y - mItemPoint.y)) {
- boolean drawing = false;
- for (int route = 0; route < 5; route++) {
- if ((busStop.routes & (1 << route)) != 0) {
- if (routes[route]) {
- drawing = true;
- break;
+ if (busStop.uniLink) {
+ boolean drawing = false;
+ for (int route = 0; route < 5; route++) {
+ if ((busStop.routes & (1 << route)) != 0) {
+ if (routes[route]) {
+ drawing = true;
+ break;
+ }
}
}
+ if (!drawing)
+ continue;
}
- if (!drawing)
- continue;
return busStop;
}