diff options
author | Christopher Baines <cbaines8@gmail.com> | 2012-03-01 22:02:02 +0000 |
---|---|---|
committer | Christopher Baines <cbaines8@gmail.com> | 2012-03-01 22:02:02 +0000 |
commit | 91a53f56aef2ed1bbbe1ae1d183136522624acec (patch) | |
tree | 29a7738227dbcc28c60ef4ae676ad54c87f57502 | |
parent | 75dc55b83cf983872f3f84b8950da27738f46b3e (diff) | |
download | southamptonuniversitymap-91a53f56aef2ed1bbbe1ae1d183136522624acec.tar southamptonuniversitymap-91a53f56aef2ed1bbbe1ae1d183136522624acec.tar.gz |
Transparent toasts, and more improvemens.
-rw-r--r-- | gen/net/cbaines/suma/R.java | 16 | ||||
-rw-r--r-- | res/layout/toast_view.xml | 2 | ||||
-rw-r--r-- | res/values/strings.xml | 14 | ||||
-rw-r--r-- | src/net/cbaines/suma/BusActivity.java | 13 | ||||
-rw-r--r-- | src/net/cbaines/suma/BusSpecificStopView.java | 25 | ||||
-rw-r--r-- | src/net/cbaines/suma/BusStopActivity.java | 6 | ||||
-rw-r--r-- | src/net/cbaines/suma/BusStopSpecificStopView.java (renamed from src/net/cbaines/suma/StopView.java) | 10 | ||||
-rw-r--r-- | src/net/cbaines/suma/BusStopSpecificTimetableAdapter.java (renamed from src/net/cbaines/suma/TimetableAdapter.java) | 10 | ||||
-rw-r--r-- | src/net/cbaines/suma/Stop.java | 2 |
9 files changed, 54 insertions, 44 deletions
diff --git a/gen/net/cbaines/suma/R.java b/gen/net/cbaines/suma/R.java index ea2dbeb..49cba3e 100644 --- a/gen/net/cbaines/suma/R.java +++ b/gen/net/cbaines/suma/R.java @@ -194,6 +194,18 @@ public final class R { public static final int buildingImageDescription=0x7f070053; 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=0x7f070059; + public static final int bus_activity_no_destination_message=0x7f07005a; + /** Bus Stop Specific Stop View Strings + */ + public static final int bus_stop_stop_view_on_click_toast_help_message=0x7f070055; + public static final int bus_stop_stop_view_on_click_toast_unidentified_message=0x7f070056; + /** Bus Specific Stop View Strings + */ + public static final int bus_stop_view_on_click_toast_help_message=0x7f070057; + public static final int bus_stop_view_on_click_toast_unidentified_message=0x7f070058; public static final int bustimes_favourite_checkbox_label=0x7f070032; public static final int credits_help_message=0x7f070019; public static final int donate_button=0x7f07001a; @@ -243,10 +255,6 @@ 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; - /** Stop View Strings - */ - public static final int stop_view_on_click_toast_help_message=0x7f070055; - public static final int stop_view_on_click_toast_unidentified_message=0x7f070056; public static final int view_help_message=0x7f070015; } public static final class xml { diff --git a/res/layout/toast_view.xml b/res/layout/toast_view.xml index 6431e6b..51d7561 100644 --- a/res/layout/toast_view.xml +++ b/res/layout/toast_view.xml @@ -3,7 +3,7 @@ android:id="@+id/toastViewLinearLayout" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:background="#000000" + android:background="#F01D1D1D" android:gravity="center_horizontal" android:orientation="vertical" android:padding="10dp" > diff --git a/res/values/strings.xml b/res/values/strings.xml index da4a2cc..05ed277 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -134,8 +134,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.< <string name="buildingImageDescription">Image of the Building</string> <string name="map_activity_toast_help_message">Double tap for more info</string> - <!-- Stop View Strings --> - <string name="stop_view_on_click_toast_help_message">Hold to view the bus schedule</string> - <string name="stop_view_on_click_toast_unidentified_message">Bus schedules not available for unidentified buses</string> + <!-- Bus Stop Specific Stop View Strings --> + <string name="bus_stop_stop_view_on_click_toast_help_message">Hold to view the bus schedule</string> + <string name="bus_stop_stop_view_on_click_toast_unidentified_message">Bus schedules not available for unidentified buses</string> + + <!-- Bus Specific Stop View Strings --> + <string name="bus_stop_view_on_click_toast_help_message">Hold to view the bus stop</string> + <string name="bus_stop_view_on_click_toast_unidentified_message">Arrival prediction not available for timetabled buses</string> + + <!-- Bus Activity --> + <string name="bus_activity_destination_label">Destination:\u0020</string> + <string name="bus_activity_no_destination_message">No given destination</string> </resources>
\ No newline at end of file diff --git a/src/net/cbaines/suma/BusActivity.java b/src/net/cbaines/suma/BusActivity.java index c1519ec..3292ce8 100644 --- a/src/net/cbaines/suma/BusActivity.java +++ b/src/net/cbaines/suma/BusActivity.java @@ -20,11 +20,8 @@ import android.view.View; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; -import android.widget.Toast; -import com.j256.ormlite.android.apptools.OrmLiteBaseActivity; - -public class BusActivity extends OrmLiteBaseActivity<DatabaseHelper> implements Preferences { +public class BusActivity extends ToastHelperActivity implements Preferences { final static String TAG = "BusActivity"; private TextView busIDTextView; @@ -33,8 +30,6 @@ public class BusActivity extends OrmLiteBaseActivity<DatabaseHelper> implements private TextView busContentMessage; private LinearLayout busActivityContentLayout; - Toast activityToast; - /** * The bus this activity is focused on */ @@ -122,11 +117,13 @@ public class BusActivity extends OrmLiteBaseActivity<DatabaseHelper> implements if (bus.destinationString != null) { Log.i(TAG, "Bus destination string is " + bus.destinationString); - busDestTextView.setText(bus.destinationString); + busDestTextView + .setText(getResources().getString(R.string.bus_activity_destination_label) + bus.destinationString); busDestTextView.setVisibility(View.VISIBLE); } else { Log.i(TAG, "Bus destination string is null"); - busDestTextView.setVisibility(View.GONE); + busDestTextView.setText(getResources().getString(R.string.bus_activity_no_destination_message)); + busDestTextView.setVisibility(View.VISIBLE); } busStops = bus.route.getRouteSection(instance, bus.direction); diff --git a/src/net/cbaines/suma/BusSpecificStopView.java b/src/net/cbaines/suma/BusSpecificStopView.java index deaf932..5ab7cd5 100644 --- a/src/net/cbaines/suma/BusSpecificStopView.java +++ b/src/net/cbaines/suma/BusSpecificStopView.java @@ -24,6 +24,7 @@ import java.text.DateFormat; import android.app.Activity; import android.content.Intent; +import android.content.res.Resources; import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; @@ -48,6 +49,9 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener private Stop stop; + private String onClickHelpMessage; + private String onClickUnidentifiedMessage; + public BusSpecificStopView(BusActivity context, Stop stop) { super(context); @@ -62,6 +66,10 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener time.setTextSize(22f); time.setGravity(Gravity.RIGHT); + 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); + setStop(stop); addView(location, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); @@ -136,13 +144,7 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener } public void onClick(View v) { - if (context.activityToast == null) { - context.activityToast = Toast.makeText(context, onClickMessage, Toast.LENGTH_SHORT); - } else { - context.activityToast.setText(onClickMessage); - context.activityToast.setDuration(Toast.LENGTH_SHORT); - } - context.activityToast.show(); + context.makeToast(onClickMessage, onClickHelpMessage, Toast.LENGTH_SHORT); } public boolean onLongClick(View v) { // TODO @@ -159,14 +161,7 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener 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); - } else { - context.activityToast.setText("Arival prediction not avalible for timetabled buses"); - context.activityToast.setDuration(Toast.LENGTH_SHORT); - } - context.activityToast.show(); + context.makeToast(onClickUnidentifiedMessage, Toast.LENGTH_SHORT); } } catch (SQLException e) { diff --git a/src/net/cbaines/suma/BusStopActivity.java b/src/net/cbaines/suma/BusStopActivity.java index 9f422af..9c49ff7 100644 --- a/src/net/cbaines/suma/BusStopActivity.java +++ b/src/net/cbaines/suma/BusStopActivity.java @@ -484,11 +484,11 @@ public class BusStopActivity extends ToastHelperActivity implements OnCheckedCha } else { busTimeList.setVisibility(View.VISIBLE); busStopMessage.setVisibility(View.GONE); - TimetableAdapter adapter; - if ((adapter = (TimetableAdapter) busTimeList.getAdapter()) != null) { + BusStopSpecificTimetableAdapter adapter; + if ((adapter = (BusStopSpecificTimetableAdapter) busTimeList.getAdapter()) != null) { adapter.updateTimetable(visibleTimetable); } else { - adapter = new TimetableAdapter(this, visibleTimetable); + adapter = new BusStopSpecificTimetableAdapter(this, visibleTimetable); busTimeList.setAdapter(adapter); } busTimeContentLayout.setGravity(Gravity.TOP); diff --git a/src/net/cbaines/suma/StopView.java b/src/net/cbaines/suma/BusStopSpecificStopView.java index fa76131..c7f9bd8 100644 --- a/src/net/cbaines/suma/StopView.java +++ b/src/net/cbaines/suma/BusStopSpecificStopView.java @@ -31,13 +31,14 @@ 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; import com.j256.ormlite.android.apptools.OpenHelperManager; import com.j256.ormlite.dao.Dao; -public class StopView extends LinearLayout implements OnClickListener, OnLongClickListener { +public class BusStopSpecificStopView extends LinearLayout implements OnClickListener, OnLongClickListener { // private final ImageView icon; @@ -45,6 +46,7 @@ public class StopView extends LinearLayout implements OnClickListener, OnLongCli private final TextView name; private final TextView time; + private String onClickMessage = ""; private final BusStopActivity context; @@ -53,7 +55,7 @@ public class StopView extends LinearLayout implements OnClickListener, OnLongCli private String onClickHelpMessage; private String onClickUnidentifiedMessage; - public StopView(BusStopActivity context, Stop stop) { + public BusStopSpecificStopView(BusStopActivity context, Stop stop) { super(context); this.context = context; @@ -68,8 +70,8 @@ public class StopView extends LinearLayout implements OnClickListener, OnLongCli time.setGravity(Gravity.RIGHT); Resources resources = context.getResources(); - onClickHelpMessage = resources.getString(R.string.stop_view_on_click_toast_help_message); - onClickUnidentifiedMessage = resources.getString(R.string.stop_view_on_click_toast_unidentified_message); + 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); setStop(stop); diff --git a/src/net/cbaines/suma/TimetableAdapter.java b/src/net/cbaines/suma/BusStopSpecificTimetableAdapter.java index 16b3ac9..511f427 100644 --- a/src/net/cbaines/suma/TimetableAdapter.java +++ b/src/net/cbaines/suma/BusStopSpecificTimetableAdapter.java @@ -26,7 +26,7 @@ import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.BaseAdapter; -public class TimetableAdapter extends BaseAdapter { +public class BusStopSpecificTimetableAdapter extends BaseAdapter { private final BusStopActivity context; private Timetable timetable; @@ -35,7 +35,7 @@ public class TimetableAdapter extends BaseAdapter { private static final String TAG = "TimetableAdapter"; - public TimetableAdapter(BusStopActivity context, Timetable timetable) { + public BusStopSpecificTimetableAdapter(BusStopActivity context, Timetable timetable) { this.context = context; this.timetable = timetable; this.a = AnimationUtils.loadAnimation(context, R.anim.updated_stop_view); @@ -44,11 +44,11 @@ public class TimetableAdapter extends BaseAdapter { public View getView(int position, View convertView, ViewGroup parent) { Log.i(TAG, "Returning stop " + position + " " + timetable.get(position)); - StopView stopView; + BusStopSpecificStopView stopView; if (convertView == null) { - stopView = new StopView(context, timetable.get(position)); + stopView = new BusStopSpecificStopView(context, timetable.get(position)); } else { - stopView = (StopView) convertView; + stopView = (BusStopSpecificStopView) convertView; stopView.setStop(timetable.get(position)); } diff --git a/src/net/cbaines/suma/Stop.java b/src/net/cbaines/suma/Stop.java index 3221ed5..9db9978 100644 --- a/src/net/cbaines/suma/Stop.java +++ b/src/net/cbaines/suma/Stop.java @@ -47,7 +47,7 @@ public class Stop { BusStop busStop; /** - * The time that the bus is estimated to arrive + * The time that the bus is estimated to arrive, if this is null, the time is still being loaded */ Date arivalTime; |