aboutsummaryrefslogtreecommitdiff
path: root/src/net/cbaines/suma/BusSpecificStopView.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/cbaines/suma/BusSpecificStopView.java')
-rw-r--r--src/net/cbaines/suma/BusSpecificStopView.java66
1 files changed, 21 insertions, 45 deletions
diff --git a/src/net/cbaines/suma/BusSpecificStopView.java b/src/net/cbaines/suma/BusSpecificStopView.java
index bdebcba..610ee76 100644
--- a/src/net/cbaines/suma/BusSpecificStopView.java
+++ b/src/net/cbaines/suma/BusSpecificStopView.java
@@ -36,8 +36,7 @@ import android.widget.Toast;
import com.j256.ormlite.android.apptools.OpenHelperManager;
import com.j256.ormlite.dao.Dao;
-public class BusSpecificStopView extends LinearLayout implements
- OnClickListener, OnLongClickListener {
+public class BusSpecificStopView extends LinearLayout implements OnClickListener, OnLongClickListener {
private static final String TAG = "BusSpecificStopView";
@@ -66,10 +65,8 @@ public class BusSpecificStopView extends LinearLayout implements
setStop(stop);
- addView(location, new LayoutParams(LayoutParams.WRAP_CONTENT,
- LayoutParams.WRAP_CONTENT));
- addView(time, new LayoutParams(LayoutParams.FILL_PARENT,
- LayoutParams.WRAP_CONTENT));
+ addView(location, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
+ addView(time, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
}
@@ -100,8 +97,7 @@ public class BusSpecificStopView extends LinearLayout implements
time.setText("");
}
- DatabaseHelper helper = OpenHelperManager.getHelper(context,
- DatabaseHelper.class);
+ DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class);
try {
Dao<Bus, Integer> busDao = helper.getBusDao();
@@ -112,31 +108,19 @@ public class BusSpecificStopView extends LinearLayout implements
if (stop.bus.id != null) {
if (stop.live) {
- onClickMessage = "Bus "
- + stop.bus.toString()
- + " at "
- + DateFormat.getTimeInstance(DateFormat.SHORT)
- .format(stop.arivalTime);
+ 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);
+ 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);
+ 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.getName() + ") at "
+ + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime);
}
}
} else {
@@ -144,16 +128,13 @@ public class BusSpecificStopView extends LinearLayout implements
if (stop.live) {
onClickMessage = "Bus " + stop.bus.toString();
} else {
- onClickMessage = "Timetabled bus "
- + stop.bus.toString();
+ onClickMessage = "Timetabled bus " + stop.bus.toString();
}
} else {
if (stop.live) {
- onClickMessage = "Unidentified bus ("
- + stop.bus.getName() + ")";
+ onClickMessage = "Unidentified bus (" + stop.bus.getName() + ")";
} else {
- onClickMessage = "Timetabled bus ("
- + stop.bus.getName() + ")";
+ onClickMessage = "Timetabled bus (" + stop.bus.getName() + ")";
}
}
}
@@ -167,8 +148,7 @@ public class BusSpecificStopView extends LinearLayout implements
public void onClick(View v) {
if (context.activityToast == null) {
- context.activityToast = Toast.makeText(context, onClickMessage,
- Toast.LENGTH_SHORT);
+ context.activityToast = Toast.makeText(context, onClickMessage, Toast.LENGTH_SHORT);
} else {
context.activityToast.setText(onClickMessage);
context.activityToast.setDuration(Toast.LENGTH_SHORT);
@@ -177,8 +157,7 @@ public class BusSpecificStopView extends LinearLayout implements
}
public boolean onLongClick(View v) { // TODO
- DatabaseHelper helper = OpenHelperManager.getHelper(context,
- DatabaseHelper.class);
+ DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class);
try {
Dao<Bus, Integer> busDao = helper.getBusDao();
@@ -186,19 +165,16 @@ public class BusSpecificStopView extends LinearLayout implements
busDao.refresh(stop.bus);
if (stop.bus.id != null) {
+ // TODO Change to URI
Intent i = new Intent(context, MapActivity.class);
i.putExtra("poiPoint", stop.busStop.point.toDoubleString());
((Activity) context).startActivityForResult(i, 0);
} else {
if (context.activityToast == null) {
- context.activityToast = Toast
- .makeText(
- context,
- "Arival prediction not avalible for timetabled buses",
- Toast.LENGTH_SHORT);
+ context.activityToast = Toast.makeText(context,
+ "Arival prediction not avalible for timetabled buses", Toast.LENGTH_SHORT);
} else {
- context.activityToast
- .setText("Arival prediction not avalible for timetabled buses");
+ context.activityToast.setText("Arival prediction not avalible for timetabled buses");
context.activityToast.setDuration(Toast.LENGTH_SHORT);
}
context.activityToast.show();