[android] #5279 - expose MarkerView alpha

This commit is contained in:
Tobrun Van Nuland
2016-06-13 13:05:25 +02:00
parent 4f622a75db
commit 7942ce9455
5 changed files with 37 additions and 3 deletions

View File

@@ -29,6 +29,7 @@ public abstract class BaseMarkerViewOptions<U extends MarkerView, T extends Base
protected float rotation;
protected boolean visible = true;
protected boolean selected;
protected float alpha = 1.0f;
/**
* Default constructor
@@ -132,13 +133,24 @@ public abstract class BaseMarkerViewOptions<U extends MarkerView, T extends Base
* Set the visibility state of the MarkerView.
*
* @param visible the visible state
* @return the object for which the method was calleds
* @return the object for which the method was called
*/
public T visible(boolean visible) {
this.visible = visible;
return getThis();
}
/**
* Set the alpha of the MarkerView.
*
* @param alpha the alpha value
* @return the object for which the method was called
*/
public T alpha(float alpha) {
this.alpha = alpha;
return getThis();
}
/**
* Get the geographical location of the MarkerView.
*
@@ -238,6 +250,15 @@ public abstract class BaseMarkerViewOptions<U extends MarkerView, T extends Base
return visible;
}
/**
* Get the alpha of the MarkerView.
*
* @return the alpha value
*/
public float getAlpha() {
return alpha;
}
/**
* Get the instance of the object for which this method was called.
*

View File

@@ -30,6 +30,7 @@ public class MarkerViewOptions extends BaseMarkerViewOptions<MarkerView, MarkerV
infoWindowAnchor(in.readFloat(), in.readFloat());
rotation(in.readFloat());
visible(in.readByte() != 0);
alpha(in.readFloat());
if (in.readByte() != 0) {
// this means we have an icon
String iconId = in.readString();
@@ -61,6 +62,7 @@ public class MarkerViewOptions extends BaseMarkerViewOptions<MarkerView, MarkerV
out.writeFloat(getInfoWindowAnchorV());
out.writeFloat(getRotation());
out.writeByte((byte) (isVisible() ? 1 : 0));
out.writeFloat(alpha);
Icon icon = getIcon();
out.writeByte((byte) (icon != null ? 1 : 0));
if (icon != null) {
@@ -80,6 +82,7 @@ public class MarkerViewOptions extends BaseMarkerViewOptions<MarkerView, MarkerV
marker.setInfoWindowAnchor(infoWindowAnchorU, infoWindowAnchorV);
marker.setRotation(rotation);
marker.setVisible(visible);
marker.setAlpha(alpha);
return marker;
}