/**
   * Draw this series in the current position calculated by the ValueAnimator.
   *
   * @param canvas Canvas used to draw
   * @param bounds Bounds to be used to draw the arc
   * @return true if drawing has already been handled
   */
  public boolean draw(Canvas canvas, RectF bounds) {
    if (!mVisible) {
      return true;
    }

    if (bounds == null || bounds.isEmpty()) {
      throw new IllegalArgumentException("Drawing bounds can not be null or empty");
    }

    processBoundsChange(bounds);

    if (mDrawMode == DecoEvent.EventType.EVENT_EFFECT) {
      // Delegate the drawing to the ArcEffect as required
      if (mEffect != null) {
        mEffect.draw(canvas, mBoundsInset, mPercentComplete, mAngleStart, mAngleSweep);
      }
      return true;
    }

    processRevealEffect();

    if (mColorAnimate != null) {
      mPaint.setColor(mColorAnimate.getColorCurrent(mPercentComplete));
    } else if (mPaint.getColor() != getSeriesItem().getColor()) {
      mPaint.setColor(getSeriesItem().getColor());
    }

    return false;
  }
예제 #2
0
 /**
  * Check whether rectangle is ignorable or not.
  *
  * @return Whether rectangle is ignorable or not.
  */
 public final boolean isIgnorable() {
   return (m_Rect.isEmpty()
       || m_Rect.left > 1
       || m_Rect.top > 1
       || m_Rect.right < 0
       || m_Rect.bottom < 0
       || Float.isNaN(m_Weight));
 }
  @SuppressWarnings("UnusedReturnValue")
  public RectF drawLabel(Canvas canvas, RectF bounds, float anglePercent) {

    if (!mVisible) {
      return null;
    }

    if (bounds == null || bounds.isEmpty()) {
      throw new IllegalArgumentException("Drawing bounds can not be null or empty");
    }
    if (mSeriesItem.getSeriesLabel() != null) {
      return mSeriesItem
          .getSeriesLabel()
          .draw(canvas, bounds, anglePercent, getPositionPercent(), mPositionCurrentEnd);
    }
    return null;
  }