All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.robotium.solo.Illustration Maven / Gradle / Ivy

There is a newer version: 5.6.3
Show newest version
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;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy