aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/data.dbbin140288 -> 140288 bytes
-rw-r--r--src/net/cbaines/suma/BuildingActivity.java87
-rw-r--r--src/net/cbaines/suma/DataManager.java6
-rw-r--r--src/net/cbaines/suma/Preferences.java2
-rw-r--r--src/net/cbaines/suma/SouthamptonUniversityMapActivity.java201
-rw-r--r--src/net/cbaines/suma/Stop.java8
-rw-r--r--src/net/cbaines/suma/StopView.java13
7 files changed, 221 insertions, 96 deletions
diff --git a/assets/data.db b/assets/data.db
index 4e890a9..d5c05ce 100644
--- a/assets/data.db
+++ b/assets/data.db
Binary files differ
diff --git a/src/net/cbaines/suma/BuildingActivity.java b/src/net/cbaines/suma/BuildingActivity.java
new file mode 100644
index 0000000..df6dea2
--- /dev/null
+++ b/src/net/cbaines/suma/BuildingActivity.java
@@ -0,0 +1,87 @@
+/*
+
+ * 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 java.io.InputStream;
+import java.util.HashSet;
+
+import android.content.Context;
+import android.os.Bundle;
+
+import com.hp.hpl.jena.rdf.model.Model;
+import com.hp.hpl.jena.rdf.model.ModelFactory;
+import com.hp.hpl.jena.util.FileManager;
+import com.j256.ormlite.android.apptools.OrmLiteBaseActivity;
+
+public class BuildingActivity extends OrmLiteBaseActivity<DatabaseHelper> {
+
+ final static String TAG = "BusTimeActivity";
+
+ private boolean dataChanged;
+
+ private Context instance;
+
+ private HashSet<BusRoute> routes = new HashSet<BusRoute>();
+
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.bustimes);
+
+ final DatabaseHelper helper = getHelper();
+
+ // create an empty model
+ Model model = ModelFactory.createDefaultModel();
+
+ // use the FileManager to find the input file
+ InputStream in = getResources().openRawResource(R.raw.u9);
+ if (in == null) {
+ throw new IllegalArgumentException("File not found");
+ }
+
+ // read the RDF/XML file
+ model.read(in, null);
+
+ instance = this;
+
+ }
+
+ public void onResume() {
+ super.onResume();
+
+ }
+
+ public void onPause() {
+
+ super.onPause();
+ }
+
+ public void finish() {
+ setResult(RESULT_OK, getIntent());
+
+ super.finish();
+ }
+
+ @Override
+ public Object onRetainNonConfigurationInstance() {
+ return null;
+ }
+
+}
diff --git a/src/net/cbaines/suma/DataManager.java b/src/net/cbaines/suma/DataManager.java
index d4d0968..536cc64 100644
--- a/src/net/cbaines/suma/DataManager.java
+++ b/src/net/cbaines/suma/DataManager.java
@@ -430,6 +430,7 @@ public class DataManager {
String time = stopObj.getString("time");
GregorianCalendar calender = new GregorianCalendar();
+ boolean live = true;
if (!time.equals("Due")) {
Log.v(TAG, "Time: " + time + " current time " + calender.getTime());
@@ -438,6 +439,7 @@ public class DataManager {
String[] minAndHour = time.split(":");
calender.set(Calendar.HOUR_OF_DAY, Integer.parseInt(minAndHour[0]));
calender.set(Calendar.MINUTE, Integer.parseInt(minAndHour[1]));
+ live = false;
} else {
// Log.i(TAG, "Parsing " + time.substring(0, time.length() - 1) + " for min");
calender.add(Calendar.MINUTE, Integer.parseInt(time.substring(0, time.length() - 1)));
@@ -534,7 +536,7 @@ public class DataManager {
busDao.update(bus);
- stop = new Stop(bus, busStop, calender.getTime(), now);
+ stop = new Stop(bus, busStop, calender.getTime(), now, live);
return stop;
@@ -574,7 +576,7 @@ public class DataManager {
if (!keepNonUniLink && !stopObj.getString("name").startsWith("U")) {
continue;
}
-
+
if (!keepUniLink && stopObj.getString("name").startsWith("U")) {
continue;
}
diff --git a/src/net/cbaines/suma/Preferences.java b/src/net/cbaines/suma/Preferences.java
index 46a521b..c92a86c 100644
--- a/src/net/cbaines/suma/Preferences.java
+++ b/src/net/cbaines/suma/Preferences.java
@@ -1,6 +1,7 @@
package net.cbaines.suma;
public interface Preferences {
+ // Preferences
static final String GPS_ENABLED = "GPSEnabled";
static final boolean GPS_ENABLED_BY_DEFAULT = true;
static final String UNI_LINK_BUS_TIMES = "uniLinkLiveBusTimesEnabled";
@@ -11,4 +12,5 @@ public interface Preferences {
static final boolean UNI_LINK_BUS_STOPS_ENABLED_BY_DEFAULT = true;
static final String NON_UNI_LINK_BUS_STOPS = "nonUniLinkBusStop";
static final boolean NON_UNI_LINK_BUS_STOPS_ENABLED_BY_DEFAULT = false;
+
}
diff --git a/src/net/cbaines/suma/SouthamptonUniversityMapActivity.java b/src/net/cbaines/suma/SouthamptonUniversityMapActivity.java
index d6a22d8..4bfb3de 100644
--- a/src/net/cbaines/suma/SouthamptonUniversityMapActivity.java
+++ b/src/net/cbaines/suma/SouthamptonUniversityMapActivity.java
@@ -90,25 +90,51 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
private HashMap<String, Overlay> overlays = new HashMap<String, Overlay>();
private HashMap<String, Overlay> pastOverlays;
+ // Overlays
+
+ // Scale Bar Overlay
+ private static final String SCALE_BAR_OVERLAY = "scaleBarOverlay";
private ScaleBarOverlay scaleBarOverlay;
private static final boolean SCALE_BAR_OVERLAY_ENABLED_BY_DEFAULT = true;
+
+ // My Location Overlay
+ private static final String MY_LOCATION_OVERLAY = "myLocationOverlay";
private MyLocationOverlay myLocationOverlay;
+ private static final boolean MY_LOCATION_OVERLAY_ENABLED_BY_DEFAULT = true;
+
+ // Residential Building Overlay
+ private static final String RESIDENTIAL_BUILDINGS = "residentialBuildingOverlay";
private BuildingNumOverlay residentialBuildingOverlay;
- private static final boolean NON_RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT = true;
- private BuildingNumOverlay nonResidentialBuildingOverlay;
private static final boolean RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT = true;
- private BusStopOverlay busStopOverlay;
- private static final boolean BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT = true;
+
+ // Non-Residential Building Overlay
+ private static final String NON_RESIDENTIAL_BUILDINGS = "nonResidentialBuildingOverlay";
+ private BuildingNumOverlay nonResidentialBuildingOverlay;
+ private static final boolean NON_RESIDENTIAL_BUILDING_OVERLAY_ENABLED_BY_DEFAULT = true;
+
+ // Uni-Link Bus Stop Overlay
+ private static final String UNI_LINK_BUS_STOPS = "uniLinkBusStopOverlay";
+ private BusStopOverlay uniLinkBusStopOverlay;
+ private static final boolean UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT = true;
+
+ // Uni-Link Bus Stop Overlay
+ private static final String NON_UNI_LINK_BUS_STOPS = "nonUniLinkBusStopOverlay";
+ private BusStopOverlay nonUniLinkBusStopOverlay;
+ private static final boolean NON_UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT = true;
+
+ // Site Overlays
private HashMap<Site, PathOverlay> siteOverlays = new HashMap<Site, PathOverlay>(21);
- private static final boolean SITE_OVERLAY_ENABLED_BY_DEFAULT = false;
+
+ // Route Overlays
private HashMap<BusRoute, PathOverlay> routeOverlays = new HashMap<BusRoute, PathOverlay>(5);
+
+ // View
+ private static final String RESIDENTIAL_BUILDING_OVERLAY = "Buildings:Residential";
+ private static final String NON_RESIDENTIAL_BUILDING_OVERLAY = "Buildings:Non-Residential";
+ private static final boolean SITE_OVERLAY_ENABLED_BY_DEFAULT = false;
private static final boolean ROUTE_OVERLAY_ENABLED_BY_DEFAULT = true;
- private String[] busRoutes;
- private String[] buildingTypes;
- private String[] other;
- private String[] groupHeadings;
- private String[] siteNames;
+ private static final int UNI_LINK_BUS_STOP_OVERLAY_RANK = 4;
private FavouriteDialog favDialog;
@@ -188,20 +214,12 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
myLocationOverlay.disableCompass();
}
- if (activityPrefs.getBoolean("Other:My Location", false) && sharedPrefs.getBoolean("GPSEnabled", false)) {
+ if (activityPrefs.getBoolean("Other:My Location", false) && sharedPrefs.getBoolean(GPS_ENABLED, false)) {
myLocationOverlay.enableMyLocation();
} else {
myLocationOverlay.disableMyLocation();
}
- if (!sharedPrefs.contains("GPSEnabled")) {
- sharedPrefs.edit().putBoolean("GPSEnabled", true).commit();
- }
-
- if (!sharedPrefs.contains("liveBusTimesEnabled")) {
- sharedPrefs.edit().putBoolean("liveBusTimesEnabled", true).commit();
- }
-
sharedPrefs.registerOnSharedPreferenceChangeListener(this);
activityPrefs.registerOnSharedPreferenceChangeListener(this);
}
@@ -348,30 +366,6 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
Log.i(TAG, "Begining setting up the static values " + (System.currentTimeMillis() - startTime));
- int size;
- try {
- size = (int) getHelper().getSiteDao().countOf();
-
- ArrayList<Site> sites = new ArrayList<Site>(size);
-
- try {
- sites.addAll(getHelper().getSiteDao().queryForAll());
- } catch (SQLException e) {
- e.printStackTrace();
- }
- siteNames = new String[size];
- for (int i = 0; i < size; i++) {
- siteNames[i] = sites.get(i).name;
- }
- } catch (SQLException e1) {
- e1.printStackTrace();
- }
-
- busRoutes = getResources().getStringArray(R.array.uniLinkBusRoutes);
- buildingTypes = getResources().getStringArray(R.array.buildingTypes);
- other = getResources().getStringArray(R.array.utilityOverlays);
- groupHeadings = getResources().getStringArray(R.array.preferencesHeadings);
-
Log.i(TAG, "Finished the database thread " + (System.currentTimeMillis() - startTime));
}
@@ -388,12 +382,7 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
showUtilityOverlays();
- for (int i = 0; i < busRoutes.length; i++) {
- if (activityPrefs.getBoolean(groupHeadings[1] + ":" + busRoutes[i], true)) {
- showBusStopOverlay();
- break;
- }
- }
+ showBusStopOverlays();
if (activityPrefs.getBoolean("Buildings:Residential", true) || activityPrefs.getBoolean("Buildings:Non-Residential", true)) {
// The argument currently dosent matter for this method.
@@ -672,7 +661,7 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
}).start();
}
- private void showBusStopOverlay() {
+ private void showBusStopOverlays() {
new Thread(new Runnable() {
public void run() {
Log.i(TAG, "Begining showing bus stop overlays at " + (System.currentTimeMillis() - startTime));
@@ -680,10 +669,10 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
final SharedPreferences activityPrefs = getPreferences(0);
final OverlayRankComparator comparator = new OverlayRankComparator(getPreferences(0));
- if (busStopOverlay != null) {
+ if (uniLinkBusStopOverlay != null) {
} else {
- if (pastOverlays != null && (busStopOverlay = (BusStopOverlay) pastOverlays.get("BusStops")) != null) {
+ if (pastOverlays != null && (uniLinkBusStopOverlay = (BusStopOverlay) pastOverlays.get("UniLinkBusStops")) != null) {
Log.i(TAG, "Restored bus stop overlays");
} else {
try {
@@ -696,27 +685,27 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
}
Log.v(TAG, "Finished fetching BusStops at " + (System.currentTimeMillis() - startTime));
- busStopOverlay = new BusStopOverlay(instance, busStops);
+ uniLinkBusStopOverlay = new BusStopOverlay(instance, busStops);
} catch (SQLException e) {
e.printStackTrace();
}
}
- overlays.put("BusStops", busStopOverlay);
+ overlays.put("BusStops", uniLinkBusStopOverlay);
Log.v(TAG, "Applyed the site overlay, now sorting them");
synchronized (mapView.getOverlays()) {
- mapView.getOverlays().add(busStopOverlay);
+ mapView.getOverlays().add(uniLinkBusStopOverlay);
Collections.sort(mapView.getOverlays(), comparator);
}
}
- busStopOverlay.setRoutes(0, activityPrefs.getBoolean("Bus Stops:U1", BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
- busStopOverlay.setRoutes(1, activityPrefs.getBoolean("Bus Stops:U1N", BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
- busStopOverlay.setRoutes(2, activityPrefs.getBoolean("Bus Stops:U2", BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
- busStopOverlay.setRoutes(3, activityPrefs.getBoolean("Bus Stops:U6", BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
- busStopOverlay.setRoutes(4, activityPrefs.getBoolean("Bus Stops:U9", BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(0, activityPrefs.getBoolean("Bus Stops:U1", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(1, activityPrefs.getBoolean("Bus Stops:U1N", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(2, activityPrefs.getBoolean("Bus Stops:U2", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(3, activityPrefs.getBoolean("Bus Stops:U6", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ uniLinkBusStopOverlay.setRoutes(4, activityPrefs.getBoolean("Bus Stops:U9", UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
mapView.postInvalidate();
@@ -854,7 +843,7 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
Log.v(TAG, "Got a busStop id back from the BusTimeActivity " + busStopID);
BusStop busStop = getHelper().getBusStopDao().queryForId(busStopID);
- busStopOverlay.refresh(busStop); // This does not invalidate the map, but it seems to make the changes appear
+ uniLinkBusStopOverlay.refresh(busStop); // This does not invalidate the map, but it seems to make the changes appear
}
} catch (SQLException e) {
e.printStackTrace();
@@ -1012,7 +1001,7 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
return prefs.getInt("mScaleBarOverlay", 1);
} else if (arg0 == myLocationOverlay) {
return prefs.getInt("myLocationOverlay", 0);
- } else if (arg0 == busStopOverlay) {
+ } else if (arg0 == uniLinkBusStopOverlay) {
return prefs.getInt("busStopOverlay", 2);
} else if (arg0 == residentialBuildingOverlay) {
return prefs.getInt("residentialBuildingOverlay", 4);
@@ -1034,7 +1023,8 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
Log.v(TAG, "Got shared prefs changed event for key " + key);
- if (key.equals("GPSEnabled")) {
+ // Shared Preferences
+ if (key.equals(GPS_ENABLED)) {
final SharedPreferences activityPrefs = getPreferences(0);
if (activityPrefs.getBoolean("Other:Compass", false) && prefs.getBoolean("GPSEnabled", false)) {
@@ -1042,10 +1032,28 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
} else {
myLocationOverlay.disableMyLocation();
}
- } else if (key.equals("liveBusTimesEnabled")) {
+ } else if (key.equals(NON_UNI_LINK_BUS_TIMES)) {
+ // Noting to do here atm
+ } else if (key.equals(UNI_LINK_BUS_TIMES)) {
// Noting to do here atm
- } else if (key.contains("Bus Stops")) {
- showBusStopOverlay();
+ } else if (key.equals(UNI_LINK_BUS_STOPS)) {
+
+ Log.v(TAG, "Begin fetching BusStops at " + (System.currentTimeMillis() - startTime));
+ try {
+ if (prefs.getBoolean(UNI_LINK_BUS_STOPS, UNI_LINK_BUS_STOPS_ENABLED_BY_DEFAULT)) {
+ uniLinkBusStopOverlay.busStops = getHelper().getBusStopDao().queryForAll();
+ } else {
+ uniLinkBusStopOverlay.busStops = getHelper().getBusStopDao().queryForEq(BusStop.UNI_LINK_FIELD_NAME, true);
+ }
+
+ Log.v(TAG, "Finished fetching BusStops at " + (System.currentTimeMillis() - startTime));
+
+ uniLinkBusStopOverlay.refresh();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ } else if (key.contains("Bus Stops")) { // Activity Preferences
+ showBusStopOverlays();
} else if (key.contains("Bus Routes")) {
try {
for (BusRoute route : getHelper().getBusRouteDao()) {
@@ -1057,14 +1065,10 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
} catch (SQLException e) {
e.printStackTrace();
}
- } else if (key.contains("Buildings")) {
- if (key.equals("Buildings:Non-Residential")) {
- showBuildingOverlay(false);
- } else if (key.equals("Buildings:Residential")) {
- showBuildingOverlay(true);
- } else {
- Log.e(TAG, "Wierd building preferences key " + key);
- }
+ } else if (key.equals(NON_RESIDENTIAL_BUILDING_OVERLAY)) {
+ showBuildingOverlay(false);
+ } else if (key.equals(RESIDENTIAL_BUILDING_OVERLAY)) {
+ showBuildingOverlay(true);
} else if (key.contains("Site Outlines")) {
try {
for (Site site : getHelper().getSiteDao()) {
@@ -1095,22 +1099,6 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
} else {
Log.e(TAG, "Unhandled preference key " + key);
}
- } else if (key.equals(NON_UNI_LINK_BUS_STOPS)) {
-
- Log.v(TAG, "Begin fetching BusStops at " + (System.currentTimeMillis() - startTime));
- try {
- if (prefs.getBoolean(NON_UNI_LINK_BUS_STOPS, NON_UNI_LINK_BUS_STOPS_ENABLED_BY_DEFAULT)) {
- busStopOverlay.busStops = getHelper().getBusStopDao().queryForAll();
- } else {
- busStopOverlay.busStops = getHelper().getBusStopDao().queryForEq(BusStop.UNI_LINK_FIELD_NAME, true);
- }
-
- Log.v(TAG, "Finished fetching BusStops at " + (System.currentTimeMillis() - startTime));
-
- busStopOverlay.refresh();
- } catch (SQLException e) {
- e.printStackTrace();
- }
} else {
Log.e(TAG, "Unhandled preference key " + key);
}
@@ -1126,6 +1114,12 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
private OnChildClickListener listener;
+ private String[] busRoutes;
+ private String[] buildingTypes;
+ private String[] other;
+ private String[] groupHeadings;
+ private String[] siteNames;
+
public ViewDialog(Context context) {
super(context);
@@ -1144,6 +1138,30 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
epView.setAdapter(mAdapter);
epView.setOnChildClickListener(this);
+ int size;
+ try {
+ size = (int) getHelper().getSiteDao().countOf();
+
+ ArrayList<Site> sites = new ArrayList<Site>(size);
+
+ try {
+ sites.addAll(getHelper().getSiteDao().queryForAll());
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ siteNames = new String[size];
+ for (int i = 0; i < size; i++) {
+ siteNames[i] = sites.get(i).name;
+ }
+ } catch (SQLException e1) {
+ e1.printStackTrace();
+ }
+
+ busRoutes = getResources().getStringArray(R.array.uniLinkBusRoutes);
+ buildingTypes = getResources().getStringArray(R.array.buildingTypes);
+ other = getResources().getStringArray(R.array.utilityOverlays);
+ groupHeadings = getResources().getStringArray(R.array.preferencesHeadings);
+
}
public void setOnItemClickListener(OnChildClickListener onChildClickListener) {
@@ -1236,7 +1254,8 @@ public class SouthamptonUniversityMapActivity extends OrmLiteBaseActivity<Databa
cb.setFocusable(false);
SharedPreferences activityPrefs = getPreferences(0);
if (groupPosition == 0) {
- cb.setChecked(activityPrefs.getBoolean(groupHeadings[groupPosition] + ":" + busRoutes[childPosition], BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
+ cb.setChecked(activityPrefs.getBoolean(groupHeadings[groupPosition] + ":" + busRoutes[childPosition],
+ UNI_LINK_BUS_STOP_OVERLAY_ENABLED_BY_DEFAULT));
} else if (groupPosition == 1) {
cb.setChecked(activityPrefs.getBoolean(groupHeadings[groupPosition] + ":" + busRoutes[childPosition], ROUTE_OVERLAY_ENABLED_BY_DEFAULT));
} else if (groupPosition == 2) {
diff --git a/src/net/cbaines/suma/Stop.java b/src/net/cbaines/suma/Stop.java
index 8e2d466..7947bed 100644
--- a/src/net/cbaines/suma/Stop.java
+++ b/src/net/cbaines/suma/Stop.java
@@ -63,17 +63,23 @@ public class Stop {
Date timeOfFetch;
/**
+ * Is the time live, or just expected
+ */
+ boolean live;
+
+ /**
*
* @param bus
* @param busStop
* @param arivalTime
* @param timeOfFetch
*/
- public Stop(Bus bus, BusStop busStop, Date arivalTime, Date timeOfFetch) {
+ public Stop(Bus bus, BusStop busStop, Date arivalTime, Date timeOfFetch, boolean live) {
this.busStop = busStop;
this.bus = bus;
this.arivalTime = arivalTime;
this.timeOfFetch = timeOfFetch;
+ this.live = live;
}
/**
diff --git a/src/net/cbaines/suma/StopView.java b/src/net/cbaines/suma/StopView.java
index dc023aa..62cbc7e 100644
--- a/src/net/cbaines/suma/StopView.java
+++ b/src/net/cbaines/suma/StopView.java
@@ -79,9 +79,18 @@ public class StopView extends LinearLayout implements OnClickListener {
busDao.refresh(stop.bus);
if (stop.bus.id != null) {
- onClickMessage = "Bus " + stop.bus.toString() + " at " + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime);
+ if (stop.live) {
+ onClickMessage = "Bus " + stop.bus.toString() + " at " + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime);
+ } else {
+ onClickMessage = "Timetabled bus " + stop.bus.toString() + " at " + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime);
+ }
} else {
- onClickMessage = "Unidentified bus (" + stop.bus.getName() + ") at " + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime);
+ if (stop.live) {
+ onClickMessage = "Unidentified bus (" + stop.bus.getName() + ") at " + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime);
+ } else {
+ onClickMessage = "Timetabled unidentified bus (" + stop.bus.getName() + ") at "
+ + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime);
+ }
}
} catch (SQLException e) {
e.printStackTrace();