Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] - transition options for layer properties #8509

Merged
merged 1 commit into from
Mar 31, 2017

Conversation

tobrun
Copy link
Member

@tobrun tobrun commented Mar 23, 2017

Closes #8015

This PR adds TransitionOptions to the Android bindings for Layer Properties that support it

Todo to finish:

  • replace jni::Array<jni::jlong> return type with jni::Object<jni::ObjectTag> jni::Object<TransformOptions>
  • add sample to Test app

cc @zugaldia @ericrwolfe

@tobrun tobrun added Android Mapbox Maps SDK for Android runtime styling labels Mar 23, 2017
@tobrun tobrun added this to the android-v5.1.0 milestone Mar 23, 2017
@tobrun tobrun self-assigned this Mar 23, 2017
@mention-bot
Copy link

@tobrun, thanks for your PR! By analyzing this pull request, we identified @jfirebaugh to be potential reviewers.

@tobrun tobrun added the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Mar 23, 2017
@tobrun tobrun force-pushed the tvn-transitionoptions-property branch 2 times, most recently from 7181f73 to 22758cf Compare March 23, 2017 15:56
Copy link
Contributor

@ivovandongen ivovandongen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobrun Looks good. Just some cleaning up to do.


mbgl::style::TransitionOptions options = layer.as<mbgl::style::FillLayer>()->FillLayer::getFillOpacityTransition();
jlong durations[2];
durations[0] = options.duration.value_or(mbgl::Duration::zero()).count();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just return the actual object in a typed manner. Don't think there is a noticeable overhead in creating an object instead of an array and filling it up and then creating the object from that jvm side.

METHOD(&CircleLayer::getCircleStrokeWidth, "nativeGetCircleStrokeWidth"),

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT. Could you remove the blank lines?

jni::Object<jni::ObjectTag> FillLayer::getFillOpacity(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
Result<jni::jobject*> converted = convert<jni::jobject*>(env, layer.as<mbgl::style::FillLayer>()->FillLayer::getFillOpacity());
return jni::Object<jni::ObjectTag>(*converted);
}

jni::Array<jni::jlong> FillLayer::getFillOpacityTransition(jni::JNIEnv& env) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Let's just use the typed object


mbgl::style::TransitionOptions options = layer.as<mbgl::style::FillLayer>()->FillLayer::getFillTranslateTransition();
jlong durations[2];
durations[0] = options.duration.value_or(mbgl::Duration::zero()).count();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the actual unit instead of Duration so it's clear on first glance what we're talking about?

}

void FillLayer::setFillTranslateTransition(jni::JNIEnv& env, jlong duration, jlong delay) {
(void) env;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove this line and instead remove the parameter name?

@@ -40,84 +41,251 @@ namespace android {
return jni::Object<jni::ObjectTag>(*converted);
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant blank lines

@tobrun tobrun force-pushed the tvn-transitionoptions-property branch 3 times, most recently from 7188b40 to 1a0b019 Compare March 31, 2017 14:01
@tobrun tobrun removed the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Mar 31, 2017
Copy link
Contributor

@ivovandongen ivovandongen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

<% if (property.transition) { -%>
void set<%- camelize(property.name) %>Transition(jni::JNIEnv&, jlong duration, jlong delay);
jni::Object<TransitionOptions> get<%- camelize(property.name) %>Transition(jni::JNIEnv&);
<% } -%>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very small nit; one empty line here would be just perfection

@tobrun tobrun force-pushed the tvn-transitionoptions-property branch from 1a0b019 to ea0fb93 Compare March 31, 2017 14:14
[android] fixup highlevel bindings for transition options

finish integration
@tobrun tobrun force-pushed the tvn-transitionoptions-property branch from ea0fb93 to 94a7146 Compare March 31, 2017 15:16
@tobrun tobrun merged commit 939526b into master Mar 31, 2017
@tobrun tobrun deleted the tvn-transitionoptions-property branch March 31, 2017 15:51
@tobrun tobrun mentioned this pull request May 2, 2017
12 tasks
@tobrun tobrun mentioned this pull request Jun 9, 2017
12 tasks
@tobrun tobrun mentioned this pull request Jun 21, 2017
11 tasks
@tobrun tobrun mentioned this pull request Jun 30, 2017
16 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android runtime styling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants