summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
Diffstat (limited to 'android')
-rw-r--r--android/cpp/jni.cpp10
-rw-r--r--android/cpp/native_map_view.cpp10
-rw-r--r--android/mapboxgl-app.gyp19
3 files changed, 21 insertions, 18 deletions
diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp
index d3934921b6..122ec794d6 100644
--- a/android/cpp/jni.cpp
+++ b/android/cpp/jni.cpp
@@ -18,6 +18,7 @@
#include <mbgl/platform/android/log_android.hpp>
#include <mbgl/platform/event.hpp>
#include <mbgl/platform/log.hpp>
+#include <mbgl/storage/network_status.hpp>
#pragma clang diagnostic ignored "-Wunused-parameter"
@@ -423,14 +424,14 @@ nativeSetAccessToken(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jstring a
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetAccessToken");
assert(nativeMapViewPtr != 0);
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
- nativeMapView->getFileSource().setAccessToken(std_string_from_jstring(env, accessToken));
+ nativeMapView->getMap().setAccessToken(std_string_from_jstring(env, accessToken));
}
jstring JNICALL nativeGetAccessToken(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetAccessToken");
assert(nativeMapViewPtr != 0);
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
- return std_string_to_jstring(env, nativeMapView->getFileSource().getAccessToken());
+ return std_string_to_jstring(env, nativeMapView->getMap().getAccessToken());
}
void JNICALL nativeCancelTransitions(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) {
@@ -701,8 +702,9 @@ void JNICALL
nativeSetReachability(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jboolean status) {
mbgl::Log::Debug(mbgl::Event::JNI, "nativeSetReachability");
assert(nativeMapViewPtr != 0);
- NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
- nativeMapView->getFileSource().setReachability(status);
+ if (status) {
+ mbgl::NetworkStatus::Reachable();
+ }
}
}
diff --git a/android/cpp/native_map_view.cpp b/android/cpp/native_map_view.cpp
index bf9a3a0532..cd3445e24e 100644
--- a/android/cpp/native_map_view.cpp
+++ b/android/cpp/native_map_view.cpp
@@ -52,14 +52,10 @@ void log_gl_string(GLenum name, const char *label) {
}
}
-// Returns the path to the default cache database on this system.
-std::string defaultCacheDatabase() {
- return mbgl::android::cachePath + "/mbgl-cache.db";
-}
-
NativeMapView::NativeMapView(JNIEnv *env, jobject obj_)
: mbgl::View(*this),
- fileSource(defaultCacheDatabase()),
+ fileCache(mbgl::android::cachePath + "/mbgl-cache.db"),
+ fileSource(&fileCache),
map(*this, fileSource) {
mbgl::Log::Debug(mbgl::Event::Android, "NativeMapView::NativeMapView");
@@ -145,7 +141,7 @@ void NativeMapView::notify() {
mbgl::Map &NativeMapView::getMap() { return map; }
-mbgl::CachingHTTPFileSource &NativeMapView::getFileSource() { return fileSource; }
+mbgl::DefaultFileSource &NativeMapView::getFileSource() { return fileSource; }
bool NativeMapView::inEmulator() {
// Detect if we are in emulator
diff --git a/android/mapboxgl-app.gyp b/android/mapboxgl-app.gyp
index 60ec22164d..71bd4f920a 100644
--- a/android/mapboxgl-app.gyp
+++ b/android/mapboxgl-app.gyp
@@ -3,14 +3,24 @@
'../gyp/common.gypi',
],
'targets': [
- {
- 'target_name': 'androidapp',
+ { 'target_name': 'androidapp',
'product_name': 'mapbox-gl',
'type': 'shared_library',
+
+ 'dependencies': [
+ '../mbgl.gyp:core',
+ '../mbgl.gyp:platform-<(platform_lib)',
+ '../mbgl.gyp:http-<(http_lib)',
+ '../mbgl.gyp:asset-<(asset_lib)',
+ '../mbgl.gyp:cache-<(cache_lib)',
+ '../mbgl.gyp:copy_certificate_bundle',
+ ],
+
'sources': [
'./cpp/native_map_view.cpp',
'./cpp/jni.cpp',
],
+
'cflags_cc': [
'-I<(boost_root)/include',
],
@@ -50,11 +60,6 @@
'libraries': [ '<@(ldflags)' ],
}]
],
- 'dependencies': [
- '../mapboxgl.gyp:mbgl-standalone',
- '../mapboxgl.gyp:mbgl-android',
- '../mapboxgl.gyp:copy_certificate_bundle',
- ],
'copies': [{
'files': [ '../styles' ],
'destination': '<(PRODUCT_DIR)'