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.java33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/net/cbaines/suma/BusSpecificStopView.java b/src/net/cbaines/suma/BusSpecificStopView.java
index 6d7e6af..fdb6f56 100644
--- a/src/net/cbaines/suma/BusSpecificStopView.java
+++ b/src/net/cbaines/suma/BusSpecificStopView.java
@@ -28,10 +28,12 @@ import android.content.res.Resources;
import android.net.Uri;
import android.util.Log;
import android.view.Gravity;
+import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.widget.LinearLayout;
+import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
@@ -46,6 +48,8 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener
private final TextView location;
private final TextView time;
+ private final ProgressBar timeProgress;
+
private String onClickMessage = "";
private final BusActivity context;
@@ -68,6 +72,8 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener
time.setTextSize(22f);
time.setGravity(Gravity.RIGHT);
+ timeProgress = new ProgressBar(context, null, android.R.attr.progressBarStyleSmall);
+
Resources resources = context.getResources();
onClickHelpMessage = resources.getString(R.string.bus_stop_view_on_click_toast_help_message);
onClickUnidentifiedMessage = resources.getString(R.string.bus_stop_view_on_click_toast_unidentified_message);
@@ -76,7 +82,7 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener
addView(location, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
addView(time, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
-
+ addView(timeProgress, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
}
public void setStop(Stop stop) {
@@ -92,8 +98,12 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener
}
if (stop.arivalTime != null) {
time.setText(stop.getShortTimeToArival());
+ time.setVisibility(View.VISIBLE);
+ timeProgress.setVisibility(View.GONE);
} else {
+ time.setVisibility(View.GONE);
time.setText("");
+ timeProgress.setVisibility(View.VISIBLE);
}
DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class);
@@ -104,23 +114,12 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener
busDao.refresh(stop.bus);
if (stop.arivalTime != null) {
-
- 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.live) {
+ onClickMessage = stop.busStop.description + " 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 = stop.busStop.description + " at "
+ + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime) + " (timetabled)";
}
} else {
if (stop.bus.id != null) {