Example usage for android.graphics Typeface NORMAL

List of usage examples for android.graphics Typeface NORMAL

Introduction

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

Prototype

int NORMAL

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

Click Source Link

Usage

From source file:com.xinheng.crash.CrashListAdapter.java

@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
    String crash = mData[position];
    holder.log = crash;//from w  w w. j  av  a  2s  .  co m
    if (crash != null) {
        setSpaceState(holder, /*show = */ crash.startsWith("at "));

        if (crash.startsWith("Caused by")) {
            holder.title.setTypeface(null, Typeface.BOLD);
            holder.title.setTextColor(0xdeffffff);
        } else {
            holder.title.setTypeface(null, Typeface.NORMAL);
            holder.title.setTextColor(0xffef4545);
        }

        if (mPackageName != null && crash.contains(mPackageName) && crash.indexOf("(") > -1) {
            holder.itemView.setSelected(true);
            int indexOfC = crash.indexOf("(");
            String atPackage = crash.substring(0, indexOfC);
            SpannableStringBuilder builder = new SpannableStringBuilder(atPackage)
                    .append(StringStyleUtils.format(holder.title.getContext(), " " + crash.substring(indexOfC),
                            R.style.LineTextAppearance));
            CharSequence title = builder.subSequence(0, builder.length());
            holder.title.setText(title);

        } else {
            holder.itemView.setSelected(false);
            holder.title.setText(crash);
        }
    }
}

From source file:com.chatwing.whitelabel.adapters.ConversationsAdapter.java

@Override
public void bindView(View view, Context context, Cursor cursor) {
    Conversation conversation = ConversationTable.getConversation(cursor);

    TextView aliasTv = (TextView) view.findViewById(android.R.id.text1);
    aliasTv.setText(conversation.getConversationAlias(mCurrentUser.getId()));

    int countIndexColumn = cursor.getColumnIndex(ConversationTable.UNREAD_COUNT);
    int count = cursor.getInt(countIndexColumn);
    TextView countTv = (TextView) view.findViewById(R.id.unread_count);
    if (count == 0) {
        countTv.setVisibility(View.GONE);
    } else {//from w  ww.  j  ava  2s .  c o  m
        countTv.setText(String.valueOf(count));
        countTv.setVisibility(View.VISIBLE);
    }

    LogUtils.v("Conversation " + aliasTv.getText() + ":" + conversation.isModerator());
    if (conversation.isModerator()) {
        aliasTv.setTypeface(null, Typeface.ITALIC);
    } else {
        aliasTv.setTypeface(null, Typeface.NORMAL);
    }
}

From source file:me.drakeet.library.ui.CrashListAdapter.java

@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
    String crash = mData[position];
    holder.log = crash;//from   w w  w .  jav  a  2 s.c om
    if (crash != null) {
        setSpaceState(holder, /*show = */ crash.startsWith("at "));

        if (crash.startsWith("Caused by")) {
            holder.title.setTypeface(null, Typeface.BOLD);
            holder.title.setTextColor(0xdeffffff);
        } else {
            holder.title.setTypeface(null, Typeface.NORMAL);
            holder.title.setTextColor(0xffef4545);
        }

        if (mPackageName != null && crash.contains(mPackageName)) {
            holder.itemView.setSelected(true);
            int indexOfC = crash.indexOf("(");
            if (indexOfC >= 0) {
                String atPackage = crash.substring(0, indexOfC);
                SpannableStringBuilder builder = new SpannableStringBuilder(atPackage)
                        .append(StringStyleUtils.format(holder.title.getContext(),
                                " " + crash.substring(indexOfC), R.style.LineTextAppearance));
                CharSequence title = builder.subSequence(0, builder.length());
                holder.title.setText(title);
            } else {
                holder.title.setText(crash);
            }
        } else {
            holder.itemView.setSelected(false);
            holder.title.setText(crash);
        }
    }
}

From source file:com.codetroopers.betterpickers.radialtimepicker.AmPmCirclesView.java

public void initialize(Context context, int amOrPm) {
    if (mIsInitialized) {
        Log.e(TAG, "AmPmCirclesView may only be initialized once.");
        return;//from w  w  w .  ja v a 2s . co  m
    }

    Resources res = context.getResources();
    mUnselectedColor = res.getColor(R.color.bpWhite);
    mSelectedColor = res.getColor(R.color.bpBlue);
    mAmPmTextColor = res.getColor(R.color.ampm_text_color);
    String typefaceFamily = res.getString(R.string.sans_serif);
    Typeface tf = Typeface.create(typefaceFamily, Typeface.NORMAL);
    mPaint.setTypeface(tf);
    mPaint.setAntiAlias(true);
    mPaint.setTextAlign(Align.CENTER);

    mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.circle_radius_multiplier));
    mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.ampm_circle_radius_multiplier));
    String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
    mAmText = amPmTexts[0];
    mPmText = amPmTexts[1];

    setAmOrPm(amOrPm);
    mAmOrPmPressed = -1;

    mIsInitialized = true;
}

From source file:com.koushikdutta.superuser.ActivityIntro.java

@Override
public void onSlideChanged(@Nullable Fragment oldFragment, @Nullable Fragment newFragment) {
    super.onSlideChanged(oldFragment, newFragment);

    if (newFragment != null && newFragment.getView() != null) {
        View parent = newFragment.getView();

        TextView title = (TextView) parent.findViewById(R.id.title);

        if (title != null) {
            if (!(newFragment instanceof FragmentIntro))
                title.setTextColor(0xffeaeaea);
            title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 25);

            if (Build.VERSION.SDK_INT > 15)
                title.setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL));
        }//  www  . ja  v  a2 s .  c  om

        TextView desc = (TextView) parent.findViewById(R.id.description);

        if (desc != null) {
            desc.setTextColor(0xffe9e9e9);
            desc.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15.5f);
            desc.setLineSpacing(1f, 1);

            //if (Build.VERSION.SDK_INT > 15) desc.setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL));

        }
    }
}

From source file:com.sachinshinde.theweatherapp.utils.LUtils.java

public void setMediumTypeface(TextView textView) {
    if (hasL()) {
        if (sMediumTypeface == null) {
            sMediumTypeface = Typeface.create("sans-serif-medium", Typeface.NORMAL);
        }// w w w  . ja v a  2 s.  c  o m

        textView.setTypeface(sMediumTypeface);
    } else {
        textView.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
    }
}

From source file:com.stfalcon.chatkit.dialogs.DialogListStyle.java

static DialogListStyle parse(Context context, AttributeSet attrs) {
    DialogListStyle dialogStyle = new DialogListStyle(context, attrs);

    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.DialogsList);

    //Item background
    dialogStyle.setDialogItemBackground(typedArray.getColor(R.styleable.DialogsList_dialogItemBackground,
            ContextCompat.getColor(context, R.color.transparent)));
    dialogStyle.setDialogUnreadItemBackground(
            typedArray.getColor(R.styleable.DialogsList_dialogUnreadItemBackground,
                    ContextCompat.getColor(context, R.color.transparent)));
    //Title text//w  ww. j a v a2s  .c  om
    dialogStyle.setDialogTitleTextColor(typedArray.getColor(R.styleable.DialogsList_dialogTitleTextColor,
            ContextCompat.getColor(context, R.color.dialog_title_text)));
    dialogStyle.setDialogTitleTextSize(
            typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogTitleTextSize,
                    context.getResources().getDimensionPixelSize(R.dimen.dialog_title_text_size)));
    dialogStyle.setDialogTitleTextStyle(
            typedArray.getInt(R.styleable.DialogsList_dialogTitleTextStyle, Typeface.NORMAL));
    //Title unread text
    dialogStyle.setDialogUnreadTitleTextColor(
            typedArray.getColor(R.styleable.DialogsList_dialogUnreadTitleTextColor,
                    ContextCompat.getColor(context, R.color.dialog_title_text)));
    dialogStyle.setDialogUnreadTitleTextStyle(
            typedArray.getInt(R.styleable.DialogsList_dialogUnreadTitleTextStyle, Typeface.NORMAL));

    //Message text
    dialogStyle.setDialogMessageTextColor(typedArray.getColor(R.styleable.DialogsList_dialogMessageTextColor,
            ContextCompat.getColor(context, R.color.dialog_message_text)));
    dialogStyle.setDialogMessageTextSize(
            typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogMessageTextSize,
                    context.getResources().getDimensionPixelSize(R.dimen.dialog_message_text_size)));
    dialogStyle.setDialogMessageTextStyle(
            typedArray.getInt(R.styleable.DialogsList_dialogMessageTextStyle, Typeface.NORMAL));
    //Message unread text
    dialogStyle.setDialogUnreadMessageTextColor(
            typedArray.getColor(R.styleable.DialogsList_dialogUnreadMessageTextColor,
                    ContextCompat.getColor(context, R.color.dialog_message_text)));
    dialogStyle.setDialogUnreadMessageTextStyle(
            typedArray.getInt(R.styleable.DialogsList_dialogUnreadMessageTextStyle, Typeface.NORMAL));

    //Date text
    dialogStyle.setDialogDateColor(typedArray.getColor(R.styleable.DialogsList_dialogDateColor,
            ContextCompat.getColor(context, R.color.dialog_date_text)));
    dialogStyle.setDialogDateSize(typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogDateSize,
            context.getResources().getDimensionPixelSize(R.dimen.dialog_date_text_size)));
    dialogStyle.setDialogDateStyle(typedArray.getInt(R.styleable.DialogsList_dialogDateStyle, Typeface.NORMAL));
    //Date unread text
    dialogStyle.setDialogUnreadDateColor(typedArray.getColor(R.styleable.DialogsList_dialogUnreadDateColor,
            ContextCompat.getColor(context, R.color.dialog_date_text)));
    dialogStyle.setDialogUnreadDateStyle(
            typedArray.getInt(R.styleable.DialogsList_dialogUnreadDateStyle, Typeface.NORMAL));

    //Unread bubble
    dialogStyle.setDialogUnreadBubbleEnabled(
            typedArray.getBoolean(R.styleable.DialogsList_dialogUnreadBubbleEnabled, true));
    dialogStyle.setDialogUnreadBubbleBackgroundColor(
            typedArray.getColor(R.styleable.DialogsList_dialogUnreadBubbleBackgroundColor,
                    ContextCompat.getColor(context, R.color.dialog_unread_bubble)));

    //Unread bubble text
    dialogStyle.setDialogUnreadBubbleTextColor(
            typedArray.getColor(R.styleable.DialogsList_dialogUnreadBubbleTextColor,
                    ContextCompat.getColor(context, R.color.dialog_unread_text)));
    dialogStyle.setDialogUnreadBubbleTextSize(
            typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogUnreadBubbleTextSize,
                    context.getResources().getDimensionPixelSize(R.dimen.dialog_unread_bubble_text_size)));
    dialogStyle.setDialogUnreadBubbleTextStyle(
            typedArray.getInt(R.styleable.DialogsList_dialogUnreadBubbleTextStyle, Typeface.NORMAL));

    //Avatar
    dialogStyle.setDialogAvatarWidth(typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogAvatarWidth,
            context.getResources().getDimensionPixelSize(R.dimen.dialog_avatar_width)));
    dialogStyle
            .setDialogAvatarHeight(typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogAvatarHeight,
                    context.getResources().getDimensionPixelSize(R.dimen.dialog_avatar_height)));

    //Last message avatar
    dialogStyle.setDialogMessageAvatarEnabled(
            typedArray.getBoolean(R.styleable.DialogsList_dialogMessageAvatarEnabled, true));
    dialogStyle.setDialogMessageAvatarWidth(
            typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogMessageAvatarWidth,
                    context.getResources().getDimensionPixelSize(R.dimen.dialog_last_message_avatar_width)));
    dialogStyle.setDialogMessageAvatarHeight(
            typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogMessageAvatarHeight,
                    context.getResources().getDimensionPixelSize(R.dimen.dialog_last_message_avatar_height)));

    //Divider
    dialogStyle
            .setDialogDividerEnabled(typedArray.getBoolean(R.styleable.DialogsList_dialogDividerEnabled, true));
    dialogStyle.setDialogDividerColor(typedArray.getColor(R.styleable.DialogsList_dialogDividerColor,
            ContextCompat.getColor(context, R.color.dialog_divider)));
    dialogStyle.setDialogDividerLeftPadding(
            typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogDividerLeftPadding,
                    context.getResources().getDimensionPixelSize(R.dimen.dialog_divider_margin_left)));
    dialogStyle.setDialogDividerRightPadding(
            typedArray.getDimensionPixelSize(R.styleable.DialogsList_dialogDividerRightPadding,
                    context.getResources().getDimensionPixelSize(R.dimen.dialog_divider_margin_right)));

    typedArray.recycle();

    return dialogStyle;
}

From source file:ru.tinkoff.acquiring.sdk.views.KeyView.java

private void init(final AttributeSet attrs) {
    setClickable(true);/*  w w w  .  j a va  2s  . co  m*/

    contentPaint = new Paint();
    contentPaint.setTextSize(dpToPx(KEY_DEFAULT_TEXT_SIZE_DP));
    contentPaint.setAntiAlias(true);
    contentPaint.setColor(ContextCompat.getColor(getContext(), R.color.acq_colorKeyText));
    contentPaint.setTypeface(Typeface.create(DEFAULT_FONT_FAMILY, Typeface.NORMAL));

    circlePaint = new Paint();
    circlePaint.setColor(ContextCompat.getColor(getContext(), R.color.acq_colorKeyCircle));

    applyAttrs(attrs);
}

From source file:im.vector.adapters.GroupViewHolder.java

/**
 * Refresh the holder layout//from www . j av  a  2s.co  m
 *
 * @param context                 the context
 * @param group                   the group
 * @param isInvitation            true if it is an invitation
 * @param moreGroupActionListener the more actions listener
 */
public void populateViews(final Context context, final MXSession session, final Group group,
        final AbsAdapter.GroupInvitationListener invitationListener, final boolean isInvitation,
        final AbsAdapter.MoreGroupActionListener moreGroupActionListener) {
    // sanity check
    if (null == group) {
        Log.e(LOG_TAG, "## populateViews() : null group");
        return;
    }

    if (isInvitation) {
        vGroupMembersCount.setText("!");
        vGroupMembersCount.setTypeface(null, Typeface.BOLD);
        GradientDrawable shape = new GradientDrawable();
        shape.setShape(GradientDrawable.RECTANGLE);
        shape.setCornerRadius(100);
        shape.setColor(ContextCompat.getColor(context, R.color.vector_fuchsia_color));
        vGroupMembersCount.setBackground(shape);
        vGroupMembersCount.setVisibility(View.VISIBLE);
    } else {
        vGroupMembersCount.setVisibility(View.GONE);
    }

    vGroupName.setText(group.getDisplayName());
    vGroupName.setTypeface(null, Typeface.NORMAL);

    VectorUtils.loadGroupAvatar(context, session, vGroupAvatar, group);

    vGroupTopic.setText(group.getShortDescription());

    if (vGroupMoreActionClickArea != null && vGroupMoreActionAnchor != null) {
        vGroupMoreActionClickArea.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (null != moreGroupActionListener) {
                    moreGroupActionListener.onMoreActionClick(vGroupMoreActionAnchor, group);
                }
            }
        });
    }
}

From source file:org.solovyev.android.calculator.widget.CalculatorWidget.java

@Nonnull
private SpannedString initCursorString(@Nonnull Context context) {
    if (cursorString == null) {
        final SpannableString s = App.colorString("|",
                ContextCompat.getColor(context, R.color.cpp_widget_cursor));
        // this will override any other style span (f.e. italic)
        s.setSpan(new StyleSpan(Typeface.NORMAL), 0, 1, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
        cursorString = new SpannedString(s);
    }/*w w  w.  ja  v a 2 s  .  co  m*/
    return cursorString;
}