Files
MapLibreParticleLab/platform/android/src/jni.hpp
Antonio Zugaldia 01e55f183e # This is a combination of 8 commits.
# The first commit's message is:
# This is a combination of 2 commits.
# The first commit's message is:

# This is a combination of 3 commits.
# The first commit's message is:
# This is a combination of 2 commits.
# The first commit's message is:

# This is a combination of 21 commits.
# The first commit's message is:
[android] - Implements Android bindings for offline API
Fixes #3891

# The 2nd commit message will be skipped:

#	[android] #3891 - rename OFFLINE_MAX_CACHE_SIZE to DEFAULT_MAX_CACHE_SIZE and adjust value

# The 3rd commit message will be skipped:

#	[android] #3891 - makes de documentation more relevant to the current android implementation

# The 4th commit message will be skipped:

#	[android] #3891 - rename isRequiredResourceCountIsIndeterminate() to isRequiredResourceCountPrecise()

# The 5th commit message will be skipped:

#	[android] #3891 - rename complete() to isComplete()

# The 6th commit message will be skipped:

#	[android] #3891 - rename OfflineRegionDefinition to OfflineTilePyramidRegionDefinition and make OfflineRegionDefinition an interface. Docs for corresponding classes updated.

# The 7th commit message will be skipped:

#	[android] #3891 - make reason a more idiomatic ErrorReason Android IntDef and remove unnecessary constructor

# The 8th commit message will be skipped:

#	[android] #3891 - reuse the calling object instead of creating a new manager

# The 9th commit message will be skipped:

#	[android] #3891 - location, location, location

# The 10th commit message will be skipped:

#	[android] #3891 - simpler list regions iteration

# The 11th commit message will be skipped:

#	[android] #3891 - proper indeterminate -> precise transition

# The 12th commit message will be skipped:

#	[android] #3891 - improve description for DEFAULT_MAX_CACHE_SIZE

# The 13th commit message will be skipped:

#	[android] #3891 - delete global refs for obj and listCallback

# The 14th commit message will be skipped:

#	[android] #3891 - simplify metadata conversion and fix metadata object

# The 15th commit message will be skipped:

#	[android] - Implements Android bindings for offline API
#	Fixes #3891

# The 16th commit message will be skipped:

#	[android] #3891 - avoid exposing the int reason value in the public API

# The 17th commit message will be skipped:

#	[android] #3891 - delete global refs for remaining callbacks and observer

# The 18th commit message will be skipped:

#	[android] #3891 - remove unused offlineManagerClassConstructorId together with unnecessary private java constructor

# The 19th commit message will be skipped:

#	[android] #3891 - remove non-relevant line

# The 20th commit message will be skipped:

#	[android] #3891 - handle requiredResourceCountIsIndeterminate -> requiredResourceCountIsPrecise rename

# The 21st commit message will be skipped:

#	[android] #3891 - revert map changes to allow rebase

# The 2nd commit message will be skipped:

#	[android] #3891 - avoid exposing the int reason value in the public API

# The 2nd commit message will be skipped:

#	[android] #3891 - rename complete() to isComplete()

# The 3rd commit message will be skipped:

#	[android] #3891 - rename OfflineRegionDefinition to OfflineTilePyramidRegionDefinition and make OfflineRegionDefinition an interface. Docs for corresponding classes updated.

# The 2nd commit message will be skipped:

#	[android] #3891 - location, location, location

# The 2nd commit message will be skipped:

#	[android] #3891 - improve description for DEFAULT_MAX_CACHE_SIZE

# The 3rd commit message will be skipped:

#	[android] #3891 - delete global refs for obj and listCallback

# The 4th commit message will be skipped:

#	[android] #3891 - simplify metadata conversion and fix metadata object

# The 5th commit message will be skipped:

#	[android] #3891 - delete global refs for remaining callbacks and observer

# The 6th commit message will be skipped:

#	[android] #3891 - remove unused offlineManagerClassConstructorId together with unnecessary private java constructor

# The 7th commit message will be skipped:

#	[android] #3891 - remove non-relevant line

# The 8th commit message will be skipped:

#	[android] #3891 - handle requiredResourceCountIsIndeterminate -> requiredResourceCountIsPrecise rename
2016-02-26 09:13:17 -05:00

179 lines
5.3 KiB
C++

#ifndef MBGL_ANDROID_JNI
#define MBGL_ANDROID_JNI
#include <string>
#include <vector>
// Forward definition of JNI types
typedef class _jclass* jclass;
typedef class _jstring* jstring;
typedef class _jobject* jobject;
typedef class _jlongArray* jlongArray;
typedef struct _jmethodID* jmethodID;
typedef struct _jfieldID* jfieldID;
struct _JavaVM;
typedef _JavaVM JavaVM;
struct _JNIEnv;
typedef _JNIEnv JNIEnv;
namespace mbgl {
namespace android {
extern JavaVM* theJVM;
extern std::string cachePath;
extern std::string dataPath;
extern std::string apkPath;
extern std::string androidRelease;
extern jmethodID onInvalidateId;
extern jmethodID onMapChangedId;
extern jmethodID onFpsChangedId;
extern jclass latLngClass;
extern jmethodID latLngConstructorId;
extern jfieldID latLngLatitudeId;
extern jfieldID latLngLongitudeId;
extern jclass latLngZoomClass;
extern jmethodID latLngZoomConstructorId;
extern jfieldID latLngZoomLatitudeId;
extern jfieldID latLngZoomLongitudeId;
extern jfieldID latLngZoomZoomId;
extern jclass bboxClass;
extern jmethodID bboxConstructorId;
extern jfieldID bboxLatNorthId;
extern jfieldID bboxLatSouthId;
extern jfieldID bboxLonEastId;
extern jfieldID bboxLonWestId;
extern jclass iconClass;
extern jfieldID iconIdId;
extern jclass markerClass;
extern jfieldID markerPositionId;
extern jfieldID markerIconId;
extern jclass polylineClass;
extern jfieldID polylineAlphaId;
extern jfieldID polylineColorId;
extern jfieldID polylineWidthId;
extern jfieldID polylinePointsId;
extern jclass polygonClass;
extern jfieldID polygonAlphaId;
extern jfieldID polygonFillColorId;
extern jfieldID polygonStrokeColorId;
extern jfieldID polygonPointsId;
extern jclass runtimeExceptionClass;
extern jclass nullPointerExceptionClass;
extern jmethodID listToArrayId;
extern jclass arrayListClass;
extern jmethodID arrayListConstructorId;
extern jmethodID arrayListAddId;
extern jclass projectedMetersClass;
extern jmethodID projectedMetersConstructorId;
extern jfieldID projectedMetersNorthingId;
extern jfieldID projectedMetersEastingId;
extern jclass pointFClass;
extern jmethodID pointFConstructorId;
extern jfieldID pointFXId;
extern jfieldID pointFYId;
extern jclass rectFClass;
extern jmethodID rectFConstructorId;
extern jfieldID rectFLeftId;
extern jfieldID rectFTopId;
extern jfieldID rectFRightId;
extern jfieldID rectFBottomId;
extern jclass httpContextClass;
extern jmethodID httpContextGetInstanceId;
extern jmethodID httpContextCreateRequestId;
extern jclass httpRequestClass;
extern jmethodID httpRequestStartId;
extern jmethodID httpRequestCancelId;
// Offline declarations start
extern jclass offlineManagerClass;
extern jfieldID offlineManagerClassPtrId;
extern jclass listOfflineRegionsCallbackClass;
extern jmethodID listOnListMethodId;
extern jmethodID listOnErrorMethodId;
extern jclass offlineRegionClass;
extern jfieldID offlineRegionOfflineManagerId;
extern jfieldID offlineRegionIdId;
extern jfieldID offlineRegionDefinitionId;
extern jfieldID offlineRegionMetadataId;
extern jfieldID offlineRegionPtrId;
extern jclass offlineRegionDefinitionClass;
extern jmethodID offlineRegionDefinitionConstructorId;
extern jfieldID offlineRegionDefinitionStyleURLId;
extern jfieldID offlineRegionDefinitionBoundsId;
extern jfieldID offlineRegionDefinitionMinZoomId;
extern jfieldID offlineRegionDefinitionMaxZoomId;
extern jfieldID offlineRegionDefinitionPixelRatioId;
extern jclass offlineRegionMetadataClass;
extern jmethodID offlineRegionMetadataConstructorId;
extern jfieldID offlineRegionMetadataMetadataId;
extern jclass createOfflineRegionCallbackClass;
extern jmethodID createOnCreateMethodId;
extern jmethodID createOnErrorMethodId;
extern jclass offlineRegionObserverClass;
extern jmethodID offlineRegionObserveronStatusChangedId;
extern jmethodID offlineRegionObserveronErrorId;
extern jmethodID offlineRegionObserveronLimitId;
extern jclass offlineRegionStatusClass;
extern jmethodID offlineRegionStatusConstructorId;
extern jfieldID offlineRegionStatusDownloadStateId;
extern jfieldID offlineRegionStatusCompletedResourceCountId;
extern jfieldID offlineRegionStatusCompletedResourceSizeId;
extern jfieldID offlineRegionStatusRequiredResourceCountId;
extern jfieldID offlineRegionStatusRequiredResourceCountIsIndeterminateId;
extern jclass offlineRegionErrorClass;
extern jmethodID offlineRegionErrorConstructorId;
extern jfieldID offlineRegionErrorReasonId;
extern jfieldID offlineRegionErrorMessageId;
extern jclass offlineRegionStatusCallbackClass;
extern jmethodID offlineRegionStatusOnStatusId;
extern jmethodID offlineRegionStatusOnErrorId;
extern jclass offlineRegionDeleteCallbackClass;
extern jmethodID offlineRegionDeleteOnDeleteId;
extern jmethodID offlineRegionDeleteOnErrorId;
// Offline declarations end
extern bool throw_jni_error(JNIEnv *env, const char *msg);
extern bool attach_jni_thread(JavaVM* vm, JNIEnv** env, std::string threadName);
extern void detach_jni_thread(JavaVM* vm, JNIEnv** env, bool detach);
extern std::string std_string_from_jstring(JNIEnv *env, jstring jstr);
extern jstring std_string_to_jstring(JNIEnv *env, std::string str);
extern std::vector<std::string> std_vector_string_from_jobject(JNIEnv *env, jobject jlist);
extern jobject std_vector_string_to_jobject(JNIEnv *env, std::vector<std::string> vector);
extern jlongArray std_vector_uint_to_jobject(JNIEnv *env, std::vector<uint32_t> vector);
}
}
#endif