From 930f1771a4df314f3a727b035c1c5f1c1074aedb Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 4 Mar 2012 20:17:38 +0000 Subject: Add back the building ID to the POI View. --- src/net/cbaines/suma/POIView.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/net/cbaines/suma/POIView.java b/src/net/cbaines/suma/POIView.java index 95c571c..6324aeb 100644 --- a/src/net/cbaines/suma/POIView.java +++ b/src/net/cbaines/suma/POIView.java @@ -91,11 +91,7 @@ public class POIView extends LinearLayout implements Preferences { Building building = (Building) poi; // Log.i(TAG, "Its a building of name " + building.name); - if (identifiersEnabled) { - name.setText(building.name + " (" + building.id + ")"); - } else { - name.setText(building.name); - } + name.setText(building.name + " (" + building.id + ")"); } else if (poi.type == POI.BUS_STOP) { BusStop busStop = (BusStop) poi; -- cgit v1.2.3 From 05b47389b46e3085a341eb1e32a36c69ad90e2b7 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 5 Mar 2012 15:14:48 +0000 Subject: Update the README. --- README | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/README b/README index 226651d..0bbf895 100644 --- a/README +++ b/README @@ -1,7 +1,3 @@ Southampton University Map -To build, you must have avalible ormlite, osmdroid and slf4j-android. As jars, these would be: -ormlite-android-4.30.jar -ormlite-core-4.30.jar -osmdroid-android-3.0.6.jar -slf4j-android-1.5.8.jar +To build, you must add the .jars in the libs directory to the build path. -- cgit v1.2.3 From 1b2872b6e53791cf5619a016d2b22d015544c2c8 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 6 Mar 2012 15:44:49 +0000 Subject: Better BusActivity. --- gen/net/cbaines/suma/R.java | 95 +++++++++++----------- res/menu/bus_menu.xml | 9 ++ res/menu/bus_stop_menu.xml | 17 ++++ res/menu/stop_menu.xml | 17 ---- res/values/strings.xml | 3 +- src/net/cbaines/suma/BusActivity.java | 23 ++++-- src/net/cbaines/suma/BusSpecificStopView.java | 33 ++++---- .../cbaines/suma/BusSpecificTimetableAdapter.java | 4 +- src/net/cbaines/suma/BusStopActivity.java | 14 ++-- 9 files changed, 120 insertions(+), 95 deletions(-) create mode 100644 res/menu/bus_menu.xml create mode 100644 res/menu/bus_stop_menu.xml delete mode 100644 res/menu/stop_menu.xml diff --git a/gen/net/cbaines/suma/R.java b/gen/net/cbaines/suma/R.java index 49cba3e..3163564 100644 --- a/gen/net/cbaines/suma/R.java +++ b/gen/net/cbaines/suma/R.java @@ -98,15 +98,16 @@ public final class R { public static final int linearLayout1=0x7f0a0016; public static final int linearLayout2=0x7f0a0025; public static final int mapview=0x7f0a002f; - public static final int menu_about=0x7f0a003c; - public static final int menu_favourites=0x7f0a003d; - public static final int menu_find=0x7f0a0038; - public static final int menu_find_my_location=0x7f0a003a; - public static final int menu_next_stop=0x7f0a0040; - public static final int menu_preferences=0x7f0a0039; - public static final int menu_previous_stop=0x7f0a003e; - public static final int menu_refresh_stop=0x7f0a003f; - public static final int menu_view=0x7f0a003b; + public static final int menu_about=0x7f0a0040; + public static final int menu_favourites=0x7f0a0041; + public static final int menu_find=0x7f0a003c; + public static final int menu_find_my_location=0x7f0a003e; + public static final int menu_next_stop=0x7f0a003b; + public static final int menu_preferences=0x7f0a003d; + public static final int menu_previous_stop=0x7f0a0039; + public static final int menu_refresh_bus=0x7f0a0038; + public static final int menu_refresh_stop=0x7f0a003a; + public static final int menu_view=0x7f0a003f; public static final int radio_u1=0x7f0a0017; public static final int radio_u1n=0x7f0a0018; public static final int radio_u2=0x7f0a0019; @@ -137,8 +138,9 @@ public final class R { public static final int view_group_row=0x7f03000d; } public static final class menu { - public static final int map_menu=0x7f090000; - public static final int stop_menu=0x7f090001; + public static final int bus_menu=0x7f090000; + public static final int bus_stop_menu=0x7f090001; + public static final int map_menu=0x7f090002; } public static final class raw { public static final int org=0x7f060000; @@ -158,54 +160,54 @@ public final class R { public static final int U9=0x7f07000d; /** About Strings */ - public static final int about=0x7f070038; - public static final int about_android_market=0x7f070045; - public static final int about_android_market_summary=0x7f070046; - public static final int about_copyright=0x7f07003b; - public static final int about_copyright_summary=0x7f07003c; - public static final int about_data=0x7f070043; - public static final int about_data_summary=0x7f070044; - public static final int about_database=0x7f07004f; - public static final int about_database_summary=0x7f070050; - public static final int about_developer=0x7f070041; - public static final int about_developer_summary=0x7f070042; - public static final int about_donate=0x7f070051; - public static final int about_donate_summary=0x7f070052; + public static final int about=0x7f070039; + public static final int about_android_market=0x7f070046; + public static final int about_android_market_summary=0x7f070047; + public static final int about_copyright=0x7f07003c; + public static final int about_copyright_summary=0x7f07003d; + public static final int about_data=0x7f070044; + public static final int about_data_summary=0x7f070045; + public static final int about_database=0x7f070050; + public static final int about_database_summary=0x7f070051; + public static final int about_developer=0x7f070042; + public static final int about_developer_summary=0x7f070043; + public static final int about_donate=0x7f070052; + public static final int about_donate_summary=0x7f070053; public static final int about_help_message=0x7f070016; - public static final int about_license=0x7f07003d; - public static final int about_license_summary=0x7f07003e; - public static final int about_map_data=0x7f070047; - public static final int about_map_data_summary=0x7f070048; - public static final int about_map_icons=0x7f070049; - public static final int about_map_icons_summary=0x7f07004a; - public static final int about_map_tiles=0x7f07004d; - public static final int about_map_tiles_summary=0x7f07004e; + public static final int about_license=0x7f07003e; + public static final int about_license_summary=0x7f07003f; + public static final int about_map_data=0x7f070048; + public static final int about_map_data_summary=0x7f070049; + public static final int about_map_icons=0x7f07004a; + public static final int about_map_icons_summary=0x7f07004b; + public static final int about_map_tiles=0x7f07004e; + public static final int about_map_tiles_summary=0x7f07004f; /** About Messages */ public static final int about_menu_instruction_text=0x7f070031; - public static final int about_osm_map=0x7f07004b; - public static final int about_osm_map_summary=0x7f07004c; - public static final int about_project=0x7f07003f; - public static final int about_project_summary=0x7f070040; - public static final int about_version=0x7f070039; - public static final int about_version_summary=0x7f07003a; + public static final int about_osm_map=0x7f07004c; + public static final int about_osm_map_summary=0x7f07004d; + public static final int about_project=0x7f070040; + public static final int about_project_summary=0x7f070041; + public static final int about_version=0x7f07003a; + public static final int about_version_summary=0x7f07003b; public static final int app_name=0x7f070004; public static final int bitcoin_error_message=0x7f07001b; - public static final int buildingImageDescription=0x7f070053; + public static final int buildingImageDescription=0x7f070054; 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; + public static final int bus_activity_destination_label=0x7f07005a; + public static final int bus_activity_no_destination_message=0x7f07005b; /** 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; + public static final int bus_stop_stop_view_on_click_toast_help_message=0x7f070056; + public static final int bus_stop_stop_view_on_click_toast_unidentified_message=0x7f070057; /** 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 bus_stop_view_on_click_toast_help_message=0x7f070058; + public static final int bus_stop_view_on_click_toast_unidentified_message=0x7f070059; public static final int bustimes_favourite_checkbox_label=0x7f070032; public static final int credits_help_message=0x7f070019; public static final int donate_button=0x7f07001a; @@ -218,7 +220,7 @@ public final class R { public static final int findmylocation_help_message=0x7f070014; public static final int legal_message=0x7f070005; public static final int licence_help_message=0x7f070018; - public static final int map_activity_toast_help_message=0x7f070054; + public static final int map_activity_toast_help_message=0x7f070055; /** Help Messages */ public static final int map_help_message=0x7f070011; @@ -230,6 +232,7 @@ public final class R { public static final int menu_preferences=0x7f070001; public static final int menu_previous_stop=0x7f070035; public static final int menu_refresh_stop=0x7f070037; + public static final int menu_refresh_stops=0x7f070038; public static final int menu_view=0x7f070002; public static final int pref_bus_stop=0x7f070008; public static final int preferences=0x7f07001c; diff --git a/res/menu/bus_menu.xml b/res/menu/bus_menu.xml new file mode 100644 index 0000000..5e22663 --- /dev/null +++ b/res/menu/bus_menu.xml @@ -0,0 +1,9 @@ + + + + + + \ No newline at end of file diff --git a/res/menu/bus_stop_menu.xml b/res/menu/bus_stop_menu.xml new file mode 100644 index 0000000..c44efa2 --- /dev/null +++ b/res/menu/bus_stop_menu.xml @@ -0,0 +1,17 @@ + + + + + + + + \ No newline at end of file diff --git a/res/menu/stop_menu.xml b/res/menu/stop_menu.xml deleted file mode 100644 index c44efa2..0000000 --- a/res/menu/stop_menu.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index e17ab11..521f04c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -102,6 +102,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.< Previous Next Refresh + Refresh About @@ -139,7 +140,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.< Bus schedules not available for unidentified buses - Hold to view the bus stop + Hold to view the bus stop on the map Arrival prediction not available for timetabled buses diff --git a/src/net/cbaines/suma/BusActivity.java b/src/net/cbaines/suma/BusActivity.java index 3292ce8..f2cf133 100644 --- a/src/net/cbaines/suma/BusActivity.java +++ b/src/net/cbaines/suma/BusActivity.java @@ -16,6 +16,8 @@ import android.os.Handler; import android.preference.PreferenceManager; import android.util.Log; import android.view.Gravity; +import android.view.Menu; +import android.view.MenuInflater; import android.view.View; import android.widget.LinearLayout; import android.widget.ListView; @@ -117,8 +119,8 @@ public class BusActivity extends ToastHelperActivity implements Preferences { if (bus.destinationString != null) { Log.i(TAG, "Bus destination string is " + bus.destinationString); - busDestTextView - .setText(getResources().getString(R.string.bus_activity_destination_label) + 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"); @@ -137,12 +139,14 @@ public class BusActivity extends ToastHelperActivity implements Preferences { refreshData = new Runnable() { public void run() { - for (int num = timetableView.getFirstVisiblePosition(); num < timetableView.getLastVisiblePosition(); num++) { + for (int num = timetableView.getFirstVisiblePosition(); num < timetableView + .getLastVisiblePosition(); num++) { Stop stop = timetable.get(num); GetTimetableStopTask task = tasks.get(busStops.get(num)); - if (stop.timeOfFetch == null || (stop.timeOfFetch.getTime() - System.currentTimeMillis()) > 20000) { + if (stop.timeOfFetch == null + || (stop.timeOfFetch.getTime() - System.currentTimeMillis()) > 20000) { if (task != null) { if (task.getStatus() == AsyncTask.Status.FINISHED) { task = null; @@ -166,6 +170,13 @@ public class BusActivity extends ToastHelperActivity implements Preferences { } } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.bus_menu, menu); + return true; + } + public void onResume() { super.onResume(); @@ -296,7 +307,9 @@ public class BusActivity extends ToastHelperActivity implements Preferences { adapter = new BusSpecificTimetableAdapter(this, visibleTimetable); timetableView.setAdapter(adapter); if (busStop != null) { - Log.i(TAG, "Moving to position of " + busStop.description + " which is " + busStops.indexOf(busStop)); + Log.i(TAG, + "Moving to position of " + busStop.description + " which is " + + busStops.indexOf(busStop)); timetableView.setSelection(busStops.indexOf(busStop)); } } 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) { diff --git a/src/net/cbaines/suma/BusSpecificTimetableAdapter.java b/src/net/cbaines/suma/BusSpecificTimetableAdapter.java index 7bcb560..96fe713 100644 --- a/src/net/cbaines/suma/BusSpecificTimetableAdapter.java +++ b/src/net/cbaines/suma/BusSpecificTimetableAdapter.java @@ -60,8 +60,8 @@ public class BusSpecificTimetableAdapter extends BaseAdapter { } if (changed == null || changed[position]) { - a.reset(); - stopView.startAnimation(a); + // a.reset(); + // stopView.startAnimation(a); // Log.i(TAG, "Animating it"); } diff --git a/src/net/cbaines/suma/BusStopActivity.java b/src/net/cbaines/suma/BusStopActivity.java index 9c49ff7..429f103 100644 --- a/src/net/cbaines/suma/BusStopActivity.java +++ b/src/net/cbaines/suma/BusStopActivity.java @@ -59,8 +59,8 @@ import com.j256.ormlite.dao.Dao; import com.j256.ormlite.stmt.PreparedQuery; import com.j256.ormlite.stmt.QueryBuilder; -public class BusStopActivity extends ToastHelperActivity implements OnCheckedChangeListener, Preferences, OnItemClickListener, - OnLongClickListener { +public class BusStopActivity extends ToastHelperActivity implements OnCheckedChangeListener, Preferences, + OnItemClickListener, OnLongClickListener { final static String TAG = "BusTimeActivity"; @@ -320,10 +320,10 @@ public class BusStopActivity extends ToastHelperActivity implements OnCheckedCha try { final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(instance); - newTimetable = DataManager - .getTimetable(instance, busStop.id, sharedPrefs.getBoolean(MapActivity.UNI_LINK_BUS_TIMES, - MapActivity.UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT), sharedPrefs.getBoolean( - MapActivity.NON_UNI_LINK_BUS_TIMES, MapActivity.NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)); + newTimetable = DataManager.getTimetable(instance, busStop.id, sharedPrefs.getBoolean( + MapActivity.UNI_LINK_BUS_TIMES, MapActivity.UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT), sharedPrefs + .getBoolean(MapActivity.NON_UNI_LINK_BUS_TIMES, + MapActivity.NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)); } catch (SQLException e) { errorMessage = "Error message regarding SQL?"; e.printStackTrace(); @@ -363,7 +363,7 @@ public class BusStopActivity extends ToastHelperActivity implements OnCheckedCha @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); - inflater.inflate(R.menu.stop_menu, menu); + inflater.inflate(R.menu.bus_stop_menu, menu); return true; } -- cgit v1.2.3 From 56c74a2fa83916915587ae2de1b46a50f2c856ee Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 6 Mar 2012 22:10:47 +0000 Subject: Improved Bus activity, and U6 route overlay. --- gen/net/cbaines/suma/R.java | 114 +++++++++++---------- res/layout/bus_specific_stop_view.xml | 28 +++++ res/raw/u6.gpx | 36 ++++--- src/net/cbaines/suma/BusActivity.java | 102 +++++++++++++----- src/net/cbaines/suma/BusSpecificStopView.java | 53 +++++----- .../cbaines/suma/BusSpecificTimetableAdapter.java | 41 ++++---- src/net/cbaines/suma/StopLoading.java | 11 ++ 7 files changed, 244 insertions(+), 141 deletions(-) create mode 100644 res/layout/bus_specific_stop_view.xml create mode 100644 src/net/cbaines/suma/StopLoading.java diff --git a/gen/net/cbaines/suma/R.java b/gen/net/cbaines/suma/R.java index 3163564..d65abc0 100644 --- a/gen/net/cbaines/suma/R.java +++ b/gen/net/cbaines/suma/R.java @@ -71,71 +71,75 @@ public final class R { public static final int busRouteActivityID=0x7f0a0013; public static final int busRouteActivityLabel=0x7f0a0012; public static final int busRouteBusStops=0x7f0a0014; - public static final int busStopID=0x7f0a001d; - public static final int busStopListItems=0x7f0a0024; - public static final int busStopLoadBar=0x7f0a0022; - public static final int busStopMessage=0x7f0a0021; - public static final int busStopName=0x7f0a0015; - public static final int busStopTimes=0x7f0a001f; - public static final int busTimeContentLayout=0x7f0a001e; - public static final int centerLoadBar=0x7f0a0020; - public static final int check1=0x7f0a0036; - public static final int childname=0x7f0a0035; - public static final int donateBitcoinAddress=0x7f0a002a; + public static final int busSpecificStopViewID=0x7f0a0016; + public static final int busSpecificStopViewName=0x7f0a0015; + public static final int busSpecificStopViewProgressBar=0x7f0a0017; + public static final int busStopID=0x7f0a0020; + public static final int busStopListItems=0x7f0a0027; + public static final int busStopLoadBar=0x7f0a0025; + public static final int busStopMessage=0x7f0a0024; + public static final int busStopName=0x7f0a0018; + public static final int busStopTimes=0x7f0a0022; + public static final int busTimeContentLayout=0x7f0a0021; + public static final int centerLoadBar=0x7f0a0023; + public static final int check1=0x7f0a0039; + public static final int childname=0x7f0a0038; + public static final int donateBitcoinAddress=0x7f0a002d; public static final int donateButton=0x7f0a0003; - public static final int donateDialogErrorMessage=0x7f0a0029; - public static final int donateDialogMessage=0x7f0a0026; - public static final int donateDialogMessageLayout=0x7f0a0028; - public static final int donateDialogProgress=0x7f0a0027; - public static final int favouriteCheckBox=0x7f0a001c; - public static final int favouriteDialogMessage=0x7f0a0030; - public static final int favouriteListItems=0x7f0a0031; - public static final int findContentLayout=0x7f0a002c; - public static final int findListItems=0x7f0a002e; - public static final int findLoadBar=0x7f0a002d; + public static final int donateDialogErrorMessage=0x7f0a002c; + public static final int donateDialogMessage=0x7f0a0029; + public static final int donateDialogMessageLayout=0x7f0a002b; + public static final int donateDialogProgress=0x7f0a002a; + public static final int favouriteCheckBox=0x7f0a001f; + public static final int favouriteDialogMessage=0x7f0a0033; + public static final int favouriteListItems=0x7f0a0034; + public static final int findContentLayout=0x7f0a002f; + public static final int findListItems=0x7f0a0031; + public static final int findLoadBar=0x7f0a0030; public static final int helpExpandableListView=0x7f0a0002; - public static final int layout_root=0x7f0a0023; - public static final int linearLayout1=0x7f0a0016; - public static final int linearLayout2=0x7f0a0025; - public static final int mapview=0x7f0a002f; - public static final int menu_about=0x7f0a0040; - public static final int menu_favourites=0x7f0a0041; - public static final int menu_find=0x7f0a003c; - public static final int menu_find_my_location=0x7f0a003e; - public static final int menu_next_stop=0x7f0a003b; - public static final int menu_preferences=0x7f0a003d; - public static final int menu_previous_stop=0x7f0a0039; - public static final int menu_refresh_bus=0x7f0a0038; - public static final int menu_refresh_stop=0x7f0a003a; - public static final int menu_view=0x7f0a003f; - public static final int radio_u1=0x7f0a0017; - public static final int radio_u1n=0x7f0a0018; - public static final int radio_u2=0x7f0a0019; - public static final int radio_u6=0x7f0a001a; - public static final int radio_u9=0x7f0a001b; - public static final int searchBar=0x7f0a002b; + public static final int layout_root=0x7f0a0026; + public static final int linearLayout1=0x7f0a0019; + public static final int linearLayout2=0x7f0a0028; + public static final int mapview=0x7f0a0032; + public static final int menu_about=0x7f0a0043; + public static final int menu_favourites=0x7f0a0044; + public static final int menu_find=0x7f0a003f; + public static final int menu_find_my_location=0x7f0a0041; + public static final int menu_next_stop=0x7f0a003e; + public static final int menu_preferences=0x7f0a0040; + public static final int menu_previous_stop=0x7f0a003c; + public static final int menu_refresh_bus=0x7f0a003b; + public static final int menu_refresh_stop=0x7f0a003d; + public static final int menu_view=0x7f0a0042; + public static final int radio_u1=0x7f0a001a; + public static final int radio_u1n=0x7f0a001b; + public static final int radio_u2=0x7f0a001c; + public static final int radio_u6=0x7f0a001d; + public static final int radio_u9=0x7f0a001e; + public static final int searchBar=0x7f0a002e; public static final int textView1=0x7f0a0000; public static final int textView2=0x7f0a0001; - public static final int toastViewLinearLayout=0x7f0a0032; - public static final int toastViewSubMessage=0x7f0a0034; - public static final int toastViewText=0x7f0a0033; - public static final int view_list=0x7f0a0037; + public static final int toastViewLinearLayout=0x7f0a0035; + public static final int toastViewSubMessage=0x7f0a0037; + public static final int toastViewText=0x7f0a0036; + public static final int view_list=0x7f0a003a; } public static final class layout { public static final int about_dialog=0x7f030000; public static final int building_activity=0x7f030001; public static final int bus_activity=0x7f030002; public static final int bus_route_activity=0x7f030003; - public static final int bus_stop_activity=0x7f030004; - public static final int bus_stop_dialog=0x7f030005; - public static final int donate_dialog=0x7f030006; - public static final int find_activity=0x7f030007; - public static final int map_activity=0x7f030008; - public static final int poi_dialog=0x7f030009; - public static final int toast_view=0x7f03000a; - public static final int view_child_row=0x7f03000b; - public static final int view_dialog=0x7f03000c; - public static final int view_group_row=0x7f03000d; + public static final int bus_specific_stop_view=0x7f030004; + public static final int bus_stop_activity=0x7f030005; + public static final int bus_stop_dialog=0x7f030006; + public static final int donate_dialog=0x7f030007; + public static final int find_activity=0x7f030008; + public static final int map_activity=0x7f030009; + public static final int poi_dialog=0x7f03000a; + public static final int toast_view=0x7f03000b; + public static final int view_child_row=0x7f03000c; + public static final int view_dialog=0x7f03000d; + public static final int view_group_row=0x7f03000e; } public static final class menu { public static final int bus_menu=0x7f090000; diff --git a/res/layout/bus_specific_stop_view.xml b/res/layout/bus_specific_stop_view.xml new file mode 100644 index 0000000..e48e2f1 --- /dev/null +++ b/res/layout/bus_specific_stop_view.xml @@ -0,0 +1,28 @@ + + + + + + + + + + \ No newline at end of file diff --git a/res/raw/u6.gpx b/res/raw/u6.gpx index 5356358..c2680e0 100644 --- a/res/raw/u6.gpx +++ b/res/raw/u6.gpx @@ -311,19 +311,21 @@ - + - + - + + + - + - + - + @@ -557,19 +559,27 @@ - + + + + + + + + + - + - + - + - + - + - + diff --git a/src/net/cbaines/suma/BusActivity.java b/src/net/cbaines/suma/BusActivity.java index f2cf133..834ce2f 100644 --- a/src/net/cbaines/suma/BusActivity.java +++ b/src/net/cbaines/suma/BusActivity.java @@ -2,6 +2,7 @@ package net.cbaines.suma; import java.io.IOException; import java.sql.SQLException; +import java.util.Date; import java.util.HashMap; import java.util.List; @@ -18,6 +19,7 @@ import android.util.Log; import android.view.Gravity; import android.view.Menu; import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.widget.LinearLayout; import android.widget.ListView; @@ -57,6 +59,8 @@ public class BusActivity extends ToastHelperActivity implements Preferences { Handler handler; + long timeOfLastRefresh = 0; + public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bus_activity); @@ -119,8 +123,8 @@ public class BusActivity extends ToastHelperActivity implements Preferences { if (bus.destinationString != null) { Log.i(TAG, "Bus destination string is " + bus.destinationString); - busDestTextView.setText(getResources().getString(R.string.bus_activity_destination_label) - + 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"); @@ -139,26 +143,37 @@ public class BusActivity extends ToastHelperActivity implements Preferences { refreshData = new Runnable() { public void run() { - for (int num = timetableView.getFirstVisiblePosition(); num < timetableView - .getLastVisiblePosition(); num++) { - Stop stop = timetable.get(num); + Log.v(TAG, "Refreshing data " + (System.currentTimeMillis() - timeOfLastRefresh)); + timeOfLastRefresh = System.currentTimeMillis(); + for (int num = timetableView.getFirstVisiblePosition(); num < timetableView.getLastVisiblePosition(); num++) { + final Stop stop = timetable.get(num); - GetTimetableStopTask task = tasks.get(busStops.get(num)); + if (System.currentTimeMillis() - stop.timeOfFetch.getTime() > 20000) { + GetTimetableStopTask task = tasks.get(busStops.get(num)); - if (stop.timeOfFetch == null - || (stop.timeOfFetch.getTime() - System.currentTimeMillis()) > 20000) { - if (task != null) { - if (task.getStatus() == AsyncTask.Status.FINISHED) { - task = null; + if (task != null) { // If there is a taks + if (task.getStatus() == AsyncTask.Status.FINISHED) { // If its finished + task = null; // Delete it } } - if (task == null) { + if (task == null) { // If there is now no task + Log.v(TAG, "Updating " + busStops.get(num)); + + // Remove the old time from the timetable + synchronized (timetable) { + timetable.set(num, new StopLoading(bus, busStops.get(num), null, new Date( + System.currentTimeMillis() - 21000), false)); + displayTimetable(timetable); + } + task = new GetTimetableStopTask(); BusStop[] str = { stop.busStop }; task.execute(str); tasks.put(stop.busStop, task); } + } else { + Log.v(TAG, "Not updating " + busStops.get(num)); } } @@ -192,12 +207,13 @@ public class BusActivity extends ToastHelperActivity implements Preferences { Log.i(TAG, "No Previous timetable"); timetable = new Timetable(); for (int i = 0; i < busStops.size(); i++) { - timetable.add(new Stop(bus, busStops.get(i), null, null, false)); + // Add a loading stop, with a fetch time such that it will be fetched + timetable + .add(new StopLoading(bus, busStops.get(i), null, new Date(System.currentTimeMillis() - 21000), false)); } Log.v(TAG, "Finished adding placeholder stops"); } else { Log.i(TAG, "Displaying previous timetable"); - } displayTimetable(timetable); handler.postDelayed(refreshData, 500); @@ -225,6 +241,46 @@ public class BusActivity extends ToastHelperActivity implements Preferences { super.onPause(); } + @Override + public boolean onOptionsItemSelected(MenuItem item) { + + if (item.getItemId() == R.id.menu_refresh_bus) { + if (handler != null) { // BusTimes are enabled + handler.removeCallbacks(refreshData); + for (GetTimetableStopTask task : tasks.values()) { + task.cancel(true); + } + Log.i(TAG, "Stoping refreshing timetable data"); + + for (int num = timetableView.getFirstVisiblePosition(); num < timetableView.getLastVisiblePosition(); num++) { + final Stop stop = timetable.get(num); + + Log.v(TAG, "Updating " + busStops.get(num)); + + // Remove the old time from the timetable + synchronized (timetable) { + timetable.set(num, new StopLoading(bus, busStops.get(num), null, new Date( + System.currentTimeMillis() - 21000), false)); + displayTimetable(timetable); + } + + GetTimetableStopTask task = new GetTimetableStopTask(); + BusStop[] str = { stop.busStop }; + task.execute(str); + tasks.put(stop.busStop, task); + } + + handler.postDelayed(refreshData, 50000); + } else { + // TODO: Toast here... + } + } else { + Log.e(TAG, "No known menu option selected"); + return super.onOptionsItemSelected(item); + } + return true; + } + private class GetTimetableStopTask extends AsyncTask { private String errorMessage; @@ -245,7 +301,7 @@ public class BusActivity extends ToastHelperActivity implements Preferences { Log.i(TAG, "Fetching stop for busStop " + position); stop = DataManager.getStop(instance, bus, busStop); if (stop == null) { - stop = new Stop(bus, busStop, null, null, false); + stop = new Stop(bus, busStop, null, new Date(System.currentTimeMillis()), false); } Log.i(TAG, "Finished fetching stop for busStop " + position); } catch (SQLException e) { @@ -266,16 +322,10 @@ public class BusActivity extends ToastHelperActivity implements Preferences { protected void onPostExecute(Stop stop) { // Log.i(TAG, "Got timetable"); - if (stop == null) { - Log.i(TAG, "Its null"); - busContentMessage.setText(errorMessage); - busContentMessage.setVisibility(View.VISIBLE); - } else { - synchronized (timetable) { - timetable.set(position, stop); - displayTimetable(timetable); - } + synchronized (timetable) { + timetable.set(position, stop); + displayTimetable(timetable); } } @@ -307,9 +357,7 @@ public class BusActivity extends ToastHelperActivity implements Preferences { adapter = new BusSpecificTimetableAdapter(this, visibleTimetable); timetableView.setAdapter(adapter); if (busStop != null) { - Log.i(TAG, - "Moving to position of " + busStop.description + " which is " - + busStops.indexOf(busStop)); + Log.i(TAG, "Moving to position of " + busStop.description + " which is " + busStops.indexOf(busStop)); timetableView.setSelection(busStops.indexOf(busStop)); } } diff --git a/src/net/cbaines/suma/BusSpecificStopView.java b/src/net/cbaines/suma/BusSpecificStopView.java index fdb6f56..92ec8c7 100644 --- a/src/net/cbaines/suma/BusSpecificStopView.java +++ b/src/net/cbaines/suma/BusSpecificStopView.java @@ -28,19 +28,18 @@ 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.RelativeLayout; import android.widget.TextView; 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 RelativeLayout implements OnClickListener, OnLongClickListener { private static final String TAG = "BusSpecificStopView"; @@ -63,14 +62,12 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener this.context = context; - this.setOrientation(HORIZONTAL); - location = new TextView(context); location.setTextSize(22f); + location.setGravity(Gravity.LEFT); time = new TextView(context); time.setTextSize(22f); - time.setGravity(Gravity.RIGHT); timeProgress = new ProgressBar(context, null, android.R.attr.progressBarStyleSmall); @@ -80,9 +77,22 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener setStop(stop); - 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)); + RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.WRAP_CONTENT); + relativeParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); + + RelativeLayout.LayoutParams relativeParams2 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, + LayoutParams.FILL_PARENT); + relativeParams2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); + + addView(location, relativeParams); + addView(time, relativeParams2); + + // LinearLayout progressLayout = new LinearLayout(context); + // progressLayout.setOrientation(LinearLayout.VERTICAL); + // progressLayout.addView(timeProgress, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); + + addView(timeProgress, relativeParams2); } public void setStop(Stop stop) { @@ -96,14 +106,19 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener } else { location.setText(stop.busStop.description); // TODO } - if (stop.arivalTime != null) { + + if (stop.arivalTime != null) { // Time available time.setText(stop.getShortTimeToArival()); time.setVisibility(View.VISIBLE); timeProgress.setVisibility(View.GONE); - } else { - time.setVisibility(View.GONE); + } else if (stop instanceof StopLoading) { time.setText(""); + time.setVisibility(View.GONE); timeProgress.setVisibility(View.VISIBLE); + } else { // No time available (yet) and not currently loading + time.setVisibility(View.GONE); + time.setText(""); + timeProgress.setVisibility(View.GONE); } DatabaseHelper helper = OpenHelperManager.getHelper(context, DatabaseHelper.class); @@ -122,19 +137,7 @@ public class BusSpecificStopView extends LinearLayout implements OnClickListener + DateFormat.getTimeInstance(DateFormat.SHORT).format(stop.arivalTime) + " (timetabled)"; } } else { - if (stop.bus.id != null) { - if (stop.live) { - onClickMessage = "Bus " + stop.bus.toString(); - } else { - onClickMessage = "Timetabled bus " + stop.bus.toString(); - } - } else { - if (stop.live) { - onClickMessage = "Unidentified bus (" + stop.bus.getName() + ")"; - } else { - onClickMessage = "Timetabled bus (" + stop.bus.getName() + ")"; - } - } + onClickMessage = stop.busStop.description + " on route, but arival time is not avalible"; } } catch (SQLException e) { e.printStackTrace(); diff --git a/src/net/cbaines/suma/BusSpecificTimetableAdapter.java b/src/net/cbaines/suma/BusSpecificTimetableAdapter.java index 96fe713..7b9a34a 100644 --- a/src/net/cbaines/suma/BusSpecificTimetableAdapter.java +++ b/src/net/cbaines/suma/BusSpecificTimetableAdapter.java @@ -21,16 +21,14 @@ package net.cbaines.suma; import android.view.View; import android.view.ViewGroup; -import android.view.animation.Animation; -import android.view.animation.AnimationUtils; import android.widget.BaseAdapter; public class BusSpecificTimetableAdapter extends BaseAdapter { private final BusActivity context; private Timetable timetable; - private final Animation a; - private boolean[] changed; + // private final Animation a; + // private boolean[] changed; private long timeOfLastForcedUpdate = System.currentTimeMillis(); @@ -39,7 +37,7 @@ public class BusSpecificTimetableAdapter extends BaseAdapter { public BusSpecificTimetableAdapter(BusActivity context, Timetable timetable) { this.context = context; this.timetable = timetable; - this.a = AnimationUtils.loadAnimation(context, R.anim.updated_stop_view); + // this.a = AnimationUtils.loadAnimation(context, R.anim.updated_stop_view); } public View getView(int position, View convertView, ViewGroup parent) { @@ -47,6 +45,7 @@ public class BusSpecificTimetableAdapter extends BaseAdapter { // timetable.get(position)); if (timeOfLastForcedUpdate + 1000 < System.currentTimeMillis()) { + context.handler.removeCallbacks(context.refreshData); context.handler.post(context.refreshData); timeOfLastForcedUpdate = System.currentTimeMillis(); } @@ -59,11 +58,11 @@ public class BusSpecificTimetableAdapter extends BaseAdapter { stopView.setStop(timetable.get(position)); } - if (changed == null || changed[position]) { - // a.reset(); - // stopView.startAnimation(a); - // Log.i(TAG, "Animating it"); - } + // if (changed == null || changed[position]) { + // a.reset(); + // stopView.startAnimation(a); + // Log.i(TAG, "Animating it"); + // } return stopView; } @@ -83,17 +82,17 @@ public class BusSpecificTimetableAdapter extends BaseAdapter { public void updateTimetable(Timetable newTimetable) { // Log.v(TAG, "Old timetable " + timetable); // Log.v(TAG, "Adaptor loading new timetable"); - changed = new boolean[newTimetable.size()]; - for (int i = 0; i < newTimetable.size(); i++) { - if (newTimetable.get(i).arivalTime != null && !timetable.contains(newTimetable.get(i), true)) { - changed[i] = true; - // Log.i(TAG, "Old timetable does not contain: " + - // newTimetable.get(i)); - } else { - // Log.i(TAG, "Old timetable contains: " + newTimetable.get(i)); - changed[i] = false; - } - } + // changed = new boolean[newTimetable.size()]; + // for (int i = 0; i < newTimetable.size(); i++) { + // if (newTimetable.get(i).arivalTime != null && !timetable.contains(newTimetable.get(i), true)) { + // changed[i] = true; + // // Log.i(TAG, "Old timetable does not contain: " + + // // newTimetable.get(i)); + // } else { + // // Log.i(TAG, "Old timetable contains: " + newTimetable.get(i)); + // changed[i] = false; + // } + // } timetable = newTimetable; this.notifyDataSetChanged(); } diff --git a/src/net/cbaines/suma/StopLoading.java b/src/net/cbaines/suma/StopLoading.java new file mode 100644 index 0000000..e8ca8e5 --- /dev/null +++ b/src/net/cbaines/suma/StopLoading.java @@ -0,0 +1,11 @@ +package net.cbaines.suma; + +import java.util.Date; + +public class StopLoading extends Stop { + + public StopLoading(Bus bus, BusStop busStop, Date arivalTime, Date timeOfFetch, boolean live) { + super(bus, busStop, arivalTime, timeOfFetch, live); + } + +} -- cgit v1.2.3 From 625e2068d0c6288321d3a6be31490767eed4defe Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 6 Mar 2012 23:08:34 +0000 Subject: Small UI improvements, BusActivity still needs more work. --- gen/net/cbaines/suma/R.java | 2 +- res/layout/building_activity.xml | 3 ++- res/layout/bus_activity.xml | 1 + res/layout/bus_stop_activity.xml | 1 + src/net/cbaines/suma/BuildingActivity.java | 33 +++++++++++++++++++++++---- src/net/cbaines/suma/BusActivity.java | 20 ++++++++++------ src/net/cbaines/suma/BusSpecificStopView.java | 10 ++++---- 7 files changed, 52 insertions(+), 18 deletions(-) diff --git a/gen/net/cbaines/suma/R.java b/gen/net/cbaines/suma/R.java index d65abc0..7e3d3f9 100644 --- a/gen/net/cbaines/suma/R.java +++ b/gen/net/cbaines/suma/R.java @@ -54,10 +54,10 @@ public final class R { public static final int u9_radio_button=0x7f02001d; } public static final class id { + public static final int buildingActivityContentLayout=0x7f0a0007; public static final int buildingActivityFavouriteCheckBox=0x7f0a0005; public static final int buildingActivityImage=0x7f0a0006; public static final int buildingActivityLoadBar=0x7f0a0008; - public static final int buildingActivityLoadBarLayout=0x7f0a0007; public static final int buildingActivityMessage=0x7f0a0009; public static final int buildingActivityName=0x7f0a0004; public static final int busActivityBusDestination=0x7f0a000c; diff --git a/res/layout/building_activity.xml b/res/layout/building_activity.xml index 777ad0a..1fc1312 100644 --- a/res/layout/building_activity.xml +++ b/res/layout/building_activity.xml @@ -25,7 +25,7 @@ diff --git a/res/layout/bus_activity.xml b/res/layout/bus_activity.xml index d8b26f6..93ad39a 100644 --- a/res/layout/bus_activity.xml +++ b/res/layout/bus_activity.xml @@ -37,6 +37,7 @@ android:id="@+id/busActivityMessage" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:gravity="center_horizontal" android:text="" android:textAppearance="?android:attr/textAppearanceLarge" /> diff --git a/res/layout/bus_stop_activity.xml b/res/layout/bus_stop_activity.xml index 66da2f6..40b0505 100644 --- a/res/layout/bus_stop_activity.xml +++ b/res/layout/bus_stop_activity.xml @@ -129,6 +129,7 @@ android:id="@+id/busStopMessage" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:gravity="center_horizontal" android:text="" android:textAppearance="?android:attr/textAppearanceLarge" /> diff --git a/src/net/cbaines/suma/BuildingActivity.java b/src/net/cbaines/suma/BuildingActivity.java index 509bc41..b4bef1b 100644 --- a/src/net/cbaines/suma/BuildingActivity.java +++ b/src/net/cbaines/suma/BuildingActivity.java @@ -62,6 +62,8 @@ public class BuildingActivity extends OrmLiteBaseActivity implem private CheckBox favouritesCheckBox; + private Drawable buildingImage; + public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.building_activity); @@ -90,7 +92,12 @@ public class BuildingActivity extends OrmLiteBaseActivity implem buildingName = (TextView) findViewById(R.id.buildingActivityName); progressBar = (ProgressBar) findViewById(R.id.buildingActivityLoadBar); + progressBar.setVisibility(View.VISIBLE); message = (TextView) findViewById(R.id.buildingActivityMessage); + message.setVisibility(View.GONE); + + imageButton = (ImageButton) findViewById(R.id.buildingActivityImage); + imageButton.setVisibility(View.GONE); Log.i(TAG, "Building id " + ID); @@ -105,9 +112,24 @@ public class BuildingActivity extends OrmLiteBaseActivity implem e1.printStackTrace(); } - GetBuildingImageTask buildingImageTask = new GetBuildingImageTask(); - buildingImageTask.execute(building); + } + + protected void onResume() { + super.onResume(); + buildingImage = (Drawable) getLastNonConfigurationInstance(); + if (buildingImage == null) { + GetBuildingImageTask buildingImageTask = new GetBuildingImageTask(); + buildingImageTask.execute(building); + } else { + imageButton.setImageDrawable(buildingImage); + imageButton.setVisibility(View.VISIBLE); + imageButton.setScaleType(ScaleType.CENTER_INSIDE); + imageButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + } + }); + } } class GetBuildingImageTask extends AsyncTask { @@ -158,7 +180,7 @@ public class BuildingActivity extends OrmLiteBaseActivity implem errorMessage = "MalformedURLException"; } catch (IOException e) { e.printStackTrace(); - errorMessage = "IOException"; + errorMessage = "No Image (Either none avalible, or a connection issue)"; } return null; @@ -170,8 +192,11 @@ public class BuildingActivity extends OrmLiteBaseActivity implem if (image != null) { Log.i(TAG, "Got a image for " + building + ", now displaying it"); + buildingImage = image; + imageButton = (ImageButton) findViewById(R.id.buildingActivityImage); imageButton.setImageDrawable(image); + imageButton.setVisibility(View.VISIBLE); imageButton.setScaleType(ScaleType.CENTER_INSIDE); imageButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { @@ -189,7 +214,7 @@ public class BuildingActivity extends OrmLiteBaseActivity implem @Override public Object onRetainNonConfigurationInstance() { - return null; + return buildingImage; } public void onCheckedChanged(CompoundButton button, boolean checked) { diff --git a/src/net/cbaines/suma/BusActivity.java b/src/net/cbaines/suma/BusActivity.java index 834ce2f..724b65f 100644 --- a/src/net/cbaines/suma/BusActivity.java +++ b/src/net/cbaines/suma/BusActivity.java @@ -162,8 +162,9 @@ public class BusActivity extends ToastHelperActivity implements Preferences { // Remove the old time from the timetable synchronized (timetable) { - timetable.set(num, new StopLoading(bus, busStops.get(num), null, new Date( - System.currentTimeMillis() - 21000), false)); + timetable.set(num, + new StopLoading(bus, busStops.get(num), null, new Date( + System.currentTimeMillis() - 21000), false)); displayTimetable(timetable); } @@ -282,7 +283,7 @@ public class BusActivity extends ToastHelperActivity implements Preferences { } private class GetTimetableStopTask extends AsyncTask { - private String errorMessage; + // private String errorMessage; private BusStop busStop; @@ -305,16 +306,16 @@ public class BusActivity extends ToastHelperActivity implements Preferences { } Log.i(TAG, "Finished fetching stop for busStop " + position); } catch (SQLException e) { - errorMessage = "Error message regarding SQL?"; + // errorMessage = "Error message regarding SQL?"; e.printStackTrace(); } catch (ClientProtocolException e) { - errorMessage = "ClientProtocolException!?!"; + // errorMessage = "ClientProtocolException!?!"; e.printStackTrace(); } catch (IOException e) { - errorMessage = "Error fetching bus times from server, are you connected to the internet?"; + // errorMessage = "Error fetching bus times from server, are you connected to the internet?"; e.printStackTrace(); } catch (JSONException e) { - errorMessage = "Error parsing bus times"; + // errorMessage = "Error parsing bus times"; e.printStackTrace(); } return stop; @@ -331,6 +332,11 @@ public class BusActivity extends ToastHelperActivity implements Preferences { } + @Override + public Object onRetainNonConfigurationInstance() { + return timetable; + } + private void displayTimetable(Timetable timetable) { visibleTimetable = (Timetable) timetable.clone(); diff --git a/src/net/cbaines/suma/BusSpecificStopView.java b/src/net/cbaines/suma/BusSpecificStopView.java index 92ec8c7..723d7c0 100644 --- a/src/net/cbaines/suma/BusSpecificStopView.java +++ b/src/net/cbaines/suma/BusSpecificStopView.java @@ -101,11 +101,11 @@ public class BusSpecificStopView extends RelativeLayout implements OnClickListen this.stop = stop; - if (stop.busStop.description.length() > 20) { - location.setText(stop.busStop.description.substring(0, 20)); // TODO - } else { - location.setText(stop.busStop.description); // TODO - } + // if (stop.busStop.description.length() > 20) { + // location.setText(stop.busStop.description.substring(0, 20)); // TODO + // } else { + location.setText(stop.busStop.description); // TODO + // } if (stop.arivalTime != null) { // Time available time.setText(stop.getShortTimeToArival()); -- cgit v1.2.3 From 39600767cb32b65e4e3495dc996b3af6d9fae52c Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 7 Mar 2012 21:24:50 +0000 Subject: Better BusActivity. --- gen/net/cbaines/suma/R.java | 93 ++++++++++++++------------- res/layout/bus_specific_stop_view.xml | 32 +++++---- src/net/cbaines/suma/BusSpecificStopView.java | 48 ++++++++------ 3 files changed, 94 insertions(+), 79 deletions(-) diff --git a/gen/net/cbaines/suma/R.java b/gen/net/cbaines/suma/R.java index 7e3d3f9..01cabe8 100644 --- a/gen/net/cbaines/suma/R.java +++ b/gen/net/cbaines/suma/R.java @@ -71,58 +71,59 @@ public final class R { public static final int busRouteActivityID=0x7f0a0013; public static final int busRouteActivityLabel=0x7f0a0012; public static final int busRouteBusStops=0x7f0a0014; - public static final int busSpecificStopViewID=0x7f0a0016; public static final int busSpecificStopViewName=0x7f0a0015; public static final int busSpecificStopViewProgressBar=0x7f0a0017; - public static final int busStopID=0x7f0a0020; - public static final int busStopListItems=0x7f0a0027; - public static final int busStopLoadBar=0x7f0a0025; - public static final int busStopMessage=0x7f0a0024; - public static final int busStopName=0x7f0a0018; - public static final int busStopTimes=0x7f0a0022; - public static final int busTimeContentLayout=0x7f0a0021; - public static final int centerLoadBar=0x7f0a0023; - public static final int check1=0x7f0a0039; - public static final int childname=0x7f0a0038; - public static final int donateBitcoinAddress=0x7f0a002d; + public static final int busSpecificStopViewRightContainer=0x7f0a0016; + public static final int busSpecificStopViewTime=0x7f0a0018; + public static final int busStopID=0x7f0a0021; + public static final int busStopListItems=0x7f0a0028; + public static final int busStopLoadBar=0x7f0a0026; + public static final int busStopMessage=0x7f0a0025; + public static final int busStopName=0x7f0a0019; + public static final int busStopTimes=0x7f0a0023; + public static final int busTimeContentLayout=0x7f0a0022; + public static final int centerLoadBar=0x7f0a0024; + public static final int check1=0x7f0a003a; + public static final int childname=0x7f0a0039; + public static final int donateBitcoinAddress=0x7f0a002e; public static final int donateButton=0x7f0a0003; - public static final int donateDialogErrorMessage=0x7f0a002c; - public static final int donateDialogMessage=0x7f0a0029; - public static final int donateDialogMessageLayout=0x7f0a002b; - public static final int donateDialogProgress=0x7f0a002a; - public static final int favouriteCheckBox=0x7f0a001f; - public static final int favouriteDialogMessage=0x7f0a0033; - public static final int favouriteListItems=0x7f0a0034; - public static final int findContentLayout=0x7f0a002f; - public static final int findListItems=0x7f0a0031; - public static final int findLoadBar=0x7f0a0030; + public static final int donateDialogErrorMessage=0x7f0a002d; + public static final int donateDialogMessage=0x7f0a002a; + public static final int donateDialogMessageLayout=0x7f0a002c; + public static final int donateDialogProgress=0x7f0a002b; + public static final int favouriteCheckBox=0x7f0a0020; + public static final int favouriteDialogMessage=0x7f0a0034; + public static final int favouriteListItems=0x7f0a0035; + public static final int findContentLayout=0x7f0a0030; + public static final int findListItems=0x7f0a0032; + public static final int findLoadBar=0x7f0a0031; public static final int helpExpandableListView=0x7f0a0002; - public static final int layout_root=0x7f0a0026; - public static final int linearLayout1=0x7f0a0019; - public static final int linearLayout2=0x7f0a0028; - public static final int mapview=0x7f0a0032; - public static final int menu_about=0x7f0a0043; - public static final int menu_favourites=0x7f0a0044; - public static final int menu_find=0x7f0a003f; - public static final int menu_find_my_location=0x7f0a0041; - public static final int menu_next_stop=0x7f0a003e; - public static final int menu_preferences=0x7f0a0040; - public static final int menu_previous_stop=0x7f0a003c; - public static final int menu_refresh_bus=0x7f0a003b; - public static final int menu_refresh_stop=0x7f0a003d; - public static final int menu_view=0x7f0a0042; - public static final int radio_u1=0x7f0a001a; - public static final int radio_u1n=0x7f0a001b; - public static final int radio_u2=0x7f0a001c; - public static final int radio_u6=0x7f0a001d; - public static final int radio_u9=0x7f0a001e; - public static final int searchBar=0x7f0a002e; + public static final int layout_root=0x7f0a0027; + public static final int linearLayout1=0x7f0a001a; + public static final int linearLayout2=0x7f0a0029; + public static final int mapview=0x7f0a0033; + public static final int menu_about=0x7f0a0044; + public static final int menu_favourites=0x7f0a0045; + public static final int menu_find=0x7f0a0040; + public static final int menu_find_my_location=0x7f0a0042; + public static final int menu_next_stop=0x7f0a003f; + public static final int menu_preferences=0x7f0a0041; + public static final int menu_previous_stop=0x7f0a003d; + public static final int menu_refresh_bus=0x7f0a003c; + public static final int menu_refresh_stop=0x7f0a003e; + public static final int menu_view=0x7f0a0043; + public static final int radio_u1=0x7f0a001b; + public static final int radio_u1n=0x7f0a001c; + public static final int radio_u2=0x7f0a001d; + public static final int radio_u6=0x7f0a001e; + public static final int radio_u9=0x7f0a001f; + public static final int searchBar=0x7f0a002f; public static final int textView1=0x7f0a0000; public static final int textView2=0x7f0a0001; - public static final int toastViewLinearLayout=0x7f0a0035; - public static final int toastViewSubMessage=0x7f0a0037; - public static final int toastViewText=0x7f0a0036; - public static final int view_list=0x7f0a003a; + public static final int toastViewLinearLayout=0x7f0a0036; + public static final int toastViewSubMessage=0x7f0a0038; + public static final int toastViewText=0x7f0a0037; + public static final int view_list=0x7f0a003b; } public static final class layout { public static final int about_dialog=0x7f030000; diff --git a/res/layout/bus_specific_stop_view.xml b/res/layout/bus_specific_stop_view.xml index e48e2f1..8652d2d 100644 --- a/res/layout/bus_specific_stop_view.xml +++ b/res/layout/bus_specific_stop_view.xml @@ -1,28 +1,36 @@ + android:layout_height="wrap_content" > + android:layout_alignParentTop="true" + android:layout_toLeftOf="@+id/busSpecificStopViewRightContainer" + android:singleLine="true" + android:text="Name" /> - + android:layout_alignParentTop="true" > - + + + + \ No newline at end of file diff --git a/src/net/cbaines/suma/BusSpecificStopView.java b/src/net/cbaines/suma/BusSpecificStopView.java index 723d7c0..79b1305 100644 --- a/src/net/cbaines/suma/BusSpecificStopView.java +++ b/src/net/cbaines/suma/BusSpecificStopView.java @@ -23,6 +23,7 @@ import java.sql.SQLException; import java.text.DateFormat; import android.app.Activity; +import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.net.Uri; @@ -31,15 +32,15 @@ import android.view.Gravity; 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.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.j256.ormlite.android.apptools.OpenHelperManager; import com.j256.ormlite.dao.Dao; -public class BusSpecificStopView extends RelativeLayout implements OnClickListener, OnLongClickListener { +public class BusSpecificStopView extends LinearLayout implements OnClickListener, OnLongClickListener { private static final String TAG = "BusSpecificStopView"; @@ -62,14 +63,19 @@ public class BusSpecificStopView extends RelativeLayout implements OnClickListen this.context = context; - location = new TextView(context); + View.inflate(context, R.layout.bus_specific_stop_view, this); + + // location = new TextView(context); + location = (TextView) findViewById(R.id.busSpecificStopViewName); location.setTextSize(22f); location.setGravity(Gravity.LEFT); - time = new TextView(context); + // time = new TextView(context); + time = (TextView) findViewById(R.id.busSpecificStopViewTime); time.setTextSize(22f); - timeProgress = new ProgressBar(context, null, android.R.attr.progressBarStyleSmall); + // timeProgress = new ProgressBar(context, null, android.R.attr.progressBarStyleSmall); + timeProgress = (ProgressBar) findViewById(R.id.busSpecificStopViewProgressBar); Resources resources = context.getResources(); onClickHelpMessage = resources.getString(R.string.bus_stop_view_on_click_toast_help_message); @@ -77,22 +83,22 @@ public class BusSpecificStopView extends RelativeLayout implements OnClickListen setStop(stop); - RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, - LayoutParams.WRAP_CONTENT); - relativeParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); - - RelativeLayout.LayoutParams relativeParams2 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, - LayoutParams.FILL_PARENT); - relativeParams2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); - - addView(location, relativeParams); - addView(time, relativeParams2); - - // LinearLayout progressLayout = new LinearLayout(context); - // progressLayout.setOrientation(LinearLayout.VERTICAL); - // progressLayout.addView(timeProgress, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); - - addView(timeProgress, relativeParams2); + // RelativeLayout.LayoutParams relativeParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, + // LayoutParams.WRAP_CONTENT); + // relativeParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); + // + // RelativeLayout.LayoutParams relativeParams2 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, + // LayoutParams.FILL_PARENT); + // relativeParams2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); + // + // addView(location, relativeParams); + // addView(time, relativeParams2); + // + // // LinearLayout progressLayout = new LinearLayout(context); + // // progressLayout.setOrientation(LinearLayout.VERTICAL); + // // progressLayout.addView(timeProgress, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); + // + // addView(timeProgress, relativeParams2); } public void setStop(Stop stop) { -- cgit v1.2.3 From bd182a85a91205bc19c92e8b1ac8d208caa286ad Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 7 Mar 2012 21:40:46 +0000 Subject: Fixed a bug stoping the last item from showing. --- src/net/cbaines/suma/BusActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net/cbaines/suma/BusActivity.java b/src/net/cbaines/suma/BusActivity.java index 724b65f..ad41a6e 100644 --- a/src/net/cbaines/suma/BusActivity.java +++ b/src/net/cbaines/suma/BusActivity.java @@ -145,7 +145,7 @@ public class BusActivity extends ToastHelperActivity implements Preferences { public void run() { Log.v(TAG, "Refreshing data " + (System.currentTimeMillis() - timeOfLastRefresh)); timeOfLastRefresh = System.currentTimeMillis(); - for (int num = timetableView.getFirstVisiblePosition(); num < timetableView.getLastVisiblePosition(); num++) { + for (int num = timetableView.getFirstVisiblePosition(); num <= timetableView.getLastVisiblePosition(); num++) { final Stop stop = timetable.get(num); if (System.currentTimeMillis() - stop.timeOfFetch.getTime() > 20000) { -- cgit v1.2.3 From 8079c02095db7a90ecde6ee5cf66f1ecb56e51f2 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 7 Mar 2012 22:22:02 +0000 Subject: More bug fixes, and commented out some of the more verbose debugging stuff. --- res/layout/bus_specific_stop_view.xml | 6 ++-- src/net/cbaines/suma/BusActivity.java | 42 +++++++++++++--------- src/net/cbaines/suma/BusRoute.java | 9 ++--- src/net/cbaines/suma/BusSpecificStopView.java | 1 - .../cbaines/suma/BusSpecificTimetableAdapter.java | 19 ---------- src/net/cbaines/suma/DataManager.java | 21 +++++------ 6 files changed, 43 insertions(+), 55 deletions(-) diff --git a/res/layout/bus_specific_stop_view.xml b/res/layout/bus_specific_stop_view.xml index 8652d2d..85ee8a7 100644 --- a/res/layout/bus_specific_stop_view.xml +++ b/res/layout/bus_specific_stop_view.xml @@ -10,8 +10,7 @@ android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_toLeftOf="@+id/busSpecificStopViewRightContainer" - android:singleLine="true" - android:text="Name" /> + android:singleLine="true" /> + android:layout_height="wrap_content" /> \ No newline at end of file diff --git a/src/net/cbaines/suma/BusActivity.java b/src/net/cbaines/suma/BusActivity.java index ad41a6e..336d336 100644 --- a/src/net/cbaines/suma/BusActivity.java +++ b/src/net/cbaines/suma/BusActivity.java @@ -113,7 +113,7 @@ public class BusActivity extends ToastHelperActivity implements Preferences { timetableView = (ListView) findViewById(R.id.busActivityTimes); if (bus.id != null) { - Log.i(TAG, "Bus id is not null (" + bus.id + ") setting busIDTextView"); + // Log.i(TAG, "Bus id is not null (" + bus.id + ") setting busIDTextView"); busIDTextView.setText(bus.id + " " + bus.getName()); } else { Log.w(TAG, "Bus id is null?"); @@ -122,21 +122,30 @@ public class BusActivity extends ToastHelperActivity implements Preferences { } if (bus.destinationString != null) { - Log.i(TAG, "Bus destination string is " + bus.destinationString); + // Log.i(TAG, "Bus destination string is " + 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"); + // Log.i(TAG, "Bus destination string is null"); busDestTextView.setText(getResources().getString(R.string.bus_activity_no_destination_message)); busDestTextView.setVisibility(View.VISIBLE); } busStops = bus.route.getRouteSection(instance, bus.direction); - Log.i(TAG, "Got " + busStops.size() + " bus stops for this bus"); + // Log.i(TAG, "Got " + busStops.size() + " bus stops for this bus"); if (bus.destination != null) { Log.i(TAG, "Bus destination is " + bus.destination); + + int index = busStops.indexOf(bus.destination); + if (index != -1) { + Log.v(TAG, "Found destination stop in busStops"); + for (int i = index + 1; i < busStops.size(); i++) { + Log.v(TAG, "Removing " + busStops.get(i)); + busStops.remove(i); + } + } } else { Log.i(TAG, "Bus destination is null"); } @@ -158,7 +167,7 @@ public class BusActivity extends ToastHelperActivity implements Preferences { } if (task == null) { // If there is now no task - Log.v(TAG, "Updating " + busStops.get(num)); + // Log.v(TAG, "Updating " + busStops.get(num)); // Remove the old time from the timetable synchronized (timetable) { @@ -174,7 +183,7 @@ public class BusActivity extends ToastHelperActivity implements Preferences { tasks.put(stop.busStop, task); } } else { - Log.v(TAG, "Not updating " + busStops.get(num)); + // Log.v(TAG, "Not updating " + busStops.get(num)); } } @@ -199,7 +208,7 @@ public class BusActivity extends ToastHelperActivity implements Preferences { SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); if (sharedPrefs.getBoolean(UNI_LINK_BUS_TIMES, UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT) || sharedPrefs.getBoolean(NON_UNI_LINK_BUS_TIMES, NON_UNI_LINK_BUS_TIMES_ENABLED_BY_DEFAULT)) { - Log.i(TAG, "Live Times enabled"); + // Log.i(TAG, "Live Times enabled"); timetable = (Timetable) getLastNonConfigurationInstance(); handler = new Handler(); @@ -212,11 +221,15 @@ public class BusActivity extends ToastHelperActivity implements Preferences { timetable .add(new StopLoading(bus, busStops.get(i), null, new Date(System.currentTimeMillis() - 21000), false)); } - Log.v(TAG, "Finished adding placeholder stops"); + // Log.v(TAG, "Finished adding placeholder stops"); } else { Log.i(TAG, "Displaying previous timetable"); } displayTimetable(timetable); + if (busStop != null) { + Log.i(TAG, "Moving to position of " + busStop.description + " which is " + busStops.indexOf(busStop)); + timetableView.setSelection(busStops.indexOf(busStop)); + } handler.postDelayed(refreshData, 500); } else { @@ -251,12 +264,11 @@ public class BusActivity extends ToastHelperActivity implements Preferences { for (GetTimetableStopTask task : tasks.values()) { task.cancel(true); } - Log.i(TAG, "Stoping refreshing timetable data"); - for (int num = timetableView.getFirstVisiblePosition(); num < timetableView.getLastVisiblePosition(); num++) { + for (int num = timetableView.getFirstVisiblePosition(); num <= timetableView.getLastVisiblePosition(); num++) { final Stop stop = timetable.get(num); - Log.v(TAG, "Updating " + busStops.get(num)); + // Log.v(TAG, "Updating " + busStops.get(num)); // Remove the old time from the timetable synchronized (timetable) { @@ -299,12 +311,12 @@ public class BusActivity extends ToastHelperActivity implements Preferences { Stop stop = null; try { - Log.i(TAG, "Fetching stop for busStop " + position); + // Log.i(TAG, "Fetching stop for busStop " + position); stop = DataManager.getStop(instance, bus, busStop); if (stop == null) { stop = new Stop(bus, busStop, null, new Date(System.currentTimeMillis()), false); } - Log.i(TAG, "Finished fetching stop for busStop " + position); + // Log.i(TAG, "Finished fetching stop for busStop " + position); } catch (SQLException e) { // errorMessage = "Error message regarding SQL?"; e.printStackTrace(); @@ -362,10 +374,6 @@ public class BusActivity extends ToastHelperActivity implements Preferences { } else { adapter = new BusSpecificTimetableAdapter(this, visibleTimetable); timetableView.setAdapter(adapter); - if (busStop != null) { - Log.i(TAG, "Moving to position of " + busStop.description + " which is " + busStops.indexOf(busStop)); - timetableView.setSelection(busStops.indexOf(busStop)); - } } busActivityContentLayout.setGravity(Gravity.TOP); } diff --git a/src/net/cbaines/suma/BusRoute.java b/src/net/cbaines/suma/BusRoute.java index 793cc24..e38d06a 100644 --- a/src/net/cbaines/suma/BusRoute.java +++ b/src/net/cbaines/suma/BusRoute.java @@ -433,8 +433,6 @@ public class BusRoute { if (direction != null) { - if (direction.equals("E")) - direction = "A"; // Quick hack for U1E } else { throw new NullPointerException("direction is null"); } @@ -458,11 +456,14 @@ public class BusRoute { int endStopSeq = -1; if (id == 326) { // U1 - if (direction.equals(forwardDirection)) { + if (direction.equals("E")) { startStopSeq = 1; endStopSeq = 43; + } else if (direction.equals(forwardDirection)) { + startStopSeq = 1; + endStopSeq = 36; } else if (direction.equals(reverseDirection)) { - startStopSeq = 44; + startStopSeq = 51; endStopSeq = 88; } else { Log.e(TAG, "Error, unrecognised direction " + direction); diff --git a/src/net/cbaines/suma/BusSpecificStopView.java b/src/net/cbaines/suma/BusSpecificStopView.java index 79b1305..6502a5f 100644 --- a/src/net/cbaines/suma/BusSpecificStopView.java +++ b/src/net/cbaines/suma/BusSpecificStopView.java @@ -23,7 +23,6 @@ import java.sql.SQLException; import java.text.DateFormat; import android.app.Activity; -import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.net.Uri; diff --git a/src/net/cbaines/suma/BusSpecificTimetableAdapter.java b/src/net/cbaines/suma/BusSpecificTimetableAdapter.java index 7b9a34a..954217c 100644 --- a/src/net/cbaines/suma/BusSpecificTimetableAdapter.java +++ b/src/net/cbaines/suma/BusSpecificTimetableAdapter.java @@ -58,12 +58,6 @@ public class BusSpecificTimetableAdapter extends BaseAdapter { stopView.setStop(timetable.get(position)); } - // if (changed == null || changed[position]) { - // a.reset(); - // stopView.startAnimation(a); - // Log.i(TAG, "Animating it"); - // } - return stopView; } @@ -80,19 +74,6 @@ public class BusSpecificTimetableAdapter extends BaseAdapter { } public void updateTimetable(Timetable newTimetable) { - // Log.v(TAG, "Old timetable " + timetable); - // Log.v(TAG, "Adaptor loading new timetable"); - // changed = new boolean[newTimetable.size()]; - // for (int i = 0; i < newTimetable.size(); i++) { - // if (newTimetable.get(i).arivalTime != null && !timetable.contains(newTimetable.get(i), true)) { - // changed[i] = true; - // // Log.i(TAG, "Old timetable does not contain: " + - // // newTimetable.get(i)); - // } else { - // // Log.i(TAG, "Old timetable contains: " + newTimetable.get(i)); - // changed[i] = false; - // } - // } timetable = newTimetable; this.notifyDataSetChanged(); } diff --git a/src/net/cbaines/suma/DataManager.java b/src/net/cbaines/suma/DataManager.java index ab1f3a7..08425a7 100644 --- a/src/net/cbaines/suma/DataManager.java +++ b/src/net/cbaines/suma/DataManager.java @@ -554,7 +554,8 @@ public class DataManager { List routeStops = routeStopsDao.query(routeStopsPreparedQuery); if (routeStops.size() > 0) { - Log.i(TAG, "Found " + routeStops.size() + " stops matching the destStop " + destStop + " on route " + route.code); + // Log.i(TAG, "Found " + routeStops.size() + " stops matching the destStop " + destStop + " on route " + + // route.code); } else { Log.w(TAG, "Found " + routeStops.size() + " stops matching the destStop " + destStop + " on route " + route.code); } @@ -635,7 +636,7 @@ public class DataManager { Iterator keyIter = routesObject.keys(); keyIter.hasNext();) { String key = keyIter.next(); - Log.v(TAG, "Route Key: " + key); + // Log.v(TAG, "Route Key: " + key); BusRoute route = busRouteDao.queryForId(Integer.parseInt(key.substring(key.length() - 3, key.length()))); @@ -648,18 +649,18 @@ public class DataManager { int age = Integer.parseInt(data.getString("age")); - Log.v(TAG, "Stops: " + data.getJSONArray("stops")); + // Log.v(TAG, "Stops: " + data.getJSONArray("stops")); for (int stopNum = 0; stopNum < stopsArray.length(); stopNum++) { JSONObject stopObj = stopsArray.getJSONObject(stopNum); if (!keepNonUniLink && !stopObj.getString("name").startsWith("U")) { - Log.v(TAG, "Skipping non uni-link stop " + stopObj.getString("name")); + // Log.v(TAG, "Skipping non uni-link stop " + stopObj.getString("name")); continue; } if (!keepUniLink && stopObj.getString("name").startsWith("U")) { - Log.v(TAG, "Skipping uni-link stop " + stopObj.getString("name")); + // Log.v(TAG, "Skipping uni-link stop " + stopObj.getString("name")); continue; } @@ -734,9 +735,9 @@ public class DataManager { HashSet busRoutes = new HashSet(); busRoutes.add(bus.route); - Log.v(TAG, "Number of entries " + data.length()); + // Log.v(TAG, "Number of entries " + data.length()); - Log.v(TAG, "Stops: " + data.getJSONArray("stops")); + // Log.v(TAG, "Stops: " + data.getJSONArray("stops")); for (int stopNum = 0; stopNum < stopsArray.length(); stopNum++) { JSONObject stopObj = stopsArray.getJSONObject(stopNum); @@ -750,8 +751,8 @@ public class DataManager { continue; } - Log.v(TAG, "Found stop for a unidentified " + stop.bus.toString() + " at " + stop.busStop.id + " at " - + stop.arivalTime); + // Log.v(TAG, "Found stop for a unidentified " + stop.bus.toString() + " at " + stop.busStop.id + " at " + // + stop.arivalTime); timetable.add(stop); @@ -841,7 +842,7 @@ public class DataManager { StringBuilder builder = new StringBuilder(); HttpClient client = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(request); - Log.v("Util.getFileFromServer", "Request used: " + request); + // Log.v("Util.getFileFromServer", "Request used: " + request); HttpResponse response = client.execute(httpGet); StatusLine statusLine = response.getStatusLine(); -- cgit v1.2.3 From 3a1e26a108f4288072ffa9c7d8cf6b7a4e54ef96 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 7 Mar 2012 22:37:01 +0000 Subject: Finaly got the progress things centered... --- res/layout/bus_specific_stop_view.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/res/layout/bus_specific_stop_view.xml b/res/layout/bus_specific_stop_view.xml index 85ee8a7..6787540 100644 --- a/res/layout/bus_specific_stop_view.xml +++ b/res/layout/bus_specific_stop_view.xml @@ -17,7 +17,9 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" - android:layout_alignParentTop="true" > + android:layout_centerVertical="true" + android:gravity="center_vertical" + android:orientation="vertical" > Date: Wed, 7 Mar 2012 23:04:39 +0000 Subject: Got the config file loading working for ormlite. --- gen/net/cbaines/suma/R.java | 15 +- res/raw/org.rdf | 6168 -------------------------- res/raw/ormlite_config.txt | 183 +- src/net/cbaines/suma/BusStop.java | 3 +- src/net/cbaines/suma/DatabaseConfigUtil.java | 5 +- src/net/cbaines/suma/DatabaseHelper.java | 37 +- src/net/cbaines/suma/POI.java | 82 +- 7 files changed, 248 insertions(+), 6245 deletions(-) delete mode 100644 res/raw/org.rdf diff --git a/gen/net/cbaines/suma/R.java b/gen/net/cbaines/suma/R.java index 01cabe8..7ff7855 100644 --- a/gen/net/cbaines/suma/R.java +++ b/gen/net/cbaines/suma/R.java @@ -148,14 +148,13 @@ public final class R { public static final int map_menu=0x7f090002; } public static final class raw { - public static final int org=0x7f060000; - public static final int ormlite_config=0x7f060001; - public static final int u1=0x7f060002; - public static final int u1e=0x7f060003; - public static final int u1n=0x7f060004; - public static final int u2=0x7f060005; - public static final int u6=0x7f060006; - public static final int u9=0x7f060007; + public static final int ormlite_config=0x7f060000; + public static final int u1=0x7f060001; + public static final int u1e=0x7f060002; + public static final int u1n=0x7f060003; + public static final int u2=0x7f060004; + public static final int u6=0x7f060005; + public static final int u9=0x7f060006; } public static final class string { public static final int U1=0x7f070009; diff --git a/res/raw/org.rdf b/res/raw/org.rdf deleted file mode 100644 index db580f9..0000000 --- a/res/raw/org.rdf +++ /dev/null @@ -1,6168 +0,0 @@ - - - - - - - - - - - - - - - - 2011-11-30T09:43:54Z - - - 2011-11-30T09:43:55Z - - - - - - - - - - - - - - - 2011-11-30T09:43:55Z - - - 2011-11-30T09:43:56Z - - - - - - - - - - - - - - - - - - 2011-11-30 - - - This list of organisations and organisational units is taken from the table used by the "MUD" directory, so may not be authoritative. The University organisation is currently changing so these identifiers should be treated with caution. - - - - - - - - - - - - Organisation - - - - - - - - - Generated by OpenOrg Grinder using the org.xsl transform by Christopher Gutteridge. See http://wiki.openorg.ecs.soton.ac.uk/wiki/OpenOrg_Grinder. Generated at 2011-11-30T09:43:56+00:00 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2011-11-30T09:43:56Z - - - 2011-11-30T09:43:56Z - - - - - - - - - - - - University of Southampton - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Human Development & Health - - - AF - - - - - - - - - - - - - - - - - - - - - - - - Aeronautics, Astronautics & Comp. Eng - - - AK - - - - - - - - - - - - - - - - - - Civil Maritime & Env. Eng & Sci Unit - - - AT - - - - - - - - - - - - - - - - - - - - - Legal Services & Research Governance - - - BB - - - - - - - - - - - - - - - Health & Safety - - - BH - - - 13 - - - - - - Centre for Biological Sciences - - - BJ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Centre for Innovation & Leadership - - - BN - - - - - - - - - - - - - - - Engineering Science Unit - - - BX - - - - - - - - - - - - - - - - - - - - - LATEU - - - BZ - - - - - - - - - - - - - - - Social Sciences - - - CC - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Development & Alumni Relations - - - CD - - - - - - - - - - - - - - - - - - - - - - - - Southampton Education School - - - CJ - - - - - - - - - - - - - - - - - - - - - - - - - - - Cancer Sciences - - - CM - - - - - - - - - - - - - - - - - - Chaplaincy - - - CY - - - - - - - - - - - - Human Resources - - - DD - - - - - - - - - - - - - - - - - - - - - Faculty Hub - - - DF - - - - - - - - - - - - - - - Communications - - - DK - - - - - - - - - - - - - - - - - - - - - Chemistry - - - EB - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Optoelectronics Research Centre - - - EH - - - - - - - - - - - - - - - - - - - - - Student Services - - - EW - - - - - - 10 - - - - - - - - - Faculty of Business and Law - - - F1 - - - - - - - - - - - - - - - - - - Graphics, Fine Art & Media - - - F1FH010000 - - - - - - Fashion & Textile Design - - - F1FH020000 - - - - - - Technical Services - - - F1FH030000 - - - - - - Research Centre - - - F1FH040000 - - - - - - International Studies - - - F1FH050000 - - - - - - Law - - - F1JJ010000 - - - - - - Management Science - - - F1TR010000 - - - - - - Knowledge & Information Systems - - - F1TR020000 - - - - - - Marketing - - - F1TR030000 - - - - - - Organisational Behaviour - - - F1TR040000 - - - - - - Strategy & Innovation - - - F1TR050000 - - - - - - Accounting - - - F1TR060000 - - - - - - Finance - - - F1TR070000 - - - - - - Academic Related - - - F1TR080000 - - - - - - - - - Faculty of Engineering and the Environment - - - F2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Aerodynamics &Flight Mech Research Group - - - F2AK010000 - - - - - - Astronautics - - - F2AK020000 - - - - - - Computational Engineering & Design - - - F2AK030000 - - - - - - Energy & Climate Change Group - - - F2AT010000 - - - - - - Environment Research Group - - - F2AT020000 - - - - - - Fluid / Structure Interactions Research - - - F2AT030000 - - - - - - Infrastructure Research Group - - - F2AT040000 - - - - - - Tranportation Research Group - - - F2AT050000 - - - - - - Bioengineering Research Group - - - F2BX010000 - - - - - - Electro-Mechanical Research Group - - - F2BX020000 - - - - - - Energy Technology Research Group - - - F2BX030000 - - - - - - Engineering Materials & Surface Engineer - - - F2BX040000 - - - - - - nCATS Research Group - - - F2BX050000 - - - - - - General - - - F2DF010000 - - - - - - Signal Processing & Control Research Grp - - - F2KR010000 - - - - - - Dynamics Research Group - - - F2KR020000 - - - - - - Fluid Dynamics & Acoustics Research Grp - - - F2KR030000 - - - - - - Human Sciences Research Group - - - F2KR040000 - - - - - - Research Institute for Industry - - - F2LH010000 - - - - - - ISVR Consulting - - - F2LH020000 - - - - - - Wolfson Unit MTIA - - - F2LH030000 - - - - - - SOECIC - - - F2LH040000 - - - - - - - - - Faculty of Health Sciences - - - F3 - - - - - - - - - - - - - - - Leadership & Health Systems - - - F3BN010000 - - - - - - Advancing Clinical & Expert Practice - - - F3BN020000 - - - - - - Researcher Development - - - F3BN030000 - - - - - - Family, Child & Psycho-Social Health - - - F3KE020000 - - - - - - Physical & Rehabilitation Health - - - F3KE030000 - - - - - - Bio-Behavioural Sciences - - - F3KE040000 - - - 15 - - - - - - - - - Faculty of Humanities - - - F4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CLS - - - F4GC010000 - - - 13 - - - - - - - - - Faculty of Medicine - - - F5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Human Genetics - - - F5AF010000 - - - - - - Bone & Joint - - - F5AF020000 - - - - - - Epidermiology - - - F5AF030000 - - - - - - Human Nutrition & Metabolism - - - F5AF040000 - - - - - - Maternal, Fetal & Neonatal Physiology - - - F5AF050000 - - - - - - Tissue Infection & Repair - - - F5FC010000 - - - - - - Allergy & Inflammation Research - - - F5FC020000 - - - - - - Clinical Neurosciences - - - F5FC030000 - - - - - - Medical Education Development Unit - - - F5RA010000 - - - - - - Centre for Learning Anatomical Sciences - - - F5RA020000 - - - - - - NETSCC - - - F5VB020000 - - - 12 - - - - - - - - - Faculty of Natural and Environmental Sciences - - - F6 - - - - - - - - - - - - - - - - - - - - - Biological Sciences Technical - - - F6BJ010000 - - - - - - Biological Sciences Research - - - F6BJ020000 - - - - - - Academic - - - F6BJ030000 - - - - - - Molecular and Cellular - - - F6BJ110000 - - - - - - Environmental - - - F6BJ120000 - - - - - - Biomedicine - - - F6BJ130000 - - - - - - Biological Sciences Education/Training - - - F6BJ140000 - - - - - - Support Staff - Technical - - - F6BJ150000 - - - - - - Chemical Biology Group - - - F6EB010000 - - - - - - Electrochemistry & Surface Science Group - - - F6EB020000 - - - - - - Structure & Materials Group - - - F6EB030000 - - - - - - Synthetic Chemistry Group - - - F6EB040000 - - - - - - Support Staff - - - F6EB050000 - - - - - - Chemistry Technical - - - F6EB070000 - - - - - - Computational Systems Chemistry - - - F6EB080000 - - - - - - Electrochemistry - - - F6EB090000 - - - - - - Chemistry Education / Training - - - F6EB110000 - - - - - - Magnetic Resonance - - - F6EB120000 - - - - - - Molecular Assembly, Function & Structure - - - F6EB130000 - - - - - - Molecular Diagnostics & Thereputics - - - F6EB140000 - - - - - - Chemistry Research - - - F6EB150000 - - - - - - Ocean & Earth Science Technical - - - F6HN010000 - - - - - - Coastal & Shelf Research - - - F6HN020000 - - - - - - Geochemistry - - - F6HN030000 - - - - - - Geology & Geophysics - - - F6HN040000 - - - - - - Ocean Biochemistry & Ecosystems - - - F6HN060000 - - - - - - Paleooceanography & Palaeoclimate - - - F6HN070000 - - - - - - Physical Oceanography - - - F6HN080000 - - - - - - - - - Faculty of Physical and Applied Science - - - F7 - - - - - - - - - - - - - - - - - - ORC Research - - - F7EH010000 - - - - - - ORC - Enterprise - - - F7EH020000 - - - - - - Technical Support Staff - - - F7EH040000 - - - - - - ECML - - - F7FP010000 - - - - - - IT Innovation - - - F7FP020000 - - - - - - - - - MECH - - - F7FP030000 - - - - - - NANO - - - F7FP040000 - - - - - - - - - EEE - - - F7FP050000 - - - - - - - - - Comms, Signal Processing & Control - - - F7FP060000 - - - - - - - - - Electronic & Software Systems - - - F7FP070000 - - - - - - - - - Agents, Interactions & Complexity - - - F7FP080000 - - - - - - - - - Web & Internet Science - - - F7FP090000 - - - - - - - - - Theory Group - - - F7WF010000 - - - - - - Astronomy Group - - - F7WF020000 - - - - - - Quantum, Light & Matter Group - - - F7WF030000 - - - - - - Support Staff - - - F7WF040000 - - - - - - - - - Faculty of Social and Human Sciences - - - F8 - - - - - - - - - - - - - - - - - - - - - - - - - - - Social Statistics & Demography - - - F8CC010000 - - - - - - - - - - - - Centre for Population Change (CPC) - - - F8CC010600 - - - - - - ESRC National Centre - Research Methods - - - F8CC010700 - - - - - - Social Work Studies - - - F8CC020000 - - - - - - - - - SWAP - - - F8CC020300 - - - - - - Economics - - - F8CC030000 - - - - - - Politics & International Relations - - - F8CC040000 - - - - - - Sociology & Social Policy - - - F8CC050000 - - - - - - Gerontology - - - F8CC060000 - - - - - - Centre for Contemporary China - - - F8CC070000 - - - - - - Third Sector Research Centre - - - F8CC080000 - - - - - - Leadership School Improve &Effectiveness - - - F8CJ010000 - - - - - - Lifelong & Work-Related Learning - - - F8CJ020000 - - - - - - Mathematics & Science Education - - - F8CJ030000 - - - - - - Social Justice & Inclusive Education - - - F8CJ040000 - - - - - - Teaching Only Staff - - - F8CJ050000 - - - - - - Technical Staff - - - F8CJ060000 - - - - - - Clinical Neuroscience - - - F8JW010000 - - - - - - - - - - - - - - - Developmental Brain-Behaviour Lab - - - F8JW010100 - - - - - - Emotion & Motivation Lab - - - F8JW010200 - - - - - - Animal Behaviour - - - F8JW010300 - - - - - - Cognition - - - F8JW020000 - - - - - - - - - - - - - - - Centre for Visual Cognition - - - F8JW020100 - - - - - - Memory & Associated Learning Lab - - - F8JW020200 - - - - - - CBT - - - F8JW020300 - - - - - - Human Wellbeing - - - F8JW030000 - - - - - - - - - - - - - - - Centre for Apps. of Health Psychology - - - F8JW030100 - - - - - - Centre for Research on Self & Identity - - - F8JW030200 - - - - - - Centre for Sexual Health Research - - - F8JW030300 - - - - - - Technical Staff - - - F8JW040000 - - - - - - Professional Training - - - F8JW050000 - - - - - - Applied Mathematics - - - F8PJ010000 - - - - - - Operational Research - - - F8PJ020000 - - - - - - Pure Mathematics - - - F8PJ030000 - - - - - - Statistics - - - F8PJ040000 - - - - - - Earth Surface Dynamics - - - F8WR010000 - - - - - - Economy, Society & Space - - - F8WR020000 - - - - - - GeoData Institute - - - F8WR030000 - - - - - - Global Env Change & Earth Observation - - - F8WR040000 - - - - - - Palaeoenvironment Laboratory (PLUS) - - - F8WR050000 - - - - - - Population, Health & Wellbeing (PHeW) - - - F8WR060000 - - - - - - Technical Staff - - - F8WR070000 - - - - - - Research Groups - - - F8WT010000 - - - - - - - - - DUMMY - - - F8WT010100 - - - - - - - - - - - - - - - Academic & Research - - - F8WT010101 - - - - - - Maths - - - F8WT010103 - - - - - - Social Sciences - - - F8WT010104 - - - - - - Infection, Inflammation & Immunity - - - FC - - - - - - - - - - - - - - - - - - Winchester School of Art - - - FH - - - - - - - - - - - - - - - - - - - - - - - - Philosophy - - - FJ - - - - - - - - - - - - Electronics & Computer Science - - - FP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Royal Naval Unit - - - FX - - - - - - - - - Modern Languages - - - GC - - - - - - - - - - - - Strategy, Planning and Governance - - - GR - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Student & Academic Administration - - - GX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ocean and Earth Science - - - HN - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - iSolutions - - - JF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Southampton Law School - - - JJ - - - - - - - - - - - - Institute for Life Sciences - - - JL - - - - - - - - - Psychology - - - JW - - - - - - - - - - - - - - - - - - - - - - - - - - - Professional Practice in Health Sciences - - - KE - - - - - - - - - - - - - - - - - - - - - Inst. Sound & Vibration Research - - - KR - - - - - - - - - - - - - - - - - - - - - - - - - - - Library - - - KX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Primary Care & Population Sciences - - - LG - - - - - - Enterprise - - - LH - - - - - - - - - - - - - - - - - - - - - Humanities: Central Faculty - - - LN - - - - - - Film - - - LT - - - - - - Archaeology - - - MH - - - - - - - - - - - - Education Hub - - - MM - - - - - - - - - - - - Music - - - NC - - - - - - - - - - - - International Office - - - NP - - - - - - - - - Professional Services - COO - - - P1 - - - - - - - - - - - - - - - - - - - - - - - - - - - Legal Services - - - P1BB010000 - - - - - - - - - General Office - - - P1BB010100 - - - - - - Research Governance Office - - - P1BB020000 - - - - - - B37 Office - - - P1BB030000 - - - - - - HR - Professional Services - - - P1GRDD0200 - - - - - - - - - - - - - - - - - - Employee Relations - - - P1GRDD0210 - - - - - - HR Systems - - - P1GRDD0220 - - - - - - Organisational Development & Design - - - P1GRDD0230 - - - - - - Recruitment, Reward & Talent - - - P1GRDD0240 - - - - - - - - - - - - - - - Reward - - - P1GRDD0241 - - - - - - Temp Bank - - - P1GRDD0242 - - - - - - Recruitment - - - P1GRDD0243 - - - - - - Development - - - P1GRDD0300 - - - - - - - - - Professional Development Unit - - - P1GRDD0310 - - - - - - Equality & Diversity - - - P1GRDD0400 - - - - - - Director's Office - - - P1GRDD0500 - - - - - - Professional Services - Registrar - - - P2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Secretariat - - - P2GR010000 - - - - - - Turner Sims Concert Hall - - - P2GR020000 - - - - - - John Hansard Gallery - - - P2GR030000 - - - - - - Planning & Performance - - - P2GR040000 - - - - - - Transition Project Team - - - P2GR050000 - - - - - - Malaysia Campus Project Team - - - P2GR060000 - - - - - - Vice Chancellor Administration - - - P2GR080000 - - - - - - FOO - Faculty of Business & Law - - - P2TX010000 - - - - - - - - - - - - - - - - - - Faculty Secretariat - - - P2TX010100 - - - - - - Faculty Administration Team - - - P2TX010200 - - - - - - Faculty Resource Team - - - P2TX010300 - - - - - - Faculty Environment Team - - - P2TX010400 - - - - - - FOO - Faculty of Engineering & The Env. - - - P2TX020000 - - - - - - - - - - - - - - - - - - Faculty Secretariat - - - P2TX020100 - - - - - - Faculty Admin for Grants & Projects - - - P2TX020200 - - - - - - Faculty Resource Team - - - P2TX020300 - - - - - - Academic Environment Team - - - P2TX020400 - - - - - - FOO - Faculty of Health Sciences - - - P2TX030000 - - - - - - - - - - - - - - - - - - - - - Faculty Seretariat - - - P2TX030100 - - - - - - Faculty Administration Team - - - P2TX030200 - - - - - - Faculty Resource Team - - - P2TX030300 - - - - - - Faculty Envionment Team - - - P2TX030400 - - - - - - Regional Centre Admin / Reception - - - P2TX030500 - - - - - - FOO - Faculty of Humanities - - - P2TX040000 - - - - - - - - - - - - Faculty Secretariat - - - P2TX040100 - - - - - - Subject Centre - LLAS - - - P2TX040500 - - - - - - FOO - Faculty of Medicine - - - P2TX050000 - - - - - - FOO - Faculty of Natural & Env. Science - - - P2TX060000 - - - - - - - - - - - - - - - - - - Faculty Administration Team - - - P2TX060200 - - - - - - Academic Environment Team - - - P2TX060300 - - - - - - Faculty Resource Team - - - P2TX060400 - - - - - - Externally Funded Projects - - - P2TX060500 - - - - - - FOO - Faculty of Physical & Applied Sci. - - - P2TX070000 - - - - - - - - - - - - - - - Research Administration - - - P2TX070400 - - - - - - Externally Funded Projects - - - P2TX070500 - - - - - - Trading / Enterprise - - - P2TX070600 - - - - - - FOO - Faculty of Social & Human Sciences - - - P2TX080000 - - - - - - - - - - - - - - - Faculty Secretariat - - - P2TX080100 - - - - - - Academic Environment Team - - - P2TX080300 - - - - - - Externally Funded Sci Leaning Cntr SWAP - - - P2TX080400 - - - - - - Mathematics - - - PJ - - - - - - - - - - - - - - - - - - - - - Vice Chancellors Office - - - PK - - - - - - - - - Administration - - - PKBZ010000 - - - - - - Quality Enhancement - - - PKBZ020000 - - - - - - Donor Relations - - - PKCD030000 - - - - - - Annual Giving - - - PKCD050000 - - - - - - Alumni Relations - - - PKCD080000 - - - - - - Major Gift Fundraising - - - PKCD090000 - - - - - - Research, Analytics & Data - - - PKCD100000 - - - - - - Marketing - - - PKGRDK0300 - - - - - - Digital Media - - - PKGRDK0400 - - - - - - Corporate Communications - - - PKGRDK0500 - - - - - - Public Affairs - - - PKGRDK0600 - - - - - - Recruitment, Outreach & Admissions - - - PKGX050000 - - - - - - - - - - - - Outreach - - - PKGX050100 - - - - - - Admissions - - - PKGX050300 - - - - - - Student Administration - - - PKGX060000 - - - - - - - - - - - - Curriculum & Timetabling - - - PKGX060100 - - - - - - Exams, Award & Graduation - - - PKGX060200 - - - - - - Student Information & Records - - - PKGX070000 - - - - - - - - - - - - - - - Business Change - - - PKGX070100 - - - - - - Student Data & Management - - - PKGX070200 - - - - - - Student Records - - - PKGX070300 - - - - - - SAA - Faculty of Business & Law - - - PKGX080000 - - - - - - - - - - - - - - - - - - Recruitment & Admissions Team - - - PKGX080100 - - - - - - Student Administration Team - - - PKGX080200 - - - - - - Assessment & Quality Team - - - PKGX080300 - - - - - - Satellite Student & Admin Office - - - PKGX080400 - - - - - - SAA Fac of Engineering & the Environment - - - PKGX090000 - - - - - - - - - - - - - - - - - - Recruitment & Admissions Team - - - PKGX090100 - - - - - - Student Admin & Assessment Team - - - PKGX090200 - - - - - - Graduate School Team - - - PKGX090300 - - - - - - Curriculum & Quality Team - - - PKGX090400 - - - - - - SAA - Faculty of Health Sciences - - - PKGX100000 - - - - - - - - - - - - - - - Recruitment & Admissions Team - - - PKGX100100 - - - - - - Student Admin & Assessment Team - - - PKGX100200 - - - - - - Curriculum, Quality & Placements Team - - - PKGX100300 - - - - - - SAA - Faculty of Social & Human Sciences - - - PKGX110000 - - - - - - - - - - - - - - - - - - - - - - - - Recruitment & Admissions Team - - - PKGX110100 - - - - - - Student Administration Team - - - PKGX110200 - - - - - - Assessment Team - - - PKGX110300 - - - - - - Curriculum & Quality Team - - - PKGX110400 - - - - - - Professional Development - - - PKGX110500 - - - - - - Graduate School - - - PKGX110600 - - - - - - SAA - Faculty of Humanities - - - PKGX120000 - - - - - - - - - - - - - - - Recruitment & Admissions Team - - - PKGX120100 - - - - - - Student Administration & Assessment Team - - - PKGX120200 - - - - - - Curriculum & Quality Team - - - PKGX120300 - - - - - - SAA - Fac of Natural & Environmental Sci - - - PKGX130000 - - - - - - - - - - - - - - - - - - - - - Recruitment & Admissions Team - - - PKGX130100 - - - - - - Student Administration & Assessment Team - - - PKGX130200 - - - - - - Curriculum & Quality Team - - - PKGX130400 - - - - - - Doctoral Training Centre - - - PKGX130500 - - - - - - NOC - Campus Administration - - - PKGX130600 - - - - - - SAA - Fac of Physical & Applied Sciences - - - PKGX140000 - - - - - - - - - - - - - - - - - - Recruitment & Admissions Team - - - PKGX140100 - - - - - - Student Administration & Assessment Team - - - PKGX140200 - - - - - - Curriculum & Quality Team - - - PKGX140300 - - - - - - Doctoral Training Centre - - - PKGX140400 - - - - - - SAA - Faculty of Medicine - - - PKGX150000 - - - - - - - - - - - - - - - - - - - - - Recruitment & Admissions Team - - - PKGX150100 - - - - - - Student Administration - - - PKGX150200 - - - - - - Placements Timetabling Curriculum & Qual - - - PKGX150300 - - - - - - Graduate School - - - PKGX150400 - - - - - - Student Assessment - - - PKGX150500 - - - - - - Director's Office - - - PKGX160000 - - - - - - Service Delivery - - - PKJF110000 - - - - - - - - - - - - - - - - - - Service Desk - - - PKJF110100 - - - - - - Switchboard - - - PKJF110200 - - - - - - ServiceLine Response Team - - - PKJF110300 - - - - - - Coaching & Training - - - PKJF110400 - - - - - - Business Support - - - PKJF120000 - - - - - - - - - - - - - - - Logistics & Distribution / H&S - - - PKJF120100 - - - - - - Admin & Financial Management - - - PKJF120200 - - - - - - Print Centre - - - PKJF120300 - - - - - - E-Learning & Enablement - - - PKJF130000 - - - - - - - - - - - - - - - Managed Learning Environment - - - PKJF130100 - - - - - - E-Learning Enablement - - - PKJF130200 - - - - - - E-Learning Innovation & Production - - - PKJF130300 - - - - - - Research Support - - - PKJF140000 - - - - - - - - - - - - Technical Innovation - - - PKJF140100 - - - - - - HPC Support - - - PKJF140200 - - - - - - Account Management - - - PKJF150000 - - - - - - Service Management & Security - - - PKJF160000 - - - - - - Programme Management - - - PKJF170000 - - - - - - - - - - - - Business & System Analysis - - - PKJF170100 - - - - - - Project Management & Resourcing - - - PKJF170200 - - - - - - Development - - - PKJF180000 - - - - - - - - - - - - - - - Enterprise & Systems Development - - - PKJF180100 - - - - - - Web Systems Development - - - PKJF180200 - - - - - - COTS Systems Development - - - PKJF180300 - - - - - - Operations - - - PKJF190000 - - - - - - - - - - - - - - - Data Centre Operations - - - PKJF190100 - - - - - - Enterprise Systems & Desktop Operations - - - PKJF190200 - - - - - - Applications & Database Operations - - - PKJF190300 - - - - - - ICT Facilities - - - PKJF200000 - - - - - - Hartley Library - - - PKKX020000 - - - - - - Bibliographical Services - - - PKKX070000 - - - - - - Acquisitions - - - PKKX080000 - - - - - - Loans - - - PKKX090000 - - - - - - Digitisation Unit - - - PKKX200000 - - - - - - Librarian's Office - - - PKKX300000 - - - - - - Archives & Special Collections - - - PKKX400000 - - - - - - Faculty Liaison & Site Services - - - PKKX500000 - - - - - - Directorate - - - PKRR010000 - - - - - - Management Accounts - - - PKRR020000 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Company & Tax - - - PKRR020600 - - - - - - FFM Team - Business & Law - - - PKRR020700 - - - - - - FFM Team - Engineering - - - PKRR020800 - - - - - - FFM Team - Health Sciences - - - PKRR020900 - - - - - - FFM Team - Humanities - - - PKRR021000 - - - - - - FFM Team - Medicine - - - PKRR021100 - - - - - - FFM Team - Natural & Env Sciences - - - PKRR021200 - - - - - - FFM Team - Physical & App Science - - - PKRR021300 - - - - - - FFM Team - Social & Human Sciences - - - PKRR021400 - - - - - - PSFM Team - CFO - - - PKRR021500 - - - - - - PSFM Team - R & COO - - - PKRR021600 - - - - - - Procurement - - - PKRR030000 - - - - - - - - - - - - - - - Central Procurement - - - PKRR030100 - - - - - - Purchase to Pay - - - PKRR030200 - - - - - - Accounts Payable - - - PKRR030300 - - - - - - Financial Accounts - - - PKRR040000 - - - - - - - - - - - - - - - - - - - - - - - - Student Fees - - - PKRR040300 - - - - - - Payroll & Pensions - - - PKRR040500 - - - - - - Income & Credit Control - - - PKRR040700 - - - - - - Systems Team - - - PKRR040900 - - - - - - Insurance Services - - - PKRR041000 - - - - - - Financial Accounts & Treasury - - - PKRR041100 - - - - - - Planning & Systems - - - PKTD010000 - - - - - - - - - - - - - - - Office Management - - - PKTD010100 - - - - - - Planning - - - PKTD010200 - - - - - - IT & Systems - - - PKTD010300 - - - - - - Facilities - - - PKTD020000 - - - - - - - - - - - - - - - - - - Building Maintenance - - - PKTD020100 - - - - - - - - - - - - - - - - - - Hall & Satellite Campuses - - - PKTD020101 - - - - - - Repairs Service - - - PKTD020102 - - - - - - Locksmiths - - - PKTD020103 - - - - - - Winchester School of Art BM - - - PKTD020104 - - - - - - Helpdesk - - - PKTD020200 - - - - - - Campus Services - - - PKTD020300 - - - - - - - - - - - - - - - Post & Portering - - - PKTD020301 - - - - - - External Services - - - PKTD020302 - - - - - - Domestic Services - - - PKTD020303 - - - - - - Security - - - PKTD020400 - - - - - - Faculty Projects Team - - - PKTD030000 - - - - - - Engineering - - - PKTD040000 - - - - - - - - - - - - - - - - - - - - - M/E Design Team - - - PKTD040100 - - - - - - Electrical Engineering - - - PKTD040200 - - - - - - Utilities - - - PKTD040300 - - - - - - Controls Engineering - - - PKTD040400 - - - - - - Mechanical Engineering - - - PKTD040500 - - - - - - Directorate - - - PKTD050000 - - - - - - - - - Transport - - - PKTD050100 - - - - - - PMU Programme Management Unit - - - PKTD060000 - - - - - - Catering - - - PKTD070000 - - - - - - - - - - - - - - - Halls Catering - - - PKTD070100 - - - - - - Central Catering - - - PKTD070200 - - - - - - Conference & Hospitality - - - PKTD070300 - - - - - - RIS HUB - - - PKTW040000 - - - - - - - - - - - - - - - Legal / IP - - - PKTW040200 - - - - - - Specialist Support Hub - - - PKTW040300 - - - - - - Incubation - - - PKTW040400 - - - - - - RIS Faculty - - - PKTW050000 - - - - - - - - - - - - Research & Enterprise Development - - - PKTW050100 - - - - - - Research Support Team - - - PKTW050200 - - - - - - Projects - - - PKTW060000 - - - - - - - - - SETSquared - - - PKTW060100 - - - - - - English - - - PL - - - - - - Medical Education - - - RA - - - - - - - - - - - - - - - - - - History - - - RG - - - - - - - - - - - - Finance - - - RR - - - - - - - - - - - - - - - - - - - - - Engineering Development Trust - - - SF - - - - - - University Health Service - - - SH - - - - - - - - - Students Union - - - SU - - - - - - - - - - - - - - - Estates & Facilities - - - TD - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Southampton Management School - - - TR - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Research & Innovation Services - - - TW - - - - - - - - - - - - - - - - - - Faculty Operating Offices - - - TX - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Wessex Institute - - - VB - - - - - - - - - Foundation Year - - - VL - - - - - - Physics & Astronomy - - - WF - - - - - - - - - - - - - - - - - - - - - Biomedical Research Facility (BRF) - - - WN - - - - - - Geography & Environment - - - WR - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Statistical Sciences Research Institute - - - WT - - - - - - - - - - - - Central Unit - - - XX - - - - - - - - - - - - - - - - - - - - - - - - School Mathematics Project - - - ZA - - diff --git a/res/raw/ormlite_config.txt b/res/raw/ormlite_config.txt index 2268ae9..e69f199 100644 --- a/res/raw/ormlite_config.txt +++ b/res/raw/ormlite_config.txt @@ -1,3 +1,184 @@ # -# generated on 2012/02/19 09:50:39 +# generated on 2012/03/07 11:01:39 # +# --table-start-- +dataClass=net.cbaines.suma.Building +tableName=buildings +# --table-fields-start-- +# --field-start-- +fieldName=name +canBeNull=false +# --field-end-- +# --field-start-- +fieldName=residential +canBeNull=false +# --field-end-- +# --field-start-- +fieldName=outline +dataPersister=SERIALIZABLE +# --field-end-- +# --field-start-- +fieldName=point +dataPersister=SERIALIZABLE +canBeNull=false +# --field-end-- +# --field-start-- +fieldName=id +id=true +# --field-end-- +# --table-fields-end-- +# --table-end-- +################################# +# --table-start-- +dataClass=net.cbaines.suma.BusStop +tableName=busstops +# --table-fields-start-- +# --field-start-- +fieldName=description +# --field-end-- +# --field-start-- +fieldName=bay +# --field-end-- +# --field-start-- +fieldName=routes +canBeNull=false +# --field-end-- +# --field-start-- +fieldName=uniLink +canBeNull=false +# --field-end-- +# --field-start-- +fieldName=point +dataPersister=SERIALIZABLE +canBeNull=false +# --field-end-- +# --field-start-- +fieldName=id +id=true +# --field-end-- +# --table-fields-end-- +# --table-end-- +################################# +# --table-start-- +dataClass=net.cbaines.suma.BusRoute +tableName=busroutes +# --table-fields-start-- +# --field-start-- +fieldName=id +id=true +# --field-end-- +# --field-start-- +fieldName=code +# --field-end-- +# --field-start-- +fieldName=label +canBeNull=false +# --field-end-- +# --field-start-- +fieldName=forwardDirection +# --field-end-- +# --field-start-- +fieldName=reverseDirection +# --field-end-- +# --field-start-- +fieldName=uniLink +canBeNull=false +# --field-end-- +# --table-fields-end-- +# --table-end-- +################################# +# --table-start-- +dataClass=net.cbaines.suma.RouteStop +tableName=routestops +# --table-fields-start-- +# --field-start-- +fieldName=id +generatedId=true +# --field-end-- +# --field-start-- +fieldName=sequence +# --field-end-- +# --field-start-- +fieldName=busStop +columnName=stop_id +foreign=true +indexName=routestops_routestop_idx +# --field-end-- +# --field-start-- +fieldName=busRoute +columnName=route_id +foreign=true +indexName=routestops_routestop_idx +# --field-end-- +# --table-fields-end-- +# --table-end-- +################################# +# --table-start-- +dataClass=net.cbaines.suma.Site +tableName=sites +# --table-fields-start-- +# --field-start-- +fieldName=name +canBeNull=false +# --field-end-- +# --field-start-- +fieldName=outline +dataPersister=SERIALIZABLE +# --field-end-- +# --field-start-- +fieldName=point +dataPersister=SERIALIZABLE +canBeNull=false +# --field-end-- +# --field-start-- +fieldName=id +id=true +# --field-end-- +# --table-fields-end-- +# --table-end-- +################################# +# --table-start-- +dataClass=net.cbaines.suma.Bus +tableName=buses +# --table-fields-start-- +# --field-start-- +fieldName=gid +generatedId=true +# --field-end-- +# --field-start-- +fieldName=id +# --field-end-- +# --field-start-- +fieldName=route +canBeNull=false +foreign=true +# --field-end-- +# --field-start-- +fieldName=direction +# --field-end-- +# --field-start-- +fieldName=destination +foreign=true +# --field-end-- +# --field-start-- +fieldName=destinationString +# --field-end-- +# --table-fields-end-- +# --table-end-- +################################# +# --table-start-- +dataClass=net.cbaines.suma.POI +tableName=poi +# --table-fields-start-- +# --field-start-- +fieldName=point +dataPersister=SERIALIZABLE +canBeNull=false +# --field-end-- +# --field-start-- +fieldName=id +id=true +# --field-end-- +# --table-fields-end-- +# --table-end-- +################################# diff --git a/src/net/cbaines/suma/BusStop.java b/src/net/cbaines/suma/BusStop.java index 750f2d1..85f6d01 100644 --- a/src/net/cbaines/suma/BusStop.java +++ b/src/net/cbaines/suma/BusStop.java @@ -50,8 +50,7 @@ public class BusStop extends POI { String bay; /** - * Used to speed up accessing the relevent uni link routes for a bus stop, - * this is not a uni link stop + * Used to speed up accessing the relevent uni link routes for a bus stop, this is not a uni link stop */ @DatabaseField(canBeNull = false) byte routes; diff --git a/src/net/cbaines/suma/DatabaseConfigUtil.java b/src/net/cbaines/suma/DatabaseConfigUtil.java index 08a54b0..31cc934 100644 --- a/src/net/cbaines/suma/DatabaseConfigUtil.java +++ b/src/net/cbaines/suma/DatabaseConfigUtil.java @@ -22,7 +22,10 @@ package net.cbaines.suma; import com.j256.ormlite.android.apptools.OrmLiteConfigUtil; public class DatabaseConfigUtil extends OrmLiteConfigUtil { + private static final Class[] classes = new Class[] { Building.class, BusStop.class, BusRoute.class, RouteStop.class, + Site.class, Bus.class, POI.class }; + public static void main(String[] args) throws Exception { - writeConfigFile("ormlite_config.txt"); + writeConfigFile("ormlite_config.txt", classes); } } diff --git a/src/net/cbaines/suma/DatabaseHelper.java b/src/net/cbaines/suma/DatabaseHelper.java index 73f4c79..17ef720 100644 --- a/src/net/cbaines/suma/DatabaseHelper.java +++ b/src/net/cbaines/suma/DatabaseHelper.java @@ -55,7 +55,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { private Context context; public DatabaseHelper(Context context) { - super(context, DATABASE_NAME, null, DATABASE_VERSION); + super(context, DATABASE_NAME, null, DATABASE_VERSION, R.raw.ormlite_config); Log.i(TAG, "Database Helper created"); this.context = context; } @@ -89,8 +89,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { } /** - * Returns the Database Access Object (DAO) for our SimpleData class. It - * will create it or just give the cached value. + * Returns the Database Access Object (DAO) for our SimpleData class. It will create it or just give the cached value. */ public Dao getBuildingDao() throws SQLException { if (buildingDao == null) { @@ -100,8 +99,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { } /** - * Returns the Database Access Object (DAO) for our SimpleData class. It - * will create it or just give the cached value. + * Returns the Database Access Object (DAO) for our SimpleData class. It will create it or just give the cached value. */ public Dao getBusStopDao() throws SQLException { if (busStopDao == null) { @@ -111,8 +109,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { } /** - * Returns the Database Access Object (DAO) for our SimpleData class. It - * will create it or just give the cached value. + * Returns the Database Access Object (DAO) for our SimpleData class. It will create it or just give the cached value. */ public Dao getBusRouteDao() throws SQLException { if (busRouteDao == null) { @@ -122,8 +119,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { } /** - * Returns the Database Access Object (DAO) for our SimpleData class. It - * will create it or just give the cached value. + * Returns the Database Access Object (DAO) for our SimpleData class. It will create it or just give the cached value. */ public Dao getRouteStopsDao() throws SQLException { if (routeStopsDao == null) { @@ -133,8 +129,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { } /** - * Returns the Database Access Object (DAO) for our SimpleData class. It - * will create it or just give the cached value. + * Returns the Database Access Object (DAO) for our SimpleData class. It will create it or just give the cached value. */ public Dao getSiteDao() throws SQLException { if (siteDao == null) { @@ -144,8 +139,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { } /** - * Returns the Database Access Object (DAO) for our SimpleData class. It - * will create it or just give the cached value. + * Returns the Database Access Object (DAO) for our SimpleData class. It will create it or just give the cached value. */ public Dao getBusDao() throws SQLException { if (busDao == null) { @@ -155,8 +149,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { } /** - * Check if the database already exist to avoid re-copying the file each - * time you open the application. + * Check if the database already exist to avoid re-copying the file each time you open the application. * * @return true if it exists, false if it doesn't */ @@ -166,8 +159,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { /* * SQLiteDatabase checkDB = null; * - * try { String myPath = DATABASE_PATH + DATABASE_NAME; checkDB = - * SQLiteDatabase.openDatabase(myPath, null, + * try { String myPath = DATABASE_PATH + DATABASE_NAME; checkDB = SQLiteDatabase.openDatabase(myPath, null, * SQLiteDatabase.OPEN_READONLY); } catch (SQLiteException e) { * * // database does't exist yet. @@ -180,8 +172,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { * * } * - * Log.i(TAG, "Finished checking database"); return checkDB != null ? - * true : false; + * Log.i(TAG, "Finished checking database"); return checkDB != null ? true : false; */ File dbFile = new File(DATABASE_PATH + DATABASE_NAME); @@ -189,9 +180,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { } /** - * Copies your database from your local assets-folder to the just created - * empty database in the system folder, from where it can be accessed and - * handled. This is done by transfering bytestream. + * Copies your database from your local assets-folder to the just created empty database in the system folder, from where it + * can be accessed and handled. This is done by transfering bytestream. * */ public void copyDataBase() throws IOException { Log.i(TAG, "Begining copy database"); @@ -228,8 +218,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { } /** - * Creates a empty database on the system and rewrites it with your own - * database. + * Creates a empty database on the system and rewrites it with your own database. * */ public void createDataBase() throws IOException { diff --git a/src/net/cbaines/suma/POI.java b/src/net/cbaines/suma/POI.java index 485845c..c84f90e 100644 --- a/src/net/cbaines/suma/POI.java +++ b/src/net/cbaines/suma/POI.java @@ -25,54 +25,54 @@ import com.j256.ormlite.field.DataType; import com.j256.ormlite.field.DatabaseField; public abstract class POI { - public static final String BUS_STOP = "busstop"; - public static final String BUILDING = "building"; - public static final String WAYPOINT = "waypoint"; - public static final String SITE = "site"; + public static final String BUS_STOP = "busstop"; + public static final String BUILDING = "building"; + public static final String WAYPOINT = "waypoint"; + public static final String SITE = "site"; - public static final String ID_FIELD_NAME = "id"; - public static final String POINT_FIELD_NAME = "point"; + public static final String ID_FIELD_NAME = "id"; + public static final String POINT_FIELD_NAME = "point"; - POI() { - } + POI() { + } - public POI(String id, GeoPoint point) { - this.id = id; - this.point = point; - } + public POI(String id, GeoPoint point) { + this.id = id; + this.point = point; + } - @DatabaseField(dataType = DataType.SERIALIZABLE, canBeNull = false) - public GeoPoint point; + @DatabaseField(dataType = DataType.SERIALIZABLE, canBeNull = false) + public GeoPoint point; - @DatabaseField(id = true) - public String id; + @DatabaseField(id = true) + public String id; - public int distTo = -1; // Used by the comparator to store distances, then later by the gui to display them. + public int distTo = -1; // Used by the comparator to store distances, then later by the gui to display them. - public String type; + public String type; - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((id == null) ? 0 : id.hashCode()); - return result; - } + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + return result; + } - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - POI other = (POI) obj; - if (id == null) { - if (other.id != null) - return false; - } else if (!id.equals(other.id)) - return false; - return true; - } + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + POI other = (POI) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + return true; + } } -- cgit v1.2.3 From 26f11938b2467d6033ade06af57dc678dc3401cd Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 7 Mar 2012 23:18:50 +0000 Subject: Bump version to 0.7. --- AndroidManifest.xml | 4 ++-- res/values/strings.xml | 2 +- src/net/cbaines/suma/MapActivity.java | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index c322b63..fa7f1c1 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="11" + android:versionName="0.8 (alpha)" > About Version - 0.6.5 (alpha) + 0.7 (alpha) Copyright © 2012, Christopher Baines License diff --git a/src/net/cbaines/suma/MapActivity.java b/src/net/cbaines/suma/MapActivity.java index 10df45e..6eab356 100644 --- a/src/net/cbaines/suma/MapActivity.java +++ b/src/net/cbaines/suma/MapActivity.java @@ -173,7 +173,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants private MapActivity instance; - private static final String TAG = "SUM"; + private static final String TAG = "MapActivity"; @SuppressWarnings("unchecked") public void onCreate(Bundle savedInstanceState) { @@ -476,7 +476,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants Log.i(TAG, "Begining to show the route overlays at " + (System.currentTimeMillis() - startTime)); for (BusRoute busRoute : getHelper().getBusRouteDao()) { if (!busRoute.uniLink) { - Log.v(TAG, "Bus route " + busRoute.code + "(" + busRoute.id + ") is not unilink"); + // Log.v(TAG, "Bus route " + busRoute.code + "(" + busRoute.id + ") is not unilink"); continue; } Log.v(TAG, "Looking at showing " + busRoute.code + " route overlay"); @@ -489,7 +489,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants Log.i(TAG, "Begining to show the site overlays at " + (System.currentTimeMillis() - startTime)); try { for (Site site : getHelper().getSiteDao()) { - Log.v(TAG, "Looking at showing " + site.name + " site overlay"); + // Log.v(TAG, "Looking at showing " + site.name + " site overlay"); if (activityPrefs.getBoolean(SITE_OVERLAYS + site.name, SITE_OVERLAYS_ENABLED_BY_DEFAULT)) { showSiteOverlay(site); } -- cgit v1.2.3