Example usage for android.graphics Canvas save

List of usage examples for android.graphics Canvas save

Introduction

In this page you can find the example usage for android.graphics Canvas save.

Prototype

public int save() 

Source Link

Document

Saves the current matrix and clip onto a private stack.

Usage

From source file:com.aizou.core.widget.pagerIndicator.indicator.FixedIndicatorView.java

private void drawSlideBar(Canvas canvas) {
    if (mAdapter == null || scrollBar == null) {
        return;/*from  www.ja va2s .  c  o  m*/
    }
    final int count = mAdapter.getCount();
    if (count == 0) {
        return;
    }
    if (getCurrentItem() >= count) {
        setCurrentItem(count - 1);
        return;
    }
    float offsetX = 0;
    int offsetY = 0;
    switch (this.scrollBar.getGravity()) {
    case CENTENT_BACKGROUND:
    case CENTENT:
        offsetY = (getHeight() - scrollBar.getHeight(getHeight())) / 2;

        break;
    case TOP:
    case TOP_FLOAT:
        offsetY = 0;
        break;
    case BOTTOM:
    case BOTTOM_FLOAT:
    default:
        offsetY = getHeight() - scrollBar.getHeight(getHeight());
        break;
    }
    View currentView = null;
    if (!inRun.isFinished() && inRun.computeScrollOffset()) {
        offsetX = inRun.getCurrentX();
        int position = 0;
        for (int i = 0; i < count; i++) {
            currentView = getChildAt(i);
            if (currentView.getLeft() <= offsetX && offsetX < currentView.getRight()) {
                position = i;
                break;
            }
        }
        int width = currentView.getWidth();
        int positionOffsetPixels = (int) (offsetX - currentView.getLeft());
        float positionOffset = (offsetX - currentView.getLeft()) / width;
        notifyPageScrolled(position, positionOffset, positionOffsetPixels);
    } else if (mPositionOffset - 0.0f > 0.01) {
        currentView = getChildAt(mPosition);
        int width = currentView.getWidth();
        offsetX = currentView.getLeft() + width * mPositionOffset;
        notifyPageScrolled(mPosition, mPositionOffset, mPositionOffsetPixels);
    } else {
        currentView = getChildAt(mSelectedTabIndex);
        if (currentView == null) {
            return;
        }
        offsetX = currentView.getLeft();
    }
    int tabWidth = currentView.getWidth();
    int width = scrollBar.getWidth(tabWidth);
    width = Math.min(tabWidth, width);
    offsetX += (tabWidth - width) / 2;
    int saveCount = canvas.save();
    canvas.translate(offsetX, offsetY);
    canvas.clipRect(0, 0, width, scrollBar.getHeight(getHeight())); // needed

    int preHeight = scrollBar.getSlideView().getHeight();
    int preWidth = scrollBar.getSlideView().getWidth();
    if (preHeight != scrollBar.getHeight(getHeight()) || preWidth != scrollBar.getWidth(tabWidth)) {
        measureScrollBar(true);
    }

    scrollBar.getSlideView().draw(canvas);
    canvas.restoreToCount(saveCount);
}

From source file:de.tum.in.tumcampus.auxiliary.calendar.DayView.java

@Override
protected void onDraw(Canvas canvas) {
    if (mRemeasure) {
        remeasure(getWidth(), getHeight());
        mRemeasure = false;//from w  w w. jav  a 2 s.  c om
    }
    canvas.save();

    float yTranslate = -mViewStartY + DAY_HEADER_HEIGHT;
    // offset canvas by the current drag and header position
    canvas.translate(-mViewStartX, yTranslate);
    // clip to everything below the allDay area
    Rect dest = mDestRect;
    dest.top = (int) (mFirstCell - yTranslate);
    dest.bottom = (int) (mViewHeight - yTranslate);
    dest.left = 0;
    dest.right = mViewWidth;
    canvas.save();
    canvas.clipRect(dest);
    // Draw the movable part of the view
    doDraw(canvas);
    // restore to having no clip
    canvas.restore();

    if ((mTouchMode & TOUCH_MODE_HSCROLL) != 0) {
        float xTranslate;
        if (mViewStartX > 0) {
            xTranslate = mViewWidth;
        } else {
            xTranslate = -mViewWidth;
        }
        // Move the canvas around to prep it for the next view
        // specifically, shift it by a screen and undo the
        // yTranslation which will be redone in the nextView's onDraw().
        canvas.translate(xTranslate, -yTranslate);
        DayView nextView = (DayView) mViewSwitcher.getNextView();

        // Prevent infinite recursive calls to onDraw().
        nextView.mTouchMode = TOUCH_MODE_INITIAL_STATE;

        nextView.onDraw(canvas);
        // Move it back for this view
        canvas.translate(-xTranslate, 0);
    } else {
        // If we drew another view we already translated it back
        // If we didn't draw another view we should be at the edge of the
        // screen
        canvas.translate(mViewStartX, -yTranslate);
    }

    // Draw the fixed areas (that don't scroll) directly to the canvas.
    drawAfterScroll(canvas);
    mComputeSelectedEvents = false;

    // Draw overscroll glow
    if (!mEdgeEffectTop.isFinished()) {
        if (DAY_HEADER_HEIGHT != 0) {
            canvas.translate(0, DAY_HEADER_HEIGHT);
        }
        if (mEdgeEffectTop.draw(canvas)) {
            invalidate();
        }
        if (DAY_HEADER_HEIGHT != 0) {
            canvas.translate(0, -DAY_HEADER_HEIGHT);
        }
    }
    if (!mEdgeEffectBottom.isFinished()) {
        canvas.rotate(180, mViewWidth / 2, mViewHeight / 2);
        if (mEdgeEffectBottom.draw(canvas)) {
            invalidate();
        }
    }
    canvas.restore();
}

From source file:com.bettervectordrawable.lib.graphics.drawable.VectorDrawable.java

@Override
public void draw(Canvas canvas) {
    // We will offset the bounds for drawBitmap, so copyBounds() here instead
    // of getBounds().
    copyBounds(mTmpBounds);/*from w  w w . j ava2  s. com*/
    if (mTmpBounds.width() <= 0 || mTmpBounds.height() <= 0) {
        // Nothing to draw
        return;
    }
    // Color filters always override tint filters.
    final ColorFilter colorFilter = (mColorFilter == null ? mTintFilter : mColorFilter);
    // The imageView can scale the canvas in different ways, in order to
    // avoid blurry scaling, we have to draw into a bitmap with exact pixel
    // size first. This bitmap size is determined by the bounds and the
    // canvas scale.
    canvas.getMatrix(mTmpMatrix);
    mTmpMatrix.getValues(mTmpFloats);
    float canvasScaleX = Math.abs(mTmpFloats[Matrix.MSCALE_X]);
    float canvasScaleY = Math.abs(mTmpFloats[Matrix.MSCALE_Y]);
    int scaledWidth = (int) (mTmpBounds.width() * canvasScaleX);
    int scaledHeight = (int) (mTmpBounds.height() * canvasScaleY);
    scaledWidth = Math.min(MAX_CACHED_BITMAP_SIZE, scaledWidth);
    scaledHeight = Math.min(MAX_CACHED_BITMAP_SIZE, scaledHeight);
    if (scaledWidth <= 0 || scaledHeight <= 0) {
        return;
    }
    final int saveCount = canvas.save();
    canvas.translate(mTmpBounds.left, mTmpBounds.top);
    // Handle RTL mirroring.
    final boolean needMirroring = needMirroring();
    if (needMirroring) {
        canvas.translate(mTmpBounds.width(), 0);
        canvas.scale(-1.0f, 1.0f);
    }
    // At this point, canvas has been translated to the right position.
    // And we use this bound for the destination rect for the drawBitmap, so
    // we offset to (0, 0);
    mTmpBounds.offsetTo(0, 0);
    mVectorState.createCachedBitmapIfNeeded(scaledWidth, scaledHeight);
    if (!mAllowCaching) {
        mVectorState.updateCachedBitmap(scaledWidth, scaledHeight);
    } else {
        if (!mVectorState.canReuseCache()) {
            mVectorState.updateCachedBitmap(scaledWidth, scaledHeight);
            mVectorState.updateCacheStates();
        }
    }
    mVectorState.drawCachedBitmapWithRootAlpha(canvas, colorFilter, mTmpBounds);
    canvas.restoreToCount(saveCount);
}

From source file:com.example.view.VerticalViewPager.java

@Override
public void draw(Canvas canvas) {
    // XXX/*from w  w w . j  a  va 2 s.co m*/
    super.draw(canvas);
    boolean needsInvalidate = false;

    final int overScrollMode = ViewCompat.getOverScrollMode(this);
    if (overScrollMode == ViewCompat.OVER_SCROLL_ALWAYS
            || (overScrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS && mAdapter != null
                    && mAdapter.getCount() > 1)) {
        if (!mTopEdge.isFinished()) {
            final int restoreCount = canvas.save();
            final int width = getWidth() - getPaddingLeft() - getPaddingRight();

            canvas.rotate(270);
            canvas.translate(-width + getPaddingLeft(), 0);
            mTopEdge.setSize(width, getHeight());
            needsInvalidate |= mTopEdge.draw(canvas);
            canvas.restoreToCount(restoreCount);
        } /* end of if */
        if (!mBottomEdge.isFinished()) {
            final int restoreCount = canvas.save();
            final int width = getWidth() - getPaddingLeft() - getPaddingRight();
            final int height = getHeight();
            final int itemCount = mAdapter != null ? mAdapter.getCount() : 1;

            canvas.rotate(180);
            canvas.translate(-width + getPaddingLeft(), -itemCount * (height + mPageMargin) + mPageMargin);
            mBottomEdge.setSize(width, height);
            needsInvalidate |= mBottomEdge.draw(canvas);
            canvas.restoreToCount(restoreCount);
        } /* end of if */
    } else {
        mTopEdge.finish();
        mBottomEdge.finish();
    } /* end of if */

    if (needsInvalidate) {
        // Keep animating
        invalidate();
    } /* end of if */
}

From source file:interactive.view.pagereader.VerticalViewPager.java

@Override
public void draw(Canvas canvas) {
    // XXX ?/*from  ww w.  jav a  2 s.c o m*/
    super.draw(canvas);
    boolean needsInvalidate = false;

    final int overScrollMode = ViewCompat.getOverScrollMode(this);
    if (overScrollMode == ViewCompat.OVER_SCROLL_ALWAYS
            || (overScrollMode == ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS && mAdapter != null
                    && mAdapter.getCount() > 1)) {
        if (!mTopEdge.isFinished()) {
            final int restoreCount = canvas.save();
            final int width = getWidth() - getPaddingLeft() - getPaddingRight();

            canvas.rotate(270);
            canvas.translate(-width + getPaddingLeft(), 0);
            mTopEdge.setSize(width, getHeight());
            needsInvalidate |= mTopEdge.draw(canvas);
            canvas.restoreToCount(restoreCount);
        } /* end of if */
        if (!mBottomEdge.isFinished()) {
            final int restoreCount = canvas.save();
            final int width = getWidth() - getPaddingLeft() - getPaddingRight();
            final int height = getHeight();
            final int itemCount = mAdapter != null ? mAdapter.getCount() : 1;

            canvas.rotate(180);
            canvas.translate(-width + getPaddingLeft(), -itemCount * (height + mPageMargin) + mPageMargin);
            mBottomEdge.setSize(width, height);
            needsInvalidate |= mBottomEdge.draw(canvas);
            canvas.restoreToCount(restoreCount);
        } /* end of if */
    } else {
        mTopEdge.finish();
        mBottomEdge.finish();
    } /* end of if */

    if (needsInvalidate) {
        // Keep animating
        invalidate();
    } /* end of if */
}

From source file:com.ad.view.staggeredgridview.StaggeredGridView.java

@Override
public void draw(Canvas canvas) {
    super.draw(canvas);

    if (mTopEdge != null) {
        boolean needsInvalidate = false;
        if (!mTopEdge.isFinished()) {
            mTopEdge.draw(canvas);/*from  ww w  . j  a  v a 2  s . c  o m*/
            needsInvalidate = true;
        }
        if (!mBottomEdge.isFinished()) {
            final int restoreCount = canvas.save();
            final int width = getWidth();
            canvas.translate(-width, getHeight());
            canvas.rotate(180, width, 0);
            mBottomEdge.draw(canvas);
            canvas.restoreToCount(restoreCount);
            needsInvalidate = true;
        }

        if (needsInvalidate) {
            invalidate();
        }
    }

    // drawSelector(canvas);
}

From source file:com.ruesga.timelinechart.TimelineChartView.java

private void drawBarItems(Canvas c, LongSparseArray<Pair<double[], int[]>> data, double maxValue) {

    final float halfItemBarWidth = mBarItemWidth / 2;
    final float height = mGraphArea.height();
    final Paint[] seriesBgPaint;
    final Paint[] highlightSeriesBgPaint;
    synchronized (mLock) {
        seriesBgPaint = mSeriesBgPaint;//from   w  ww .  j  a v a2 s.c  o m
        highlightSeriesBgPaint = mHighlightSeriesBgPaint;
    }

    // Apply zoom animation
    final float zoom = mCurrentZoom;
    final float cx = mGraphArea.left + (mGraphArea.width() / 2);
    int restoreCount = 0;
    if (zoom != 1.f) {
        restoreCount = c.save();
        c.scale(zoom, zoom, cx, mGraphArea.bottom);
    }

    final int size = data.size() - 1;
    for (int i = mItemsOnScreen[1]; i >= mItemsOnScreen[0]; i--) {
        final float x = cx + mCurrentOffset - (mBarWidth * (size - i));
        float bw = mBarItemWidth / mSeries;
        double[] values = data.valueAt(i).first;
        int[] indexes = data.valueAt(i).second;

        float y1, y2 = height;
        float x1 = x - halfItemBarWidth, x2 = x + halfItemBarWidth;
        if (mGraphMode != GRAPH_MODE_BARS_STACK) {
            int count = values.length - 1;
            for (int j = count, n = 0; j >= 0; j--, n++) {
                y2 = height;
                final Paint paint;
                if (mGraphMode == GRAPH_MODE_BARS_SIDE_BY_SIDE) {
                    y1 = (float) (height - ((height * ((values[n] * 100) / maxValue)) / 100));
                    x1 = x - halfItemBarWidth + (bw * n);
                    x2 = x1 + bw;
                    paint = (x - halfItemBarWidth) < cx && (x + halfItemBarWidth) > cx
                            && (mLastTimestamp == mCurrentTimestamp || (mState != STATE_SCROLLING))
                                    ? highlightSeriesBgPaint[indexes[n]]
                                    : seriesBgPaint[indexes[n]];
                } else {
                    y1 = (float) (height - ((height * ((values[j] * 100) / maxValue)) / 100));
                    paint = x1 < cx && x2 > cx
                            && (mLastTimestamp == mCurrentTimestamp || (mState != STATE_SCROLLING))
                                    ? highlightSeriesBgPaint[indexes[j]]
                                    : seriesBgPaint[indexes[j]];
                }

                c.drawRect(x1, mGraphArea.top + y1, x2, mGraphArea.top + y2, paint);
            }
        } else {
            int count = values.length;
            for (int j = 0; j < count; j++) {
                float h = (float) ((height * ((values[j] * 100) / maxValue)) / 100);
                y1 = y2 - h;

                final Paint paint = x1 < cx && x2 > cx
                        && (mLastTimestamp == mCurrentTimestamp || (mState != STATE_SCROLLING))
                                ? highlightSeriesBgPaint[indexes[j]]
                                : seriesBgPaint[indexes[j]];
                c.drawRect(x1, mGraphArea.top + y1, x2, mGraphArea.top + y2, paint);
                y2 -= h;
            }
        }
    }

    // Restore from zoom
    if (zoom != 1.f) {
        c.restoreToCount(restoreCount);
    }
}

From source file:com.huewu.pla.lib.internal.PLA_ListView.java

/**
 * Draws a divider for the given child in the given bounds.
 * /*from ww  w  .  j  a v a  2s. c om*/
 * @param canvas
 *            The canvas to draw to.
 * @param bounds
 *            The bounds of the divider.
 * @param childIndex
 *            The index of child (of the View) above the divider. This will
 *            be -1 if there is no child above the divider to be drawn.
 */
void drawDivider(Canvas canvas, Rect bounds, int childIndex) {
    // This widget draws the same divider for all children
    final Drawable divider = mDivider;
    final boolean clipDivider = mClipDivider;

    if (!clipDivider) {
        divider.setBounds(bounds);
    } else {
        canvas.save();
        canvas.clipRect(bounds);
    }

    divider.draw(canvas);

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

From source file:com.hippo.vector.VectorDrawable.java

@Override
@SuppressWarnings("deprecation")
public void draw(Canvas canvas) {
    // We will offset the bounds for drawBitmap, so copyBounds() here instead
    // of getBounds().
    copyBounds(mTmpBounds);// w  w w  .  j  a v  a 2 s  . co m
    if (mTmpBounds.width() <= 0 || mTmpBounds.height() <= 0) {
        // Nothing to draw
        return;
    }

    // Color filters always override tint filters.
    final ColorFilter colorFilter = (mColorFilter == null ? mTintFilter : mColorFilter);

    // The imageView can scale the canvas in different ways, in order to
    // avoid blurry scaling, we have to draw into a bitmap with exact pixel
    // size first. This bitmap size is determined by the bounds and the
    // canvas scale.
    canvas.getMatrix(mTmpMatrix);
    mTmpMatrix.getValues(mTmpFloats);
    float canvasScaleX = Math.abs(mTmpFloats[Matrix.MSCALE_X]);
    float canvasScaleY = Math.abs(mTmpFloats[Matrix.MSCALE_Y]);
    int scaledWidth = (int) (mTmpBounds.width() * canvasScaleX);
    int scaledHeight = (int) (mTmpBounds.height() * canvasScaleY);
    scaledWidth = Math.min(MAX_CACHED_BITMAP_SIZE, scaledWidth);
    scaledHeight = Math.min(MAX_CACHED_BITMAP_SIZE, scaledHeight);

    if (scaledWidth <= 0 || scaledHeight <= 0) {
        return;
    }

    final int saveCount = canvas.save();
    canvas.translate(mTmpBounds.left, mTmpBounds.top);

    // Handle RTL mirroring.
    final boolean needMirroring = needMirroring();
    if (needMirroring) {
        canvas.translate(mTmpBounds.width(), 0);
        canvas.scale(-1.0f, 1.0f);
    }

    // At this point, canvas has been translated to the right position.
    // And we use this bound for the destination rect for the drawBitmap, so
    // we offset to (0, 0);
    mTmpBounds.offsetTo(0, 0);

    mVectorState.createCachedBitmapIfNeeded(scaledWidth, scaledHeight);
    if (!mAllowCaching) {
        mVectorState.updateCachedBitmap(scaledWidth, scaledHeight);
    } else {
        if (!mVectorState.canReuseCache()) {
            mVectorState.updateCachedBitmap(scaledWidth, scaledHeight);
            mVectorState.updateCacheStates();
        }
    }
    mVectorState.drawCachedBitmapWithRootAlpha(canvas, colorFilter, mTmpBounds);
    canvas.restoreToCount(saveCount);
}

From source file:com.tct.mail.browse.ConversationItemView.java

@Override
protected void onDraw(Canvas canvas) {
    // TS: jin.dongjin 2015-06-23 EMAIL BUGFIX_1015610 MOD_S
    if (mCoordinates == null) {
        LogUtils.e(LOG_TAG, "null coordinates in ConversationItemView#onDraw");
        return;/*from w  w  w.  j  a  v  a  2  s .c  o m*/
    }
    // TS: jin.dongjin 2015-06-23 EMAIL BUGFIX_1015610 MOD_E

    Utils.traceBeginSection("CIVC.draw");

    // Contact photo
    if (mGadgetMode == ConversationItemViewCoordinates.GADGET_CONTACT_PHOTO) {
        canvas.save();
        Utils.traceBeginSection("draw senders image");
        drawSendersImage(canvas);
        Utils.traceEndSection();
        canvas.restore();
    }

    //TS: yanhua.chen 2015-9-2 EMAIL CR_ID MOD_S
    // Subject.
    boolean isUnread = mHeader.unread;
    // Old style subject; apply text colors/ sizes/ styling.
    canvas.save();
    if (mHeader.subjectDisplayLayout != null) {
        sPaint.setTextSize(mCoordinates.subjectFontSize);
        sPaint.setTypeface(Typeface.DEFAULT);
        // [FEATURE]-ADD-BEGIN by TSNJ,zhujian.shao,10/23/2014,FR-736411(porting from FR622697)
        canvas.translate(mSubjectWidth - mPriorityX,
                mCoordinates.subjectY + mHeader.subjectDisplayLayout.getTopPadding());
        // [FEATURE]-ADD-END by TSNJ,zhujian.shao,10/23/2014,FR-736411
        mHeader.subjectDisplayLayout.draw(canvas);
    } else {
        drawSubject(canvas);
    }
    canvas.restore();

    // Sender.
    sPaint.setTypeface(Typeface.DEFAULT);
    canvas.save();
    drawSenders(canvas);
    canvas.restore();
    //TS: yanhua.chen 2015-9-2 EMAIL CR_ID MOD_E

    canvas.save();
    drawSnippet(canvas);
    canvas.restore();

    // Folders.
    if (mConfig.areFoldersVisible()) {
        mHeader.folderDisplayer.drawFolders(canvas, mCoordinates, ViewUtils.isViewRtl(this));
    }

    // If this folder has a color (combined view/Email), show it here
    if (mConfig.isColorBlockVisible()) {
        sFoldersPaint.setColor(mHeader.conversation.color);
        sFoldersPaint.setStyle(Paint.Style.FILL);
        canvas.drawRect(mCoordinates.colorBlockX, mCoordinates.colorBlockY,
                mCoordinates.colorBlockX + mCoordinates.colorBlockWidth,
                mCoordinates.colorBlockY + mCoordinates.colorBlockHeight, sFoldersPaint);
    }

    // Draw the reply state. Draw nothing if neither replied nor forwarded.
    if (mConfig.isReplyStateVisible()) {
        if (mHeader.hasBeenRepliedTo && mHeader.hasBeenForwarded) {
            canvas.drawBitmap(STATE_REPLIED_AND_FORWARDED, mCoordinates.replyStateX, mCoordinates.replyStateY,
                    null);
        } else if (mHeader.hasBeenRepliedTo) {
            canvas.drawBitmap(STATE_REPLIED, mCoordinates.replyStateX, mCoordinates.replyStateY, null);
        } else if (mHeader.hasBeenForwarded) {
            canvas.drawBitmap(STATE_FORWARDED, mCoordinates.replyStateX, mCoordinates.replyStateY, null);
        } else if (mHeader.isInvite) {
            canvas.drawBitmap(STATE_CALENDAR_INVITE, mCoordinates.replyStateX, mCoordinates.replyStateY, null);
        }
    }

    if (mConfig.isPersonalIndicatorVisible()) {
        canvas.drawBitmap(mHeader.personalLevelBitmap, mCoordinates.personalIndicatorX,
                mCoordinates.personalIndicatorY, null);
    }

    // Info icon
    if (mHeader.infoIcon != null) {
        canvas.drawBitmap(mHeader.infoIcon, mInfoIconX, mCoordinates.infoIconY, sPaint);
    }

    // Date.
    sPaint.setTextSize(mCoordinates.dateFontSize);
    sPaint.setTypeface(isUnread ? Typeface.SANS_SERIF : SANS_SERIF_LIGHT);
    sPaint.setColor(isUnread ? sDateTextColorUnread : sDateTextColorRead);
    drawText(canvas, mHeader.dateText, mDateX, mCoordinates.dateYBaseline, sPaint);
    //TS: yanhua.chen 2015-6-19 EMAIL BUGFIX_305581 MOD_S
    //TS: wenggangjin 2015-01-27 EMAIL BUGFIX_-888881 MOD_S
    //TS: wenggangjin 2015-01-15 EMAIL BUGFIX_886241 MOD_S
    //        if (mHeader.conversation.hasAttachments && !mDisplayedFolder.isSearch()) {
    if (mHeader.conversation.hasAttachments) {
        mHeader.paperclip = ATTACHMENT;
    } else {
        mHeader.paperclip = null;
    }
    //TS: wenggangjin 2015-01-15 EMAIL BUGFIX_886241 MOD_E
    //TS: wenggangjin 2015-01-27 EMAIL BUGFIX_-888881 MOD_S
    //TS: yanhua.chen 2015-6-19 EMAIL BUGFIX_305581 MOD_E
    // Paper clip icon.
    if (mHeader.paperclip != null) {
        canvas.drawBitmap(mHeader.paperclip, mPaperclipX, mCoordinates.paperclipY, sPaint);
    }

    //[FEATURE]-Add-BEGIN by TSCD.chao zhang,04/17/2014,FR 631895(porting from FR514398)
    //priority icon
    Bitmap sPrio = sNormalPriorityIcon;
    mPriority = mHeader.conversation.flagPriority;
    if (mPriority == HIGH_PRIORITY) {
        sPrio = sHighPriorityIcon;
    } else if (mPriority == LOW_PRIORITY) {
        sPrio = sLowPriorityIcon;
    }
    // TS: zhaotianyong 2014-12-15 EMAIL BUGFIX_859814 ADD_S
    sPrio = resizeBitMap(sPrio, 0.6f, 0.6f);
    // TS: zhaotianyong 2014-12-15 EMAIL BUGFIX_859814 ADD_E
    canvas.drawBitmap(sPrio, mPriorityX, mCoordinates.paperclipY, null);

    //[FEATURE]-Add-END by TSCD.chao zhang

    if (mStarEnabled) {
        // Star.
        canvas.drawBitmap(getStarBitmap(), mCoordinates.starX, mCoordinates.starY, sPaint);
    }

    // right-side edge effect when in tablet conversation mode and the list is not collapsed
    if (Utils.getDisplayListRightEdgeEffect(mTabletDevice, mListCollapsible, mConfig.getViewMode())) {
        final boolean isRtl = ViewUtils.isViewRtl(this);
        RIGHT_EDGE_TABLET.setBounds((isRtl) ? 0 : getWidth() - RIGHT_EDGE_TABLET.getIntrinsicWidth(), 0,
                (isRtl) ? RIGHT_EDGE_TABLET.getIntrinsicWidth() : getWidth(), getHeight());
        RIGHT_EDGE_TABLET.draw(canvas);

        if (isActivated()) {
            final int w = VISIBLE_CONVERSATION_HIGHLIGHT.getIntrinsicWidth();
            VISIBLE_CONVERSATION_HIGHLIGHT.setBounds((isRtl) ? getWidth() - w : 0, 0, (isRtl) ? getWidth() : w,
                    getHeight());
            VISIBLE_CONVERSATION_HIGHLIGHT.draw(canvas);
        }
    }
    //TS: zheng.zou 2015-09-01 EMAIL BUGFIX_539892 MOD_S
    if (mWillDrawDivider) {
        // draw the inset divider
        sDividerPaint.setColor(sDividerColor);
        final int dividerBottomY = getHeight();
        final int dividerTopY = dividerBottomY - sDividerHeight;
        // AM: Kexue.Geng 2015-02-28 EMAIL BUGFIX_900927 MOD_S
        // canvas.drawRect(sDividerInset, dividerTopY, getWidth(), dividerBottomY, sDividerPaint);
        canvas.drawRect(mGadgetMode == ConversationItemViewCoordinates.GADGET_NONE ? 0 : sDividerInset,
                dividerTopY, getWidth(), dividerBottomY, sDividerPaint);
        // AM: Kexue.Geng 2015-02-28 EMAIL BUGFIX_900927 MOD_E
    }
    //TS: zheng.zou 2015-09-01 EMAIL BUGFIX_539892 MOD_E
    Utils.traceEndSection();
    // TS: chao.zhang 2015-09-14 EMAIL FEATURE-585337 ADD_S
    //draw the status
    canvas.save();
    drawStatus(canvas);
    canvas.restore();
    // TS: chao.zhang 2015-09-14 EMAIL FEATURE-585337 ADD_E
}