aboutsummaryrefslogtreecommitdiff
path: root/src/net/cbaines/suma/BusStopOverlay.java
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2012-03-08 22:03:48 +0000
committerChristopher Baines <cbaines8@gmail.com>2012-03-08 22:03:48 +0000
commitac9a84e8bb5dc43a5d72840eaa325c5e99ac610a (patch)
treeb622d312d258e90f6f017ee282783c98294e2423 /src/net/cbaines/suma/BusStopOverlay.java
parent26f11938b2467d6033ade06af57dc678dc3401cd (diff)
downloadsouthamptonuniversitymap-ac9a84e8bb5dc43a5d72840eaa325c5e99ac610a.tar
southamptonuniversitymap-ac9a84e8bb5dc43a5d72840eaa325c5e99ac610a.tar.gz
Beginings of a welcome dialog, and overlay improvements.
Diffstat (limited to 'src/net/cbaines/suma/BusStopOverlay.java')
-rw-r--r--src/net/cbaines/suma/BusStopOverlay.java33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/net/cbaines/suma/BusStopOverlay.java b/src/net/cbaines/suma/BusStopOverlay.java
index 778b306..b8377cf 100644
--- a/src/net/cbaines/suma/BusStopOverlay.java
+++ b/src/net/cbaines/suma/BusStopOverlay.java
@@ -110,8 +110,7 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants, Pref
final SharedPreferences favouritesPreferences = context.getSharedPreferences(FAVOURITES_PREFERENCES, 0);
/*
- * Draw in backward cycle, so the items with the least index are on the
- * front.
+ * Draw in backward cycle, so the items with the least index are on the front.
*/
for (int stopNum = 0; stopNum < busStops.size(); stopNum++) {
@@ -184,9 +183,9 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants, Pref
Log.e(TAG, "Unknown route code");
}
- canvas.drawRect(rectLeft, mCurScreenCoords.y
- + ((yOfsetPerMarker * makersPlaced) - (45 * scale)), rectRight, mCurScreenCoords.y
- + (yOfsetPerMarker * makersPlaced) - ((45 * scale) - markerYSize), paint);
+ canvas.drawRect(rectLeft, mCurScreenCoords.y + ((yOfsetPerMarker * makersPlaced) - (45 * scale)),
+ rectRight, mCurScreenCoords.y + (yOfsetPerMarker * makersPlaced) - ((45 * scale) - markerYSize),
+ paint);
makersPlaced++;
}
@@ -210,8 +209,7 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants, Pref
if (showIdentifiers) {
str += " (" + busStop.id + ")";
}
- context.makeToast(str, context.getResources().getString(R.string.map_activity_toast_help_message),
- Toast.LENGTH_SHORT);
+ context.makeToast(str, context.getResources().getString(R.string.map_activity_toast_help_message), Toast.LENGTH_SHORT);
return true;
}
@@ -250,21 +248,28 @@ public class BusStopOverlay extends Overlay implements RouteColorConstants, Pref
} else {
Log.i(TAG, "Pressed " + busStop.id);
- SharedPreferences favouritesPreferences = context.getSharedPreferences(FAVOURITES_PREFERENCES, 0);
+ final SharedPreferences favouritesPreferences = context.getSharedPreferences(FAVOURITES_PREFERENCES, 0);
+ final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
if (favouritesPreferences.getBoolean(busStop.id, false)) {
favouritesPreferences.edit().remove(busStop.id).commit();
- context.makeToast(busStop.id + " removed from favourites", Toast.LENGTH_SHORT);
-
+ if (sharedPrefs.getBoolean(SHOW_IDENTIFIERS, SHOW_IDENTIFIERS_ENABLED_BY_DEFAULT)) {
+ context.makeToast(busStop.description + " removed from favourites", "(" + busStop.id + ")",
+ Toast.LENGTH_SHORT);
+ } else {
+ context.makeToast(busStop.description + " removed from favourites", Toast.LENGTH_SHORT);
+ }
} else {
- context.makeToast(busStop.id + " made a favourite", Toast.LENGTH_SHORT);
-
+ if (sharedPrefs.getBoolean(SHOW_IDENTIFIERS, SHOW_IDENTIFIERS_ENABLED_BY_DEFAULT)) {
+ context.makeToast(busStop.description + " added to favourites", "(" + busStop.id + ")", Toast.LENGTH_SHORT);
+ } else {
+ context.makeToast(busStop.description + " added to favourites", Toast.LENGTH_SHORT);
+ }
favouritesPreferences.edit().putBoolean(busStop.id, true).commit();
}
- Collections.sort(busStops,
- new POIFavouriteComparator(context.getSharedPreferences(FAVOURITES_PREFERENCES, 0)));
+ Collections.sort(busStops, new POIFavouriteComparator(context.getSharedPreferences(FAVOURITES_PREFERENCES, 0)));
mapView.invalidate();