summaryrefslogtreecommitdiff
path: root/platform/android/src/file_source.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-04-11 17:18:09 +0200
committerKonstantin Käfer <mail@kkaefer.com>2017-04-24 10:42:10 +0200
commit197f0ca6b418a27412bfcc7e891ab80949fd8833 (patch)
treebb7dd2400bfc002dc5794466d3a74d39a80f8b00 /platform/android/src/file_source.cpp
parenteed7dedf030ed71aac6d004becef42dbec5606bf (diff)
downloadqtlocation-mapboxgl-197f0ca6b418a27412bfcc7e891ab80949fd8833.tar.gz
[android] use AAssetManager instead of libzip
Diffstat (limited to 'platform/android/src/file_source.cpp')
-rw-r--r--platform/android/src/file_source.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/platform/android/src/file_source.cpp b/platform/android/src/file_source.cpp
index 20715bf920..16c09b7b52 100644
--- a/platform/android/src/file_source.cpp
+++ b/platform/android/src/file_source.cpp
@@ -2,21 +2,24 @@
#include <mbgl/util/logging.hpp>
-#include <string>
-
+#include "asset_manager_file_source.hpp"
#include "jni/generic_global_ref_deleter.hpp"
+#include <string>
namespace mbgl {
namespace android {
// FileSource //
-FileSource::FileSource(jni::JNIEnv& _env, jni::String accessToken, jni::String _cachePath, jni::String _apkPath) {
+FileSource::FileSource(jni::JNIEnv& _env,
+ jni::String accessToken,
+ jni::String _cachePath,
+ jni::Object<AssetManager> assetManager) {
// Create a core default file source
fileSource = std::make_unique<mbgl::DefaultFileSource>(
jni::Make<std::string>(_env, _cachePath) + "/mbgl-offline.db",
- jni::Make<std::string>(_env, _apkPath));
+ std::make_unique<AssetManagerFileSource>(_env, assetManager));
// Set access token
fileSource->setAccessToken(jni::Make<std::string>(_env, accessToken));
@@ -80,7 +83,7 @@ void FileSource::registerNative(jni::JNIEnv& env) {
// Register the peer
jni::RegisterNativePeer<FileSource>(
env, FileSource::javaClass, "nativePtr",
- std::make_unique<FileSource, JNIEnv&, jni::String, jni::String, jni::String>,
+ std::make_unique<FileSource, JNIEnv&, jni::String, jni::String, jni::Object<AssetManager>>,
"initialize",
"finalize",
METHOD(&FileSource::getAccessToken, "getAccessToken"),