summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorIvo van Dongen <ivovandongen@users.noreply.github.com>2016-10-11 10:30:38 +0300
committerGitHub <noreply@github.com>2016-10-11 10:30:38 +0300
commit61d8ecefda3a01d0860746af98d632b73c526d98 (patch)
tree1205aa2a9b7363805f62ed0c8704968575311194 /platform/android
parentefc1bff65f1667b59e3045c5258b2aa1dd9532b5 (diff)
downloadqtlocation-mapboxgl-61d8ecefda3a01d0860746af98d632b73c526d98.tar.gz
[android] Runtime Style Filter enhancements (#6623)
* [android] Additional null check - prevents errors in array conversion * [android] style conversion - delete local refs asap to avoid ref table overflow * [android] Filter - hide concrete implementation classes to avoid confusion
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Filter.java8
-rw-r--r--platform/android/src/style/android_conversion.hpp4
-rw-r--r--platform/android/src/style/value.cpp6
3 files changed, 12 insertions, 6 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Filter.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Filter.java
index 4d9791b125..6f881e4960 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Filter.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Filter.java
@@ -31,7 +31,7 @@ public class Filter {
/**
* Represents a {@link Filter} statement. Can be unary (eg `has()`, etc) or take any number of values.
*/
- public static class SimpleStatement extends Statement {
+ private static class SimpleStatement extends Statement {
private final String key;
private final Object[] values;
@@ -40,7 +40,7 @@ public class Filter {
* @param key the property key
* @param values the values to operate on, if any
*/
- public SimpleStatement(String operator, String key, Object... values) {
+ SimpleStatement(String operator, String key, Object... values) {
super(operator);
this.key = key;
this.values = values;
@@ -63,14 +63,14 @@ public class Filter {
/**
* Represents a collection of {@link Statement}s with an operator that describes their relationship
*/
- public static class CompoundStatement extends Statement {
+ private static class CompoundStatement extends Statement {
private final Statement[] statements;
/**
* @param operator the relationship operator
* @param statements the statements to compound
*/
- public CompoundStatement(String operator, Statement... statements) {
+ CompoundStatement(String operator, Statement... statements) {
super(operator);
this.statements = statements;
}
diff --git a/platform/android/src/style/android_conversion.hpp b/platform/android/src/style/android_conversion.hpp
index 46ee768348..cea7ce6d2a 100644
--- a/platform/android/src/style/android_conversion.hpp
+++ b/platform/android/src/style/android_conversion.hpp
@@ -75,7 +75,9 @@ inline optional<std::string> toString(const mbgl::android::Value& value) {
}
inline optional<Value> toValue(const mbgl::android::Value& value) {
- if (value.isBool()) {
+ if (value.isNull()) {
+ return {};
+ } else if (value.isBool()) {
return { value.toBool() };
} else if (value.isString()) {
return { value.toString() };
diff --git a/platform/android/src/style/value.cpp b/platform/android/src/style/value.cpp
index daad3e998d..c03dd39132 100644
--- a/platform/android/src/style/value.cpp
+++ b/platform/android/src/style/value.cpp
@@ -9,7 +9,11 @@ namespace android {
Value::Value(jni::JNIEnv& env, jni::jobject* _value) : jenv(env), value(_value) {}
- Value::~Value() {}
+ Value::~Value() {
+ if (value) {
+ jni::DeleteLocalRef(jenv, value);
+ }
+ }
bool Value::isNull() const {
return value == nullptr;