Example usage for android.graphics Typeface BOLD_ITALIC

List of usage examples for android.graphics Typeface BOLD_ITALIC

Introduction

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

Prototype

int BOLD_ITALIC

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

Click Source Link

Usage

From source file:org.rm3l.ddwrt.tiles.admin.nvram.EditNVRAMKeyValueDialogFragment.java

@Override
public void onStart() {
    super.onStart(); //super.onStart() is where dialog.show() is actually called on the underlying dialog, so we have to do it after this point

    final AlertDialog d = (AlertDialog) getDialog();
    if (d != null) {

        ((TextView) d.findViewById(R.id.tile_admin_nvram_edit_key)).setText(this.mKey);
        final EditText valueEditText = (EditText) d.findViewById(R.id.tile_admin_nvram_edit_value);
        valueEditText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override// ww w.j  a  v a 2  s. c om
            public void onFocusChange(View v, boolean hasFocus) {
                ((TextView) d.findViewById(R.id.tile_admin_nvram_edit_value_textview)).setTypeface(null,
                        hasFocus ? Typeface.BOLD_ITALIC : Typeface.NORMAL);
            }
        });
        valueEditText.setText(this.mValue, TextView.BufferType.EDITABLE);

        d.getButton(Dialog.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                //Validate data
                final EditText editText = (EditText) d.findViewById(R.id.tile_admin_nvram_edit_value);
                final Editable newValue = editText.getText();

                if (mValue != null && StringUtils.equals(newValue.toString(), mValue.toString())) {
                    //Crouton
                    Crouton.makeText(getActivity(), "No change", ALERT,
                            (ViewGroup) (d.findViewById(R.id.tile_admin_nvram_edit_notification_viewgroup)))
                            .show();
                    editText.requestFocus();
                    //Open Keyboard
                    final InputMethodManager imm = (InputMethodManager) getActivity()
                            .getSystemService(Context.INPUT_METHOD_SERVICE);
                    if (imm != null) {
                        // only will trigger it if no physical keyboard is open
                        imm.showSoftInput(editText, 0);
                    }
                    return;
                }

                final CharSequence variableKey = ((TextView) d.findViewById(R.id.tile_admin_nvram_edit_key))
                        .getText();

                final Bundle token = new Bundle();
                token.putInt(POSITION, mPosition);
                token.putCharSequence(VALUE, newValue);
                token.putCharSequence(KEY, variableKey);

                //nvram set data changed
                new UndoBarController.UndoBar(getSherlockActivity())
                        .message(String.format("Variable '%s' will be updated", variableKey))
                        .listener(nvramDataRecyclerViewAdapter).token(token).show();

                d.cancel();
            }
        });
    }
}

From source file:org.odk.collect.android.widgets.SelectMultiWidget.java

@SuppressWarnings("unchecked")
public SelectMultiWidget(Context context, FormEntryPrompt prompt) {
    super(context, prompt);
    mPrompt = prompt;/*from  w ww  . ja  v  a 2 s.  co  m*/
    mCheckboxes = new ArrayList<CheckBox>();

    // SurveyCTO-added support for dynamic select content (from .csv files)
    XPathFuncExpr xPathFuncExpr = ExternalDataUtil.getSearchXPathExpression(prompt.getAppearanceHint());
    if (xPathFuncExpr != null) {
        mItems = ExternalDataUtil.populateExternalChoices(prompt, xPathFuncExpr);
    } else {
        mItems = prompt.getSelectChoices();
    }

    setOrientation(LinearLayout.VERTICAL);

    String fieldElementReference = prompt.getFormElement().getBind().getReference().toString();
    fieldName = getFieldID(fieldElementReference);

    if (fieldName.equalsIgnoreCase("typedirt")) {
        if (PropertiesUtils.getiAnswer32() == 1) {
            setVisibility(VISIBLE);
        } else
            setVisibility(INVISIBLE);
        PropertiesUtils.setLayoutQuestion321(this);
    }
    if (fieldName.equalsIgnoreCase("taste1")) {
        if (PropertiesUtils.getiAns33() == 0) {
            setVisibility(INVISIBLE);
        } else {
            if (PropertiesUtils.getiAns332() == 0) {
                setVisibility(INVISIBLE);
            } else
                setVisibility(VISIBLE);
        }
        PropertiesUtils.setLayoutQues333(this);
    }
    Vector<Selection> ve = new Vector<Selection>();
    if (prompt.getAnswerValue() != null) {
        ve = (Vector<Selection>) prompt.getAnswerValue().getValue();
    }

    //       int row_index       = 0 ;
    //       int col_index       = 0 ;
    Boolean isNewRow = false;
    Boolean isAddDirect = false;
    Boolean isTextView = false;
    Boolean isAddDivider = false;
    int itemCount = 0;

    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT, 0.5f);
    if (mItems != null) {
        for (int i = 0; i < mItems.size(); i++) {
            // no checkbox group so id by answer + offset
            View c;
            //Check text of the Choice Start With ($), i must be category
            if (prompt.getSelectChoiceText(mItems.get(i)).startsWith("$")) {
                StringBuilder sb = new StringBuilder(prompt.getSelectChoiceText(mItems.get(i)));
                String str = sb.deleteCharAt(0).toString();

                c = new TextView(getContext());
                ((TextView) c).setText(str);
                ((TextView) c).setTextSize(TypedValue.COMPLEX_UNIT_DIP, mQuestionFontsize + 1);
                ((TextView) c).setTypeface(null, Typeface.BOLD_ITALIC);
                c.setPadding(70, 10, 10, 10);
                c.setId(QuestionWidget.newUniqueId()); // assign random id
                isNewRow = true;
                itemCount = 0;
                isTextView = true;
                mCheckboxes.add(new CheckBox(context));
            } else { //  checkbox 
                isNewRow = true;
                isTextView = false;
                itemCount++;
                c = new CheckBox(getContext());
                c.setTag(Integer.valueOf(i));
                c.setId(QuestionWidget.newUniqueId());
                ((CheckBox) c).setText(prompt.getSelectChoiceText(mItems.get(i)));
                ((CheckBox) c).setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize);
                c.setFocusable(!prompt.isReadOnly());
                c.setEnabled(!prompt.isReadOnly());
                c.setPadding(10, 10, 10, 10);
                ((CheckBox) c).setLineSpacing(1, 1.15f);
                mCheckboxes.add((CheckBox) c);

            }

            if (!isTextView)
                for (int vi = 0; vi < ve.size(); vi++) {
                    // match based on value, not key
                    if (mItems.get(i).getValue().equals(ve.elementAt(vi).getValue())) {
                        ((CheckBox) c).setChecked(true);
                        break;
                    }

                }

            if (!prompt.getSelectChoiceText(mItems.get(i)).startsWith("$")) {
                // when clicked, check for readonly before toggling

                ((CheckBox) c).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                    @Override
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

                        try {
                            if (fieldName.equalsIgnoreCase("typedirt")) {

                                if (mItems.get((Integer) buttonView.getTag()).getValue()
                                        .equalsIgnoreCase("other")) {
                                    if (isChecked) {
                                        PropertiesUtils.getTvQuestion321Other().setVisibility(VISIBLE);
                                        PropertiesUtils.getEdQuestion321Other().setVisibility(VISIBLE);
                                        PropertiesUtils.setiAnswer321(1);
                                        PropertiesUtils.setIsOther321Checked(true);

                                    } else {
                                        PropertiesUtils.getTvQuestion321Other().setVisibility(INVISIBLE);
                                        PropertiesUtils.getEdQuestion321Other().setVisibility(INVISIBLE);
                                        PropertiesUtils.setiAnswer321(0);
                                        PropertiesUtils.setIsOther321Checked(false);
                                    }
                                } else {
                                    PropertiesUtils.getTvQuestion321Other().setVisibility(INVISIBLE);
                                    PropertiesUtils.getEdQuestion321Other().setVisibility(INVISIBLE);
                                    if (PropertiesUtils.isIsOther321Checked() == true) {
                                        PropertiesUtils.getTvQuestion321Other().setVisibility(VISIBLE);
                                        PropertiesUtils.getEdQuestion321Other().setVisibility(VISIBLE);
                                        PropertiesUtils.setiAnswer321(1);
                                    }
                                }

                            }
                            if (fieldName.equalsIgnoreCase("taste1")) {
                                if (mItems.get((Integer) buttonView.getTag()).getValue()
                                        .equalsIgnoreCase("other_taste")) {
                                    if (isChecked) {
                                        PropertiesUtils.setiAns333(1);
                                        PropertiesUtils.getTvQues333Other().setVisibility(VISIBLE);
                                        PropertiesUtils.getEdQues333Other().setVisibility(VISIBLE);
                                        PropertiesUtils.setIsOther333Checked(true);
                                    } else {
                                        PropertiesUtils.setiAns333(0);
                                        PropertiesUtils.getTvQues333Other().setVisibility(INVISIBLE);
                                        PropertiesUtils.getEdQues333Other().setVisibility(INVISIBLE);
                                        PropertiesUtils.setIsOther333Checked(false);
                                    }
                                } else {
                                    PropertiesUtils.getTvQues333Other().setVisibility(INVISIBLE);
                                    PropertiesUtils.getEdQues333Other().setVisibility(INVISIBLE);
                                    if (PropertiesUtils.isIsOther333Checked() == true) {
                                        PropertiesUtils.getTvQues333Other().setVisibility(VISIBLE);
                                        PropertiesUtils.getEdQues333Other().setVisibility(VISIBLE);
                                        PropertiesUtils.setiAns333(1);
                                    }
                                }

                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (!mCheckboxInit && mPrompt.isReadOnly()) {
                            if (buttonView.isChecked()) {
                                buttonView.setChecked(false);
                                Collect.getInstance().getActivityLogger().logInstanceAction(this,
                                        "onItemClick.deselect",
                                        mItems.get((Integer) buttonView.getTag()).getValue(),
                                        mPrompt.getIndex());
                            } else {
                                buttonView.setChecked(true);
                                Collect.getInstance().getActivityLogger().logInstanceAction(this,
                                        "onItemClick.select",
                                        mItems.get((Integer) buttonView.getTag()).getValue(),
                                        mPrompt.getIndex());
                            }
                        }
                    }
                });
            }

            String audioURI = null;
            audioURI = prompt.getSpecialFormSelectChoiceText(mItems.get(i), FormEntryCaption.TEXT_FORM_AUDIO);

            String imageURI;
            if (mItems.get(i) instanceof ExternalSelectChoice) {
                imageURI = ((ExternalSelectChoice) mItems.get(i)).getImage();
            } else {
                imageURI = prompt.getSpecialFormSelectChoiceText(mItems.get(i),
                        FormEntryCaption.TEXT_FORM_IMAGE);
            }

            String videoURI = null;
            videoURI = prompt.getSpecialFormSelectChoiceText(mItems.get(i), "video");

            String bigImageURI = null;
            bigImageURI = prompt.getSpecialFormSelectChoiceText(mItems.get(i), "big-image");

            MediaLayout mediaLayout = new MediaLayout(getContext());
            if (isTextView) {
                mediaLayout.setAVT(prompt.getIndex(), "." + Integer.toString(i), (TextView) c, audioURI,
                        imageURI, videoURI, bigImageURI);
            } else {
                mediaLayout.setAVT(prompt.getIndex(), "." + Integer.toString(i), (CheckBox) c, audioURI,
                        imageURI, videoURI, bigImageURI);
            }
            mediaLayout.setLayoutParams(params);

            //                row_index = i/2 +1;
            //                col_index = i%2;

            if (itemCount == 2) {
                isNewRow = false;
                itemCount = 0;
            }

            if (isNewRow) {
                ll = null;
                ll = new LinearLayout(getContext());
                ll.setOrientation(LinearLayout.HORIZONTAL);
                ll.addView(mediaLayout);
                isNewRow = false;
                isAddDirect = false;
                isAddDivider = false;

                try {
                    //if textview (category in choices) or the next element is textView , so must add direct
                    if (isTextView || prompt.getSelectChoiceText(mItems.get(i + 1)).startsWith("$"))
                        isAddDirect = true;
                } catch (Exception e) {
                    isAddDirect = true;

                }

                if (isAddDirect) {
                    addView(ll);
                    isAddDivider = true;
                }
            } else {
                ll.addView(mediaLayout);
                addView(ll);
                isAddDivider = true;
            }

            // add the dividing line between elements (except for the last element) but not last
            ImageView divider = new ImageView(getContext());
            divider.setBackgroundResource(android.R.drawable.divider_horizontal_bright);
            int size = mItems.size() / 2;
            // if ( (i+1)/2< size && (i+1)%2==0) {
            if (isAddDivider && i < mItems.size() - 1)
                addView(divider);

            // }

        }
    }

    mCheckboxInit = false;

}

From source file:com.ekuater.labelchat.ui.widget.PagerSlidingTabStrip.java

private int indexToTextStyle(int index, int defaultStyle) {
    int style;//from w  w w .  j  a va  2  s.  com

    switch (index) {
    case 0:
        style = Typeface.NORMAL;
        break;
    case 1:
        style = Typeface.BOLD;
        break;
    case 2:
        style = Typeface.ITALIC;
        break;
    case 3:
        style = Typeface.BOLD_ITALIC;
        break;
    default:
        style = defaultStyle;
        break;

    }
    return style;
}

From source file:org.stockchart.core.Appearance.java

static int fontStyleToTypefaceConstant(FontStyle fs) {
    switch (fs) {
    case BOLD:/*from w w  w.  ja va 2  s  .  c o m*/
        return Typeface.BOLD;
    case ITALIC:
        return Typeface.ITALIC;
    case BOLD_ITALIC:
        return Typeface.BOLD_ITALIC;
    case NORMAL:
        return Typeface.NORMAL;
    }

    return -1;
}

From source file:com.appeaser.sublimenavigationviewlibrary.SublimeNavigationView.java

public SublimeNavigationView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.SublimeNavigationView, defStyleAttr,
            R.style.SnvSublimeNavigationView);

    try {/* w w  w.j a  va2 s .co m*/
        // Used for creating default resources
        SublimeThemer.DefaultTheme defaultTheme = SublimeThemer.DefaultTheme.LIGHT;

        if (a.hasValue(R.styleable.SublimeNavigationView_snvDefaultTheme)) {
            defaultTheme = a.getInt(R.styleable.SublimeNavigationView_snvDefaultTheme, 0) == 0
                    ? SublimeThemer.DefaultTheme.LIGHT
                    : SublimeThemer.DefaultTheme.DARK;
        }

        mThemer = new SublimeThemer(getContext(), defaultTheme);

        mThemer.setDrawerBackground(a.getDrawable(R.styleable.SublimeNavigationView_android_background));

        if (a.hasValue(R.styleable.SublimeNavigationView_elevation)) {
            mThemer.setElevation(
                    (float) a.getDimensionPixelSize(R.styleable.SublimeNavigationView_elevation, 0));
        }

        ViewCompat.setFitsSystemWindows(this,
                a.getBoolean(R.styleable.SublimeNavigationView_android_fitsSystemWindows, false));
        mMaxWidth = a.getDimensionPixelSize(R.styleable.SublimeNavigationView_android_maxWidth, 0);

        if (a.hasValue(R.styleable.SublimeNavigationView_snvItemIconTint)) {
            mThemer.setIconTintList(a.getColorStateList(R.styleable.SublimeNavigationView_snvItemIconTint));
        }

        mThemer.setGroupExpandDrawable(a.getDrawable(R.styleable.SublimeNavigationView_snvGroupExpandDrawable));

        mThemer.setGroupCollapseDrawable(
                a.getDrawable(R.styleable.SublimeNavigationView_snvGroupCollapseDrawable));

        // Text style profiles for Item, Hint, SubheaderItem & SubheaderHint
        ColorStateList itemTextColor = null, hintTextColor = null, subheaderItemTextColor = null,
                subheaderHintTextColor = null, badgeTextColor = null;
        Typeface itemTypeface = null, hintTypeface = null, subheaderItemTypeface = null,
                subheaderHintTypeface = null, badgeTypeface = null;
        int itemTypefaceStyle = 0, hintTypefaceStyle = 0, subheaderItemTypefaceStyle = 0,
                subheaderHintTypefaceStyle = 0, badgeTypefaceStyle = 0;

        if (a.hasValue(R.styleable.SublimeNavigationView_snvItemTextColor)) {
            itemTextColor = a.getColorStateList(R.styleable.SublimeNavigationView_snvItemTextColor);
        }

        if (a.hasValue(R.styleable.SublimeNavigationView_snvHintTextColor)) {
            hintTextColor = a.getColorStateList(R.styleable.SublimeNavigationView_snvHintTextColor);
        }

        if (a.hasValue(R.styleable.SublimeNavigationView_snvSubheaderItemTextColor)) {
            subheaderItemTextColor = a
                    .getColorStateList(R.styleable.SublimeNavigationView_snvSubheaderItemTextColor);
        }

        if (a.hasValue(R.styleable.SublimeNavigationView_snvSubheaderHintTextColor)) {
            subheaderHintTextColor = a
                    .getColorStateList(R.styleable.SublimeNavigationView_snvSubheaderHintTextColor);
        }

        if (a.hasValue(R.styleable.SublimeNavigationView_snvBadgeTextColor)) {
            badgeTextColor = a.getColorStateList(R.styleable.SublimeNavigationView_snvBadgeTextColor);
        }

        try { // Catch the RuntimeException thrown if
              // the Typeface filename is incorrect
            if (a.hasValue(R.styleable.SublimeNavigationView_snvItemTypefaceFilename)) {
                String itemTypefaceFilename = a
                        .getString(R.styleable.SublimeNavigationView_snvItemTypefaceFilename);
                if (!TextUtils.isEmpty(itemTypefaceFilename)) {
                    itemTypeface = Typeface.createFromAsset(context.getAssets(), itemTypefaceFilename);
                }
            }

            if (a.hasValue(R.styleable.SublimeNavigationView_snvHintTypefaceFilename)) {
                String hintTypefaceFilename = a
                        .getString(R.styleable.SublimeNavigationView_snvHintTypefaceFilename);
                if (!TextUtils.isEmpty(hintTypefaceFilename)) {
                    hintTypeface = Typeface.createFromAsset(context.getAssets(), hintTypefaceFilename);
                }
            }

            if (a.hasValue(R.styleable.SublimeNavigationView_snvSubheaderItemTypefaceFilename)) {
                String subheaderItemTypefaceFilename = a
                        .getString(R.styleable.SublimeNavigationView_snvSubheaderItemTypefaceFilename);
                if (!TextUtils.isEmpty(subheaderItemTypefaceFilename)) {
                    subheaderItemTypeface = Typeface.createFromAsset(context.getAssets(),
                            subheaderItemTypefaceFilename);
                }
            }

            if (a.hasValue(R.styleable.SublimeNavigationView_snvSubheaderHintTypefaceFilename)) {
                String subheaderHintTypefaceFilename = a
                        .getString(R.styleable.SublimeNavigationView_snvSubheaderHintTypefaceFilename);
                if (!TextUtils.isEmpty(subheaderHintTypefaceFilename)) {
                    subheaderHintTypeface = Typeface.createFromAsset(context.getAssets(),
                            subheaderHintTypefaceFilename);
                }
            }

            if (a.hasValue(R.styleable.SublimeNavigationView_snvBadgeTypefaceFilename)) {
                String badgeTypefaceFilename = a
                        .getString(R.styleable.SublimeNavigationView_snvBadgeTypefaceFilename);
                if (!TextUtils.isEmpty(badgeTypefaceFilename)) {
                    badgeTypeface = Typeface.createFromAsset(context.getAssets(), badgeTypefaceFilename);
                }
            }
        } catch (RuntimeException re) {
            Log.e(TAG,
                    "Error loading Typeface from Assets. " + "Confirm that the Typeface filename is correct:\n"
                            + "    - filename should include the extension\n"
                            + "    - filename is case-sensitive");
        }

        if (a.hasValue(R.styleable.SublimeNavigationView_snvItemTypefaceStyle)) {
            itemTypefaceStyle = a.getInt(R.styleable.SublimeNavigationView_snvItemTypefaceStyle,
                    Typeface.NORMAL);

            switch (itemTypefaceStyle) {
            case 1:
                itemTypefaceStyle = Typeface.BOLD;
                break;
            case 2:
                itemTypefaceStyle = Typeface.ITALIC;
                break;
            case 3:
                itemTypefaceStyle = Typeface.BOLD_ITALIC;
                break;
            default:
                // case 0: NORMAL
                itemTypefaceStyle = Typeface.NORMAL;
                break;
            }
        }

        if (a.hasValue(R.styleable.SublimeNavigationView_snvHintTypefaceStyle)) {
            hintTypefaceStyle = a.getInt(R.styleable.SublimeNavigationView_snvHintTypefaceStyle,
                    Typeface.NORMAL);

            switch (hintTypefaceStyle) {
            case 1:
                hintTypefaceStyle = Typeface.BOLD;
                break;
            case 2:
                hintTypefaceStyle = Typeface.ITALIC;
                break;
            case 3:
                hintTypefaceStyle = Typeface.BOLD_ITALIC;
                break;
            default:
                // case 0: NORMAL
                hintTypefaceStyle = Typeface.NORMAL;
                break;
            }
        }

        if (a.hasValue(R.styleable.SublimeNavigationView_snvSubheaderItemTypefaceStyle)) {
            subheaderItemTypefaceStyle = a
                    .getInt(R.styleable.SublimeNavigationView_snvSubheaderItemTypefaceStyle, Typeface.NORMAL);

            switch (subheaderItemTypefaceStyle) {
            case 1:
                subheaderItemTypefaceStyle = Typeface.BOLD;
                break;
            case 2:
                subheaderItemTypefaceStyle = Typeface.ITALIC;
                break;
            case 3:
                subheaderItemTypefaceStyle = Typeface.BOLD_ITALIC;
                break;
            default:
                // case 0: NORMAL
                subheaderItemTypefaceStyle = Typeface.NORMAL;
                break;
            }
        }

        if (a.hasValue(R.styleable.SublimeNavigationView_snvSubheaderHintTypefaceStyle)) {
            subheaderHintTypefaceStyle = a
                    .getInt(R.styleable.SublimeNavigationView_snvSubheaderHintTypefaceStyle, Typeface.NORMAL);

            switch (subheaderHintTypefaceStyle) {
            case 1:
                subheaderHintTypefaceStyle = Typeface.BOLD;
                break;
            case 2:
                subheaderHintTypefaceStyle = Typeface.ITALIC;
                break;
            case 3:
                subheaderHintTypefaceStyle = Typeface.BOLD_ITALIC;
                break;
            default:
                // case 0: NORMAL
                subheaderHintTypefaceStyle = Typeface.NORMAL;
                break;
            }
        }

        if (a.hasValue(R.styleable.SublimeNavigationView_snvBadgeTypefaceStyle)) {
            badgeTypefaceStyle = a.getInt(R.styleable.SublimeNavigationView_snvBadgeTypefaceStyle,
                    Typeface.NORMAL);

            switch (badgeTypefaceStyle) {
            case 1:
                badgeTypefaceStyle = Typeface.BOLD;
                break;
            case 2:
                badgeTypefaceStyle = Typeface.ITALIC;
                break;
            case 3:
                badgeTypefaceStyle = Typeface.BOLD_ITALIC;
                break;
            default:
                // case 0: NORMAL
                badgeTypefaceStyle = Typeface.NORMAL;
                break;
            }
        }

        // Item text styling
        TextViewStyleProfile itemStyleProfile = new TextViewStyleProfile(context, defaultTheme);
        itemStyleProfile.setTextColor(itemTextColor).setTypeface(itemTypeface)
                .setTypefaceStyle(itemTypefaceStyle);
        mThemer.setItemStyleProfile(itemStyleProfile);

        // Hint text styling
        TextViewStyleProfile hintStyleProfile = new TextViewStyleProfile(context, defaultTheme);
        hintStyleProfile.setTextColor(hintTextColor).setTypeface(hintTypeface)
                .setTypefaceStyle(hintTypefaceStyle);
        mThemer.setItemHintStyleProfile(hintStyleProfile);

        // Sub-header item text styling
        TextViewStyleProfile subheaderItemStyleProfile = new TextViewStyleProfile(context, defaultTheme);
        subheaderItemStyleProfile.setTextColor(subheaderItemTextColor).setTypeface(subheaderItemTypeface)
                .setTypefaceStyle(subheaderItemTypefaceStyle);
        mThemer.setSubheaderStyleProfile(subheaderItemStyleProfile);

        // Sub-header hint text styling
        TextViewStyleProfile subheaderHintStyleProfile = new TextViewStyleProfile(context, defaultTheme);
        subheaderHintStyleProfile.setTextColor(subheaderHintTextColor).setTypeface(subheaderHintTypeface)
                .setTypefaceStyle(subheaderHintTypefaceStyle);
        mThemer.setSubheaderHintStyleProfile(subheaderHintStyleProfile);

        // Badge text styling
        TextViewStyleProfile badgeStyleProfile = new TextViewStyleProfile(context, defaultTheme);
        badgeStyleProfile.setTextColor(badgeTextColor).setTypeface(badgeTypeface)
                .setTypefaceStyle(badgeTypefaceStyle);
        mThemer.setBadgeStyleProfile(badgeStyleProfile);

        mThemer.setItemBackground(a.getDrawable(R.styleable.SublimeNavigationView_snvItemBackground));

        if (a.hasValue(R.styleable.SublimeNavigationView_snvMenu)) {
            int menuResId = a.getResourceId(R.styleable.SublimeNavigationView_snvMenu, -1);

            if (menuResId == -1) {
                throw new RuntimeException("Passed menuResId was not valid");
            }

            mMenu = new SublimeMenu(menuResId);
            inflateMenu(menuResId);
        }

        mMenu.setCallback(new SublimeMenu.Callback() {
            public boolean onMenuItemSelected(SublimeMenu menu, SublimeBaseMenuItem item,
                    OnNavigationMenuEventListener.Event event) {
                return SublimeNavigationView.this.mEventListener != null
                        && SublimeNavigationView.this.mEventListener.onNavigationMenuEvent(event, item);
            }
        });

        mPresenter = new SublimeMenuPresenter();
        applyThemer();

        mMenu.setMenuPresenter(getContext(), mPresenter);
        addView(mPresenter.getMenuView(this));

        if (a.hasValue(R.styleable.SublimeNavigationView_snvHeaderLayout)) {
            inflateHeaderView(a.getResourceId(R.styleable.SublimeNavigationView_snvHeaderLayout, 0));
        }
    } finally {
        a.recycle();
    }

    // Upon creation, and until initializations are done,
    // SublimeMenuPresenter blocks all calls for invalidation.
    // We can now finalize the initialization phase to allow
    // invalidation of the menu when required.
    mPresenter.setInitializationDone();
}

From source file:org.appcelerator.titanium.util.TiUIHelper.java

public static int toTypefaceStyle(final String fontWeight, final String fontStyle) {
    int style = Typeface.NORMAL;

    if (fontWeight != null) {
        if (fontWeight.equals("bold")) {
            if (fontStyle != null && fontStyle.equals("italic")) {
                style = Typeface.BOLD_ITALIC;
            } else {
                style = Typeface.BOLD;/*ww  w .  j  a  v  a2 s  .c om*/
            }
        } else if (fontStyle != null && fontStyle.equals("italic")) {
            style = Typeface.ITALIC;
        }
    } else if (fontStyle != null && fontStyle.equals("italic")) {
        style = Typeface.ITALIC;
    }
    return style;
}

From source file:com.github.irshulx.Components.InputExtensions.java

public void boldifyText(EditorControl tag, TextView editText, int textMode) {
    if (editorCore.containsStyle(tag.editorTextStyles, EditorTextStyle.BOLD)) {
        tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLD, Op.Delete);
        editText.setTypeface(getTypeface(textMode, Typeface.NORMAL));
    } else if (editorCore.containsStyle(tag.editorTextStyles, EditorTextStyle.BOLDITALIC)) {
        tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLDITALIC, Op.Delete);
        tag = editorCore.updateTagStyle(tag, EditorTextStyle.ITALIC, Op.Insert);
        editText.setTypeface(getTypeface(textMode, Typeface.ITALIC));
    } else if (editorCore.containsStyle(tag.editorTextStyles, EditorTextStyle.ITALIC)) {
        tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLDITALIC, Op.Insert);
        tag = editorCore.updateTagStyle(tag, EditorTextStyle.ITALIC, Op.Delete);
        editText.setTypeface(getTypeface(textMode, Typeface.BOLD_ITALIC));
    } else {/*from  w w w  . ja va  2 s  .  c  om*/
        tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLD, Op.Insert);
        editText.setTypeface(getTypeface(textMode, Typeface.BOLD));
    }
    editText.setTag(tag);
}

From source file:com.github.irshulx.Components.InputExtensions.java

public void italicizeText(EditorControl tag, TextView editText, int textMode) {

    if (editorCore.containsStyle(tag.editorTextStyles, EditorTextStyle.ITALIC)) {
        tag = editorCore.updateTagStyle(tag, EditorTextStyle.ITALIC, Op.Delete);
        editText.setTypeface(getTypeface(textMode, Typeface.NORMAL));
    } else if (editorCore.containsStyle(tag.editorTextStyles, EditorTextStyle.BOLDITALIC)) {
        tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLDITALIC, Op.Delete);
        tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLD, Op.Insert);
        editText.setTypeface(getTypeface(textMode, Typeface.BOLD));
    } else if (editorCore.containsStyle(tag.editorTextStyles, EditorTextStyle.BOLD)) {
        tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLDITALIC, Op.Insert);
        tag = editorCore.updateTagStyle(tag, EditorTextStyle.BOLD, Op.Delete);
        editText.setTypeface(getTypeface(textMode, Typeface.BOLD_ITALIC));
    } else {/*from w w  w .  j a  v a  2s  .  co m*/
        tag = editorCore.updateTagStyle(tag, EditorTextStyle.ITALIC, Op.Insert);
        editText.setTypeface(getTypeface(textMode, Typeface.ITALIC));
    }
    editText.setTag(tag);
}

From source file:com.money.manager.ex.common.AllDataListFragment.java

private void renderFooter() {
    this.footer = (LinearLayout) View.inflate(getActivity(), R.layout.item_generic_report_2_columns, null);

    TextView txtColumn1 = (TextView) footer.findViewById(R.id.textViewColumn1);
    TextView txtColumn2 = (TextView) footer.findViewById(R.id.textViewColumn2);

    txtColumn1.setText(R.string.total);/*from   ww w .  j ava2s .c  om*/
    txtColumn1.setTypeface(null, Typeface.BOLD_ITALIC);
    txtColumn2.setText(R.string.total);
    txtColumn2.setTypeface(null, Typeface.BOLD_ITALIC);

    ListView listView = getListView();
    listView.addFooterView(footer);
}

From source file:org.telegram.ui.ArticleViewer.java

private TextPaint getTextPaint(TLRPC.RichText parentRichText, TLRPC.RichText richText,
        TLRPC.PageBlock parentBlock) {/*from  w  w w. j a v  a 2s  .c om*/
    int flags = getTextFlags(richText);
    HashMap<Integer, TextPaint> currentMap = null;
    int textSize = AndroidUtilities.dp(14);
    int textColor = 0xffff0000;

    if (parentBlock instanceof TLRPC.TL_pageBlockPhoto) {
        currentMap = captionTextPaints;
        textSize = AndroidUtilities.dp(14);
        textColor = 0xff838c96;
    } else if (parentBlock instanceof TLRPC.TL_pageBlockTitle) {
        currentMap = titleTextPaints;
        textSize = AndroidUtilities.dp(24);
        textColor = 0xff000000;
    } else if (parentBlock instanceof TLRPC.TL_pageBlockAuthorDate) {
        currentMap = authorTextPaints;
        textSize = AndroidUtilities.dp(14);
        textColor = 0xff838c96;
    } else if (parentBlock instanceof TLRPC.TL_pageBlockFooter) {
        currentMap = footerTextPaints;
        textSize = AndroidUtilities.dp(14);
        textColor = 0xff838c96;
    } else if (parentBlock instanceof TLRPC.TL_pageBlockSubtitle) {
        currentMap = subtitleTextPaints;
        textSize = AndroidUtilities.dp(21);
        textColor = 0xff000000;
    } else if (parentBlock instanceof TLRPC.TL_pageBlockHeader) {
        currentMap = headerTextPaints;
        textSize = AndroidUtilities.dp(21);
        textColor = 0xff000000;
    } else if (parentBlock instanceof TLRPC.TL_pageBlockSubheader) {
        currentMap = subheaderTextPaints;
        textSize = AndroidUtilities.dp(18);
        textColor = 0xff000000;
    } else if (parentBlock instanceof TLRPC.TL_pageBlockBlockquote
            || parentBlock instanceof TLRPC.TL_pageBlockPullquote) {
        if (parentBlock.text == parentRichText) {
            currentMap = quoteTextPaints;
            textSize = AndroidUtilities.dp(15);
            textColor = 0xff000000;
        } else if (parentBlock.caption == parentRichText) {
            currentMap = subquoteTextPaints;
            textSize = AndroidUtilities.dp(14);
            textColor = 0xff838c96;
        }
    } else if (parentBlock instanceof TLRPC.TL_pageBlockPreformatted) {
        currentMap = preformattedTextPaints;
        textSize = AndroidUtilities.dp(14);
        textColor = 0xff000000;
    } else if (parentBlock instanceof TLRPC.TL_pageBlockParagraph) {
        if (parentBlock.caption == parentRichText) {
            currentMap = embedPostCaptionTextPaints;
            textSize = AndroidUtilities.dp(14);
            textColor = 0xff838c96;
        } else {
            currentMap = paragraphTextPaints;
            textSize = AndroidUtilities.dp(16);
            textColor = 0xff000000;
        }
    } else if (parentBlock instanceof TLRPC.TL_pageBlockList) {
        currentMap = listTextPaints;
        textSize = AndroidUtilities.dp(15);
        textColor = 0xff000000;
    } else if (parentBlock instanceof TLRPC.TL_pageBlockEmbed) {
        currentMap = embedTextPaints;
        textSize = AndroidUtilities.dp(14);
        textColor = 0xff838c96;
    } else if (parentBlock instanceof TLRPC.TL_pageBlockSlideshow) {
        currentMap = slideshowTextPaints;
        textSize = AndroidUtilities.dp(14);
        textColor = 0xff838c96;
    } else if (parentBlock instanceof TLRPC.TL_pageBlockEmbedPost) {
        if (richText != null) {
            currentMap = embedPostTextPaints;
            textSize = AndroidUtilities.dp(14);
            textColor = 0xff000000;
        }
    } else if (parentBlock instanceof TLRPC.TL_pageBlockVideo) {
        currentMap = videoTextPaints;
        textSize = AndroidUtilities.dp(14);
        textColor = 0xff000000;
    }
    if (currentMap == null) {
        if (errorTextPaint == null) {
            errorTextPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
            errorTextPaint.setColor(0xffff0000);
        }
        errorTextPaint.setTextSize(AndroidUtilities.dp(14));
        return errorTextPaint;
    }
    TextPaint paint = currentMap.get(flags);
    if (paint == null) {
        paint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
        if ((flags & TEXT_FLAG_MONO) != 0) {
            paint.setTypeface(AndroidUtilities.getTypeface("fonts/rmono.ttf"));
        } else {
            if (parentBlock instanceof TLRPC.TL_pageBlockTitle
                    || parentBlock instanceof TLRPC.TL_pageBlockHeader
                    || parentBlock instanceof TLRPC.TL_pageBlockSubtitle
                    || parentBlock instanceof TLRPC.TL_pageBlockSubheader) {
                if ((flags & TEXT_FLAG_MEDIUM) != 0 && (flags & TEXT_FLAG_ITALIC) != 0) {
                    paint.setTypeface(Typeface.create("serif", Typeface.BOLD_ITALIC));
                } else if ((flags & TEXT_FLAG_MEDIUM) != 0) {
                    paint.setTypeface(Typeface.create("serif", Typeface.BOLD));
                } else if ((flags & TEXT_FLAG_ITALIC) != 0) {
                    paint.setTypeface(Typeface.create("serif", Typeface.ITALIC));
                } else {
                    paint.setTypeface(Typeface.create("serif", Typeface.NORMAL));
                }
            } else {
                if ((flags & TEXT_FLAG_MEDIUM) != 0 && (flags & TEXT_FLAG_ITALIC) != 0) {
                    paint.setTypeface(AndroidUtilities.getTypeface("fonts/rmediumitalic.ttf"));
                } else if ((flags & TEXT_FLAG_MEDIUM) != 0) {
                    paint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
                } else if ((flags & TEXT_FLAG_ITALIC) != 0) {
                    paint.setTypeface(AndroidUtilities.getTypeface("fonts/ritalic.ttf"));
                }
            }
        }
        if ((flags & TEXT_FLAG_STRIKE) != 0) {
            paint.setFlags(paint.getFlags() | TextPaint.STRIKE_THRU_TEXT_FLAG);
        }
        if ((flags & TEXT_FLAG_UNDERLINE) != 0) {
            paint.setFlags(paint.getFlags() | TextPaint.UNDERLINE_TEXT_FLAG);
        }
        if ((flags & TEXT_FLAG_URL) != 0) {
            textColor = 0xff4d83b3;
        }
        paint.setColor(textColor);
        currentMap.put(flags, paint);
    }
    paint.setTextSize(textSize);
    return paint;
}