aboutsummaryrefslogtreecommitdiff
path: root/src/net/cbaines/suma/BusStopSpecificStopView.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/cbaines/suma/BusStopSpecificStopView.java')
-rw-r--r--src/net/cbaines/suma/BusStopSpecificStopView.java53
1 files changed, 16 insertions, 37 deletions
diff --git a/src/net/cbaines/suma/BusStopSpecificStopView.java b/src/net/cbaines/suma/BusStopSpecificStopView.java
index eade3fe..635d2e8 100644
--- a/src/net/cbaines/suma/BusStopSpecificStopView.java
+++ b/src/net/cbaines/suma/BusStopSpecificStopView.java
@@ -70,8 +70,7 @@ public class BusStopSpecificStopView extends LinearLayout implements OnClickList
Resources resources = context.getResources();
onClickHelpMessage = resources.getString(R.string.bus_stop_stop_view_on_click_toast_help_message);
- onClickUnidentifiedMessage = resources
- .getString(R.string.bus_stop_stop_view_on_click_toast_unidentified_message);
+ onClickUnidentifiedMessage = resources.getString(R.string.bus_stop_stop_view_on_click_toast_unidentified_message);
setStop(stop);
@@ -88,32 +87,22 @@ public class BusStopSpecificStopView extends LinearLayout implements OnClickList
name.setText(stop.bus.getName());
time.setText(stop.getTimeToArival());
- DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class);
-
- try {
- Dao<Bus, Integer> busDao = helper.getBusDao();
-
- busDao.refresh(stop.bus);
-
- if (stop.bus.id != null) {
- 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);
- }
+ if (stop.bus.id != null) {
+ if (stop.live) {
+ onClickMessage = "Bus " + stop.bus.toString() + " at "
+ + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime);
} else {
- if (stop.live) {
- onClickMessage = "Unidentified bus (" + stop.bus.getName() + ") at "
- + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime);
- } else {
- onClickMessage = "Timetabled bus (" + stop.bus.getName() + ") at "
- + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime);
- }
+ onClickMessage = "Timetabled bus " + stop.bus.toString() + " at "
+ + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime);
+ }
+ } else {
+ if (stop.live) {
+ onClickMessage = "Unidentified bus (" + stop.bus.getName() + ") at "
+ + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime);
+ } else {
+ onClickMessage = "Timetabled bus (" + stop.bus.getName() + ") at "
+ + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime);
}
- } catch (SQLException e) {
- e.printStackTrace();
}
this.setOnClickListener(this);
@@ -122,13 +111,6 @@ public class BusStopSpecificStopView extends LinearLayout implements OnClickList
public void onClick(View v) {
Log.v(TAG, "onClick");
- DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class);
- try {
- Dao<Bus, Integer> busDao = helper.getBusDao();
- busDao.refresh(stop.bus);
- } catch (SQLException e) {
- e.printStackTrace();
- }
if (stop.bus.id != null) {
Log.v(TAG, "stop.bus != null");
@@ -143,14 +125,11 @@ public class BusStopSpecificStopView extends LinearLayout implements OnClickList
DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class);
try {
- Dao<Bus, Integer> busDao = helper.getBusDao();
Dao<BusRoute, Integer> busRouteDao = helper.getBusRouteDao();
- busDao.refresh(stop.bus);
busRouteDao.refresh(stop.bus.route);
- Log.i("StopView", "Bus route " + stop.bus.route + " Uni-Link " + stop.bus.route.uniLink + " Bus ID "
- + stop.bus.id);
+ Log.i("StopView", "Bus route " + stop.bus.route + " Uni-Link " + stop.bus.route.uniLink + " Bus ID " + stop.bus.id);
if (stop.bus.id != null && stop.bus.route.uniLink) {
Uri uri = Uri.parse("http://id.southampton.ac.uk/bus/" + stop.bus.id);