3737import com .mapbox .mapboxsdk .maps .MapboxMap ;
3838import com .mapbox .mapboxsdk .maps .OnMapReadyCallback ;
3939
40+ import org .codeforamerica .open311 .facade .data .City ;
4041import org .open311 .android .adapters .GeocoderAdapter ;
4142import org .open311 .android .helpers .Utils ;
4243import org .open311 .android .widgets .GeocoderView ;
@@ -82,6 +83,7 @@ private enum source {
8283 protected void onCreate (Bundle savedInstanceState ) {
8384
8485 super .onCreate (savedInstanceState );
86+
8587 // Mapbox access token only needs to be configured once in your app
8688 MapboxAccountManager .start (this , getString (R .string .mapbox_api_key ));
8789 setContentView (R .layout .activity_map );
@@ -97,6 +99,14 @@ protected void onCreate(Bundle savedInstanceState) {
9799 mapView .getMapAsync (new OnMapReadyCallback () {
98100 @ Override
99101 public void onMapReady (MapboxMap mapboxMap ) {
102+ City city = City .fromString (getString (R .string .open311_endpoint ));
103+ if (city .getMap () != null ) {
104+ LatLng point = new LatLng (city .getMap ().getLat (), city .getMap ().getLon ());
105+ mapboxMap .setCameraPosition (new CameraPosition .Builder ()
106+ .target (point )
107+ .zoom (new Double (city .getMap ().getZoom ()))
108+ .build ());
109+ }
100110 map = mapboxMap ;
101111 map .setOnMapClickListener (new MapboxMap .OnMapClickListener () {
102112 @ Override
@@ -209,7 +219,6 @@ private void updateAddress(Address result) {
209219 TextView AddressLine = (TextView ) findViewById ((R .id .address ));
210220 TextView CoordsLine = (TextView ) findViewById ((R .id .coords ));
211221 assert AddressLine != null ;
212- //AddressLine.setText(Utils.addressString(address));
213222 AddressLine .setText (Utils .formatAddress (address ));
214223 assert CoordsLine != null ;
215224 String coordText = String .format (Locale .getDefault (), "(%f, %f)" , latitude , longitude );
0 commit comments