summaryrefslogtreecommitdiff
path: root/platform/android/src
diff options
context:
space:
mode:
authorŁukasz Paczos <lukas.paczos@gmail.com>2018-11-07 17:17:26 +0100
committerŁukasz Paczos <lukasz.paczos@mapbox.com>2018-11-20 12:22:16 +0100
commit9ac444a08d9701dc7b0da41859842a77d7be8e00 (patch)
tree08ab99d6caa7a24a9106382eedcc5812bf2c1811 /platform/android/src
parent1d73bda00d1e4c18ef32eac5053afa4cc9bc4b0a (diff)
downloadqtlocation-mapboxgl-9ac444a08d9701dc7b0da41859842a77d7be8e00.tar.gz
[android] removing plain text getter for "text-field"
Diffstat (limited to 'platform/android/src')
-rw-r--r--platform/android/src/style/formatted.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/platform/android/src/style/formatted.cpp b/platform/android/src/style/formatted.cpp
index ecbc7be1c8..8659e6961e 100644
--- a/platform/android/src/style/formatted.cpp
+++ b/platform/android/src/style/formatted.cpp
@@ -18,21 +18,28 @@ jni::Local<jni::Object<Formatted>> Formatted::New(jni::JNIEnv& env, const style:
auto section = value.sections.at(i);
auto text = jni::Make<jni::String>(env, section.text);
- double fontScale = 1.0;
- if (section.fontScale) {
- fontScale = section.fontScale.value();
- }
-
- if (section.fontStack) {
+ if (section.fontStack && section.fontScale) {
+ double fontScale = section.fontScale.value();
+ auto fontStack = jni::Array<jni::String>::New(env, section.fontStack.value().size());
+ for (std::size_t j = 0; j < section.fontStack.value().size(); j++) {
+ fontStack.Set(env, j, jni::Make<jni::String>(env, section.fontStack.value().at(j)));
+ }
+ static auto formattedSectionConstructor = formattedSection.GetConstructor<jni::String, jni::Number, jni::Array<jni::String>>(env);
+ sections.Set(env, i, formattedSection.New(env, formattedSectionConstructor, text, jni::Box(env, fontScale), fontStack));
+ } else if (section.fontScale) {
+ double fontScale = section.fontScale.value();
+ static auto formattedSectionConstructor = formattedSection.GetConstructor<jni::String, jni::Number>(env);
+ sections.Set(env, i, formattedSection.New(env, formattedSectionConstructor, text, jni::Box(env, fontScale)));
+ } else if (section.fontStack) {
auto fontStack = jni::Array<jni::String>::New(env, section.fontStack.value().size());
for (std::size_t j = 0; j < section.fontStack.value().size(); j++) {
fontStack.Set(env, j, jni::Make<jni::String>(env, section.fontStack.value().at(j)));
}
- static auto formattedSectionConstructor = formattedSection.GetConstructor<jni::String, double, jni::Array<jni::String>>(env);
- sections.Set(env, i, formattedSection.New(env, formattedSectionConstructor, text, fontScale, fontStack));
+ static auto formattedSectionConstructor = formattedSection.GetConstructor<jni::String, jni::Array<jni::String>>(env);
+ sections.Set(env, i, formattedSection.New(env, formattedSectionConstructor, text, fontStack));
} else {
- static auto formattedSectionConstructor = formattedSection.GetConstructor<jni::String, double>(env);
- sections.Set(env, i, formattedSection.New(env, formattedSectionConstructor, text, fontScale));
+ static auto formattedSectionConstructor = formattedSection.GetConstructor<jni::String>(env);
+ sections.Set(env, i, formattedSection.New(env, formattedSectionConstructor, text));
}
}