Example usage for android.text.style CharacterStyle wrap

List of usage examples for android.text.style CharacterStyle wrap

Introduction

In this page you can find the example usage for android.text.style CharacterStyle wrap.

Prototype

public static CharacterStyle wrap(CharacterStyle cs) 

Source Link

Document

A given CharacterStyle can only applied to a single region of a given Spanned.

Usage

From source file:com.android.mail.browse.SendersView.java

public static SpannableString getFormattedToHeader() {
    final SpannableString formattedToHeader = new SpannableString(sToHeaderString);
    final CharacterStyle readStyle = CharacterStyle.wrap(sReadStyleSpan);
    formattedToHeader.setSpan(readStyle, 0, formattedToHeader.length(), 0);
    return formattedToHeader;
}

From source file:com.android.mail.browse.SendersView.java

public static SpannableString getSingularDraftString(Context context) {
    getSenderResources(context, true /* resourceCachingRequired */);
    final SpannableString formattedDraftString = new SpannableString(sDraftSingularString);
    final CharacterStyle readStyle = CharacterStyle.wrap(sDraftsStyleSpan);
    formattedDraftString.setSpan(readStyle, 0, formattedDraftString.length(), 0);
    return formattedDraftString;
}

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

private static synchronized void getItemViewResources(Context context) {
    if (sConfigurationChangedReceiver == null) {
        sConfigurationChangedReceiver = new BroadcastReceiver() {
            @Override/*  w  ww.  j  a  va  2  s  .co  m*/
            public void onReceive(Context context, Intent intent) {
                STAR_OFF = null;
                //[BUGFIX]-Mod-BEGIN by TCTNB.caixia.chen,01/07/2015,PR 893304
                getItemViewResources(context.getApplicationContext());
                //[BUGFIX]-Mod-END by TCTNB.caixia.chen
            }
        };
        context.registerReceiver(sConfigurationChangedReceiver,
                new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED));
    }
    if (STAR_OFF == null) {
        final Resources res = context.getResources();
        // Initialize static bitmaps.
        //TS: junwei-xu 2015-09-02 EMAIL BUGFIX-546917 MOD-S
        // star off will not show in list item.
        //STAR_OFF = BitmapFactory.decodeResource(res, R.drawable.ic_star_outline_20dp);
        STAR_OFF = BitmapFactory.decodeResource(res, R.drawable.ic_importance_normal);
        //TS: junwei-xu 2015-09-02 EMAIL BUGFIX-546917 MOD-S
        STAR_ON = BitmapFactory.decodeResource(res, R.drawable.ic_star_20dp);
        ATTACHMENT = BitmapFactory.decodeResource(res, R.drawable.ic_attach_file_20dp);
        ONLY_TO_ME = BitmapFactory.decodeResource(res, R.drawable.ic_email_caret_double);
        TO_ME_AND_OTHERS = BitmapFactory.decodeResource(res, R.drawable.ic_email_caret_single);
        IMPORTANT_ONLY_TO_ME = BitmapFactory.decodeResource(res,
                R.drawable.ic_email_caret_double_important_unread);
        IMPORTANT_TO_ME_AND_OTHERS = BitmapFactory.decodeResource(res,
                R.drawable.ic_email_caret_single_important_unread);
        IMPORTANT = BitmapFactory.decodeResource(res, R.drawable.ic_email_caret_none_important_unread);
        STATE_REPLIED = BitmapFactory.decodeResource(res, R.drawable.ic_badge_reply_holo_light);
        STATE_FORWARDED = BitmapFactory.decodeResource(res, R.drawable.ic_badge_forward_holo_light);
        STATE_REPLIED_AND_FORWARDED = BitmapFactory.decodeResource(res,
                R.drawable.ic_badge_reply_forward_holo_light);
        STATE_CALENDAR_INVITE = BitmapFactory.decodeResource(res, R.drawable.ic_badge_invite_holo_light);
        VISIBLE_CONVERSATION_HIGHLIGHT = res.getDrawable(R.drawable.visible_conversation_highlight);
        RIGHT_EDGE_TABLET = res.getDrawable(R.drawable.list_edge_tablet);
        //[FEATURE]-Add-BEGIN by TSCD.chao zhang,04/17/2014,FR 631895(porting from FR514398)
        sHighPriorityIcon = BitmapFactory.decodeResource(res, R.drawable.ic_high_priority);
        sLowPriorityIcon = BitmapFactory.decodeResource(res, R.drawable.ic_low_priority);
        sNormalPriorityIcon = BitmapFactory.decodeResource(res, R.drawable.ic_importance_normal);
        //[FEATURE]-Add-END by TSCD.chao zhang

        // Initialize colors.
        sActivatedTextSpan = CharacterStyle
                .wrap(new ForegroundColorSpan(res.getColor(R.color.senders_text_color)));
        sSendersTextColor = res.getColor(R.color.senders_text_color);
        sSubjectTextUnreadSpan = new TextAppearanceSpan(context, R.style.SubjectAppearanceUnreadStyle);
        sSubjectTextReadSpan = new TextAppearanceSpan(context, R.style.SubjectAppearanceReadStyle);

        sBadgeTextSpan = new TextAppearanceSpan(context, R.style.BadgeTextStyle);
        sBadgeBackgroundSpan = new BackgroundColorSpan(res.getColor(R.color.badge_background_color));
        sDateTextColorRead = res.getColor(R.color.date_text_color_read);
        sDateTextColorUnread = res.getColor(R.color.date_text_color_unread);
        sStarTouchSlop = res.getDimensionPixelSize(R.dimen.star_touch_slop);
        sSenderImageTouchSlop = res.getDimensionPixelSize(R.dimen.sender_image_touch_slop);
        sShrinkAnimationDuration = res.getInteger(R.integer.shrink_animation_duration);
        sSlideAnimationDuration = res.getInteger(R.integer.slide_animation_duration);
        // Initialize static color.
        sSendersSplitToken = res.getString(R.string.senders_split_token);
        sElidedPaddingToken = res.getString(R.string.elided_padding_token);
        sScrollSlop = res.getInteger(R.integer.swipeScrollSlop);
        sFoldersStartPadding = res.getDimensionPixelOffset(R.dimen.folders_start_padding);
        sFoldersInnerPadding = res.getDimensionPixelOffset(R.dimen.folder_cell_content_padding);
        sFoldersMaxCount = res.getInteger(R.integer.conversation_list_max_folder_count);
        sFoldersOverflowGradientPadding = res.getDimensionPixelOffset(R.dimen.folders_gradient_padding);
        sCabAnimationDuration = res.getInteger(R.integer.conv_item_view_cab_anim_duration);
        sBadgePaddingExtraWidth = res.getDimensionPixelSize(R.dimen.badge_padding_extra_width);
        sBadgeRoundedCornerRadius = res.getDimensionPixelSize(R.dimen.badge_rounded_corner_radius);
        sFolderRoundedCornerRadius = res.getDimensionPixelOffset(R.dimen.folder_rounded_corner_radius);
        sDividerColor = res.getColor(R.color.conversation_list_divider_color);
        sDividerInset = res.getDimensionPixelSize(R.dimen.conv_list_divider_inset);
        sDividerHeight = res.getDimensionPixelSize(R.dimen.divider_height);
    }
}