aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <cbaines8@gmail.com>2012-03-14 01:00:56 +0000
committerChristopher Baines <cbaines8@gmail.com>2012-03-14 01:00:56 +0000
commit19e189ef9ed67f382fea00e48f997ce8e979f030 (patch)
tree1ccd78f3152c19de6c7f14861b1a7d2d7ae92efa
parent16721bd07d3dd892631d82024a259997cd152ba4 (diff)
downloadsouthamptonuniversitymap-19e189ef9ed67f382fea00e48f997ce8e979f030.tar
southamptonuniversitymap-19e189ef9ed67f382fea00e48f997ce8e979f030.tar.gz
Update for beta release.
-rw-r--r--assets/data.dbbin490496 -> 487424 bytes
-rw-r--r--assets/sites.csv12
-rw-r--r--gen/net/cbaines/suma/R.java314
-rw-r--r--res/layout/about_dialog.xml33
-rw-r--r--res/values/strings.xml16
-rw-r--r--res/xml/searchable.xml3
-rw-r--r--src/net/cbaines/suma/Building.java2
-rw-r--r--src/net/cbaines/suma/BusStop.java2
-rw-r--r--src/net/cbaines/suma/DataManager.java5
-rw-r--r--src/net/cbaines/suma/FavouritesDialog.java11
-rw-r--r--src/net/cbaines/suma/MapActivity.java249
-rw-r--r--src/net/cbaines/suma/MapContentProvider.java141
-rw-r--r--src/net/cbaines/suma/Preferences.java6
-rw-r--r--src/net/cbaines/suma/SearchResultsDialog.java10
-rw-r--r--src/net/cbaines/suma/StringPOIDistanceComparator.java (renamed from src/net/cbaines/suma/StringDistanceComparator.java)8
-rw-r--r--src/net/cbaines/suma/WelcomeDialog.java2
16 files changed, 392 insertions, 422 deletions
diff --git a/assets/data.db b/assets/data.db
index 856725d..e8cba4c 100644
--- a/assets/data.db
+++ b/assets/data.db
Binary files differ
diff --git a/assets/sites.csv b/assets/sites.csv
index 878b401..b8caf73 100644
--- a/assets/sites.csv
+++ b/assets/sites.csv
@@ -1,14 +1,14 @@
Id,Name,Long,Lat,Polygon,source
-1,Highfield Campus,,,"-1.3990823 50.9377130,-1.4006918 50.9342877,-1.3979531 50.9330237,-1.3961531 50.9328590,-1.3956357 50.9329379,-1.3954335 50.9331140,-1.3950459 50.9331990,-1.3951385 50.9333849,-1.3946835 50.9334752,-1.3944391 50.9334114,-1.3944644 50.9331512,-1.3939419 50.9330131,-1.3938408 50.9334699,-1.3928043 50.9349887,-1.3925852 50.9349356,-1.3924841 50.9351109,-1.3927200 50.9351640,-1.3923620 50.9357142,-1.3944239 50.9363169,-1.3945234 50.9365712,-1.3951385 50.9371501,-1.3938914 50.9370279,-1.3939167 50.9369164,-1.3936133 50.9368793,-1.3934026 50.9378988,-1.3935543 50.9379095,-1.3936049 50.9381643,-1.3990823 50.9377130",http://os.openstreetmap.org/
+1,Highfield Campus,-1.39577,50.93551,"-1.3990823 50.9377130,-1.4006918 50.9342877,-1.3979531 50.9330237,-1.3961531 50.9328590,-1.3956357 50.9329379,-1.3954335 50.9331140,-1.3950459 50.9331990,-1.3951385 50.9333849,-1.3946835 50.9334752,-1.3944391 50.9334114,-1.3944644 50.9331512,-1.3939419 50.9330131,-1.3938408 50.9334699,-1.3928043 50.9349887,-1.3925852 50.9349356,-1.3924841 50.9351109,-1.3927200 50.9351640,-1.3923620 50.9357142,-1.3944239 50.9363169,-1.3945234 50.9365712,-1.3951385 50.9371501,-1.3938914 50.9370279,-1.3939167 50.9369164,-1.3936133 50.9368793,-1.3934026 50.9378988,-1.3935543 50.9379095,-1.3936049 50.9381643,-1.3990823 50.9377130",http://os.openstreetmap.org/
2,Boldrewood Campus,-1.4046552,50.9372223,"-1.4034619 50.9368059,-1.4062591 50.9360660,-1.4064260 50.9376872,-1.4054058 50.9377964,-1.4046488 50.9379783,-1.4041933 50.9379096,-1.4038789 50.9380430,-1.4039815 50.9381360,-1.4037634 50.9382573,-1.4035709 50.9381360,-1.4031090 50.9381320,-1.4030577 50.9374204,-1.4033207 50.9373557,-1.4035389 50.9370363,-1.4034619 50.9368059",http://os.openstreetmap.org/
3,Avenue Campus,-1.402511,50.928699,"-1.4033313 50.9296693,-1.4011463 50.9289554,-1.4021913 50.9277164,-1.4041790 50.9282737,-1.4033313 50.9296693",http://os.openstreetmap.org/
4,Winchester School of Art,-1.30954,51.065765,"-1.3104990 51.0653919,-1.3091437 51.0651497,-1.3090241 51.0653251,-1.3086520 51.0651497,-1.3080940 51.0654169,-1.3093961 51.0663689,-1.3104193 51.0665693,-1.3111235 51.0658595,-1.3103661 51.0657009,-1.3104990 51.0653919",http://os.openstreetmap.org/
5,The University of Southampton Science Park,-1.424618,50.962158,"-1.4200515 50.9655440,-1.4196262 50.9651958,-1.4211360 50.9642985,-1.4215825 50.9638565,-1.4214762 50.9629458,-1.4219441 50.9621556,-1.4223056 50.9607761,-1.4223268 50.9596912,-1.4257080 50.9601733,-1.4286638 50.9603609,-1.4336611 50.9602537,-1.4339588 50.9608296,-1.4332145 50.9610573,-1.4335547 50.9618208,-1.4317047 50.9619547,-1.4303863 50.9628655,-1.4290466 50.9619011,-1.4270477 50.9623699,-1.4290591 50.9643976,-1.4275013 50.9649480,-1.4248037 50.9641822,-1.4237090 50.9641512,-1.4225182 50.9647539,-1.4219015 50.9654101,-1.4211785 50.9656913,-1.4200515 50.9655440",http://os.openstreetmap.org/
6,National Oceanography Centre Campus,-1.3946555,50.8927263,"-1.3963013 50.8937513,-1.3942781 50.8935386,-1.3933204 50.8934195,-1.3924032 50.8927474,-1.3922278 50.8921944,-1.3935902 50.8912840,-1.3963553 50.8925687,-1.3961530 50.8927134,-1.3967330 50.8930197,-1.3963013 50.8937513",http://os.openstreetmap.org/
-8,Boat House,,,"-1.3800720 50.9347696,-1.3797898 50.9344413,-1.3800286 50.9343866,-1.3802818 50.9341313,-1.3801805 50.9339352,-1.3799562 50.9337528,-1.3802022 50.9334929,-1.3810849 50.9337164,-1.3805061 50.9346875,-1.3800720 50.9347696",http://os.openstreetmap.org/
-18,Southampton General Hospital,,,"-1.4392547 50.9337565,-1.4392547 50.9332940,-1.4381754 50.9326954,-1.4384560 50.9325321,-1.4345488 50.9302464,-1.4317425 50.9323824,-1.4315698 50.9337429,-1.4339012 50.9348312,-1.4341602 50.9355931,-1.4348510 50.9361236,-1.4365564 50.9353482,-1.4357361 50.9342871,-1.4392547 50.9337565",http://os.openstreetmap.org/
-20,Royal South Hants Hospital,,,"-1.3980658 50.9135097,-1.3952237 50.9132480,-1.3955633 50.9117098,-1.3990719 50.9116384,-1.3990467 50.9126851,-1.3983677 50.9127168,-1.3980658 50.9135097",http://os.openstreetmap.org/
-39,Recreation Facilities at Wide Lane,,,"-1.3664622 50.9482380,-1.3647258 50.9494535,-1.3650860 50.9505474,-1.3647001 50.9509444,-1.3632810 50.9513658,-1.3626464 50.9517979,-1.3602112 50.9547041,-1.3641899 50.9548553,-1.3689403 50.9544880,-1.3680314 50.9529215,-1.3682886 50.9492590,-1.3664622 50.9482380",http://os.openstreetmap.org/
+8,Boat House,-1.380151,50.934092,"-1.3800720 50.9347696,-1.3797898 50.9344413,-1.3800286 50.9343866,-1.3802818 50.9341313,-1.3801805 50.9339352,-1.3799562 50.9337528,-1.3802022 50.9334929,-1.3810849 50.9337164,-1.3805061 50.9346875,-1.3800720 50.9347696",http://os.openstreetmap.org/
+18,Southampton General Hospital,-1.434632,50.932953,"-1.4392547 50.9337565,-1.4392547 50.9332940,-1.4381754 50.9326954,-1.4384560 50.9325321,-1.4345488 50.9302464,-1.4317425 50.9323824,-1.4315698 50.9337429,-1.4339012 50.9348312,-1.4341602 50.9355931,-1.4348510 50.9361236,-1.4365564 50.9353482,-1.4357361 50.9342871,-1.4392547 50.9337565",http://os.openstreetmap.org/
+20,Royal South Hants Hospital,-1.396995,50.912413,"-1.3980658 50.9135097,-1.3952237 50.9132480,-1.3955633 50.9117098,-1.3990719 50.9116384,-1.3990467 50.9126851,-1.3983677 50.9127168,-1.3980658 50.9135097",http://os.openstreetmap.org/
+39,Recreation Facilities at Wide Lane,-1.364209,50.952315,"-1.3664622 50.9482380,-1.3647258 50.9494535,-1.3650860 50.9505474,-1.3647001 50.9509444,-1.3632810 50.9513658,-1.3626464 50.9517979,-1.3602112 50.9547041,-1.3641899 50.9548553,-1.3689403 50.9544880,-1.3680314 50.9529215,-1.3682886 50.9492590,-1.3664622 50.9482380",http://os.openstreetmap.org/
45,Belgrave Industrial Site,-1.3840253,50.9309864,"-1.3841191 50.9303904,-1.3845444 50.9304838,-1.3839286 50.9315982,-1.3835033 50.9315048,-1.3841191 50.9303904"
56,Highfield Hall,-1.402286,50.930084,"-1.4030286 50.9305226,-1.4014071 50.9299818,-1.4017779 50.9296106,-1.4032176 50.9301239,-1.4030286 50.9305226",http://os.openstreetmap.org/
57,Glen Eyre Hall,-1.401615,50.943504,"-1.4016517 50.9418655,-1.4013481 50.9423883,-1.4011390 50.9423458,-1.3990076 50.9432298,-1.3990615 50.9439693,-1.3995269 50.9439608,-1.3999721 50.9440756,-1.4009299 50.9442286,-1.4017056 50.9443178,-1.4023532 50.9443476,-1.4026162 50.9443433,-1.4030614 50.9442243,-1.4035470 50.9439311,-1.4034863 50.9430811,-1.4033919 50.9428303,-1.4031626 50.9425668,-1.4027106 50.9422481,-1.4016517 50.9418655",http://os.openstreetmap.org/
@@ -19,4 +19,4 @@ Id,Name,Long,Lat,Polygon,source
63,Connaught Hall,-1.374632,50.937965,"-1.3756787 50.9387817,-1.3757050 50.9376211,-1.3754814 50.9374885,-1.3750604 50.9370408,-1.3738765 50.9373973,-1.3743632 50.9387983,-1.3756787 50.9387817",http://os.openstreetmap.org/
64,Montefiore Hall,-1.377164,50.938297,"-1.3789171 50.9373740,-1.3786071 50.9367713,-1.3783302 50.9367713,-1.3781653 50.9369750,-1.3778355 50.9371869,-1.3772750 50.9373490,-1.3760088 50.9376358,-1.3759626 50.9395765,-1.3768859 50.9396638,-1.3766683 50.9402373,-1.3770376 50.9403287,-1.3779213 50.9390778,-1.3789171 50.9373740",http://os.openstreetmap.org/
65,Stoneham Hall,-1.3765588,50.9369483,"-1.3780071 50.9367009,-1.3776782 50.9369745,-1.3771652 50.9371569,-1.3759155 50.9374636,-1.3755866 50.9372564,-1.3754551 50.9369414,-1.3775730 50.9363445,-1.3780071 50.9367009",http://os.openstreetmap.org/
-70,Erasmus Park,-1.3000948,51.0687982,"-1.3005228 51.0677314,-1.3005750 51.0683404,-1.3004482 51.0688089,-1.2999040 51.0697038,-1.2994641 51.0696101,-1.2999561 51.0686450,-1.3000605 51.0683311,-1.3000531 51.0680125,-1.3005228 51.0677314" \ No newline at end of file
+70,Erasmus Park,-1.3000948,51.0687982,"-1.3005228 51.0677314,-1.3005750 51.0683404,-1.3004482 51.0688089,-1.2999040 51.0697038,-1.2994641 51.0696101,-1.2999561 51.0686450,-1.3000605 51.0683311,-1.3000531 51.0680125,-1.3005228 51.0677314"
diff --git a/gen/net/cbaines/suma/R.java b/gen/net/cbaines/suma/R.java
index 9babefb..71f1c96 100644
--- a/gen/net/cbaines/suma/R.java
+++ b/gen/net/cbaines/suma/R.java
@@ -54,93 +54,88 @@ 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 buildingActivityMessage=0x7f0a0009;
- public static final int buildingActivityName=0x7f0a0004;
- public static final int busActivityBusDestination=0x7f0a000c;
- public static final int busActivityBusID=0x7f0a000b;
- public static final int busActivityContentLayout=0x7f0a000d;
- public static final int busActivityHeaderLayout=0x7f0a000a;
- public static final int busActivityMessage=0x7f0a000e;
- public static final int busActivityTimes=0x7f0a000f;
- public static final int busRouteActivityCode=0x7f0a0010;
- public static final int busRouteActivityHeaderLayout=0x7f0a0011;
- public static final int busRouteActivityID=0x7f0a0013;
- public static final int busRouteActivityLabel=0x7f0a0012;
- public static final int busRouteBusStops=0x7f0a0014;
- public static final int busSpecificStopViewName=0x7f0a0015;
- public static final int busSpecificStopViewProgressBar=0x7f0a0017;
- 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=0x7f0a0036;
- public static final int childname=0x7f0a0035;
- public static final int donateBitcoinAddress=0x7f0a002e;
- public static final int donateButton=0x7f0a0003;
- 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=0x7f0a0030;
- public static final int favouriteListItems=0x7f0a0031;
- public static final int helpExpandableListView=0x7f0a0002;
- public static final int layout_root=0x7f0a0027;
- public static final int linearLayout1=0x7f0a001a;
- public static final int linearLayout2=0x7f0a0029;
- public static final int mapview=0x7f0a002f;
- 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 textView1=0x7f0a0000;
- public static final int textView2=0x7f0a0001;
- public static final int textView3=0x7f0a0039;
- public static final int textView4=0x7f0a003a;
- 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 welcomeDialogButton=0x7f0a0038;
- public static final int welcomeDialogMessage=0x7f0a003b;
+ public static final int buildingActivityContentLayout=0x7f0a0003;
+ public static final int buildingActivityFavouriteCheckBox=0x7f0a0001;
+ public static final int buildingActivityImage=0x7f0a0002;
+ public static final int buildingActivityLoadBar=0x7f0a0004;
+ public static final int buildingActivityMessage=0x7f0a0005;
+ public static final int buildingActivityName=0x7f0a0000;
+ public static final int busActivityBusDestination=0x7f0a0008;
+ public static final int busActivityBusID=0x7f0a0007;
+ public static final int busActivityContentLayout=0x7f0a0009;
+ public static final int busActivityHeaderLayout=0x7f0a0006;
+ public static final int busActivityMessage=0x7f0a000a;
+ public static final int busActivityTimes=0x7f0a000b;
+ public static final int busRouteActivityCode=0x7f0a000c;
+ public static final int busRouteActivityHeaderLayout=0x7f0a000d;
+ public static final int busRouteActivityID=0x7f0a000f;
+ public static final int busRouteActivityLabel=0x7f0a000e;
+ public static final int busRouteBusStops=0x7f0a0010;
+ public static final int busSpecificStopViewName=0x7f0a0011;
+ public static final int busSpecificStopViewProgressBar=0x7f0a0013;
+ public static final int busSpecificStopViewRightContainer=0x7f0a0012;
+ public static final int busSpecificStopViewTime=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=0x7f0a0032;
+ public static final int childname=0x7f0a0031;
+ public static final int donateBitcoinAddress=0x7f0a002a;
+ 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=0x7f0a002c;
+ public static final int favouriteListItems=0x7f0a002d;
+ public static final int layout_root=0x7f0a0023;
+ public static final int linearLayout1=0x7f0a0016;
+ public static final int linearLayout2=0x7f0a0025;
+ public static final int mapview=0x7f0a002b;
+ 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 textView3=0x7f0a0035;
+ public static final int textView4=0x7f0a0036;
+ public static final int toastViewLinearLayout=0x7f0a002e;
+ public static final int toastViewSubMessage=0x7f0a0030;
+ public static final int toastViewText=0x7f0a002f;
+ public static final int view_list=0x7f0a0033;
+ public static final int welcomeDialogButton=0x7f0a0034;
+ public static final int welcomeDialogMessage=0x7f0a0037;
}
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_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 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 welcome_dialog=0x7f03000e;
+ public static final int building_activity=0x7f030000;
+ public static final int bus_activity=0x7f030001;
+ public static final int bus_route_activity=0x7f030002;
+ public static final int bus_specific_stop_view=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 map_activity=0x7f030007;
+ public static final int poi_dialog=0x7f030008;
+ public static final int toast_view=0x7f030009;
+ public static final int view_child_row=0x7f03000a;
+ public static final int view_dialog=0x7f03000b;
+ public static final int view_group_row=0x7f03000c;
+ public static final int welcome_dialog=0x7f03000d;
}
public static final class menu {
public static final int bus_menu=0x7f090000;
@@ -166,108 +161,97 @@ public final class R {
public static final int U9=0x7f070005;
/** About Strings
*/
- public static final int about=0x7f07003b;
- public static final int about_android_market=0x7f070048;
- public static final int about_android_market_summary=0x7f070049;
- public static final int about_copyright=0x7f07003e;
- public static final int about_copyright_summary=0x7f07003f;
- public static final int about_data=0x7f070046;
- public static final int about_data_summary=0x7f070047;
- public static final int about_database=0x7f070052;
- public static final int about_database_summary=0x7f070053;
- public static final int about_developer=0x7f070044;
- public static final int about_developer_summary=0x7f070045;
- public static final int about_donate=0x7f070054;
- public static final int about_donate_summary=0x7f070055;
- public static final int about_help_message=0x7f070019;
- public static final int about_license=0x7f070040;
- public static final int about_license_summary=0x7f070041;
- public static final int about_map_data=0x7f07004a;
- public static final int about_map_data_summary=0x7f07004b;
- public static final int about_map_icons=0x7f07004c;
- public static final int about_map_icons_summary=0x7f07004d;
- public static final int about_map_tiles=0x7f070050;
- public static final int about_map_tiles_summary=0x7f070051;
- /** About Messages
- */
- public static final int about_menu_instruction_text=0x7f070033;
- public static final int about_osm_map=0x7f07004e;
- public static final int about_osm_map_summary=0x7f07004f;
- public static final int about_project=0x7f070042;
- public static final int about_project_summary=0x7f070043;
- public static final int about_version=0x7f07003c;
- public static final int about_version_summary=0x7f07003d;
+ public static final int about=0x7f070032;
+ public static final int about_android_market=0x7f07003f;
+ public static final int about_android_market_summary=0x7f070040;
+ public static final int about_copyright=0x7f070035;
+ public static final int about_copyright_summary=0x7f070036;
+ public static final int about_data=0x7f07003d;
+ public static final int about_data_summary=0x7f07003e;
+ public static final int about_database=0x7f070049;
+ public static final int about_database_summary=0x7f07004a;
+ public static final int about_developer=0x7f07003b;
+ public static final int about_developer_summary=0x7f07003c;
+ public static final int about_donate=0x7f07004b;
+ public static final int about_donate_summary=0x7f07004c;
+ public static final int about_license=0x7f070037;
+ public static final int about_license_summary=0x7f070038;
+ public static final int about_map_data=0x7f070041;
+ public static final int about_map_data_summary=0x7f070042;
+ public static final int about_map_icons=0x7f070043;
+ public static final int about_map_icons_summary=0x7f070044;
+ public static final int about_map_tiles=0x7f070047;
+ public static final int about_map_tiles_summary=0x7f070048;
+ public static final int about_osm_map=0x7f070045;
+ public static final int about_osm_map_summary=0x7f070046;
+ public static final int about_project=0x7f070039;
+ public static final int about_project_summary=0x7f07003a;
+ public static final int about_version=0x7f070033;
+ public static final int about_version_summary=0x7f070034;
public static final int app_name=0x7f070000;
- public static final int bitcoin_error_message=0x7f07001d;
- public static final int buildingImageDescription=0x7f070056;
+ public static final int bitcoin_error_message=0x7f070015;
+ public static final int buildingImageDescription=0x7f07004d;
/** Bus Activity
*/
- public static final int bus_activity_destination_label=0x7f07005c;
- public static final int bus_activity_no_destination_message=0x7f07005d;
+ public static final int bus_activity_destination_label=0x7f070053;
+ public static final int bus_activity_no_destination_message=0x7f070054;
/** Bus Stop Specific Stop View Strings
*/
- public static final int bus_stop_stop_view_on_click_toast_help_message=0x7f070058;
- public static final int bus_stop_stop_view_on_click_toast_unidentified_message=0x7f070059;
+ public static final int bus_stop_stop_view_on_click_toast_help_message=0x7f07004f;
+ public static final int bus_stop_stop_view_on_click_toast_unidentified_message=0x7f070050;
/** Bus Specific Stop View Strings
*/
- public static final int bus_stop_view_on_click_toast_help_message=0x7f07005a;
- public static final int bus_stop_view_on_click_toast_unidentified_message=0x7f07005b;
- public static final int bustimes_favourite_checkbox_label=0x7f070034;
- public static final int credits_help_message=0x7f07001b;
- public static final int donate_button=0x7f07001c;
- public static final int donate_dialog_error_title=0x7f070036;
- public static final int donate_dialog_message=0x7f070035;
- public static final int favourites_dialog_message=0x7f07001f;
- /** Favourites Dialog
+ public static final int bus_stop_view_on_click_toast_help_message=0x7f070051;
+ public static final int bus_stop_view_on_click_toast_unidentified_message=0x7f070052;
+ /** About Messages
*/
- public static final int favourites_dialog_title=0x7f07005e;
- public static final int favourites_help_message=0x7f07001a;
- public static final int find_help_message=0x7f070015;
- public static final int findmylocation_help_message=0x7f070017;
- public static final int map_activity_toast_help_message=0x7f070057;
- /** Help Messages
+ public static final int bustimes_favourite_checkbox_label=0x7f07002b;
+ public static final int donate_button=0x7f070014;
+ public static final int donate_dialog_error_title=0x7f07002d;
+ public static final int donate_dialog_message=0x7f07002c;
+ public static final int favourites_dialog_message=0x7f070017;
+ /** Favourites Dialog
*/
- public static final int map_help_message=0x7f070014;
+ public static final int favourites_dialog_title=0x7f070055;
+ public static final int map_activity_toast_help_message=0x7f07004e;
public static final int menu_about=0x7f07000b;
public static final int menu_favourites=0x7f07000c;
/** Map Activity
*/
public static final int menu_find=0x7f070006;
public static final int menu_find_my_location=0x7f070009;
- public static final int menu_next_stop=0x7f070038;
+ public static final int menu_next_stop=0x7f07002f;
public static final int menu_preferences=0x7f070007;
- public static final int menu_previous_stop=0x7f070037;
- public static final int menu_refresh_stop=0x7f070039;
- public static final int menu_refresh_stops=0x7f07003a;
+ public static final int menu_previous_stop=0x7f07002e;
+ public static final int menu_refresh_stop=0x7f070030;
+ public static final int menu_refresh_stops=0x7f070031;
public static final int menu_view=0x7f070008;
public static final int pref_bus_stop=0x7f07000a;
- public static final int preferences=0x7f07001e;
+ public static final int preferences=0x7f070016;
/** Preferences Messages
*/
- public static final int preferences_catagory_appearance=0x7f070020;
- public static final int preferences_catagory_data=0x7f07002f;
- public static final int preferences_catagory_live_bus_times=0x7f070028;
- public static final int preferences_catagory_positioning=0x7f070024;
- public static final int preferences_gps=0x7f070025;
- public static final int preferences_gps_disabled=0x7f070027;
- public static final int preferences_gps_enabled=0x7f070026;
- public static final int preferences_help_message=0x7f070016;
- public static final int preferences_non_uni_link=0x7f070030;
- public static final int preferences_non_uni_link_disabled=0x7f070032;
- public static final int preferences_non_uni_link_enabled=0x7f070031;
- public static final int preferences_non_uni_link_live_bus_times=0x7f07002c;
- public static final int preferences_non_uni_link_live_bus_times_disabled=0x7f07002e;
- public static final int preferences_non_uni_link_live_bus_times_enabled=0x7f07002d;
- public static final int preferences_show_identifiers=0x7f070021;
- public static final int preferences_show_identifiers_disabled=0x7f070023;
- public static final int preferences_show_identifiers_enabled=0x7f070022;
- public static final int preferences_uni_link_live_bus_times=0x7f070029;
- public static final int preferences_uni_link_live_bus_times_disabled=0x7f07002b;
- public static final int preferences_uni_link_live_bus_times_enabled=0x7f07002a;
+ public static final int preferences_catagory_appearance=0x7f070018;
+ public static final int preferences_catagory_data=0x7f070027;
+ public static final int preferences_catagory_live_bus_times=0x7f070020;
+ public static final int preferences_catagory_positioning=0x7f07001c;
+ public static final int preferences_gps=0x7f07001d;
+ public static final int preferences_gps_disabled=0x7f07001f;
+ public static final int preferences_gps_enabled=0x7f07001e;
+ public static final int preferences_non_uni_link=0x7f070028;
+ public static final int preferences_non_uni_link_disabled=0x7f07002a;
+ public static final int preferences_non_uni_link_enabled=0x7f070029;
+ public static final int preferences_non_uni_link_live_bus_times=0x7f070024;
+ public static final int preferences_non_uni_link_live_bus_times_disabled=0x7f070026;
+ public static final int preferences_non_uni_link_live_bus_times_enabled=0x7f070025;
+ public static final int preferences_show_identifiers=0x7f070019;
+ public static final int preferences_show_identifiers_disabled=0x7f07001b;
+ public static final int preferences_show_identifiers_enabled=0x7f07001a;
+ public static final int preferences_uni_link_live_bus_times=0x7f070021;
+ public static final int preferences_uni_link_live_bus_times_disabled=0x7f070023;
+ public static final int preferences_uni_link_live_bus_times_enabled=0x7f070022;
public static final int search_results_dialog_title=0x7f07000e;
public static final int search_settings_description=0x7f07000d;
- public static final int view_help_message=0x7f070018;
- public static final int welcome_dialog_button_text=0x7f07005f;
+ public static final int welcome_dialog_button_text=0x7f070056;
public static final int welcome_dialog_copyright=0x7f070011;
public static final int welcome_dialog_install_message=0x7f070013;
/** Welcome Dialog
diff --git a/res/layout/about_dialog.xml b/res/layout/about_dialog.xml
deleted file mode 100644
index 03a68ad..0000000
--- a/res/layout/about_dialog.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical" >
-
- <TextView
- android:id="@+id/textView1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/app_name"
- android:textAppearance="?android:attr/textAppearanceLarge" />
-
- <TextView
- android:id="@+id/textView2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/about_menu_instruction_text" />
-
- <ExpandableListView
- android:id="@+id/helpExpandableListView"
- android:layout_width="fill_parent"
- android:layout_height="0dip"
- android:layout_weight="0.05" >
- </ExpandableListView>
-
- <Button
- android:id="@+id/donateButton"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/donate_button" />
-
-</LinearLayout> \ No newline at end of file
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6f6cecc..208f4eb 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -19,13 +19,13 @@
<string name="menu_about">About</string>
<string name="menu_favourites">Favourites</string>
<string name="search_settings_description">Southampton University Map</string>
- <string name="search_results_dialog_title">Search Results</string>
+ <string name="search_results_dialog_title">Search Results for\u0020</string>
<!-- Welcome Dialog -->
<string name="welcome_dialog_title">Southampton University Map App</string>
<string name="welcome_dialog_version">Version 0.9 (beta)</string>
<string name="welcome_dialog_copyright">© 2011 Christopher Baines</string>
- <string name="welcome_dialog_upgrade_message">Thanks for upgrading this app, and it\'s hoped that its better for you than the previous version. Noteable changes include\:\n
+ <string name="welcome_dialog_upgrade_message">Thanks for upgrading this app, and it\'s hoped that its better for you than the previous version. Noteable changes include:\n
• This message\n
• New Search interface\n
@@ -38,7 +38,7 @@ of the License, or (at your option) any later version.\n
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.</string>
- <string name="welcome_dialog_install_message">Welcome to the Southampton University Map App. Noteable features include\:\n
+ <string name="welcome_dialog_install_message">Welcome to the Southampton University Map App. Noteable features include:\n
• Search for Buildings and Bus Stops\n
• Get Live Bus Times\n
@@ -52,15 +52,6 @@ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.</string>
- <!-- Help Messages -->
- <string name="map_help_message">You can drag the map to move it, you can use pinch motions to zoom in and out, this can also be done with the buttons at the bottom of the screen. Taping the building markers will show you there full name, and tapping the bus stop markers will show the live times at that stop. Presing and holding a marker, will add the item to the favourites list.</string>
- <string name="find_help_message">The Find screen allows you to search for buildings, bus stops and sites. You can search by description and id. If your location is known, the results will be sorted by distance from your current location.</string>
- <string name="preferences_help_message">You can disable and enable the apps use of live bus times and gps positioning from the preferences screen.</string>
- <string name="findmylocation_help_message">When you press the Find my Location button on the menu, the map view will move to your location, and zoom in.</string>
- <string name="view_help_message">Use the options in the View dialog to enable and disable the map elements.</string>
- <string name="about_help_message">The About screen displays the help messages and also the contact details of the developer. You also have the option of making a Bitcoin donation using the Donate button at the bottom. WARNING, the donation address is not private as it is hardcoded in to the app.</string>
- <string name="favourites_help_message">The favourites dialog includes a list of buildings or bus stops marked as favourites, this is meant to allow for easier access to frequently used locations.</string>
- <string name="credits_help_message">Data: Map Icons: From the "Map Icons Collection" (http://mapicons.nicolasmollet.com). Map Tiles: From the Mapnik project, through the OSMDroid libary. Database: Using the ORMLite libary.</string>
<string name="donate_button">Donate</string>
<string name="bitcoin_error_message">You appear to have no bitcoin client installed, or at least none that listen for bitcoin uri\'s. Either install such a client, or just send coins via any method from any device to the address below.</string>
<string name="preferences">Preferences</string>
@@ -113,7 +104,6 @@ GNU General Public License for more details.</string>
<string name="preferences_non_uni_link_disabled">Non Uni-Link Bus Stops Disabled</string>
<!-- About Messages -->
- <string name="about_menu_instruction_text">Expand the items below to learn more about each feature of the application.</string>
<string name="bustimes_favourite_checkbox_label">Favourite</string>
<string name="donate_dialog_message">Loading bitcoin client</string>
<string name="donate_dialog_error_title">Error</string>
diff --git a/res/xml/searchable.xml b/res/xml/searchable.xml
index d6dedc8..34c6f76 100644
--- a/res/xml/searchable.xml
+++ b/res/xml/searchable.xml
@@ -7,6 +7,7 @@
android:searchSuggestAuthority="net.cbaines.suma.provider"
android:searchSuggestIntentAction="android.intent.action.VIEW"
android:searchSuggestSelection=" ?"
- android:searchSuggestThreshold="1" >
+ android:searchSuggestThreshold="1"
+ android:voiceSearchMode="showVoiceSearchButton|launchRecognizer" >
</searchable> \ No newline at end of file
diff --git a/src/net/cbaines/suma/Building.java b/src/net/cbaines/suma/Building.java
index 84c9b6c..38c8265 100644
--- a/src/net/cbaines/suma/Building.java
+++ b/src/net/cbaines/suma/Building.java
@@ -59,6 +59,6 @@ public class Building extends POI {
}
public String toString() {
- return name + " (" + id + ")";
+ return name;
}
}
diff --git a/src/net/cbaines/suma/BusStop.java b/src/net/cbaines/suma/BusStop.java
index 85f6d01..3bfd9a4 100644
--- a/src/net/cbaines/suma/BusStop.java
+++ b/src/net/cbaines/suma/BusStop.java
@@ -71,6 +71,6 @@ public class BusStop extends POI {
}
public String toString() {
- return description + " (" + id + ")";
+ return description;
}
}
diff --git a/src/net/cbaines/suma/DataManager.java b/src/net/cbaines/suma/DataManager.java
index ca27672..8b04928 100644
--- a/src/net/cbaines/suma/DataManager.java
+++ b/src/net/cbaines/suma/DataManager.java
@@ -457,9 +457,10 @@ public class DataManager {
GeoPoint point = null;
if (dataBits[2].length() > 1 && dataBits[3].length() > 1) {
- point = Util.csLatLongToGeoPoint(dataBits[2], dataBits[3]);
+ point = Util.csLatLongToGeoPoint(dataBits[3], dataBits[2]);
} else {
- point = new GeoPoint(0, 0);
+ Log.e(TAG, "Missing point for site " + dataBits[1]);
+ throw new RuntimeException();
}
Polygon poly = Util.csPolygonToPolygon(strLine.split("\"")[1]);
diff --git a/src/net/cbaines/suma/FavouritesDialog.java b/src/net/cbaines/suma/FavouritesDialog.java
new file mode 100644
index 0000000..0884b63
--- /dev/null
+++ b/src/net/cbaines/suma/FavouritesDialog.java
@@ -0,0 +1,11 @@
+package net.cbaines.suma;
+
+import android.content.Context;
+
+public class FavouritesDialog extends POIDialog implements Preferences {
+
+ public FavouritesDialog(Context context) {
+ super(context);
+ }
+
+}
diff --git a/src/net/cbaines/suma/MapActivity.java b/src/net/cbaines/suma/MapActivity.java
index effd9b4..58c7918 100644
--- a/src/net/cbaines/suma/MapActivity.java
+++ b/src/net/cbaines/suma/MapActivity.java
@@ -92,7 +92,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
private ArrayList<POI> searchResults = null;
- private POIDialog favDialog;
+ private FavouritesDialog favDialog;
private HashMap<String, Overlay> overlays = new HashMap<String, Overlay>();
private HashMap<String, Overlay> pastOverlays;
@@ -179,7 +179,7 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
private MapActivity instance;
- private POIDialog searchResultsDialog;
+ private SearchResultsDialog searchResultsDialog;
private static final String TAG = "MapActivity";
@@ -297,11 +297,30 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
searchResults.addAll(busStops);
busStops = null;
+ Dao<Site, String> siteDao = getHelper().getSiteDao();
+
+ QueryBuilder<Site, String> siteQueryBuilder = siteDao.queryBuilder();
+ siteQueryBuilder.where().like(Site.NAME_FIELD_NAME, "%" + query + "%").or()
+ .like(Site.ID_FIELD_NAME, "%" + query + "%");
+ PreparedQuery<Site> sitePreparedQuery = siteQueryBuilder.prepare();
+ List<Site> sites = siteDao.query(sitePreparedQuery);
+ searchResults.addAll(sites);
+ sites = null;
+
+ Collections.sort(searchResults, new StringPOIDistanceComparator(query));
+
startLocation = new GeoPoint(50935551, -1393488);
mapController.setZoom(15);
showDialog(SEARCH_RESULTS_DIALOG_ID);
+ searchResultsDialog.setTitle(getResources().getString(R.string.search_results_dialog_title) + query);
+ if (searchResults.size() == 0) {
+ searchResultsDialog.setMessage("No results found");
+ } else {
+ searchResultsDialog.setItems(searchResults);
+ }
+
} catch (SQLException e) {
e.printStackTrace();
}
@@ -967,8 +986,6 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
return false;
}
- refreshFavouriteDialog();
-
return false;
case R.id.menu_about:
Intent aboutIntent = new Intent(MapActivity.this, AboutActivity.class);
@@ -980,40 +997,6 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
}
}
- private void refreshFavouriteDialog() {
- ArrayList<POI> newFavouriteItems = new ArrayList<POI>();
-
- try {
- Dao<Building, String> buildingDao = getHelper().getBuildingDao();
- Dao<BusStop, String> busStopDao = getHelper().getBusStopDao();
-
- final SharedPreferences favouritesPrefs = getSharedPreferences(FAVOURITES_PREFERENCES, MODE_PRIVATE);
- for (String id : favouritesPrefs.getAll().keySet()) {
- Building building;
- BusStop busStop;
- if ((building = buildingDao.queryForId(id)) != null) {
- newFavouriteItems.add(building);
- } else if ((busStop = busStopDao.queryForId(id)) != null) {
- newFavouriteItems.add(busStop);
- } else {
- Log.e(TAG, "Item in favourites " + id + " cannot be found");
- }
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
-
- Log.i(TAG, "There are " + newFavouriteItems.size() + " favourites");
- if (newFavouriteItems.size() == 0) {
- Log.i(TAG, "Favourite dialog has no favourites, displaying message");
- favDialog.setMessage(getResources().getString(R.string.favourites_dialog_message));
- favDialog.setItems(null);
- } else {
- favDialog.setMessage("");
- favDialog.setItems(newFavouriteItems);
- }
- }
-
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Log.i(TAG, "Got activity result");
if (resultCode == RESULT_OK) {
@@ -1050,10 +1033,6 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
Log.i(TAG, "Got null poi id");
}
- if (favDialog != null) {
- refreshFavouriteDialog();
- }
-
mapView.invalidate();
}
}
@@ -1066,17 +1045,15 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
ViewDialog viewDialog = new ViewDialog(instance);
return viewDialog;
case FAVOURITE_DIALOG_ID:
- favDialog = new POIDialog(instance);
+ favDialog = new FavouritesDialog(instance);
favDialog.setOnItemClickListener(this);
favDialog.setOnItemLongClickListener(this);
favDialog.setTitle(R.string.favourites_dialog_title);
return favDialog;
case SEARCH_RESULTS_DIALOG_ID:
- searchResultsDialog = new POIDialog(instance);
+ searchResultsDialog = new SearchResultsDialog(instance);
searchResultsDialog.setOnItemClickListener(this);
searchResultsDialog.setOnItemLongClickListener(this);
- searchResultsDialog.setTitle(R.string.search_results_dialog_title);
- searchResultsDialog.setItems(searchResults);
return searchResultsDialog;
case WELCOME_DIALOG_ID:
WelcomeDialog welcomeDialog = new WelcomeDialog(instance);
@@ -1085,54 +1062,75 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
return null;
}
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- Log.i(TAG, "OnItemClick pos " + position + " id " + id);
+ protected void onPrepareDialog(int id, Dialog dialog) {
+ if (dialog instanceof FavouritesDialog) {
+ favDialog = (FavouritesDialog) dialog;
- String poiId = null;
- if (favDialog != null) {
- poiId = favDialog.adapter.getItemStringId(position);
- } else if (searchResultsDialog != null) {
- poiId = searchResultsDialog.adapter.getItemStringId(position);
- }
+ ArrayList<POI> newFavouriteItems = new ArrayList<POI>();
- Log.i(TAG, "POI " + poiId + " selected");
-
- POI poi = null;
-
- if (poiId != null) {
- Log.i(TAG, "Got id " + poiId);
try {
- poi = getHelper().getBuildingDao().queryForId(poiId);
- if (poi == null) {
- poi = getHelper().getBusStopDao().queryForId(poiId);
+ Dao<Building, String> buildingDao = getHelper().getBuildingDao();
+ Dao<BusStop, String> busStopDao = getHelper().getBusStopDao();
+
+ final SharedPreferences favouritesPrefs = getSharedPreferences(FAVOURITES_PREFERENCES, 0);
+ for (String idStr : favouritesPrefs.getAll().keySet()) {
+ Building building;
+ BusStop busStop;
+ if ((building = buildingDao.queryForId(idStr)) != null) {
+ newFavouriteItems.add(building);
+ } else if ((busStop = busStopDao.queryForId(idStr)) != null) {
+ newFavouriteItems.add(busStop);
+ } else {
+ Log.e(TAG, "Item in favourites " + idStr + " cannot be found");
+ }
}
} catch (SQLException e) {
e.printStackTrace();
}
- if (poi == null) {
- Log.e(TAG, "Could not find poi " + poiId + " in onActivityResult");
+ Log.i(TAG, "There are " + newFavouriteItems.size() + " favourites");
+ if (newFavouriteItems.size() == 0) {
+ Log.i(TAG, "Favourite dialog has no favourites, displaying message");
+ favDialog.setMessage(getResources().getString(R.string.favourites_dialog_message));
+ favDialog.setItems(null);
} else {
- if (myLocationOverlay != null) {
- myLocationOverlay.disableFollowLocation();
- }
- mapController.setZoom(20);
- mapController.setCenter(poi.point);
+ favDialog.setMessage("");
+ favDialog.setItems(newFavouriteItems);
+ }
+ } else if (dialog instanceof SearchResultsDialog) {
+ searchResultsDialog = (SearchResultsDialog) dialog;
+ }
+ }
- if (favDialog != null) {
- favDialog.dismiss();
- favDialog = null;
- } else if (searchResultsDialog != null) {
- searchResultsDialog.dismiss();
- searchResultsDialog = null;
- }
+ public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+ Log.i(TAG, "OnItemClick pos " + position + " id " + id);
+
+ POI poi = null;
+ if (favDialog != null) {
+ poi = favDialog.adapter.getPOIItem(position);
+ } else if (searchResultsDialog != null) {
+ poi = searchResultsDialog.adapter.getPOIItem(position);
+ }
+
+ if (poi != null) {
+ Log.i(TAG, "Got id " + poi.id);
+ if (myLocationOverlay != null) {
+ myLocationOverlay.disableFollowLocation();
+ }
+ mapController.setZoom(20);
+ mapController.setCenter(poi.point);
+
+ if (favDialog != null) {
+ favDialog.dismiss();
+ favDialog = null;
+ } else if (searchResultsDialog != null) {
+ searchResultsDialog.dismiss();
+ searchResultsDialog = null;
}
+
} else {
Log.i(TAG, "Got null poi id");
-
- // mapController.setZoom(15);
- // mapController.setCenter(new GeoPoint(50935551, -1393488));
}
}
@@ -1144,77 +1142,76 @@ public class MapActivity extends ToastHelperActivity implements MapViewConstants
Log.i(TAG, "OnItemClick pos " + position + " id " + id);
- String poiId = null;
+ POI poi = null;
if (favDialog != null) {
- poiId = favDialog.adapter.getItemStringId(position);
+ poi = favDialog.adapter.getPOIItem(position);
} else if (searchResultsDialog != null) {
- poiId = searchResultsDialog.adapter.getItemStringId(position);
+ poi = searchResultsDialog.adapter.getPOIItem(position);
}
- Log.i(TAG, "POI " + poiId + " selected");
+ if (poi != null) {
+ Log.i(TAG, "Got id " + poi.id);
- POI poi = null;
+ if (poi.type == POI.BUS_STOP) {
+ BusStop busStop = (BusStop) poi;
- if (poiId != null) {
- Log.i(TAG, "Got id " + poiId);
- try {
- poi = getHelper().getBuildingDao().queryForId(poiId);
- if (poi == null) {
- poi = getHelper().getBusStopDao().queryForId(poiId);
- }
- } catch (SQLException e) {
- e.printStackTrace();
- }
+ Log.i(TAG, "Pressed " + busStop.id);
- if (poi == null) {
- Log.e(TAG, "Could not find poi " + poiId + " in onActivityResult");
- } else {
- if (poi.type == POI.BUS_STOP) {
- BusStop busStop = (BusStop) poi;
+ Uri uri = Uri.parse("http://id.southampton.ac.uk/bus-stop/" + busStop.id);
- Log.i(TAG, "Pressed " + busStop.id);
+ Log.i(TAG, "Starting a activity for " + uri + " path " + uri.getPath());
- Uri uri = Uri.parse("http://id.southampton.ac.uk/bus-stop/" + busStop.id);
+ Intent busStopIntent = new Intent(Intent.ACTION_VIEW, uri);
+ startActivity(busStopIntent);
- Log.i(TAG, "Starting a activity for " + uri + " path " + uri.getPath());
+ return true;
- Intent busStopIntent = new Intent(Intent.ACTION_VIEW, uri);
- startActivity(busStopIntent);
+ } else if (poi.type == POI.BUILDING) {
+ Building building = (Building) poi;
- return true;
+ Log.i(TAG, "Pressed " + building.id);
- } else if (poi.type == POI.BUILDING) {
- Building building = (Building) poi;
+ Uri uri = Uri.parse("http://id.southampton.ac.uk/building/" + building.id);
- Log.i(TAG, "Pressed " + building.id);
+ Log.i(TAG, "Starting a activity for " + uri + " path " + uri.getPath());
- Uri uri = Uri.parse("http://id.southampton.ac.uk/building/" + building.id);
+ Intent buildingIntent = new Intent(Intent.ACTION_VIEW, uri);
+ startActivity(buildingIntent);
- Log.i(TAG, "Starting a activity for " + uri + " path " + uri.getPath());
+ return true;
- Intent buildingIntent = new Intent(Intent.ACTION_VIEW, uri);
- startActivity(buildingIntent);
+ } else if (poi.type == POI.SITE) {
+ Site site = (Site) poi;
- return true;
+ Log.i(TAG, "Pressed " + site.id);
- } else {
+ Uri uri = Uri.parse("http://id.southampton.ac.uk/site/" + site.id);
- myLocationOverlay.disableFollowLocation();
- mapController.setZoom(20);
- mapController.setCenter(poi.point);
+ Log.i(TAG, "Starting a activity for " + uri + " path " + uri.getPath());
- if (favDialog != null) {
- favDialog.dismiss();
- favDialog = null;
- } else if (searchResultsDialog != null) {
- searchResultsDialog.dismiss();
- searchResultsDialog = null;
- }
+ Intent siteIntent = new Intent(Intent.ACTION_VIEW, uri);
+ startActivity(siteIntent);
+
+ return true;
+
+ } else {
+
+ myLocationOverlay.disableFollowLocation();
+ mapController.setZoom(20);
+ mapController.setCenter(poi.point);
+ if (favDialog != null) {
+ favDialog.dismiss();
+ favDialog = null;
+ } else if (searchResultsDialog != null) {
+ searchResultsDialog.dismiss();
+ searchResultsDialog = null;
}
+
}
+
} else {
- Log.i(TAG, "Got null poi id");
+ Log.i(TAG, "Got null poi");
// mapController.setZoom(15);
// mapController.setCenter(new GeoPoint(50935551, -1393488));
diff --git a/src/net/cbaines/suma/MapContentProvider.java b/src/net/cbaines/suma/MapContentProvider.java
index d920b21..efbdf2f 100644
--- a/src/net/cbaines/suma/MapContentProvider.java
+++ b/src/net/cbaines/suma/MapContentProvider.java
@@ -17,6 +17,8 @@
package net.cbaines.suma;
import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import android.app.SearchManager;
@@ -48,10 +50,8 @@ public class MapContentProvider extends ContentProvider {
// + "/building");
// MIME types used for searching words or looking up a single definition
- public static final String ALLS_MIME_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
- + "/vnd.net.cbaines.suma.provider.all";
- public static final String ALL_MIME_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
- + "/vnd.net.cbaines.suma.provider.all";
+ public static final String ALLS_MIME_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/vnd.net.cbaines.suma.provider.all";
+ public static final String ALL_MIME_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/vnd.net.cbaines.suma.provider.all";
public static final String BUILDINGS_MIME_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
+ "/vnd.net.cbaines.suma.provider.building";
public static final String BUILDING_MIME_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
@@ -60,14 +60,10 @@ public class MapContentProvider extends ContentProvider {
+ "/vnd.net.cbaines.suma.provider.bus-stop";
public static final String BUS_STOP_MIME_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
+ "/vnd.net.cbaines.suma.provider.bus-stop";
- public static final String SITES_MIME_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
- + "/vnd.net.cbaines.suma.provider.site";
- public static final String SITE_MIME_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
- + "/vnd.net.cbaines.suma.provider.site";
- public static final String BUSES_MIME_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE
- + "/vnd.net.cbaines.suma.provider.bus";
- public static final String BUS_MIME_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE
- + "/vnd.net.cbaines.suma.provider.bus";
+ public static final String SITES_MIME_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/vnd.net.cbaines.suma.provider.site";
+ public static final String SITE_MIME_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/vnd.net.cbaines.suma.provider.site";
+ public static final String BUSES_MIME_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/vnd.net.cbaines.suma.provider.bus";
+ public static final String BUS_MIME_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/vnd.net.cbaines.suma.provider.bus";
private DatabaseHelper helper;
@@ -87,8 +83,7 @@ public class MapContentProvider extends ContentProvider {
private static final UriMatcher sURIMatcher = buildUriMatcher();
/**
- * Builds up a UriMatcher for search suggestion and shortcut refresh
- * queries.
+ * Builds up a UriMatcher for search suggestion and shortcut refresh queries.
*/
private static UriMatcher buildUriMatcher() {
UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
@@ -109,12 +104,10 @@ public class MapContentProvider extends ContentProvider {
matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH_SUGGEST);
/*
- * The following are unused in this implementation, but if we include
- * {@link SearchManager#SUGGEST_COLUMN_SHORTCUT_ID} as a column in our
- * suggestions table, we could expect to receive refresh queries when a
- * shortcutted suggestion is displayed in Quick Search Box, in which
- * case, the following Uris would be provided and we would return a
- * cursor with a single item representing the refreshed suggestion data.
+ * The following are unused in this implementation, but if we include {@link SearchManager#SUGGEST_COLUMN_SHORTCUT_ID} as
+ * a column in our suggestions table, we could expect to receive refresh queries when a shortcutted suggestion is
+ * displayed in Quick Search Box, in which case, the following Uris would be provided and we would return a cursor with a
+ * single item representing the refreshed suggestion data.
*/
matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_SHORTCUT, REFRESH_SHORTCUT);
matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_SHORTCUT + "/*", REFRESH_SHORTCUT);
@@ -128,11 +121,9 @@ public class MapContentProvider extends ContentProvider {
}
/**
- * Handles all the dictionary searches and suggestion queries from the
- * Search Manager. When requesting a specific word, the uri alone is
- * required. When searching all of the dictionary for matches, the
- * selectionArgs argument must carry the search query as the first element.
- * All other arguments are ignored.
+ * Handles all the dictionary searches and suggestion queries from the Search Manager. When requesting a specific word, the
+ * uri alone is required. When searching all of the dictionary for matches, the selectionArgs argument must carry the search
+ * query as the first element. All other arguments are ignored.
*/
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
@@ -193,9 +184,10 @@ public class MapContentProvider extends ContentProvider {
private Cursor getSuggestions(String query) throws SQLException {
Log.v(TAG, "Got query for " + query);
- String[] columnNames = { BaseColumns._ID, SearchManager.SUGGEST_COLUMN_ICON_1,
- SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_TEXT_2,
- SearchManager.SUGGEST_COLUMN_INTENT_DATA };
+ String[] columnNames = { BaseColumns._ID, SearchManager.SUGGEST_COLUMN_ICON_1, SearchManager.SUGGEST_COLUMN_TEXT_1,
+ SearchManager.SUGGEST_COLUMN_TEXT_2, SearchManager.SUGGEST_COLUMN_INTENT_DATA };
+
+ List<POI> results = new ArrayList<POI>();
MatrixCursor cursor = new MatrixCursor(columnNames);
int id = 0;
@@ -203,24 +195,10 @@ public class MapContentProvider extends ContentProvider {
Dao<Building, String> buildingDao = helper.getBuildingDao();
QueryBuilder<Building, String> qb = buildingDao.queryBuilder();
- qb.where().like(Building.ID_FIELD_NAME, "%" + query + "%").or()
- .like(Building.NAME_FIELD_NAME, "%" + query + "%");
+ qb.where().like(Building.ID_FIELD_NAME, "%" + query + "%").or().like(Building.NAME_FIELD_NAME, "%" + query + "%");
PreparedQuery<Building> preparedQuery = qb.prepare();
- List<Building> buildings = buildingDao.query(preparedQuery);
- Log.v(TAG, "Returning " + buildings.size() + " buildings");
-
- for (Building building : buildings) {
- // Log.v(TAG, "Building " + id + ", " + building.name);
- Object[] values = {
- id++,
- R.drawable.building,
- building.name,
- building.id,
- "geo:" + Util.E6IntToDouble(building.point.getLatitudeE6()) + ","
- + Util.E6IntToDouble(building.point.getLongitudeE6()) + "?z=18" };
- cursor.addRow(values);
- }
+ results.addAll(buildingDao.query(preparedQuery));
Dao<BusStop, String> busStopDao = helper.getBusStopDao();
@@ -229,19 +207,52 @@ public class MapContentProvider extends ContentProvider {
.like(BusStop.DESCRIPTION_FIELD_NAME, "%" + query + "%");
PreparedQuery<BusStop> busStopPreparedQuery = busStopQB.prepare();
- List<BusStop> busStops = busStopDao.query(busStopPreparedQuery);
- Log.v(TAG, "Returning " + busStops.size() + " busStops");
-
- for (BusStop busStop : busStops) {
- // Log.v(TAG, "Building " + id + ", " + building.name);
- Object[] values = {
- id++,
- R.drawable.busstop,
- busStop.description,
- busStop.id,
- "geo:" + Util.E6IntToDouble(busStop.point.getLatitudeE6()) + ","
- + Util.E6IntToDouble(busStop.point.getLongitudeE6()) + "?z=18" };
- cursor.addRow(values);
+ results.addAll(busStopDao.query(busStopPreparedQuery));
+
+ Dao<Site, String> siteDao = helper.getSiteDao();
+
+ QueryBuilder<Site, String> siteQB = siteDao.queryBuilder();
+ siteQB.where().like(Site.NAME_FIELD_NAME, "%" + query + "%").or().like(Site.ID_FIELD_NAME, "%" + query + "%");
+ PreparedQuery<Site> sitePreparedQuery = siteQB.prepare();
+
+ results.addAll(siteDao.query(sitePreparedQuery));
+
+ Collections.sort(results, new StringPOIDistanceComparator(query));
+
+ for (POI poi : results) {
+ if (poi instanceof Site) {
+ Site site = (Site) poi;
+ Object[] values = {
+ id++,
+ R.drawable.empty,
+ site.name,
+ site.id,
+ "geo:" + Util.E6IntToDouble(site.point.getLatitudeE6()) + ","
+ + Util.E6IntToDouble(site.point.getLongitudeE6()) + "?z=18" };
+ cursor.addRow(values);
+ } else if (poi instanceof Building) {
+ Building building = (Building) poi;
+ Object[] values = {
+ id++,
+ R.drawable.building,
+ building.name,
+ building.id,
+ "geo:" + Util.E6IntToDouble(building.point.getLatitudeE6()) + ","
+ + Util.E6IntToDouble(building.point.getLongitudeE6()) + "?z=18" };
+ cursor.addRow(values);
+ } else if (poi instanceof BusStop) {
+ BusStop busStop = (BusStop) poi;
+ Object[] values = {
+ id++,
+ R.drawable.busstop,
+ busStop.description,
+ busStop.id,
+ "geo:" + Util.E6IntToDouble(busStop.point.getLatitudeE6()) + ","
+ + Util.E6IntToDouble(busStop.point.getLongitudeE6()) + "?z=18" };
+ cursor.addRow(values);
+ } else {
+ Log.e(TAG, "Error, unexpected class");
+ }
}
return cursor;
@@ -307,13 +318,11 @@ public class MapContentProvider extends ContentProvider {
private Cursor refreshShortcut(Uri uri) throws SQLException {
/*
- * This won't be called with the current implementation, but if we
- * include {@link SearchManager#SUGGEST_COLUMN_SHORTCUT_ID} as a column
- * in our suggestions table, we could expect to receive refresh queries
- * when a shortcutted suggestion is displayed in Quick Search Box. In
- * which case, this method will query the table for the specific word,
- * using the given item Uri and provide all the columns originally
- * provided with the suggestion query.
+ * This won't be called with the current implementation, but if we include {@link
+ * SearchManager#SUGGEST_COLUMN_SHORTCUT_ID} as a column in our suggestions table, we could expect to receive refresh
+ * queries when a shortcutted suggestion is displayed in Quick Search Box. In which case, this method will query the table
+ * for the specific word, using the given item Uri and provide all the columns originally provided with the suggestion
+ * query.
*/
String buildingID = uri.getLastPathSegment();
Dao<Building, String> buildingDao = helper.getBuildingDao();
@@ -330,8 +339,8 @@ public class MapContentProvider extends ContentProvider {
}
/**
- * This method is required in order to query the supported types. It's also
- * useful in our own query() method to determine the type of Uri received.
+ * This method is required in order to query the supported types. It's also useful in our own query() method to determine the
+ * type of Uri received.
*/
@Override
public String getType(Uri uri) {
diff --git a/src/net/cbaines/suma/Preferences.java b/src/net/cbaines/suma/Preferences.java
index 9f2eaca..791aad8 100644
--- a/src/net/cbaines/suma/Preferences.java
+++ b/src/net/cbaines/suma/Preferences.java
@@ -16,18 +16,18 @@ public interface Preferences {
static final String APP_VERSION = "appVersion";
static final String APP_NOT_INSTALLED = "";
- static final String CURRENT_APP_VERSION = "0.8";
+ static final String CURRENT_APP_VERSION = "0.9";
static final String FAVOURITES_PREFERENCES = "favourites";
static final String DATABASE_PATH = "/data/data/net.cbaines.suma/databases/";
static final String DATABASE_NAME = "data.db";
- static final int DATABASE_VERSION = 41;
+ static final int DATABASE_VERSION = 42;
/**
* Enable to use the database in the assets folder, if its not enabled, the database is built from the csv files in the assets
* folder
*/
- static final boolean USE_BUNDLED_DATABASE = false;
+ static final boolean USE_BUNDLED_DATABASE = true;
}
diff --git a/src/net/cbaines/suma/SearchResultsDialog.java b/src/net/cbaines/suma/SearchResultsDialog.java
new file mode 100644
index 0000000..43fa206
--- /dev/null
+++ b/src/net/cbaines/suma/SearchResultsDialog.java
@@ -0,0 +1,10 @@
+package net.cbaines.suma;
+
+import android.content.Context;
+
+public class SearchResultsDialog extends POIDialog implements Preferences {
+
+ public SearchResultsDialog(Context context) {
+ super(context);
+ }
+}
diff --git a/src/net/cbaines/suma/StringDistanceComparator.java b/src/net/cbaines/suma/StringPOIDistanceComparator.java
index d42451f..e8a7539 100644
--- a/src/net/cbaines/suma/StringDistanceComparator.java
+++ b/src/net/cbaines/suma/StringPOIDistanceComparator.java
@@ -21,21 +21,21 @@ package net.cbaines.suma;
import java.util.Comparator;
-public class StringDistanceComparator implements Comparator<POI> {
+public class StringPOIDistanceComparator implements Comparator<POI> {
private String userString;
// private static final String TAG = "StringDistanceComparator";
- public StringDistanceComparator(String userString) {
+ public StringPOIDistanceComparator(String userString) {
super();
this.userString = userString;
}
public int compare(POI poi1, POI poi2) {
- int distTo1 = LD(userString, poi1.toString());
+ int distTo1 = Math.min(LD(userString, poi1.toString()), LD(userString, poi1.id));
// Log.i(TAG, "Comparing " + userString + " and " + poi1.toString() +
// " got dist " + distTo1);
- int distTo2 = LD(userString, poi2.toString());
+ int distTo2 = Math.min(LD(userString, poi2.toString()), LD(userString, poi2.id));
// Log.i(TAG, "Comparing " + userString + " and " + poi2.toString() +
// " got dist " + distTo2);
return distTo1 - distTo2;
diff --git a/src/net/cbaines/suma/WelcomeDialog.java b/src/net/cbaines/suma/WelcomeDialog.java
index 7262f48..7afec03 100644
--- a/src/net/cbaines/suma/WelcomeDialog.java
+++ b/src/net/cbaines/suma/WelcomeDialog.java
@@ -46,7 +46,7 @@ public class WelcomeDialog extends Dialog implements OnClickListener, Preference
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
String appVersion = sharedPrefs.getString(APP_VERSION, APP_NOT_INSTALLED);
- if (!appVersion.equals(CURRENT_APP_VERSION)) {
+ if (!appVersion.equals(APP_NOT_INSTALLED)) {
TextView welcomeDialogMessage = (TextView) findViewById(R.id.welcomeDialogMessage);
welcomeDialogMessage.setText(R.string.welcome_dialog_upgrade_message);
}