diff --git a/lib/android/build.gradle b/lib/android/build.gradle index 1702e0d4c..f0dc5d4f8 100644 --- a/lib/android/build.gradle +++ b/lib/android/build.gradle @@ -37,6 +37,6 @@ dependencies { provided "com.facebook.react:react-native:+" compile "com.google.android.gms:play-services-base:10.2.4" compile "com.google.android.gms:play-services-maps:10.2.4" - compile 'org.osmdroid:osmdroid-android:5.6.5' + compile 'org.osmdroid:osmdroid-android:6.1.11' testCompile 'junit:junit:4.12' } diff --git a/lib/android/src/main/java/com/airbnb/android/react/maps/open/LatLngBoundsUtils.java b/lib/android/src/main/java/com/airbnb/android/react/maps/open/LatLngBoundsUtils.java index a6dacaa2a..857847ac1 100644 --- a/lib/android/src/main/java/com/airbnb/android/react/maps/open/LatLngBoundsUtils.java +++ b/lib/android/src/main/java/com/airbnb/android/react/maps/open/LatLngBoundsUtils.java @@ -4,6 +4,7 @@ import com.google.android.gms.maps.model.LatLngBounds; public class LatLngBoundsUtils { + public static boolean BoundsAreDifferent(LatLngBounds a, LatLngBounds b) { LatLng centerA = a.getCenter(); double latA = centerA.latitude; diff --git a/lib/android/src/main/java/com/airbnb/android/react/maps/open/OpenAirMapFeature.java b/lib/android/src/main/java/com/airbnb/android/react/maps/open/OpenAirMapFeature.java index b70dab6ce..90b4eddc3 100644 --- a/lib/android/src/main/java/com/airbnb/android/react/maps/open/OpenAirMapFeature.java +++ b/lib/android/src/main/java/com/airbnb/android/react/maps/open/OpenAirMapFeature.java @@ -1,9 +1,6 @@ package com.airbnb.android.react.maps.open; - import android.content.Context; - import com.facebook.react.views.view.ReactViewGroup; - import org.osmdroid.views.MapView; public abstract class OpenAirMapFeature extends ReactViewGroup { diff --git a/lib/android/src/main/java/com/airbnb/android/react/maps/open/OpenAirMapManager.java b/lib/android/src/main/java/com/airbnb/android/react/maps/open/OpenAirMapManager.java index 0832bf503..8789ccfcc 100644 --- a/lib/android/src/main/java/com/airbnb/android/react/maps/open/OpenAirMapManager.java +++ b/lib/android/src/main/java/com/airbnb/android/react/maps/open/OpenAirMapManager.java @@ -23,7 +23,6 @@ import org.osmdroid.views.MapView; import java.util.Map; - import javax.annotation.Nullable; public class OpenAirMapManager extends ViewGroupManager { @@ -37,7 +36,9 @@ public class OpenAirMapManager extends ViewGroupManager { private static final int FIT_TO_SUPPLIED_MARKERS = 6; private static final int FIT_TO_COORDINATES = 7; private static final int SET_MAP_BOUNDARIES = 8; - + private double lat = -18.9855811 + private double log = -53.7266065 + private final Map MAP_TYPES = MapBuilder.of( "standard", TileSourceFactory.MAPNIK, "satellite", TileSourceFactory.OPEN_SEAMAP @@ -61,7 +62,7 @@ protected OpenAirMapView createViewInstance(ThemedReactContext context) { MapView mapView = view.map; mapView.setTileSource(TileSourceFactory.MAPNIK); IMapController controller = mapView.getController(); - GeoPoint startPoint = new GeoPoint(-18.9855811, -53.7266065); + GeoPoint startPoint = new GeoPoint(this.lat, this.log); controller.setCenter(startPoint); return view; } @@ -76,8 +77,8 @@ private void emitMapError(ThemedReactContext context, String message, String typ error.putString("type", type); context - .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) - .emit("onError", error); + .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) + .emit("onError", error); } @ReactProp(name = "region") @@ -95,6 +96,16 @@ public void showMultiTouchControls(OpenAirMapView view, boolean hasMultiTouchCon view.showMultiTouchControls(hasMultiTouchControls); } + @ReactProp(name = "initalLat") + public void setIntialLat(double lat) { + this.lat = lat; + } + + @ReactProp(name = "initalLog") + public void setIntialLat(double log) { + this.log = log; + } + @ReactProp(name = "initialRegion") public void setInitialRegion(OpenAirMapView view, ReadableMap initialRegion) { view.setInitialRegion(initialRegion); diff --git a/package.json b/package.json index 15c895873..b5444d5a6 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "description": "React Native Mapview component for Android", "main": "index.js", "author": "Enieber Cunha ", - "version": "0.0.2", + "version": "0.1.0", "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest",