Example usage for android.widget TextView setAllCaps

List of usage examples for android.widget TextView setAllCaps

Introduction

In this page you can find the example usage for android.widget TextView setAllCaps.

Prototype

public void setAllCaps(boolean allCaps) 

Source Link

Document

Sets the properties of this field to transform input to ALL CAPS display.

Usage

From source file:Main.java

/**
 * Sets the font face of {@code view} to all caps (true) or regular (false).
 * @param view the text view to update/*w w  w.jav a  2s.  co  m*/
 * @param allCaps true for all caps, false otherwise
 */
public static void setAllCaps(TextView view, boolean allCaps) {
    if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
        view.setAllCaps(allCaps);
    }
}

From source file:com.odoo.addons.crm.CRMOpportunitiesPager.java

private void initPager(View view) {
    getActivity().getContentResolver().registerContentObserver(crmStage.uri(), true, observer);
    initCR();/*from   ww  w.  j  av  a2s .c o  m*/
    mPager = (ViewPager) view.findViewById(R.id.pager);
    mPager.setOnPageChangeListener(this);
    mTabStrip = (PagerTabStrip) view.findViewById(R.id.pager_title_strip);
    mTabStrip.setTabIndicatorColor(Color.WHITE);
    mPager.setOffscreenPageLimit(2);
    mAdapter = new StagePagerAdapter(cursor, getChildFragmentManager());
    mPager.setAdapter(mAdapter);
    for (int i = 0; i < mTabStrip.getChildCount(); ++i) {
        View nextChild = mTabStrip.getChildAt(i);
        if (nextChild instanceof TextView) {
            TextView textViewToConvert = (TextView) nextChild;
            textViewToConvert.setAllCaps(true);
            textViewToConvert.setTextColor(Color.WHITE);
            textViewToConvert.setTypeface(OControlHelper.boldFont());
        }
    }
}

From source file:com.odoo.addons.notes.StagesPager.java

private void updatePager() {
    viewPager = (ViewPager) mView.findViewById(R.id.pager);
    pagerTabStrip = (PagerTabStrip) mView.findViewById(R.id.pager_title_strip);
    viewPager.setOnPageChangeListener(this);
    viewPager.setOffscreenPageLimit(2);//from  w  w w .j  av a2 s . c  o  m
    pagerTabStrip.setTabIndicatorColor(Color.WHITE);
    stagePagerAdapter = new StagePagerAdapter(getChildFragmentManager());
    viewPager.setAdapter(stagePagerAdapter);
    for (int i = 0; i < pagerTabStrip.getChildCount(); ++i) {
        View nextChild = pagerTabStrip.getChildAt(i);
        if (nextChild instanceof TextView) {
            TextView textViewToConvert = (TextView) nextChild;
            textViewToConvert.setAllCaps(true);
            textViewToConvert.setTextColor(Color.WHITE);
            textViewToConvert.setTypeface(OControlHelper.boldFont());
        }
    }
    viewPager.setCurrentItem(stagePosition);
}

From source file:ch.pantas.billsplitter.ui.FixedTabsView.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {
        TextView v = (TextView) tabsContainer.getChildAt(i);

        TextView tab = (TextView) v;
        tab.setTextSize(TypedValue.COMPLEX_UNIT_DIP, tabTextSize);
        tab.setTypeface(tabTypeface, tabTypefaceStyle);
        tab.setTextColor(tabTextColor);//from www  .  j av a  2s  .  co m

        tab.setAllCaps(textAllCaps);
    }

}

From source file:com.github.johnpersano.supertoasts.demo.views.TabStrip.java

private void addTextTab(final int position, String title) {

    TextView tab = new TextView(getContext());
    tab.setText(title);//from w  ww.ja  v a 2s.com
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tab.setAllCaps(true);

    addTab(position, tab);
}

From source file:com.jasonchen.microlang.view.SlidingTabLayout.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   w w w. j a  v a2 s. c om
 */
protected View createDefaultTabView(Context context) {
    View v;
    if (mIconAdapter == null) {
        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);
        textView.setAllCaps(true);
        textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.MATCH_PARENT));

        v = textView;
    } else {
        ImageView imgView = new TintImageView(context);
        imgView.setScaleType(ImageView.ScaleType.FIT_XY);
        imgView.setLayoutParams(new LinearLayout.LayoutParams(mTabIconSize, mTabIconSize));
        v = imgView;
    }

    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
    v.setBackgroundResource(outValue.resourceId);

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

    return v;
}

From source file:com.android.contacts.list.MultiSelectContactsListFragment.java

protected void bindListHeaderCustom(View listView, View accountFilterContainer) {
    bindListHeaderCommon(listView, accountFilterContainer);

    final TextView accountFilterHeader = (TextView) accountFilterContainer
            .findViewById(R.id.account_filter_header);
    accountFilterHeader.setText(R.string.listCustomView);
    accountFilterHeader.setAllCaps(false);

    final ImageView accountFilterHeaderIcon = (ImageView) accountFilterContainer
            .findViewById(R.id.account_filter_icon);
    accountFilterHeaderIcon.setVisibility(View.GONE);
}

From source file:com.dreamspace.superman.UI.View.SlidingTabLayout.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)}.// ww  w  . j  a  va2  s.c o m
 */
protected View createDefaultTabView(Context context) {
    View v;
    if (mIconAdapter == null) {
        TextView textView = new TextView(context);
        textView.setGravity(Gravity.CENTER);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
        textView.setTypeface(Typeface.DEFAULT);
        textView.setAllCaps(true);
        textView.setTextColor(getStartColor());
        if (fillTheWidth) {
            textView.setLayoutParams(new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1));
        } else {
            textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                    ViewGroup.LayoutParams.MATCH_PARENT));

        }
        ;

        v = textView;
    } else {
        ImageView imgView = new TintImageView(context);
        imgView.setScaleType(ImageView.ScaleType.FIT_XY);
        imgView.setLayoutParams(new LinearLayout.LayoutParams(mTabIconSize, mTabIconSize));
        v = imgView;
    }

    TypedValue outValue = new TypedValue();
    getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
    v.setBackgroundResource(outValue.resourceId);

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

    return v;
}

From source file:com.ibm.mil.readyapps.telco.activities.MainActivity.java

/**
 * Programmatically take away all caps for tab bar titles.
 *
 * @param pagerAdapter needed so we know how many tabs to loop through
 *///from  w  w w. j  a  va 2s.  co m
private void updateTabText(ViewPagerAdapter pagerAdapter) {
    Typeface font = FontCache.get("Roboto-Regular.ttf", context);

    for (int i = 0; i < pagerAdapter.getCount(); i++) {
        TextView tv = (TextView) (((LinearLayout) ((LinearLayout) tabLayout.getChildAt(0)).getChildAt(i))
                .getChildAt(0));
        tv.setAllCaps(false);
        tv.setTypeface(font);
    }
}

From source file:devicroft.burnboy.Activities.MainActivity.java

private void dispatchLicenseDialog() {
    Log.d(LOG_TAG, "dispatchLicenseDialog");
    AlertDialog d = new AlertDialog.Builder(this).setTitle("Licenses")
            .setMessage(Html.fromHtml(getString(R.string.license_fab) + "<br><br>"
                    + getString(R.string.license_mpandroidchart) + getString(R.string.app_name))) //https://stackoverflow.com/questions/3235131/set-textview-text-from-html-formatted-string-resource-in-xml
            .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();/*from   w  w w .j av  a  2 s  . c o  m*/
                }
            }).show();
    TextView textView = (TextView) d.findViewById(android.R.id.message);
    textView.setScroller(new Scroller(this));
    textView.setVerticalScrollBarEnabled(true);
    textView.setAllCaps(false);
    textView.setMovementMethod(new ScrollingMovementMethod());
}