Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] jni high level binding refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ivovandongen committed Feb 24, 2017
1 parent 7d90180 commit 465c949
Show file tree
Hide file tree
Showing 62 changed files with 3,716 additions and 2,853 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class Marker extends Annotation {
private LatLng position;
private String snippet;
private Icon icon;
//Redundantly stored for JNI access
private String iconId;
private String title;

private InfoWindow infoWindow;
Expand All @@ -51,24 +53,19 @@ public class Marker extends Annotation {
* @param baseMarkerOptions The builder used to construct the Marker.
*/
public Marker(BaseMarkerOptions baseMarkerOptions) {
position = baseMarkerOptions.position;
snippet = baseMarkerOptions.snippet;
icon = baseMarkerOptions.icon;
title = baseMarkerOptions.title;
this(baseMarkerOptions.position, baseMarkerOptions.icon, baseMarkerOptions.title, baseMarkerOptions.snippet);
}

Marker(BaseMarkerViewOptions baseMarkerViewOptions) {
position = baseMarkerViewOptions.position;
snippet = baseMarkerViewOptions.snippet;
icon = baseMarkerViewOptions.icon;
title = baseMarkerViewOptions.title;
this(baseMarkerViewOptions.position, baseMarkerViewOptions.icon,
baseMarkerViewOptions.title, baseMarkerViewOptions.snippet);
}

Marker(LatLng position, Icon icon, String title, String snippet) {
this.position = position;
this.icon = icon;
this.title = title;
this.snippet = snippet;
setIcon(icon);
}

/**
Expand Down Expand Up @@ -148,6 +145,7 @@ public void setSnippet(String snippet) {
*/
public void setIcon(@Nullable Icon icon) {
this.icon = icon;
this.iconId = icon != null ? icon.getId() : null;
MapboxMap map = getMapboxMap();
if (map != null) {
map.updateMarker(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
Expand Down Expand Up @@ -203,8 +202,6 @@ private void initalizeDrawingSurface(Context context, MapboxMapOptions options)
*/
@UiThread
public void onCreate(@Nullable Bundle savedInstanceState) {
nativeMapView.setAccessToken(Mapbox.getAccessToken());

if (savedInstanceState == null) {
MapboxTelemetry.getInstance().pushEvent(MapboxEvent.buildMapLoadEvent());
} else if (savedInstanceState.getBoolean(MapboxConstants.STATE_HAS_SAVED_STATE)) {
Expand Down Expand Up @@ -409,11 +406,6 @@ public void setStyleUrl(@NonNull String url) {
return;
}

// stopgap for https://github.com/mapbox/mapbox-gl-native/issues/6242
if (TextUtils.isEmpty(nativeMapView.getAccessToken())) {
nativeMapView.setAccessToken(Mapbox.getAccessToken());
}

nativeMapView.setStyleUrl(url);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import android.view.View;
import android.view.ViewGroup;

import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.annotations.Annotation;
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
Expand Down Expand Up @@ -866,10 +865,6 @@ public void setStyle(@Style.StyleUrl String style) {
private void setStyleUrl(@NonNull MapboxMapOptions options) {
String style = options.getStyle();
if (!TextUtils.isEmpty(style)) {
// stopgap for https://github.com/mapbox/mapbox-gl-native/issues/6242
if (TextUtils.isEmpty(nativeMapView.getAccessToken())) {
nativeMapView.setAccessToken(Mapbox.getAccessToken());
}
setStyleUrl(style);
}
}
Expand Down
Loading

0 comments on commit 465c949

Please sign in to comment.