forked from react-native-maps/react-native-maps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Vizzuality/feature/canvas-android
Feature/canvas android
- Loading branch information
Showing
26 changed files
with
1,040 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>react-native-maps</name> | ||
<comment>Project react-native-maps created by Buildship.</comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) | ||
connection.project.dir= | ||
eclipse.preferences.version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/> | ||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>example-android</name> | ||
<comment>Project example-android created by Buildship.</comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature> | ||
</natures> | ||
</projectDescription> |
3 changes: 3 additions & 0 deletions
3
example/android/app/.settings/org.eclipse.buildship.core.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) | ||
connection.project.dir=../../.. | ||
eclipse.preferences.version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/> | ||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>react-native-maps-lib</name> | ||
<comment>Project react-native-maps-lib created by Buildship.</comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) | ||
connection.project.dir=../.. | ||
eclipse.preferences.version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
lib/android/src/main/java/com/airbnb/android/react/maps/AirMapCanvasFeature.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
package com.airbnb.android.react.maps; | ||
|
||
import android.content.Context; | ||
|
||
import com.google.android.gms.maps.GoogleMap; | ||
import com.google.android.gms.maps.model.TileOverlay; | ||
import com.google.android.gms.maps.model.TileOverlayOptions; | ||
|
||
/** | ||
* Created by joseangel.parreno@vizzuality.com on 25/05/2017. | ||
*/ | ||
|
||
public abstract class AirMapCanvasFeature extends AirMapFeature { | ||
protected TileOverlayOptions tileOverlayOptions; | ||
protected TileOverlay tileOverlay; | ||
protected AirMapCanvasTileProvider tileProvider; | ||
|
||
protected String urlTemplate; | ||
protected int maxZoom; | ||
protected String areaId; | ||
protected String alertType; | ||
protected String minDate; | ||
protected String maxDate; | ||
protected boolean isConnected; | ||
protected float zIndex; | ||
protected Coordinates coordinates; | ||
|
||
public AirMapCanvasFeature(Context context) { | ||
super(context); | ||
} | ||
|
||
public void setUrlTemplate(String urlTemplate) { | ||
this.urlTemplate = urlTemplate; | ||
if (tileProvider != null) { | ||
tileProvider.setUrlTemplate(urlTemplate); | ||
} | ||
if (tileOverlay != null) { | ||
tileOverlay.clearTileCache(); | ||
} | ||
} | ||
|
||
public void setMaxZoom(int maxZoom) { | ||
this.maxZoom = maxZoom; | ||
if (tileProvider != null) { | ||
tileProvider.setMaxZoom(maxZoom); | ||
} | ||
if (tileOverlay != null) { | ||
tileOverlay.clearTileCache(); | ||
} | ||
} | ||
|
||
public void setAreaId(String areaId) { | ||
this.areaId = areaId; | ||
if (tileProvider != null) { | ||
tileProvider.setAreaId(areaId); | ||
} | ||
if (tileOverlay != null) { | ||
tileOverlay.clearTileCache(); | ||
} | ||
} | ||
|
||
public void setIsConnected(boolean isConnected) { | ||
this.isConnected = isConnected; | ||
if (tileProvider != null) { | ||
tileProvider.setIsConnected(isConnected); | ||
} | ||
if (tileOverlay != null) { | ||
tileOverlay.clearTileCache(); | ||
} | ||
} | ||
|
||
public void setAlertType(String alertType) { | ||
this.alertType = alertType; | ||
if (tileProvider != null) { | ||
tileProvider.setAlertType(alertType); | ||
} | ||
if (tileOverlay != null) { | ||
tileOverlay.clearTileCache(); | ||
} | ||
} | ||
|
||
public void setMinDate(String minDate) { | ||
this.minDate = minDate; | ||
} | ||
|
||
public void setMaxDate(String maxDate) { | ||
this.maxDate = maxDate; | ||
} | ||
|
||
public void setZIndex(float zIndex) { | ||
this.zIndex = zIndex; | ||
if (tileOverlay != null) { | ||
tileOverlay.setZIndex(zIndex); | ||
} | ||
} | ||
|
||
public void setCoordinates(Coordinates coordinates) { | ||
this.coordinates = coordinates; | ||
if (tileProvider != null) { | ||
tileProvider.setCoordinates(coordinates); | ||
} | ||
if (tileOverlay != null) { | ||
tileOverlay.clearTileCache(); | ||
} | ||
} | ||
|
||
public TileOverlayOptions getTileOverlayOptions() { | ||
if (tileOverlayOptions == null) { | ||
tileOverlayOptions = createTileOverlayOptions(); | ||
} | ||
return tileOverlayOptions; | ||
} | ||
|
||
protected abstract TileOverlayOptions createTileOverlayOptions(); | ||
|
||
|
||
@Override | ||
public Object getFeature() { | ||
return tileOverlay; | ||
} | ||
|
||
@Override | ||
public void addToMap(GoogleMap map) { | ||
this.tileOverlay = map.addTileOverlay(getTileOverlayOptions()); | ||
} | ||
|
||
@Override | ||
public void removeFromMap(GoogleMap map) { | ||
tileOverlay.remove(); | ||
} | ||
} |
Oops, something went wrong.