Example usage for android.widget TextView setSelected

List of usage examples for android.widget TextView setSelected

Introduction

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

Prototype

@Override
    public void setSelected(boolean selected) 

Source Link

Usage

From source file:com.luanthanhthai.android.liteworkouttimer.TimerFragment.java

/**
 * Display selected time with color,//from   w w w.  j  a va  2  s. co m
 * and deselect the other
 */
public void selectTimerTextView(TextView selectView, TextView deselectView) {
    selectView.setSelected(true);
    deselectView.setSelected(false);
    selectView.setTextColor(getColor(getContext(), restColor));
    deselectView.setTextColor(getColor(getContext(), timerColor));
    firstDigitHasValue = false;
}

From source file:com.mit.dstore.widget.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);
            tab.setSelected(false);

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }//from www . ja v  a  2 s .  c  om
            }
            if (i == selectedPosition) {
                tab.setSelected(true);
                tab.setTextColor(selectedTabTextColor);
            }
        }
    }

}

From source file:org.live.circle.component.PagerSlidingTabStrip.java

private void updateTabStyles() {
    if (tabView == null || tabView.length == 0) {
        return;//from www. j  av a2 s  . c o m
    }
    for (int i = 0; i < tabView.length; i++) {
        View v = tabView[i];
        if (pager.getAdapter() != null && pager.getAdapter() instanceof CustomTabProvider) {
        } else {
            v.setBackgroundResource(tabBackgroundResId);
        }
        if (v instanceof TextView) {
            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);
            tab.setSelected(i == (pager != null ? pager.getCurrentItem() : 0));
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }
            }
        } else if (v instanceof ImageView) {
            ImageView tab = (ImageView) v;
            tab.setSelected(i == (pager != null ? pager.getCurrentItem() : 0));
        }
    }
}

From source file:com.zhongsou.souyue.ui.indicator.SuberPageIndicator.java

@Override
public void setCurrentItem(int item) {
    if (mViewPager == null) {
        throw new IllegalStateException("ViewPager has not been bound.");
    }//w  w w . j  a v  a 2  s . c o m
    mSelectedTabIndex = item;
    mViewPager.setCurrentItem(item);
    final int tabCount = mTabLayout.getChildCount();
    for (int i = 0; i < tabCount; i++) {
        final TextView child = (TextView) mTabLayout.getChildAt(i);
        final boolean isSelected = (i == item);
        if (isSelected) {
            //?.
            child.setTextColor(Color.parseColor("#da4644"));
            child.setBackgroundResource(R.drawable.suberlist_indicator_underline);
        } else {
            //?????
            child.setTextColor(getResources().getColor(R.color.middark_black));
            child.setBackgroundColor(Color.TRANSPARENT);
        }
        child.setSelected(isSelected);
        if (isSelected) {
            animateToTab(item);
        }
    }
}

From source file:com.pinthecloud.item.view.PagerSlidingTabStrip.java

private void updateActivateTab(final int position) {
    for (int i = 0; i < tabCount; i++) {
        View v = tabsContainer.getChildAt(i);

        if (v instanceof TextView) {
            TextView tab = (TextView) v;
            tab.setTextColor(position == i ? tabTextColor : tabDeactivateTextColor);
        } else if (v instanceof ImageButton) {
            ImageButton tab = (ImageButton) v;
            tab.setSelected(position == i ? true : false);
        } else {/*from   w  w  w.j  a  v  a 2  s.  c  om*/
            v.setSelected(position == i ? true : false);
        }
    }
}

From source file:com.csform.android.uiapptemplate.view.PagerSlidingTabStrip.java

private void unSelect(View tab) {
    if (tab != null) {
        TextView tab_title = (TextView) tab.findViewById(R.id.psts_tab_title);
        if (tab_title != null) {
            tab_title.setSelected(false);
        }/*from ww w  .j a v  a  2s.  c  om*/
        if (isCustomTabs)
            ((CustomTabProvider) mPager.getAdapter()).tabUnselected(tab);
    }
}

From source file:com.csform.android.uiapptemplate.view.PagerSlidingTabStrip.java

private void select(View tab) {
    if (tab != null) {
        TextView tab_title = (TextView) tab.findViewById(R.id.psts_tab_title);
        if (tab_title != null) {
            tab_title.setSelected(true);
        }/*from w w w.  j ava 2  s .  co m*/
        if (isCustomTabs)
            ((CustomTabProvider) mPager.getAdapter()).tabSelected(tab);
    }
}

From source file:com.bei.test.view.tab.PagerSlidingTabStrip.java

private void unSelect(View tab) {
    if (tab != null) {
        TextView tab_title = (TextView) tab.findViewById(R.id.psts_tab_title);
        if (tab_title != null) {
            tab_title.setSelected(false);
            tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabNormalTextSize);
        }// w  w  w .  j  a va2s  .c o m
        if (isCustomTabs)
            ((CustomTabProvider) mPager.getAdapter()).tabUnselected(tab);
    }
}

From source file:com.bei.test.view.tab.PagerSlidingTabStrip.java

private void select(View tab) {
    if (tab != null) {
        TextView tab_title = (TextView) tab.findViewById(R.id.psts_tab_title);
        if (tab_title != null) {
            tab_title.setSelected(true);
            tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabSelectTextSize);
        }/*  w  w  w.j a  v a  2 s  .  co m*/
        if (isCustomTabs)
            ((CustomTabProvider) mPager.getAdapter()).tabSelected(tab);
    }
}

From source file:yjbo.yy.ynewsrecycle.mainutil.PSFirst.java

private void select(View tab) {
    if (tab != null) {
        TextView tab_title = (TextView) tab.findViewById(R.id.psts_tab_title);
        if (tab_title != null) {
            tab_title.setSelected(true);
            // LogUtils.i("--select----");
            tab_title.setTextColor(Color.parseColor("#29b4ed"));
            tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize);
            //                TextPaint tp = tab_title.getPaint();
            //                tp.setFakeBoldText(true);
        }/*from w  w  w  .  j  a v a 2 s .c o m*/
        if (isCustomTabs)
            ((CustomTabProvider) mPager.getAdapter()).tabSelected(tab);
    }
}