Example usage for android.graphics Typeface DEFAULT_BOLD

List of usage examples for android.graphics Typeface DEFAULT_BOLD

Introduction

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

Prototype

Typeface DEFAULT_BOLD

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

Click Source Link

Document

The default BOLD typeface object.

Usage

From source file:com.matthewtamlin.sliding_intro_screen_manual_testing.TestButtonConfig.java

/**
 * Modifies the Behaviour and Appearance of the buttons.
 *///from   ww w. jav a 2  s  . c  o  m
private void makeChanges() {
    // Modify the left button
    final IntroButtonAccessor leftButtonAccessor = getLeftButtonAccessor();
    leftButtonAccessor.setBehaviour(LEFT_BUTTON_BEHAVIOUR);
    leftButtonAccessor.setAppearance(LEFT_BUTTON_APPEARANCE);
    leftButtonAccessor.setText(LEFT_BUTTON_TEXT, null);
    leftButtonAccessor.setIcon(leftDrawable, null);
    leftButtonAccessor.setTextColor(LEFT_BUTTON_COLOR);
    leftButtonAccessor.setTextSize(LEFT_BUTTON_TEXT_SIZE_SP);
    leftButtonAccessor.setTypeface(Typeface.DEFAULT_BOLD);

    // Modify the right button
    final IntroButtonAccessor rightButtonAccessor = getRightButtonAccessor();
    rightButtonAccessor.setBehaviour(RIGHT_BUTTON_BEHAVIOUR);
    rightButtonAccessor.setAppearance(RIGHT_BUTTON_APPEARANCE);
    rightButtonAccessor.setText(RIGHT_BUTTON_TEXT, null);
    rightButtonAccessor.setIcon(rightDrawable, null);
    rightButtonAccessor.setTextColor(RIGHT_BUTTON_COLOR);
    rightButtonAccessor.setTextSize(RIGHT_BUTTON_TEXT_SIZE_SP);
    rightButtonAccessor.setTypeface(Typeface.MONOSPACE);

    // Modify the final button
    final IntroButtonAccessor finalButtonAccessor = getFinalButtonAccessor();
    finalButtonAccessor.setBehaviour(FINAL_BUTTON_BEHAVIOUR);
    finalButtonAccessor.setAppearance(FINAL_BUTTON_APPEARANCE);
    finalButtonAccessor.setText(FINAL_BUTTON_TEXT, null);
    finalButtonAccessor.setIcon(finalDrawable, null);
    finalButtonAccessor.setTextColor(FINAL_BUTTON_COLOR);
    finalButtonAccessor.setTextSize(FINAL_BUTTON_TEXT_SIZE_SP);
    finalButtonAccessor.setTypeface(Typeface.SANS_SERIF);
}

From source file:com.jinzht.pro.smarttablayout.SmartTabLayout.java

/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}./*w w  w.ja  v a  2  s . c om*/
 */
protected TextView createDefaultTabView(CharSequence title) {
    TextView textView = new TextView(getContext());
    textView.setGravity(Gravity.CENTER);
    textView.setText(title);
    textView.setTextColor(tabViewTextColors);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabViewTextSize);
    textView.setTypeface(Typeface.DEFAULT_BOLD);
    textView.setSingleLine(true);
    UiHelp.textBold(textView);
    textView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.MATCH_PARENT));

    if (tabViewBackgroundResId != NO_ID) {
        textView.setBackgroundResource(tabViewBackgroundResId);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // If we're running on Honeycomb or newer, then we can use the Theme's
        // selectableItemBackground to ensure that the View has a pressed state
        TypedValue outValue = new TypedValue();
        getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
        textView.setBackgroundResource(outValue.resourceId);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
        textView.setAllCaps(tabViewTextAllCaps);
    }

    textView.setPadding(tabViewTextHorizontalPadding, 0, tabViewTextHorizontalPadding, 0);

    if (tabViewTextMinWidth > 0) {
        textView.setMinWidth(tabViewTextMinWidth);
    }

    return textView;
}

From source file:org.heaven7.core.view.SlidingTabLayout.java

protected TextView createDefaultTabView(Context context) {
    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTypeface(Typeface.DEFAULT_BOLD);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // If we're running on Honeycomb or newer, then we can use the Theme's
        // selectableItemBackground to ensure that the View has a pressed state
        TypedValue outValue = new TypedValue();
        getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
        textView.setBackgroundResource(outValue.resourceId);
    }//w  w w .j a v a  2 s . c  om

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
        textView.setAllCaps(true);
    }

    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);

    return textView;
}

From source file:cn.bingoogolapple.androidcommon.adapter.BGAViewHolderHelper.java

/**
 * id?/*from   w  ww  . j ava  2  s  .com*/
 *
 * @param viewId
 * @param isBold ?
 * @return
 */
public BGAViewHolderHelper setIsBold(@IdRes int viewId, boolean isBold) {
    getTextView(viewId).getPaint().setTypeface(isBold ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
    return this;
}

From source file:com.hao.common.adapter.BaseViewHolderHelper.java

/**
 * id?/*from   w  w  w  .  j a  v  a2 s. co m*/
 *
 * @param viewId
 * @param isBold ?
 * @return
 */
public BaseViewHolderHelper setIsBold(@IdRes int viewId, boolean isBold) {
    getTextView(viewId).getPaint().setTypeface(isBold ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
    return this;
}

From source file:xyz.yhsj.helper.ViewHolderHelper.java

/**
 * id?/*from  w w w  .  j av a 2 s . c  om*/
 *
 * @param viewId
 * @param isBold ?
 * @return
 */
public ViewHolderHelper setIsBold(@IdRes int viewId, boolean isBold) {
    getTextView(viewId).getPaint().setTypeface(isBold ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT);
    return this;
}

From source file:net.ustyugov.jtalk.adapter.ChatsSpinnerAdapter.java

@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
    IconPicker iconPicker = service.getIconPicker();
    int fontSize = Integer.parseInt(service.getResources().getString(R.string.DefaultFontSize));
    try {//from  w  w w. j  a  va 2s.  c  o  m
        fontSize = Integer.parseInt(
                prefs.getString("RosterSize", service.getResources().getString(R.string.DefaultFontSize)));
    } catch (NumberFormatException ignored) {
    }
    int statusSize = fontSize - 4;

    RosterItem item = getItem(position);
    String account = item.getAccount();

    ItemHolder holder;
    if (convertView == null) {
        LayoutInflater inflater = activity.getLayoutInflater();
        convertView = inflater.inflate(R.layout.entry, null, false);
        holder = new ItemHolder();

        holder.name = (TextView) convertView.findViewById(R.id.name);
        holder.name.setTextSize(fontSize);
        holder.status = (TextView) convertView.findViewById(R.id.status);
        holder.status.setTextSize(statusSize);
        holder.status.setTextColor(Colors.SECONDARY_TEXT);

        holder.counter = (TextView) convertView.findViewById(R.id.msg_counter);
        holder.counter.setTextSize(fontSize);
        holder.messageIcon = (ImageView) convertView.findViewById(R.id.msg);
        holder.messageIcon.setImageBitmap(iconPicker.getMsgBitmap());
        holder.statusIcon = (ImageView) convertView.findViewById(R.id.status_icon);
        holder.statusIcon.setVisibility(View.VISIBLE);
        holder.avatar = (ImageView) convertView.findViewById(R.id.contactlist_pic);
        holder.caps = (ImageView) convertView.findViewById(R.id.caps);
        convertView.setTag(holder);
    } else {
        holder = (ItemHolder) convertView.getTag();
    }

    if (item.isEntry()) {
        String jid = item.getEntry().getUser();
        String status = "";
        String name = jid;

        ChatState state = service.getRoster(account).getChatState(jid);
        if (state != null && state == ChatState.composing)
            status = service.getString(R.string.Composes);
        else
            status = service.getStatus(account, jid);

        if (service.getConferencesHash(account).containsKey(StringUtils.parseBareAddress(jid))) {
            name = StringUtils.parseResource(jid);
        } else {
            RosterEntry re = item.getEntry();
            if (re != null)
                name = re.getName();
            if (name == null || name.equals(""))
                name = jid;
        }

        Presence presence = service.getPresence(account, jid);
        int count = service.getMessagesCount(account, jid);

        holder.name.setText(name);
        holder.name.setTypeface(Typeface.DEFAULT_BOLD);

        if (prefs.getBoolean("ShowStatuses", false)) {
            if (status != null && status.length() > 0) {
                holder.status.setVisibility(View.VISIBLE);
                holder.status.setText(status);
            } else {
                holder.status.setVisibility(View.GONE);
            }
        }

        if (count > 0) {
            holder.messageIcon.setVisibility(View.VISIBLE);
            holder.counter.setVisibility(View.VISIBLE);
            holder.counter.setText(count + "");
        } else {
            holder.messageIcon.setVisibility(View.GONE);
            holder.counter.setVisibility(View.GONE);
        }

        if (prefs.getBoolean("ShowCaps", false)) {
            String node = service.getNode(account, jid);
            ClientIcons.loadClientIcon(activity, holder.caps, node);
        } else
            holder.caps.setVisibility(View.GONE);

        if (prefs.getBoolean("LoadAvatar", false))
            Avatars.loadAvatar(activity, jid, holder.avatar);
        holder.statusIcon.setImageBitmap(iconPicker.getIconByPresence(presence));
        return convertView;
    } else if (item.isMuc()) {
        String name = item.getName();
        String subject = null;
        boolean joined = false;
        int count = service.getMessagesCount(account, name);

        if (service.getConferencesHash(account).containsKey(name)) {
            MultiUserChat muc = service.getConferencesHash(account).get(name);
            subject = muc.getSubject();
            joined = muc.isJoined();
        }

        holder.name.setText(StringUtils.parseName(name));
        holder.name.setTypeface(Typeface.DEFAULT_BOLD);

        if (prefs.getBoolean("ShowStatuses", false)) {
            if (subject != null && subject.length() > 0) {
                holder.status.setVisibility(View.VISIBLE);
                holder.status.setText(subject);
            } else {
                holder.status.setVisibility(View.GONE);
            }
        }

        if (count > 0) {
            holder.messageIcon.setVisibility(View.VISIBLE);
            holder.counter.setVisibility(View.VISIBLE);
            holder.counter.setText(count + "");
        } else {
            holder.messageIcon.setVisibility(View.GONE);
            holder.counter.setVisibility(View.GONE);
        }

        holder.caps.setVisibility(View.GONE);
        holder.avatar.setVisibility(View.GONE);
        if (joined)
            holder.statusIcon.setImageBitmap(iconPicker.getMucBitmap());
        else
            holder.statusIcon.setImageBitmap(iconPicker.getOfflineBitmap());
        return convertView;
    }
    return null;
}

From source file:com.cssweb.android.view.PriceMini.java

public void drawQihuo(Canvas canvas) {
    //canvas.restore();
    Paint paint = this.mPaint;
    paint.setTypeface(Typeface.DEFAULT_BOLD);
    paint.setAntiAlias(true);/*from w w  w  .  j  a  v  a 2s . co  m*/
    if (quoteData != null) {
        try {
            JSONArray jArr = quoteData.getJSONArray("data");
            JSONObject jo = jArr.getJSONObject(0);
            String str = "";
            double zrsp = jo.getDouble("zrsp");

            double zjcj = jo.getDouble("zjcj");
            paint.setTextSize(mTextSize * 2);
            setColor(paint, zjcj, zrsp);
            paint.setTextAlign(Paint.Align.LEFT);
            canvas.translate(DX, DY * 2f);
            canvas.drawText(Utils.dataFormation(zjcj, stockdigit), x, y, paint);

            paint.setStyle(Paint.Style.STROKE);
            paint.setTextSize(mTextSize);

            double zhangd = jo.getDouble("zd");
            if (zhangd < 0) {
                paint.setColor(GlobalColor.colorPriceDown);
            } else if (zhangd > 0) {
                paint.setColor(GlobalColor.colorpriceUp);
            } else {
                paint.setColor(GlobalColor.colorPriceEqual);
            }
            canvas.translate(-DX / 2, DY * 0.8f);
            String zhangdie = Utils.dataFormation(zhangd, stockdigit, jo.getInt("tp"));
            if (zhangdie.equals("-"))
                canvas.drawText("", x, y, paint);
            else
                canvas.drawText(zhangdie, x, y, paint);

            double zhangf = jo.getDouble("zf");
            if (zhangf < 0) {
                paint.setColor(GlobalColor.colorPriceDown);
            } else if (zhangf > 0) {
                paint.setColor(GlobalColor.colorpriceUp);
            } else {
                paint.setColor(GlobalColor.colorPriceEqual);
            }
            canvas.translate(DX * 2.5f, 0);
            String zhangfu = Utils.dataFormation(zhangf * 100, 1);
            if (zhangfu.equals("-") || zhangfu.equals(""))
                canvas.drawText("", x, y, paint);
            else
                canvas.drawText(zhangfu + "%", x, y, paint);

            paint.setColor(GlobalColor.colorLabelName);

            canvas.translate(-DX * 3, DY * 1.2f);
            canvas.drawText("?", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText(" ", x, y, paint);

            canvas.translate(width / 2, -DY * 2);
            paint.setTextAlign(Paint.Align.RIGHT);
            double temp2 = jo.getDouble("sjw1");
            setColor(paint, temp2, zrsp);
            str = Utils.dataFormation(temp2, stockdigit, jo.getInt("tp"));
            canvas.drawText(str, x - tips, y, paint);

            canvas.translate(0, DY);
            temp2 = jo.getDouble("bjw1");
            setColor(paint, temp2, zrsp);
            str = Utils.dataFormation(temp2, stockdigit, jo.getInt("tp"));
            canvas.drawText(str, x - tips, y, paint);

            paint.setColor(GlobalColor.colorStockName);
            canvas.translate(0, DY);
            canvas.drawText(Utils.dataFormation(jo.getDouble("jrkc"), 0, jo.getInt("tp")), x - tips, y, paint);

            paint.setColor(GlobalColor.colorLabelName);
            paint.setTextAlign(Paint.Align.LEFT);
            canvas.translate(0, -DY * 5);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("??", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText("?", x, y, paint);
            canvas.translate(0, DY);
            canvas.drawText(" ", x, y, paint);

            paint.setTextAlign(Paint.Align.RIGHT);
            canvas.translate(width / 2, -DY * 5);
            double jrkp = jo.getDouble("jrkp");
            setColor(paint, jrkp, zrsp);
            canvas.drawText(Utils.dataFormation(jrkp, stockdigit, jo.getInt("tp")), x - tips, y, paint);

            canvas.translate(0, DY);
            double zg = jo.getDouble("zgcj");
            setColor(paint, zg, zrsp);
            canvas.drawText(Utils.dataFormation(zg, stockdigit, jo.getInt("tp")), x - tips, y, paint);

            canvas.translate(0, DY);
            double zd = jo.getDouble("zdcj");
            setColor(paint, zd, zrsp);
            canvas.drawText(Utils.dataFormation(zd, stockdigit, jo.getInt("tp")), x - tips, y, paint);

            canvas.translate(0, DY);
            paint.setColor(GlobalColor.colorStockName);
            canvas.drawText(Utils.getAmountFormat(jo.getInt("ssl1"), false), x - tips, y, paint);

            canvas.translate(0, DY);
            canvas.drawText(Utils.getAmountFormat(jo.getInt("bsl1"), false), x - tips, y, paint);

            paint.setColor(GlobalColor.colorStockName);
            canvas.translate(0, DY);
            canvas.drawText(Utils.dataFormation(jo.getDouble("jrpc"), 0, jo.getInt("tp")), x - tips, y, paint);
        } catch (JSONException e) {
            Log.e(TAG, e.toString());
        }
    } else {//?????
        paint.setTextAlign(Paint.Align.LEFT);
        paint.setColor(GlobalColor.colorLabelName);

        canvas.translate(DX, DY * 2f);
        canvas.drawText("-", x, y, paint);

        paint.setStyle(Paint.Style.STROKE);
        paint.setTextSize(mTextSize);

        canvas.translate(-DX / 2, DY * 0.8f);
        canvas.drawText("-", x, y, paint);

        canvas.translate(DX * 2.5f, 0);
        canvas.drawText("-", x, y, paint);
        canvas.translate(-DX * 3, DY * 1.2f);
        canvas.drawText("?", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText(" ", x, y, paint);

        paint.setTextAlign(Paint.Align.LEFT);
        canvas.translate(width / 2, -DY * 5);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("??", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText("?", x, y, paint);
        canvas.translate(0, DY);
        canvas.drawText(" ", x, y, paint);
    }
}

From source file:com.shichai.www.choume.view.tab.SmartTabLayout.java

/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}./*from ww  w . j a v  a2s.c o m*/
 */
protected TextView createDefaultTabView(CharSequence title) {
    TextView textView = new TextView(getContext());
    textView.setGravity(Gravity.CENTER);
    textView.setText(title);
    textView.setTextColor(mTabViewTextColor);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabViewTextSize);
    textView.setTypeface(Typeface.DEFAULT_BOLD);
    textView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.MATCH_PARENT));

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // If we're running on Honeycomb or newer, then we can use the Theme's
        // selectableItemBackground to ensure that the View has a pressed state
        TypedValue outValue = new TypedValue();
        getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
        textView.setBackgroundResource(outValue.resourceId);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
        textView.setAllCaps(mTabViewTextAllCaps);
    }

    textView.setPadding(mTabViewTextHorizontalPadding, 0, mTabViewTextHorizontalPadding, 0);

    if (mTabViewTextMinWidth > 0) {
        textView.setMinWidth(mTabViewTextMinWidth);
    }

    return textView;
}

From source file:com.github.wakhub.monodict.activity.FlashcardActivity.java

@UiThread
void showAutoPlayAlertDialog() {
    if (autoPlayDialog != null) {
        return;/* w  w w .j  a  v  a2  s .com*/
    }

    LinearLayout layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setLayoutParams(new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    layout.setPadding(20, 20, 20, 20);
    autoPlayDisplayText = new TextView(this);
    autoPlayDisplayText.setTypeface(Typeface.DEFAULT_BOLD);
    layout.addView(autoPlayDisplayText);
    autoPlayTranslateText = new TextView(this);
    autoPlayTranslateText.setText(R.string.message_in_processing);
    layout.addView(autoPlayTranslateText);

    autoPlayDialog = new AlertDialog.Builder(this).setTitle(R.string.action_auto_play)
            .setIcon(R.drawable.ic_action_play).setView(layout)
            .setOnCancelListener(new DialogInterface.OnCancelListener() {
                @Override
                public void onCancel(DialogInterface dialogInterface) {
                    autoPlayDisplayText = null;
                    autoPlayTranslateText = null;
                    stopAutoPlay();
                }
            }).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    dialogInterface.cancel();
                }
            }).show();
}