[android] #5652 - fix PressForMarkerActivity setup to follow best practices of loading a style and initial location of a MapView as early as possible.

This commit is contained in:
Tobrun Van Nuland
2016-07-13 13:51:50 +02:00
parent cbfc9bc33c
commit 081c61dcc2
2 changed files with 8 additions and 7 deletions

View File

@@ -11,8 +11,6 @@ import android.view.Menu;
import android.view.MenuItem;
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
@@ -52,7 +50,6 @@ public class PressForMarkerActivity extends AppCompatActivity {
@Override
public void onMapReady(final MapboxMap map) {
mapboxMap = map;
mapboxMap.setStyleUrl(Style.OUTDOORS);
resetMap();
mapboxMap.setOnMapLongClickListener(new MapboxMap.OnMapLongClickListener() {
@@ -85,7 +82,6 @@ public class PressForMarkerActivity extends AppCompatActivity {
if (mapboxMap == null) {
return;
}
mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(45.1855569, 5.7215506), 11));
mapboxMap.removeAnnotations();
}

View File

@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
@@ -15,6 +16,10 @@
android:id="@+id/pressForMarkerMapView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:center_latitude="45.1855569"
app:center_longitude="5.7215506"
app:zoom="11"
app:style_url="@string/style_mapbox_streets"
android:layout_below="@id/toolbar"/>
</RelativeLayout>