aboutsummaryrefslogtreecommitdiff
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
parent26f11938b2467d6033ade06af57dc678dc3401cd (diff)
downloadsouthamptonuniversitymap-ac9a84e8bb5dc43a5d72840eaa325c5e99ac610a.tar
southamptonuniversitymap-ac9a84e8bb5dc43a5d72840eaa325c5e99ac610a.tar.gz
Beginings of a welcome dialog, and overlay improvements.
-rw-r--r--gen/net/cbaines/suma/R.java86
-rw-r--r--res/layout/welcome_dialog.xml52
-rw-r--r--res/values/strings.xml72
-rw-r--r--src/net/cbaines/suma/BuildingNumOverlay.java58
-rw-r--r--src/net/cbaines/suma/BusStopOverlay.java33
-rw-r--r--src/net/cbaines/suma/MapActivity.java7
-rw-r--r--src/net/cbaines/suma/WelcomeDialog.java48
7 files changed, 250 insertions, 106 deletions
diff --git a/gen/net/cbaines/suma/R.java b/gen/net/cbaines/suma/R.java
index 7ff7855..67c7f33 100644
--- a/gen/net/cbaines/suma/R.java
+++ b/gen/net/cbaines/suma/R.java
@@ -14,7 +14,7 @@ public final class R {
public static final class array {
public static final int buildingTypes=0x7f080001;
public static final int preferencesHeadings=0x7f080003;
- /** View Strings
+ /** View Dialog
*/
public static final int uniLinkBusRoutes=0x7f080000;
public static final int utilityOverlays=0x7f080002;
@@ -102,16 +102,16 @@ public final class R {
public static final int linearLayout1=0x7f0a001a;
public static final int linearLayout2=0x7f0a0029;
public static final int mapview=0x7f0a0033;
- public static final int menu_about=0x7f0a0044;
- public static final int menu_favourites=0x7f0a0045;
- public static final int menu_find=0x7f0a0040;
- public static final int menu_find_my_location=0x7f0a0042;
- public static final int menu_next_stop=0x7f0a003f;
- public static final int menu_preferences=0x7f0a0041;
- public static final int menu_previous_stop=0x7f0a003d;
- public static final int menu_refresh_bus=0x7f0a003c;
- public static final int menu_refresh_stop=0x7f0a003e;
- public static final int menu_view=0x7f0a0043;
+ public static final int menu_about=0x7f0a0047;
+ public static final int menu_favourites=0x7f0a0048;
+ public static final int menu_find=0x7f0a0043;
+ public static final int menu_find_my_location=0x7f0a0045;
+ public static final int menu_next_stop=0x7f0a0042;
+ public static final int menu_preferences=0x7f0a0044;
+ public static final int menu_previous_stop=0x7f0a0040;
+ public static final int menu_refresh_bus=0x7f0a003f;
+ public static final int menu_refresh_stop=0x7f0a0041;
+ public static final int menu_view=0x7f0a0046;
public static final int radio_u1=0x7f0a001b;
public static final int radio_u1n=0x7f0a001c;
public static final int radio_u2=0x7f0a001d;
@@ -120,10 +120,13 @@ public final class R {
public static final int searchBar=0x7f0a002f;
public static final int textView1=0x7f0a0000;
public static final int textView2=0x7f0a0001;
+ public static final int textView3=0x7f0a003d;
+ public static final int textView4=0x7f0a003e;
public static final int toastViewLinearLayout=0x7f0a0036;
public static final int toastViewSubMessage=0x7f0a0038;
public static final int toastViewText=0x7f0a0037;
public static final int view_list=0x7f0a003b;
+ public static final int welcomeDialogButton=0x7f0a003c;
}
public static final class layout {
public static final int about_dialog=0x7f030000;
@@ -141,6 +144,7 @@ public final class R {
public static final int view_child_row=0x7f03000c;
public static final int view_dialog=0x7f03000d;
public static final int view_group_row=0x7f03000e;
+ public static final int welcome_dialog=0x7f03000f;
}
public static final class menu {
public static final int bus_menu=0x7f090000;
@@ -157,11 +161,13 @@ public final class R {
public static final int u9=0x7f060006;
}
public static final class string {
- public static final int U1=0x7f070009;
- public static final int U1N=0x7f07000a;
- public static final int U2=0x7f07000b;
- public static final int U6=0x7f07000c;
- public static final int U9=0x7f07000d;
+ /** General
+ */
+ public static final int U1=0x7f070001;
+ public static final int U1N=0x7f070002;
+ public static final int U2=0x7f070003;
+ public static final int U6=0x7f070004;
+ public static final int U9=0x7f070005;
/** About Strings
*/
public static final int about=0x7f070039;
@@ -177,7 +183,7 @@ public final class R {
public static final int about_developer_summary=0x7f070043;
public static final int about_donate=0x7f070052;
public static final int about_donate_summary=0x7f070053;
- public static final int about_help_message=0x7f070016;
+ public static final int about_help_message=0x7f070017;
public static final int about_license=0x7f07003e;
public static final int about_license_summary=0x7f07003f;
public static final int about_map_data=0x7f070048;
@@ -195,11 +201,9 @@ public final class R {
public static final int about_project_summary=0x7f070041;
public static final int about_version=0x7f07003a;
public static final int about_version_summary=0x7f07003b;
- public static final int app_name=0x7f070004;
+ public static final int app_name=0x7f070000;
public static final int bitcoin_error_message=0x7f07001b;
public static final int buildingImageDescription=0x7f070054;
- public static final int building_non_residential=0x7f070007;
- public static final int building_residential=0x7f070006;
/** Bus Activity
*/
public static final int bus_activity_destination_label=0x7f07005a;
@@ -218,27 +222,29 @@ public final class R {
public static final int donate_dialog_error_title=0x7f070034;
public static final int donate_dialog_message=0x7f070033;
public static final int favourites_dialog_message=0x7f07001d;
- public static final int favourites_dialog_title=0x7f070010;
- public static final int favourites_help_message=0x7f070017;
- public static final int find_help_message=0x7f070012;
- public static final int findmylocation_help_message=0x7f070014;
- public static final int legal_message=0x7f070005;
- public static final int licence_help_message=0x7f070018;
+ /** Favourites Dialog
+ */
+ public static final int favourites_dialog_title=0x7f07005c;
+ public static final int favourites_help_message=0x7f070018;
+ public static final int find_help_message=0x7f070013;
+ public static final int findmylocation_help_message=0x7f070015;
public static final int map_activity_toast_help_message=0x7f070055;
/** Help Messages
*/
- public static final int map_help_message=0x7f070011;
- public static final int menu_about=0x7f07000e;
- public static final int menu_favourites=0x7f07000f;
- public static final int menu_find=0x7f070000;
- public static final int menu_find_my_location=0x7f070003;
+ public static final int map_help_message=0x7f070012;
+ public static final int menu_about=0x7f07000b;
+ public static final int menu_favourites=0x7f07000c;
+ /** Map Activity
+ */
+ public static final int menu_find=0x7f070006;
+ public static final int menu_find_my_location=0x7f070009;
public static final int menu_next_stop=0x7f070036;
- public static final int menu_preferences=0x7f070001;
+ public static final int menu_preferences=0x7f070007;
public static final int menu_previous_stop=0x7f070035;
public static final int menu_refresh_stop=0x7f070037;
public static final int menu_refresh_stops=0x7f070038;
- public static final int menu_view=0x7f070002;
- public static final int pref_bus_stop=0x7f070008;
+ public static final int menu_view=0x7f070008;
+ public static final int pref_bus_stop=0x7f07000a;
public static final int preferences=0x7f07001c;
/** Preferences Messages
*/
@@ -249,7 +255,7 @@ public final class R {
public static final int preferences_gps=0x7f070023;
public static final int preferences_gps_disabled=0x7f070025;
public static final int preferences_gps_enabled=0x7f070024;
- public static final int preferences_help_message=0x7f070013;
+ public static final int preferences_help_message=0x7f070014;
public static final int preferences_non_uni_link=0x7f07002e;
public static final int preferences_non_uni_link_disabled=0x7f070030;
public static final int preferences_non_uni_link_enabled=0x7f07002f;
@@ -262,7 +268,15 @@ public final class R {
public static final int preferences_uni_link_live_bus_times=0x7f070027;
public static final int preferences_uni_link_live_bus_times_disabled=0x7f070029;
public static final int preferences_uni_link_live_bus_times_enabled=0x7f070028;
- public static final int view_help_message=0x7f070015;
+ public static final int view_help_message=0x7f070016;
+ public static final int welcome_dialog_button_text=0x7f07005d;
+ public static final int welcome_dialog_copyright=0x7f07000f;
+ public static final int welcome_dialog_install_message=0x7f070011;
+ /** Welcome Dialog
+ */
+ public static final int welcome_dialog_title=0x7f07000d;
+ public static final int welcome_dialog_upgrade_message=0x7f070010;
+ public static final int welcome_dialog_version=0x7f07000e;
}
public static final class xml {
public static final int about=0x7f050000;
diff --git a/res/layout/welcome_dialog.xml b/res/layout/welcome_dialog.xml
new file mode 100644
index 0000000..49b7c27
--- /dev/null
+++ b/res/layout/welcome_dialog.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/layout_root"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ android:padding="2dp" >
+
+ <LinearLayout
+ android:id="@+id/linearLayout1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentLeft="true"
+ android:gravity="center"
+ android:orientation="horizontal" >
+
+ <Button
+ android:id="@+id/welcomeDialogButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/welcome_dialog_button_text" />
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/textView3"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_below="@+id/textView4"
+ android:text="@string/welcome_dialog_version"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/textView4"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:text="@string/welcome_dialog_copyright"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <TextView
+ android:id="@+id/textView2"
+ android:layout_width="match_parent"
+ android:layout_height="305dp"
+ android:layout_above="@+id/linearLayout1"
+ android:layout_alignParentLeft="true"
+ android:layout_below="@+id/textView3"
+ android:scrollbars="vertical"
+ android:text="@string/welcome_dialog_install_message" />
+
+</RelativeLayout> \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d9932e9..b61609b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1,23 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="menu_find">Find</string>
- <string name="menu_preferences">Preferences</string>
- <string name="menu_view">View</string>
- <string name="menu_find_my_location">Find my Location</string>
<string name="app_name">Southampton University Map</string>
- <string name="legal_message">Southampton University Map comes with ABSOLUTELY NO WARRANTY; do not rely on the data or functionality provided by this application. This is free software, and you are welcome to redistribute it under certain conditions; expand the Licence item above for more details.</string>
- <string name="building_residential">Residential Building</string>
- <string name="building_non_residential">Non-Residential Building</string>
- <string name="pref_bus_stop">Bus Stops</string>
+
+ <!-- General -->
<string name="U1">U1</string>
<string name="U1N">U1N</string>
<string name="U2">U2</string>
<string name="U6">U6</string>
<string name="U9">U9</string>
+
+ <!-- Map Activity -->
+ <string name="menu_find">Find</string>
+ <string name="menu_preferences">Preferences</string>
+ <string name="menu_view">View</string>
+ <string name="menu_find_my_location">Find my Location</string>
+ <string name="pref_bus_stop">Bus Stops</string>
<string name="menu_about">About</string>
<string name="menu_favourites">Favourites</string>
- <string name="favourites_dialog_title">Favourites</string>
+
+ <!-- Welcome Dialog -->
+ <string name="welcome_dialog_title">Southampton University Map App</string>
+ <string name="welcome_dialog_version">Version 0.7 (alpha)</string>
+ <string name="welcome_dialog_copyright">© 2011 Christopher Baines</string>
+ <string name="welcome_dialog_upgrade_message">
+Thanks for upgrading this app, and it\'s hoped that its better for you than the previous version. Noteable changes include\:\n
+ &#8226; New Search\n
+ &#8226; Other\n
+
+\nThis program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.\n
+
+\nThis program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.</string>
+ <string name="welcome_dialog_install_message">
+Welcome to the Southampton University Map App. Noteable features include\:\n
+ &#8226; Search for Buildings\n
+ &#8226; Get Live Bus Times\n
+
+\nThis program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.\n
+
+\nThis program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.</string>
<!-- Help Messages -->
<string name="map_help_message">You can drag the map to move it, you can use pinch motions to zoom in and out, this can also be done with the buttons at the bottom of the screen. Taping the building markers will show you there full name, and tapping the bus stop markers will show the live times at that stop. Presing and holding a marker, will add the item to the favourites list.</string>
@@ -27,28 +60,13 @@
<string name="view_help_message">Use the options in the View dialog to enable and disable the map elements.</string>
<string name="about_help_message">The About screen displays the help messages and also the contact details of the developer. You also have the option of making a Bitcoin donation using the Donate button at the bottom. WARNING, the donation address is not private as it is hardcoded in to the app.</string>
<string name="favourites_help_message">The favourites dialog includes a list of buildings or bus stops marked as favourites, this is meant to allow for easier access to frequently used locations.</string>
- <string name="licence_help_message">Southampton University Map App Copyright © 2011 Christopher Baines\n
-\n
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.\n
-\n
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.\n
-\n
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.</string>
<string name="credits_help_message">Data: Map Icons: From the "Map Icons Collection" (http://mapicons.nicolasmollet.com). Map Tiles: From the Mapnik project, through the OSMDroid libary. Database: Using the ORMLite libary.</string>
<string name="donate_button">Donate</string>
<string name="bitcoin_error_message">You appear to have no bitcoin client installed, or at least none that listen for bitcoin uri\'s. Either install such a client, or just send coins via any method from any device to the address below.</string>
<string name="preferences">Preferences</string>
<string name="favourites_dialog_message">No Favourite\'s. To add a building or bus stop to the favourites list, just press and hold it on the map.</string>
- <!-- View Strings -->
+ <!-- View Dialog -->
<string-array name="uniLinkBusRoutes">
<item>U1</item>
<item>U1N</item>
@@ -147,4 +165,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.<
<string name="bus_activity_destination_label">Destination:\u0020</string>
<string name="bus_activity_no_destination_message">No given destination</string>
+ <!-- Favourites Dialog -->
+ <string name="favourites_dialog_title">Favourites</string>
+ <string name="welcome_dialog_button_text">Continue</string>
+
</resources> \ No newline at end of file
diff --git a/src/net/cbaines/suma/BuildingNumOverlay.java b/src/net/cbaines/suma/BuildingNumOverlay.java
index f11a166..b541aa1 100644
--- a/src/net/cbaines/suma/BuildingNumOverlay.java
+++ b/src/net/cbaines/suma/BuildingNumOverlay.java
@@ -94,33 +94,24 @@ public class BuildingNumOverlay extends Overlay implements Preferences, OnShared
}
/**
- * Draw a marker on each of our items. populate() must have been called
- * first.<br/>
+ * Draw a marker on each of our items. populate() must have been called first.<br/>
* <br/>
- * The marker will be drawn twice for each Item in the Overlay--once in the
- * shadow phase, skewed and darkened, then again in the non-shadow phase.
- * The bottom-center of the marker will be aligned with the geographical
- * coordinates of the Item.<br/>
+ * The marker will be drawn twice for each Item in the Overlay--once in the shadow phase, skewed and darkened, then again in
+ * the non-shadow phase. The bottom-center of the marker will be aligned with the geographical coordinates of the Item.<br/>
* <br/>
- * The order of drawing may be changed by overriding the getIndexToDraw(int)
- * method. An item may provide an alternate marker via its
- * OverlayItem.getMarker(int) method. If that method returns null, the
- * default marker is used.<br/>
+ * The order of drawing may be changed by overriding the getIndexToDraw(int) method. An item may provide an alternate marker
+ * via its OverlayItem.getMarker(int) method. If that method returns null, the default marker is used.<br/>
* <br/>
- * The focused item is always drawn last, which puts it visually on top of
- * the other items.<br/>
+ * The focused item is always drawn last, which puts it visually on top of the other items.<br/>
*
* @param canvas
- * the Canvas upon which to draw. Note that this may already have
- * a transformation applied, so be sure to leave it the way you
- * found it
+ * the Canvas upon which to draw. Note that this may already have a transformation applied, so be sure to leave it
+ * the way you found it
* @param mapView
- * the MapView that requested the draw. Use
- * MapView.getProjection() to convert between on-screen pixels
- * and latitude/longitude pairs
+ * the MapView that requested the draw. Use MapView.getProjection() to convert between on-screen pixels and
+ * latitude/longitude pairs
* @param shadow
- * if true, draw the shadow layer. If false, draw the overlay
- * contents.
+ * if true, draw the shadow layer. If false, draw the overlay contents.
*/
@Override
public void draw(final Canvas canvas, final MapView mapView, final boolean shadow) {
@@ -144,8 +135,7 @@ public class BuildingNumOverlay extends Overlay implements Preferences, OnShared
final SharedPreferences favouritesPrefs = 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 (Iterator<Building> buildingIter = buildings.iterator(); buildingIter.hasNext();) {
final Building building = buildingIter.next();
@@ -219,8 +209,7 @@ public class BuildingNumOverlay extends Overlay implements Preferences, OnShared
if (showIdentifiers) {
str += " (" + building.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;
}
@@ -230,7 +219,7 @@ public class BuildingNumOverlay extends Overlay implements Preferences, OnShared
public boolean onDoubleTap(final MotionEvent event, final MapView mapView) {
if (!this.isEnabled())
return false;
-
+
Building building = getSelectedItem(event, mapView);
if (building == null) {
@@ -265,19 +254,27 @@ public class BuildingNumOverlay extends Overlay implements Preferences, OnShared
Log.v(TAG, "building Pressed " + building.id);
final SharedPreferences favouritesPrefs = context.getSharedPreferences(FAVOURITES_PREFERENCES, 0);
+ final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
if (favouritesPrefs.getBoolean(building.id, false)) {
favouritesPrefs.edit().remove(building.id).commit();
- context.makeToast(building.id + " removed from favourites", Toast.LENGTH_SHORT);
+ // if (sharedPrefs.getBoolean(SHOW_IDENTIFIERS, SHOW_IDENTIFIERS_ENABLED_BY_DEFAULT)) {
+ context.makeToast(building.name + " removed from favourites", "(" + building.id + ")", Toast.LENGTH_SHORT);
+ // } else {
+ // context.makeToast(building.name + " removed from favourites", Toast.LENGTH_SHORT);
+ // }
} else {
- context.makeToast(building.id + " made a favourite", Toast.LENGTH_SHORT);
+ // if (sharedPrefs.getBoolean(SHOW_IDENTIFIERS, SHOW_IDENTIFIERS_ENABLED_BY_DEFAULT)) {
+ context.makeToast(building.name + " added to favourites", "(" + building.id + ")", Toast.LENGTH_SHORT);
+ // } else {
+ // context.makeToast(building.name + " added to favourites", Toast.LENGTH_SHORT);
+ // }
favouritesPrefs.edit().putBoolean(building.id, true).commit();
}
- Collections.sort(buildings,
- new POIFavouriteComparator(context.getSharedPreferences(FAVOURITES_PREFERENCES, 0)));
+ Collections.sort(buildings, new POIFavouriteComparator(context.getSharedPreferences(FAVOURITES_PREFERENCES, 0)));
mapView.invalidate();
@@ -310,8 +307,7 @@ public class BuildingNumOverlay extends Overlay implements Preferences, OnShared
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
Log.i(TAG, "Got a favourites change in the BuildingNumOverlay for key " + key);
- Collections
- .sort(buildings, new POIFavouriteComparator(context.getSharedPreferences(FAVOURITES_PREFERENCES, 0)));
+ Collections.sort(buildings, new POIFavouriteComparator(context.getSharedPreferences(FAVOURITES_PREFERENCES, 0)));
}
}
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();
diff --git a/src/net/cbaines/suma/MapActivity.java b/src/net/cbaines/suma/MapActivity.java
index 6eab356..413ec48 100644
--- a/src/net/cbaines/suma/MapActivity.java
+++ b/src/net/cbaines/suma/MapActivity.java
@@ -86,6 +86,8 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
static final int VIEW_DIALOG_ID = 0;
static final int FAVOURITE_DIALOG_ID = 1;
+ static final int WELCOME_DIALOG_ID = 2;
+
private POIDialog favDialog;
private HashMap<String, Overlay> overlays = new HashMap<String, Overlay>();
@@ -271,6 +273,8 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
mapController.setCenter(userLocation);
+ showDialog(WELCOME_DIALOG_ID);
+
Log.i(TAG, "Finished onCreate " + (System.currentTimeMillis() - startTime));
}
@@ -1079,6 +1083,9 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
favDialog.setOnItemLongClickListener(this);
favDialog.setTitle(R.string.favourites_dialog_title);
return favDialog;
+ case WELCOME_DIALOG_ID:
+ WelcomeDialog welcomeDialog = new WelcomeDialog(instance);
+ return welcomeDialog;
}
return null;
}
diff --git a/src/net/cbaines/suma/WelcomeDialog.java b/src/net/cbaines/suma/WelcomeDialog.java
new file mode 100644
index 0000000..d0d6fd0
--- /dev/null
+++ b/src/net/cbaines/suma/WelcomeDialog.java
@@ -0,0 +1,48 @@
+/*
+ * Southampton University Map App
+ * Copyright (C) 2011 Christopher Baines
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package net.cbaines.suma;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.view.View;
+import android.widget.Button;
+
+public class WelcomeDialog extends Dialog implements android.view.View.OnClickListener {
+
+ // private static final String TAG = "WelcomeDialog";
+
+ private Button continueButton;
+
+ public WelcomeDialog(Context context) {
+ super(context);
+
+ this.setTitle(R.string.welcome_dialog_title);
+
+ setContentView(R.layout.welcome_dialog);
+
+ continueButton = (Button) findViewById(R.id.welcomeDialogButton);
+ continueButton.setOnClickListener(this);
+ }
+
+ public void onClick(View arg0) {
+ this.dismiss();
+ }
+
+}