Example usage for android.graphics Rect centerY

List of usage examples for android.graphics Rect centerY

Introduction

In this page you can find the example usage for android.graphics Rect centerY.

Prototype

public final int centerY() 

Source Link

Usage

From source file:Main.java

/**
 * Scales a rect about its centroid/*from  w  ww  . j a v a 2s. c  o  m*/
 */
public static void scaleRectAboutCenter(Rect r, float scale) {
    if (scale != 1.0f) {
        int cx = r.centerX();
        int cy = r.centerY();
        r.offset(-cx, -cy);
        r.left = (int) (r.left * scale + 0.5f);
        r.top = (int) (r.top * scale + 0.5f);
        r.right = (int) (r.right * scale + 0.5f);
        r.bottom = (int) (r.bottom * scale + 0.5f);
        r.offset(cx, cy);
    }
}

From source file:org.telegram.ui.ActionBar.Theme.java

public static Drawable createBarSelectorDrawable(int color, boolean masked) {
    Drawable drawable;/*from   ww  w.  ja v a 2s  . c  om*/
    if (Build.VERSION.SDK_INT >= 21) {
        Drawable maskDrawable = null;
        if (masked) {
            maskPaint.setColor(0xffffffff);
            maskDrawable = new Drawable() {
                @Override
                public void draw(Canvas canvas) {
                    android.graphics.Rect bounds = getBounds();
                    canvas.drawCircle(bounds.centerX(), bounds.centerY(), AndroidUtilities.dp(18), maskPaint);
                }

                @Override
                public void setAlpha(int alpha) {

                }

                @Override
                public void setColorFilter(ColorFilter colorFilter) {

                }

                @Override
                public int getOpacity() {
                    return PixelFormat.UNKNOWN;
                }
            };
        }
        ColorStateList colorStateList = new ColorStateList(new int[][] { new int[] {} }, new int[] { color });
        return new RippleDrawable(colorStateList, null, maskDrawable);
    } else {
        StateListDrawable stateListDrawable = new StateListDrawable();
        stateListDrawable.addState(new int[] { android.R.attr.state_pressed }, new ColorDrawable(color));
        stateListDrawable.addState(new int[] { android.R.attr.state_focused }, new ColorDrawable(color));
        stateListDrawable.addState(new int[] { android.R.attr.state_selected }, new ColorDrawable(color));
        stateListDrawable.addState(new int[] { android.R.attr.state_activated }, new ColorDrawable(color));
        stateListDrawable.addState(new int[] {}, new ColorDrawable(0x00000000));
        return stateListDrawable;
    }
}

From source file:com.atwal.wakeup.battery.util.Utilities.java

public static void scaleRectAboutCenter(Rect r, float scale) {
    int cx = r.centerX();
    int cy = r.centerY();
    r.offset(-cx, -cy);//  w w  w .ja v  a2s.  co  m
    Utilities.scaleRect(r, scale);
    r.offset(cx, cy);
}

From source file:com.imczy.customactivitytransition.transition.ShareElemReturnChangePosition.java

@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    if (null == startValues || null == endValues) {
        return null;
    }//  w w  w  . j  ava2  s  . c  o m

    if (startValues.view.getId() > 0) {
        Rect startRect = (Rect) startValues.values.get(PROPNAME_POSITION);
        Rect endRect = (Rect) endValues.values.get(PROPNAME_POSITION);

        final View view = endValues.view;

        Path changePosPath = getPathMotion().getPath(startRect.centerX(), startRect.centerY(),
                endRect.centerX(), endRect.centerY() - endRect.height() / 2);

        ObjectAnimator objectAnimator = ObjectAnimator.ofObject(view, new PropPosition(PointF.class, "position",
                new PointF(startRect.centerX(), startRect.centerY())), null, changePosPath);
        objectAnimator.setInterpolator(new FastOutSlowInInterpolator());

        return objectAnimator;
    }
    return null;

}

From source file:com.imczy.customactivitytransition.transition.ChangePosition.java

@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    if (null == startValues || null == endValues) {
        return null;
    }//from ww w .  j  a  va  2  s. co  m

    if (startValues.view.getId() > 0) {
        Rect startRect = (Rect) startValues.values.get(PROPNAME_POSITION);
        Rect endRect = (Rect) endValues.values.get(PROPNAME_POSITION);

        final View view = endValues.view;

        Path changePosPath = getPathMotion().getPath(startRect.centerX(), startRect.centerY(),
                endRect.centerX(), endRect.centerY());

        int radius = startRect.centerY() - endRect.centerY();

        ObjectAnimator objectAnimator = ObjectAnimator.ofObject(view,
                new PropPosition(PointF.class, "position", new PointF(endRect.centerX(), endRect.centerY())),
                null, changePosPath);
        objectAnimator.setInterpolator(new FastOutSlowInInterpolator());

        return objectAnimator;
    }
    return null;

}

From source file:com.appsimobile.appsii.module.home.SunriseDrawable.java

@Override
public void draw(Canvas canvas) {
    Rect bounds = getBounds();
    if (mIsRtl) {
        canvas.save();// w w w .  ja  v  a 2 s. co m
        canvas.scale(-1, 1, bounds.centerX(), bounds.centerY());
    }
    float pct = drawArc(canvas, bounds);

    if (pct < 0) {
        pct = 0;
    } else if (pct > 1) {
        pct = 1;
    }

    int y = bounds.bottom - mBottomOffset;
    canvas.drawLine(bounds.left + mLeftOffset / 2, y, bounds.right - mRightOffset / 2, y, mLinePaint);

    drawSun(canvas, pct);

    if (mIsRtl) {
        canvas.restore();
    }

}

From source file:org.srr.dev.view.refreshlayout.SwipeProgressBar.java

private boolean draw(Canvas canvas, boolean first) {
    Rect bounds = mBounds;
    final int width = bounds.width();
    final int cx = bounds.centerX();
    final int cy = bounds.centerY();
    boolean drawTriggerWhileFinishing = false;
    boolean drawAgain = false;
    int restoreCount = canvas.save();
    canvas.clipRect(bounds);/*from   w  w w  . j  a va  2s .co m*/

    if (mRunning || (mFinishTime > 0)) {
        long now = AnimationUtils.currentAnimationTimeMillis();
        long elapsed = (now - mStartTime) % ANIMATION_DURATION_MS;
        long iterations = (now - mStartTime) / ANIMATION_DURATION_MS;
        float rawProgress = (elapsed / (ANIMATION_DURATION_MS / 100f));

        // If we're not running anymore, that means we're running through
        // the finish animation.
        if (!mRunning) {
            // If the finish animation is done, don't draw anything, and
            // don't re-post.
            if ((now - mFinishTime) >= FINISH_ANIMATION_DURATION_MS) {
                mFinishTime = 0;
                return false;
            }

            // Otherwise, use a 0 opacity alpha layer to clear the animation
            // from the inside out. This layer will prevent the circles from
            // drawing within its bounds.
            long finishElapsed = (now - mFinishTime) % FINISH_ANIMATION_DURATION_MS;
            float finishProgress = (finishElapsed / (FINISH_ANIMATION_DURATION_MS / 100f));
            float pct = (finishProgress / 100f);
            // Radius of the circle is half of the screen.
            float clearRadius = width / 2 * INTERPOLATOR.getInterpolation(pct);
            if (SUPPORT_CLIP_RECT_DIFFERENCE) {
                mClipRect.set(cx - clearRadius, bounds.top, cx + clearRadius, bounds.bottom);
                canvas.clipRect(mClipRect, Region.Op.DIFFERENCE);
            } else {
                if (first) {
                    // First time left
                    drawAgain = true;
                    mClipRect.set(bounds.left, bounds.top, cx - clearRadius, bounds.bottom);
                } else {
                    // Second time right
                    mClipRect.set(cx + clearRadius, bounds.top, bounds.right, bounds.bottom);
                }
                canvas.clipRect(mClipRect);
            }
            // Only draw the trigger if there is a space in the center of
            // this refreshing view that needs to be filled in by the
            // trigger. If the progress view is just still animating, let it
            // continue animating.
            drawTriggerWhileFinishing = true;
        }

        // First fill in with the last color that would have finished drawing.
        if (iterations == 0) {
            canvas.drawColor(mColor1);
        } else {
            if (rawProgress >= 0 && rawProgress < 25) {
                canvas.drawColor(mColor4);
            } else if (rawProgress >= 25 && rawProgress < 50) {
                canvas.drawColor(mColor1);
            } else if (rawProgress >= 50 && rawProgress < 75) {
                canvas.drawColor(mColor2);
            } else {
                canvas.drawColor(mColor3);
            }
        }

        // Then draw up to 4 overlapping concentric circles of varying radii, based on how far
        // along we are in the cycle.
        // progress 0-50 draw mColor2
        // progress 25-75 draw mColor3
        // progress 50-100 draw mColor4
        // progress 75 (wrap to 25) draw mColor1
        if ((rawProgress >= 0 && rawProgress <= 25)) {
            float pct = (((rawProgress + 25) * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor1, pct);
        }
        if (rawProgress >= 0 && rawProgress <= 50) {
            float pct = ((rawProgress * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor2, pct);
        }
        if (rawProgress >= 25 && rawProgress <= 75) {
            float pct = (((rawProgress - 25) * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor3, pct);
        }
        if (rawProgress >= 50 && rawProgress <= 100) {
            float pct = (((rawProgress - 50) * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor4, pct);
        }
        if ((rawProgress >= 75 && rawProgress <= 100)) {
            float pct = (((rawProgress - 75) * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor1, pct);
        }
        if (mTriggerPercentage > 0 && drawTriggerWhileFinishing) {
            // There is some portion of trigger to draw. Restore the canvas,
            // then draw the trigger. Otherwise, the trigger does not appear
            // until after the bar has finished animating and appears to
            // just jump in at a larger width than expected.
            canvas.restoreToCount(restoreCount);
            restoreCount = canvas.save();
            canvas.clipRect(bounds);
            drawTrigger(canvas, cx, cy);
        }
        // Keep running until we finish out the last cycle.
        ViewCompat.postInvalidateOnAnimation(mParent, bounds.left, bounds.top, bounds.right, bounds.bottom);
    } else {
        // Otherwise if we're in the middle of a trigger, draw that.
        if (mTriggerPercentage > 0 && mTriggerPercentage <= 1.0) {
            drawTrigger(canvas, cx, cy);
        }
    }
    canvas.restoreToCount(restoreCount);
    return drawAgain;
}

From source file:com.hippo.refreshlayout.SwipeProgressBar.java

private boolean draw(Canvas canvas, boolean first) {
    Rect bounds = mBounds;
    final int width = bounds.width();
    final int cx = bounds.centerX();
    final int cy = bounds.centerY();
    final int colors = mColors.length;
    boolean drawTriggerWhileFinishing = false;
    boolean drawAgain = false;
    int restoreCount = canvas.save();
    canvas.clipRect(bounds);/*from   w  w w .jav  a  2  s  . c  o  m*/

    if (mRunning || (mFinishTime > 0)) {
        long now = AnimationUtils.currentAnimationTimeMillis();
        long elapsed = (now - mStartTime) % mAnimationDuration;
        long iterations = (now - mStartTime) / ANIMATION_DURATION_MS_PER_COLOR;
        float rawProgress = (elapsed / (mAnimationDuration / (float) colors));

        // If we're not running anymore, that means we're running through
        // the finish animation.
        if (!mRunning) {
            // If the finish animation is done, don't draw anything, and
            // don't repost.
            if ((now - mFinishTime) >= FINISH_ANIMATION_DURATION_MS) {
                mFinishTime = 0;
                return false;
            }

            // Otherwise, use a 0 opacity alpha layer to clear the animation
            // from the inside out. This layer will prevent the circles from
            // drawing within its bounds.
            long finishElapsed = (now - mFinishTime) % FINISH_ANIMATION_DURATION_MS;
            float finishProgress = (finishElapsed / (FINISH_ANIMATION_DURATION_MS / 100f));
            float pct = (finishProgress / 100f);
            // Radius of the circle is half of the screen.
            float clearRadius = width / 2 * INTERPOLATOR.getInterpolation(pct);
            if (SUPPORT_CLIP_RECT_DIFFERENCE) {
                mClipRect.set(cx - clearRadius, bounds.top, cx + clearRadius, bounds.bottom);
                canvas.clipRect(mClipRect, Region.Op.DIFFERENCE);
            } else {
                if (first) {
                    // First time left
                    drawAgain = true;
                    mClipRect.set(bounds.left, bounds.top, cx - clearRadius, bounds.bottom);
                } else {
                    // Second time right
                    mClipRect.set(cx + clearRadius, bounds.top, bounds.right, bounds.bottom);
                }
                canvas.clipRect(mClipRect);
            }
            // Only draw the trigger if there is a space in the center of
            // this refreshing view that needs to be filled in by the
            // trigger. If the progress view is just still animating, let it
            // continue animating.
            drawTriggerWhileFinishing = true;
        }

        // First fill in with the last color that would have finished drawing.
        if (iterations == 0) {
            canvas.drawColor(mColors[0]);
        } else {
            int index = colors - 1;
            float left = 0.0f;
            float right = 1.0f;
            for (int i = 0; i < colors; ++i) {
                if ((rawProgress >= left && rawProgress < right) || i == colors - 1) {
                    canvas.drawColor(mColors[index]);
                    break;
                }
                index = (index + 1) % colors;
                left += 1.0f;
                right += 1.0f;
            }
        }

        // Then draw up to 4 overlapping concentric circles of varying radii, based on how far
        // along we are in the cycle.
        // progress 0-50 draw mColor2
        // progress 25-75 draw mColor3
        // progress 50-100 draw mColor4
        // progress 75 (wrap to 25) draw mColor1
        if (colors > 1) {
            if ((rawProgress >= 0.0f && rawProgress <= 1.0f)) {
                float pct = (rawProgress + 1.0f) / 2;
                drawCircle(canvas, cx, cy, mColors[0], pct);
            }
            float left = 0.0f;
            float right = 2.0f;
            for (int i = 1; i < colors; ++i) {
                if (rawProgress >= left && rawProgress <= right) {
                    float pct = (rawProgress - i + 1.0f) / 2;
                    drawCircle(canvas, cx, cy, mColors[i], pct);
                }
                left += 1.0f;
                right += 1.0f;
            }
            if ((rawProgress >= colors - 1.0f && rawProgress <= colors)) {
                float pct = (rawProgress - colors + 1.0f) / 2;
                drawCircle(canvas, cx, cy, mColors[0], pct);
            }
        }
        if (mTriggerPercentage > 0 && drawTriggerWhileFinishing) {
            // There is some portion of trigger to draw. Restore the canvas,
            // then draw the trigger. Otherwise, the trigger does not appear
            // until after the bar has finished animating and appears to
            // just jump in at a larger width than expected.
            canvas.restoreToCount(restoreCount);
            restoreCount = canvas.save();
            canvas.clipRect(bounds);
            drawTrigger(canvas, cx, cy);
        }
        // Keep running until we finish out the last cycle.
        ViewCompat.postInvalidateOnAnimation(mParent, bounds.left, bounds.top, bounds.right, bounds.bottom);
    } else {
        // Otherwise if we're in the middle of a trigger, draw that.
        if (mTriggerPercentage > 0 && mTriggerPercentage <= 1.0) {
            drawTrigger(canvas, cx, cy);
        }
    }
    canvas.restoreToCount(restoreCount);
    return drawAgain;
}

From source file:com.callba.phone.widget.refreshlayout.SwipeProgressBar.java

void draw(Canvas canvas) {
    Rect bounds = mBounds;
    final int width = bounds.width();
    final int height = bounds.height();
    final int cx = bounds.centerX();
    final int cy = bounds.centerY();
    boolean drawTriggerWhileFinishing = false;
    int restoreCount = canvas.save();
    canvas.clipRect(bounds);//from ww w  .  ja v  a  2s . c o m

    if (mRunning || (mFinishTime > 0)) {
        long now = AnimationUtils.currentAnimationTimeMillis();
        long elapsed = (now - mStartTime) % ANIMATION_DURATION_MS;
        long iterations = (now - mStartTime) / ANIMATION_DURATION_MS;
        float rawProgress = (elapsed / (ANIMATION_DURATION_MS / 100f));

        // If we're not running anymore, that means we're running through
        // the finish animation.
        if (!mRunning) {
            // If the finish animation is done, don't draw anything, and
            // don't repost.
            if ((now - mFinishTime) >= FINISH_ANIMATION_DURATION_MS) {
                mFinishTime = 0;
                return;
            }

            // Otherwise, use a 0 opacity alpha layer to clear the animation
            // from the inside out. This layer will prevent the circles from
            // drawing within its bounds.
            long finishElapsed = (now - mFinishTime) % FINISH_ANIMATION_DURATION_MS;
            float finishProgress = (finishElapsed / (FINISH_ANIMATION_DURATION_MS / 100f));
            float pct = (finishProgress / 100f);
            // Radius of the community is half of the screen.
            float clearRadius = width / 2 * INTERPOLATOR.getInterpolation(pct);
            mClipRect.set(cx - clearRadius, 0, cx + clearRadius, height);
            canvas.saveLayerAlpha(mClipRect, 0, 0);
            // Only draw the trigger if there is a space in the center of
            // this refreshing view that needs to be filled in by the
            // trigger. If the progress view is just still animating, let it
            // continue animating.
            drawTriggerWhileFinishing = true;
        }

        // First fill in with the last color that would have finished drawing.
        if (iterations == 0) {
            canvas.drawColor(mColor1);
        } else {
            if (rawProgress >= 0 && rawProgress < 25) {
                canvas.drawColor(mColor4);
            } else if (rawProgress >= 25 && rawProgress < 50) {
                canvas.drawColor(mColor1);
            } else if (rawProgress >= 50 && rawProgress < 75) {
                canvas.drawColor(mColor2);
            } else {
                canvas.drawColor(mColor3);
            }
        }

        // Then draw up to 4 overlapping concentric circles of varying radii, based on how far
        // along we are in the cycle.
        // progress 0-50 draw mColor2
        // progress 25-75 draw mColor3
        // progress 50-100 draw mColor4
        // progress 75 (wrap to 25) draw mColor1
        if ((rawProgress >= 0 && rawProgress <= 25)) {
            float pct = (((rawProgress + 25) * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor1, pct);
        }
        if (rawProgress >= 0 && rawProgress <= 50) {
            float pct = ((rawProgress * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor2, pct);
        }
        if (rawProgress >= 25 && rawProgress <= 75) {
            float pct = (((rawProgress - 25) * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor3, pct);
        }
        if (rawProgress >= 50 && rawProgress <= 100) {
            float pct = (((rawProgress - 50) * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor4, pct);
        }
        if ((rawProgress >= 75 && rawProgress <= 100)) {
            float pct = (((rawProgress - 75) * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor1, pct);
        }
        if (mTriggerPercentage > 0 && drawTriggerWhileFinishing) {
            // There is some portion of trigger to draw. Restore the canvas,
            // then draw the trigger. Otherwise, the trigger does not appear
            // until after the bar has finished animating and appears to
            // just jump in at a larger width than expected.
            canvas.restoreToCount(restoreCount);
            restoreCount = canvas.save();
            canvas.clipRect(bounds);
            drawTrigger(canvas, cx, cy);
        }
        // Keep running until we finish out the last cycle.
        ViewCompat.postInvalidateOnAnimation(mParent, bounds.left, bounds.top, bounds.right, bounds.bottom);
    } else {
        // Otherwise if we're in the middle of a trigger, draw that.
        if (mTriggerPercentage > 0 && mTriggerPercentage <= 1.0) {
            drawTrigger(canvas, cx, cy);
        }
    }
    canvas.restoreToCount(restoreCount);
}

From source file:com.cyan.widget.refreshlayout.SwipeProgressBar.java

void draw(Canvas canvas) {
    Rect bounds = mBounds;
    final int width = bounds.width();
    final int height = bounds.height();
    final int cx = bounds.centerX();
    final int cy = bounds.centerY();
    boolean drawTriggerWhileFinishing = false;
    int restoreCount = canvas.save();
    canvas.clipRect(bounds);//from   w  w  w .jav  a 2  s  .com

    if (mRunning || (mFinishTime > 0)) {
        long now = AnimationUtils.currentAnimationTimeMillis();
        long elapsed = (now - mStartTime) % ANIMATION_DURATION_MS;
        long iterations = (now - mStartTime) / ANIMATION_DURATION_MS;
        float rawProgress = (elapsed / (ANIMATION_DURATION_MS / 100f));

        // If we're not running anymore, that means we're running through
        // the finish animation.
        if (!mRunning) {
            // If the finish animation is done, don't draw anything, and
            // don't repost.
            if ((now - mFinishTime) >= FINISH_ANIMATION_DURATION_MS) {
                mFinishTime = 0;
                return;
            }

            // Otherwise, use a 0 opacity alpha layer to clear the animation
            // from the inside out. This layer will prevent the circles from
            // drawing within its bounds.
            long finishElapsed = (now - mFinishTime) % FINISH_ANIMATION_DURATION_MS;
            float finishProgress = (finishElapsed / (FINISH_ANIMATION_DURATION_MS / 100f));
            float pct = (finishProgress / 100f);
            // Radius of the circle is half of the screen.
            float clearRadius = width / 2 * INTERPOLATOR.getInterpolation(pct);
            mClipRect.set(cx - clearRadius, 0, cx + clearRadius, height);
            canvas.saveLayerAlpha(mClipRect, 0, 0);
            // Only draw the trigger if there is a space in the center of
            // this refreshing view that needs to be filled in by the
            // trigger. If the progress view is just still animating, let it
            // continue animating.
            drawTriggerWhileFinishing = true;
        }

        // First fill in with the last color that would have finished drawing.
        if (iterations == 0) {
            canvas.drawColor(mColor1);
        } else {
            if (rawProgress >= 0 && rawProgress < 25) {
                canvas.drawColor(mColor4);
            } else if (rawProgress >= 25 && rawProgress < 50) {
                canvas.drawColor(mColor1);
            } else if (rawProgress >= 50 && rawProgress < 75) {
                canvas.drawColor(mColor2);
            } else {
                canvas.drawColor(mColor3);
            }
        }

        // Then draw up to 4 overlapping concentric circles of varying radii, based on how far
        // along we are in the cycle.
        // progress 0-50 draw mColor2
        // progress 25-75 draw mColor3
        // progress 50-100 draw mColor4
        // progress 75 (wrap to 25) draw mColor1
        if ((rawProgress >= 0 && rawProgress <= 25)) {
            float pct = (((rawProgress + 25) * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor1, pct);
        }
        if (rawProgress >= 0 && rawProgress <= 50) {
            float pct = ((rawProgress * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor2, pct);
        }
        if (rawProgress >= 25 && rawProgress <= 75) {
            float pct = (((rawProgress - 25) * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor3, pct);
        }
        if (rawProgress >= 50 && rawProgress <= 100) {
            float pct = (((rawProgress - 50) * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor4, pct);
        }
        if ((rawProgress >= 75 && rawProgress <= 100)) {
            float pct = (((rawProgress - 75) * 2) / 100f);
            drawCircle(canvas, cx, cy, mColor1, pct);
        }
        if (mTriggerPercentage > 0 && drawTriggerWhileFinishing) {
            // There is some portion of trigger to draw. Restore the canvas,
            // then draw the trigger. Otherwise, the trigger does not appear
            // until after the bar has finished animating and appears to
            // just jump in at a larger width than expected.
            canvas.restoreToCount(restoreCount);
            restoreCount = canvas.save();
            canvas.clipRect(bounds);
            drawTrigger(canvas, cx, cy);
        }
        // Keep running until we finish out the last cycle.
        ViewCompat.postInvalidateOnAnimation(mParent, bounds.left, bounds.top, bounds.right, bounds.bottom);
    } else {
        // Otherwise if we're in the middle of a trigger, draw that.
        if (mTriggerPercentage > 0 && mTriggerPercentage <= 1.0) {
            drawTrigger(canvas, cx, cy);
        }
    }
    canvas.restoreToCount(restoreCount);
}