Skip to content
Browse files

- Playing with map camera settings, no tests yet, but works.. I think.

  • Loading branch information...
1 parent b696438 commit 5c85d1bc88b6abafe93f9160bfb3d6fd090baffd @justinberry justinberry committed Apr 7, 2013
View
19 ...ence-app/src/main/java/au/com/dius/resilience/ui/activity/ViewServiceRequestActivity.java
@@ -1,28 +1,29 @@
package au.com.dius.resilience.ui.activity;
-import android.content.Intent;
import android.os.Bundle;
-import android.text.format.DateUtils;
-import android.util.Log;
import android.widget.TextView;
import au.com.dius.resilience.R;
import au.com.dius.resilience.factory.SerializableExtraFactory;
import au.com.dius.resilience.intent.Extras;
import au.com.dius.resilience.ui.ResilienceActionBarThemer;
import au.com.dius.resilience.util.ResilienceDateUtils;
import au.com.justinb.open311.model.ServiceRequest;
+import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
+import com.google.android.gms.maps.model.CameraPosition;
+import com.google.android.gms.maps.model.LatLng;
+import com.google.android.gms.maps.model.MarkerOptions;
import com.google.inject.Inject;
import roboguice.activity.RoboActivity;
import roboguice.inject.ContentView;
import roboguice.inject.InjectView;
-import java.io.Serializable;
-
@ContentView(R.layout.activity_view_service_request)
public class ViewServiceRequestActivity extends RoboActivity {
+ public static final int ZOOM_LEVEL = 12;
+
@Inject
private ResilienceActionBarThemer themer;
@@ -56,6 +57,14 @@ public void onCreate(Bundle savedInstanceState) {
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
map.getUiSettings().setZoomControlsEnabled(false);
map.getUiSettings().setAllGesturesEnabled(false);
+
+ LatLng latLng = new LatLng(serviceRequest.getLat(), serviceRequest.getLong());
+ CameraPosition cameraPosition = new CameraPosition.Builder()
+ .target(latLng)
+ .zoom(ZOOM_LEVEL)
+ .build();
+ map.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
+ map.addMarker(new MarkerOptions().position(latLng));
}
}

0 comments on commit 5c85d1b

Please sign in to comment.
Something went wrong with that request. Please try again.