com.robotium.solo.Illustration Maven / Gradle / Ivy
package com.robotium.solo;
import java.util.ArrayList;
import android.view.MotionEvent;
/**
* A class used to pass Illustrations to an Illustrator.
* Compatible with specific MotionEvent.TOOL_TYPEs
*
* @author Jake Kuli, [email protected]
*/
public class Illustration {
private final int toolType;
private final ArrayList points;
private Illustration(Builder builder) {
this.toolType = builder.builderToolType;
this.points = builder.builderPoints;
}
/**
* Builder class to build illustrations
*/
public static class Builder {
private int builderToolType = MotionEvent.TOOL_TYPE_FINGER;
private ArrayList builderPoints = new ArrayList();
/**
* Sets the tool type to use when illustrating.
* By default this is set to MotionEvent.TOOL_TYPE_FINGER
* @param toolType an int from MotionEvent's static int TOOL_TYPEs
*/
public Builder setToolType(int toolType) {
builderToolType = toolType;
return this;
}
public Builder addPoint(float x, float y, float pressure) {
builderPoints.add(new PressurePoint(x, y, pressure));
return this;
}
public Illustration build() {
return new Illustration(this);
}
}
public ArrayList getPoints() {
return points;
}
public int getToolType() {
return toolType;
}
}