Merge branch 'master' of github.com:mapbox/mapbox-gl-native into geoAPI

This commit is contained in:
Brad Leege
2015-02-12 18:51:23 -08:00
7 changed files with 40 additions and 30 deletions

View File

@@ -12,7 +12,7 @@ POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=mapbox
POM_DEVELOPER_NAME=Mapbox
ANDROID_MIN_SDK=14
ANDROID_MIN_SDK=8
ANDROID_BUILD_TARGET_SDK_VERSION=21
ANDROID_BUILD_TOOLS_VERSION=21.1.2
ANDROID_BUILD_SDK_VERSION=21

View File

@@ -1,5 +1,6 @@
package com.mapbox.mapboxgl.lib;
import android.annotation.TargetApi;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -177,7 +178,11 @@ public class MapView extends SurfaceView {
requestFocus();
// Register the SurfaceHolder callbacks
getHolder().addCallback(new Callbacks());
if (android.os.Build.VERSION.SDK_INT >= 9) {
getHolder().addCallback(new Callbacks2());
} else {
getHolder().addCallback(new Callbacks());
}
// Touch gesture detectors
mGestureDetector = new GestureDetectorCompat(context, new GestureListener());
@@ -332,7 +337,7 @@ public class MapView extends SurfaceView {
private void validateAccessToken(String accessToken) {
if (accessToken.isEmpty() | (!accessToken.startsWith("pk.") && !accessToken.startsWith("sk."))) {
if (!accessToken.startsWith("pk.") && !accessToken.startsWith("sk.")) {
throw new RuntimeException("Using MapView requires setting a valid access token. See the README.md");
}
}
@@ -425,11 +430,11 @@ public class MapView extends SurfaceView {
outState.putParcelable(STATE_CENTER_COORDINATE, getCenterCoordinate());
outState.putDouble(STATE_ZOOM_LEVEL, getZoomLevel()); // need to set zoom level first because of limitation on rotating when zoomed out
outState.putDouble(STATE_CENTER_DIRECTION, getDirection());
outState.putBoolean(STATE_ZOOM_ENABLED, isZoomEnabled());
outState.putBoolean(STATE_SCROLL_ENABLED, isScrollEnabled());
outState.putBoolean(STATE_ROTATE_ENABLED, isRotateEnabled());
outState.putBoolean(STATE_ZOOM_ENABLED, mZoomEnabled);
outState.putBoolean(STATE_SCROLL_ENABLED, mScrollEnabled);
outState.putBoolean(STATE_ROTATE_ENABLED, mRotateEnabled);
outState.putBoolean(STATE_DEBUG_ACTIVE, isDebugActive());
outState.putString(STATE_STYLE_URL, getStyleUrl());
outState.putString(STATE_STYLE_URL, mStyleUrl);
outState.putString(STATE_ACCESS_TOKEN, getAccessToken());
outState.putStringArrayList(STATE_CLASSES, new ArrayList<String>(getClasses()));
outState.putLong(STATE_DEFAULT_TRANSITION_DURATION, mNativeMapView.getDefaultTransitionDuration());
@@ -483,16 +488,7 @@ public class MapView extends SurfaceView {
}
// This class handles SurfaceHolder callbacks
private class Callbacks implements SurfaceHolder.Callback2 {
// Called when we need to redraw the view
// This is called before our view is first visible to prevent an initial
// flicker (see Android SDK documentation)
@Override
public void surfaceRedrawNeeded(SurfaceHolder holder) {
Log.v(TAG, "surfaceRedrawNeeded");
mNativeMapView.update();
}
private class Callbacks implements SurfaceHolder.Callback {
// Called when the native surface buffer has been created
// Must do all EGL/GL ES initialization here
@@ -522,6 +518,19 @@ public class MapView extends SurfaceView {
}
}
@TargetApi(9)
private class Callbacks2 extends Callbacks implements SurfaceHolder.Callback2 {
// Called when we need to redraw the view
// This is called before our view is first visible to prevent an initial
// flicker (see Android SDK documentation)
@Override
public void surfaceRedrawNeeded(SurfaceHolder holder) {
Log.v(TAG, "surfaceRedrawNeeded");
mNativeMapView.update();
}
}
// TODO examine how GLSurvaceView hadles attach/detach from window
// Called when view is no longer connected
@@ -577,10 +586,10 @@ public class MapView extends SurfaceView {
}
// Called when user touches the screen, all positions are absolute
@Override
@Override @TargetApi(14)
public boolean onTouchEvent(@NonNull MotionEvent event) {
// Check and ignore non touch or left clicks
if ((event.getButtonState() != 0) && (event.getButtonState() != MotionEvent.BUTTON_PRIMARY)) {
if ((android.os.Build.VERSION.SDK_INT >= 14) && (event.getButtonState() != 0) && (event.getButtonState() != MotionEvent.BUTTON_PRIMARY)) {
return false;
}
@@ -1093,7 +1102,7 @@ public class MapView extends SurfaceView {
// Called for events that don't fit the other handlers
// such as mouse scroll events, mouse moves, joystick, trackpad
@Override
@Override @TargetApi(12)
public boolean onGenericMotionEvent(MotionEvent event) {
// Mouse events
// TODO: SOURCE_TOUCH_NAVIGATION?
@@ -1131,7 +1140,7 @@ public class MapView extends SurfaceView {
// Called when the mouse pointer enters or exits the view
// or when it fades in or out due to movement
@Override
@Override @TargetApi(14)
public boolean onHoverEvent(@NonNull MotionEvent event) {
switch (event.getActionMasked()) {
case MotionEvent.ACTION_HOVER_ENTER:

View File

@@ -14,5 +14,6 @@ echo "${MAPBOX_ACCESS_TOKEN}" >> ./android/java/MapboxGLAndroidSDKTestApp/src/ma
make android -j$JOBS BUILDTYPE=$BUILDTYPE JOBS=$JOBS
aws s3 cp ./build/android-${ANDROID_ABI}/${BUILDTYPE}/lib.target/libmapbox-gl.so s3://mapbox-gl-testing/android/${NAME}/libmapbox-gl.so
aws s3 cp ./android/java/MapboxGLAndroidSDKTestApp/build/outputs/apk/MapboxGLAndroidSDKTestApp-debug.apk s3://mapbox-gl-testing/android/${NAME}/MapboxGLAndroidSDKTestApp-debug.apk
aws s3 cp ./android/java/MapboxGLAndroidSDKTestApp/build/outputs/apk/MapboxGLAndroidSDKTestApp-release-unsigned.apk s3://mapbox-gl-testing/android/${NAME}/MapboxGLAndroidSDKTestApp-release-unsigned.apk

2
configure vendored
View File

@@ -30,7 +30,7 @@ case ${MASON_PLATFORM} in
LIBJPEG_VERSION=v9a
OPENSSL_VERSION=1.0.1l
LIBCURL_VERSION=7.40.0
LIBUV_VERSION=0.11.29
LIBUV_VERSION=1.4.0
ZLIB_VERSION=system
BOOST_VERSION=1.57.0
NUNICODE_VERSION=1.5.1

View File

@@ -1,12 +1,12 @@
#ifndef MBGL_UTIL_UV_MESSENGER
#define MBGL_UTIL_UV_MESSENGER
#include <uv.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <uv.h>
typedef struct uv_messenger_s uv_messenger_t;
typedef void (*uv_messenger_cb)(void *arg);
typedef void (*uv_messenger_stop_cb)(uv_messenger_t *msgr);

View File

@@ -1,12 +1,12 @@
#ifndef MBGL_UTIL_UV_CHANNEL
#define MBGL_UTIL_UV_CHANNEL
#include <uv.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <uv.h>
// Taken from http://navaneeth.github.io/blog/2013/08/02/channels-in-libuv/
typedef struct uv_chan_s uv_chan_t;

View File

@@ -1,14 +1,14 @@
#ifndef MBGL_UTIL_UV_WORKER
#define MBGL_UTIL_UV_WORKER
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <mbgl/util/uv-messenger.h>
#include <mbgl/util/uv-channel.h>
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct uv_worker_s uv_worker_t;