Ejemplo n.º 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();
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 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;
 }