Example #1
0
 /**
  * Sets padding for this shape, defined by a Rect object. Define the padding in the Rect object
  * as: left, top, right, bottom.
  */
 public void setPadding(Rect padding) {
   if (padding == null) {
     mShapeState.mPadding = null;
   } else {
     if (mShapeState.mPadding == null) {
       mShapeState.mPadding = new Rect();
     }
     mShapeState.mPadding.set(padding);
   }
   invalidateSelf();
 }
Example #2
0
 /**
  * Sets padding for the shape.
  *
  * @param left padding for the left side (in pixels)
  * @param top padding for the top (in pixels)
  * @param right padding for the right side (in pixels)
  * @param bottom padding for the bottom (in pixels)
  */
 public void setPadding(int left, int top, int right, int bottom) {
   if ((left | top | right | bottom) == 0) {
     mShapeState.mPadding = null;
   } else {
     if (mShapeState.mPadding == null) {
       mShapeState.mPadding = new Rect();
     }
     mShapeState.mPadding.set(left, top, right, bottom);
   }
   invalidateSelf();
 }
Example #3
0
 @Override
 public Drawable mutate() {
   if (!mMutated && super.mutate() == this) {
     mShapeState.mPaint = new Paint(mShapeState.mPaint);
     mShapeState.mPadding = new Rect(mShapeState.mPadding);
     try {
       mShapeState.mShape = mShapeState.mShape.clone();
     } catch (CloneNotSupportedException e) {
       return null;
     }
     mMutated = true;
   }
   return this;
 }
  public void move() {

    state.move();
  }
Example #5
0
 /**
  * Sets a ShaderFactory to which requests for a {@link android.graphics.Shader} object will be
  * made.
  *
  * @param fact an instance of your ShaderFactory implementation
  */
 public void setShaderFactory(ShaderFactory fact) {
   mShapeState.mShaderFactory = fact;
 }
Example #6
0
 /** Sets the Shape of this ShapeDrawable. */
 public void setShape(Shape s) {
   mShapeState.mShape = s;
   updateShape();
 }
Example #7
0
  /**
   * Creates a ShapeDrawable with a specified Shape.
   *
   * @param s the Shape that this ShapeDrawable should be
   */
  public ShapeDrawable(Shape s) {
    this((ShapeState) null);

    mShapeState.mShape = s;
  }
Example #8
0
 @Override
 public ConstantState getConstantState() {
   mShapeState.mChangingConfigurations = getChangingConfigurations();
   return mShapeState;
 }
Example #9
0
 /**
  * Set the alpha level for this drawable [0..255]. Note that this drawable also has a color in its
  * paint, which has an alpha as well. These two values are automatically combined during drawing.
  * Thus if the color's alpha is 75% (i.e. 192) and the drawable's alpha is 50% (i.e. 128), then
  * the combined alpha that will be used during drawing will be 37.5% (i.e. 96).
  */
 @Override
 public void setAlpha(int alpha) {
   mShapeState.mAlpha = alpha;
   invalidateSelf();
 }
Example #10
0
 /**
  * Sets the intrinsic (default) height for this shape.
  *
  * @param height the intrinsic height (in pixels)
  */
 public void setIntrinsicHeight(int height) {
   mShapeState.mIntrinsicHeight = height;
   invalidateSelf();
 }
Example #11
0
 /**
  * Sets the intrinsic (default) width for this shape.
  *
  * @param width the intrinsic width (in pixels)
  */
 public void setIntrinsicWidth(int width) {
   mShapeState.mIntrinsicWidth = width;
   invalidateSelf();
 }