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

Commit

Permalink
[android] - allow literal expression property arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Łukasz Paczos committed May 28, 2018
1 parent 22741a0 commit 6f5fe86
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3582,6 +3582,12 @@ Object toValue() {
return literal;
}

@NonNull
@Override
public Object[] toArray() {
return new Object[] {"literal", literal};
}

/**
* Returns a string representation of the expression literal.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.support.annotation.NonNull;

import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.mapbox.mapboxsdk.style.expressions.Expression;
import com.mapbox.mapboxsdk.utils.ThreadUtils;
Expand All @@ -27,7 +26,7 @@ public Layer() {
/**
* Validates if layer interaction is happening on the UI thread
*/
protected void checkThread(){
protected void checkThread() {
ThreadUtils.checkThread("Layer");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,17 @@ public void testCompositeFunction() {
});
}

@Test
public void testLiteralProperty() {
validateTestSetup();
setupStyle();
invoke(mapboxMap, (uiController, mapboxMap) -> {
layer.setProperties(
fillColor(literal("#4286f4"))
);
});
}

private void setupStyle() {
invoke(mapboxMap, (uiController, mapboxMap) -> {
// Add a source
Expand Down

0 comments on commit 6f5fe86

Please sign in to comment.