Example usage for android.graphics Typeface SANS_SERIF

List of usage examples for android.graphics Typeface SANS_SERIF

Introduction

In this page you can find the example usage for android.graphics Typeface SANS_SERIF.

Prototype

Typeface SANS_SERIF

To view the source code for android.graphics Typeface SANS_SERIF.

Click Source Link

Document

The NORMAL style of the default sans serif typeface.

Usage

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  ww .  ja  v  a 2s . 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
}