List of usage examples for android.widget TextView setSelected
@Override public void setSelected(boolean selected)
From source file:org.dmfs.webcal.adapters.MixedNavigationAdapter.java
@Override public void bindView(View view, final Context context, final Cursor cursor) { final long id = cursor.getLong(cursor.getColumnIndex(SubscribedCalendars.ITEM_ID) >= 0 ? cursor.getColumnIndex(SubscribedCalendars.ITEM_ID) : cursor.getColumnIndex(ContentItem._ID)); String itemType = cursor.getString(2); String season = cursor.getString(4); long img = cursor.getLong(3); if (CalendarContentContract.ContentItem.TYPE_PAGE.equals(itemType)) { TextView title = (TextView) view.findViewById(android.R.id.title); TextView subtitle = (TextView) view.findViewById(android.R.id.text1); title.setText(cursor.getString(1)); subtitle.setText(TextUtils.isEmpty(season) ? null : context.getString(R.string.season, season)); title.setSelected(true); RemoteImageView icon = (RemoteImageView) view.findViewById(android.R.id.icon); icon.setRemoteSource(img, mShowMissingIcons); } else {// w w w. j ava 2 s .co m TextView title = (TextView) view.findViewById(android.R.id.title); TextView subtitle = (TextView) view.findViewById(android.R.id.text1); RemoteImageView image = (RemoteImageView) view.findViewById(android.R.id.icon); subtitle.setText(TextUtils.isEmpty(season) ? null : context.getString(R.string.season, season)); title.setText(cursor.getString(1)); image.setRemoteSource(img, mShowMissingIcons); } TextView status = (TextView) view.findViewById(android.R.id.text2); // if (status != null) // { // if (!TextUtils.isEmpty(cursor.getString(4)) || !TextUtils.isEmpty(cursor.getString(8))) // { // status.setText(R.string.status_unlocked); // } // else if (TextUtils.isEmpty(cursor.getString(6)) && !CalendarContentContract.ContentItem.TYPE_PAGE.equals(itemType)) // { // status.setText(R.string.status_free); // } // else if ("".equals(cursor.getString(5))) // { // status.setText(R.string.status_free); // } // else if (cursor.getLong(7) > System.currentTimeMillis()) // { // status.setText(R.string.status_free_trial); // } // else // { // status.setText(""); // TextView price = (TextView) view.findViewById(R.id.content_item_price); // if (price != null && price.getVisibility() == View.VISIBLE) // { // price.setText(cursor.getString(9)); // } // } // } CheckBox starred = (CheckBox) view.findViewById(R.id.menu_starred); if (starred != null) { if (mShowStars) { starred.setVisibility(View.VISIBLE); starred.setOnCheckedChangeListener(null); starred.setChecked(cursor.getInt(5) > 0); starred.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { ContentItem.setStarred(context, id, isChecked); } }); } else { starred.setVisibility(View.GONE); } } }
From source file:cn.org.eshow.framwork.view.sliding.AbSlidingSmoothFixTabView.java
/** * ???.//from ww w. j av a2 s.c o m * * @param index the index */ public void computeTabImg(int index) { for (int i = 0; i < tabItemList.size(); i++) { TextView tv = tabItemList.get(i); tv.setTextColor(tabColor); tv.setSelected(false); if (index == i) { tv.setTextColor(tabSelectedColor); tv.setSelected(true); } } //? int itemWidth = mWidth / tabItemList.size(); LayoutParams mParams = new LayoutParams(itemWidth, tabSlidingHeight); mParams.topMargin = -tabSlidingHeight; mTabImg.setLayoutParams(mParams); AbLogUtil.d(AbSlidingSmoothFixTabView.class, "old--startX:" + startX); int toX = itemWidth * index; imageSlide(mTabImg, startX, toX, 0, 0); startX = toX; mSelectedTabIndex = index; }
From source file:com.bangqu.eshow.view.sliding.ESSlidingSmoothFixTabView.java
/** * ???./*from w ww . j ava 2 s . co m*/ * * @param index the index */ public void computeTabImg(int index) { for (int i = 0; i < tabItemList.size(); i++) { TextView tv = tabItemList.get(i); tv.setTextColor(tabColor); tv.setSelected(false); if (index == i) { tv.setTextColor(tabSelectedColor); tv.setSelected(true); } } //? int itemWidth = mWidth / tabItemList.size(); LayoutParams mParams = new LayoutParams(itemWidth, tabSlidingHeight); mParams.topMargin = -tabSlidingHeight; mTabImg.setLayoutParams(mParams); ESLogUtil.d(ESSlidingSmoothFixTabView.class, "old--startX:" + startX); int toX = itemWidth * index; imageSlide(mTabImg, startX, toX, 0, 0); startX = toX; mSelectedTabIndex = index; }
From source file:com.tony.selene.sliding.AbSlidingSmoothFixTabView.java
/** * ???.//from www. j a v a2 s . c om * * @param index * the index */ public void computeTabImg(int index) { for (int i = 0; i < tabItemList.size(); i++) { TextView tv = tabItemList.get(i); tv.setTextColor(tabColor); tv.setSelected(false); if (index == i) { tv.setTextColor(tabSelectedColor); tv.setSelected(true); } } // ? int itemWidth = mWidth / tabItemList.size(); LayoutParams mParams = new LayoutParams(itemWidth, tabSlidingHeight); mParams.topMargin = -tabSlidingHeight; mTabImg.setLayoutParams(mParams); AbLogUtil.d(AbSlidingSmoothFixTabView.class, "old--startX:" + startX); int toX = itemWidth * index; imageSlide(mTabImg, startX, toX, 0, 0); startX = toX; mSelectedTabIndex = index; }
From source file:org.ciasaboark.tacere.activity.fragment.AboutFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.fragment_about, container, false); context = getActivity();//from ww w .j a v a2 s .com ongoingToast = Toast.makeText(context, "", Toast.LENGTH_SHORT); TextView sourceText = (TextView) rootView.findViewById(id.about_source_text); sourceText.setMovementMethod(LinkMovementMethod.getInstance()); TextView bugsText = (TextView) rootView.findViewById(id.about_bugs_text); bugsText.setMovementMethod(LinkMovementMethod.getInstance()); TextView commentsText = (TextView) rootView.findViewById(id.about_comments_text); commentsText.setMovementMethod(LinkMovementMethod.getInstance()); TextView versionText = (TextView) rootView.findViewById(id.about_version_number); String formattedVersion = String.format(getString(R.string.about_version), Versioning.getVersionCode()); versionText.setText(formattedVersion); //textview using marquee scrolling, but this only works if the textview is selected versionText.setSelected(true); TextView versionType = (TextView) rootView.findViewById(id.about_version_type); String type; Authenticator authenticator = new Authenticator(context); type = authenticator.getAuthenticatedTypeString() + " version"; versionType.setText(type); final View betaSettingsHeaderContent = rootView.findViewById(id.about_header_beta_settings); betaSettingsHeaderContent.setOnTouchListener(mOnTouch); final View normalHeaderContent = rootView.findViewById(id.about_header_normal); normalHeaderContent.setOnTouchListener(mOnTouch); normalHeaderContent.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { toggleVisibility(normalHeaderContent); return true; } }); betaSettingsHeaderContent.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { toggleVisibility(normalHeaderContent); return true; } }); final View betaSettingsClickArea = rootView.findViewById(id.about_header_beta_settings_clickarea); betaSettingsClickArea.setOnTouchListener(mOnTouch); final SwitchCompat betaSettingsSwitch = (SwitchCompat) rootView .findViewById(id.about_header_beta_settings_switch); final BetaPrefs betaPrefs = new BetaPrefs(context); betaSettingsSwitch.setChecked(betaPrefs.isBetaPrefsUnlocked()); betaSettingsClickArea.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { betaSettingsSwitch.performClick(); betaPrefs.setIsBetaPrefsUnlocked(betaSettingsSwitch.isChecked()); } }); betaSettingsClickArea.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { toggleVisibility(normalHeaderContent); return true; } }); return rootView; }
From source file:com.groksolutions.grok.mobile.chart.AbstractAnomalyChartFragment.java
protected void updateName(final View parent, final AnomalyChartData data) { final TextView textView = (TextView) parent.findViewById(R.id.name); if (textView != null) { final CharSequence oldName = textView.getText(); if (data == null) { textView.setText(null);/* w w w . j a va2 s . c o m*/ textView.setSelected(false); } else if (!oldName.equals(data.getName())) { textView.setText(data.getName()); textView.setSelected(true); } parent.forceLayout(); } }
From source file:com.tarot.sdfnash.tarot.registnew.View.indicator.PageTabLabel.java
@Override public void setCurrentItem(int item) { if (mViewPager == null) { throw new IllegalStateException("ViewPager has not been bound."); }/*from w ww . j ava 2s . c o m*/ mSelectedTabIndex = item; mViewPager.setCurrentItem(item); try { TabView tabView = mTabViewList.get(item); if (tabView != null) { tabView.setText(mViewPager.getAdapter().getPageTitle(item)); } if (mLastSelectedItem >= 0) { tabView = mTabViewList.get(mLastSelectedItem); if (tabView != null) { tabView.setText(mViewPager.getAdapter().getPageTitle(mLastSelectedItem)); } } } catch (Exception e) { } try { TextView textView = mTextViewList.get(item); if (textView != null) { textView.setText(mViewPager.getAdapter().getPageTitle(item)); textView.setSelected(true); } if (mLastSelectedItem >= 0 && mLastSelectedItem != mSelectedTabIndex) { textView = mTextViewList.get(mLastSelectedItem); if (textView != null) { textView.setText(mViewPager.getAdapter().getPageTitle(mLastSelectedItem)); textView.setSelected(false); } } } catch (Exception e) { } mLastSelectedItem = item; int divider = 1; final int tabCount = mTabLayout.getChildCount(); for (int i = 0; i < tabCount; i++) { if (mDividerRes > 0 && i % 2 == 1) { divider = 2; continue; } final View child = mTabLayout.getChildAt(i); final boolean isSelected = (i == item * divider); child.setSelected(isSelected); // DLog.d("@@@child " + child.findViewById(R.id.tab_text) + " " + isSelected); // child.findViewById(R.id.tab_text).setSelected(isSelected); if (isSelected) { animateToTab(item * divider); } } }
From source file:com.jams.music.player.MainActivity.MainActivity.java
/** * Displays the folder fragment's action items. * * @param filePath The file path to set as the ActionBar's title text. * @param inflater The ActionBar's menu inflater. * @param menu The ActionBar menu to work with. * @param showPaste Pass true if the ActionBar is being updated for a copy/move operation. *//*from w w w . j a va2 s . c o m*/ public void showFolderFragmentActionItems(String filePath, MenuInflater inflater, Menu menu, boolean showPaste) { getMenu().clear(); inflater.inflate(R.menu.files_folders_fragment, menu); getSupportActionBar().setDisplayShowTitleEnabled(false); getSupportActionBar().setDisplayUseLogoEnabled(false); getSupportActionBar().setDisplayShowCustomEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setLogo(0); getSupportActionBar().setIcon(0); if (showPaste) { //Change the ActionBar's background and show the Paste Here option. menu.findItem(R.id.action_paste).setVisible(true); menu.findItem(R.id.action_cancel).setVisible(true); getSupportActionBar().setBackgroundDrawable( mContext.getResources().getDrawable(R.drawable.cab_background_top_apptheme)); //Change the KitKat system bar color. if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) getWindow().setBackgroundDrawable(new ColorDrawable(0xFF002E3E)); } else { //Hide the Paste Here option and set the default ActionBar background. menu.findItem(R.id.action_paste).setVisible(false); menu.findItem(R.id.action_cancel).setVisible(false); getSupportActionBar().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext)); //Change the KitKat system bar color. if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) getWindow().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext)); } LayoutInflater inflator = LayoutInflater.from(this); View view = inflator.inflate(R.layout.custom_actionbar_layout, null); TextView titleText = (TextView) view.findViewById(R.id.custom_actionbar_title); titleText.setText(filePath); titleText.setSelected(true); titleText.setTextColor(0xFFFFFFFF); //Inject the custom view into the ActionBar. getSupportActionBar().setCustomView(view); }
From source file:com.ab.view.sliding.AbSlidingTabView2.java
/** * //from w w w. ja va2 s. co m * ??? * @param index * @throws */ public void computeTabImg(int index) { for (int i = 0; i < tabItemList.size(); i++) { TextView tv = tabItemList.get(i); tv.setTextColor(tabColor); tv.setSelected(false); if (index == i) { tv.setTextColor(tabSelectColor); tv.setSelected(true); } } // final View tabView = mTabLayout.getChildAt(index); AbViewUtil.measureView(tabView); LayoutParams mParams = new LayoutParams(tabView.getMeasuredWidth(), tabSlidingHeight); mParams.topMargin = -tabSlidingHeight; mTabImg.setLayoutParams(mParams); if (D) Log.d(TAG, "old--startX:" + startX); //????????tab if (D) Log.d(TAG, "view" + index + ":" + tabView.getMeasuredWidth()); if (D) Log.d(TAG, "ScrollView:" + mTabScrollView.getWidth()); if (D) Log.d(TAG, "scrollX:" + scrollX); if (D) Log.d(TAG, "tabView right:" + tabView.getRight()); if (D) Log.d(TAG, "tabView left:" + tabView.getLeft()); if (mSelectedTabIndex < index && tabView.getRight() - scrollX > mTabScrollView.getWidth()) { if (D) Log.d(TAG, "??"); int offsetX = 0; //?? if (index == mTabLayout.getChildCount() - 1) { offsetX = tabView.getRight() - mTabScrollView.getWidth() - scrollX; mTabScrollView.smoothScrollBy(offsetX, 0); scrollX = scrollX + offsetX; if (D) Log.d(TAG, "startX:" + startX + ",offsetX:" + offsetX); imageSlide(mTabImg, startX, mTabScrollView.getWidth() - tabView.getMeasuredWidth(), 0, 0); startX = mTabScrollView.getWidth() - tabView.getMeasuredWidth(); } else { offsetX = tabView.getMeasuredWidth(); mTabScrollView.smoothScrollBy(offsetX, 0); scrollX = scrollX + offsetX; if (D) Log.d(TAG, "startX:" + startX + ",offsetX:" + offsetX); int toX = tabView.getLeft() - scrollX; imageSlide(mTabImg, startX, toX, 0, 0); startX = toX; } } else if (mSelectedTabIndex > index && tabView.getLeft() < scrollX) { if (D) Log.d(TAG, "?"); //? offsetX int offsetX = 0; if (index == 0) { offsetX = -scrollX; mTabScrollView.smoothScrollBy(offsetX, 0); scrollX = scrollX + offsetX; imageSlide(mTabImg, startX, 0, 0, 0); startX = 0; } else { offsetX = -tabView.getMeasuredWidth(); mTabScrollView.smoothScrollBy(offsetX, 0); scrollX = scrollX + offsetX; if (D) Log.d(TAG, "startX2:" + startX + ",offsetX:" + offsetX); int toX = tabView.getLeft() - scrollX; imageSlide(mTabImg, startX, toX, 0, 0); startX = toX; } } else { int toX = tabView.getLeft() - scrollX; imageSlide(mTabImg, startX, toX, 0, 0); startX = toX; } mSelectedTabIndex = index; }
From source file:com.aniruddhc.acemusic.player.MainActivity.MainActivity.java
/** * Displays the folder fragment's action items. * * @param filePath The file path to set as the ActionBar's title text. * @param inflater The ActionBar's menu inflater. * @param menu The ActionBar menu to work with. * @param showPaste Pass true if the ActionBar is being updated for a copy/move operation. *//*w ww . jav a2 s. co m*/ public void showFolderFragmentActionItems(String filePath, MenuInflater inflater, Menu menu, boolean showPaste) { getMenu().clear(); inflater.inflate(R.menu.files_folders_fragment, menu); getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setDisplayUseLogoEnabled(false); getActionBar().setDisplayShowCustomEnabled(true); getActionBar().setHomeButtonEnabled(true); getActionBar().setLogo(0); getActionBar().setIcon(0); if (showPaste) { //Change the ActionBar's background and show the Paste Here option. menu.findItem(R.id.action_paste).setVisible(true); menu.findItem(R.id.action_cancel).setVisible(true); getActionBar().setBackgroundDrawable( mContext.getResources().getDrawable(R.drawable.cab_background_top_apptheme)); //Change the KitKat system bar color. if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) getWindow().setBackgroundDrawable(new ColorDrawable(0xFF002E3E)); } else { //Hide the Paste Here option and set the default ActionBar background. menu.findItem(R.id.action_paste).setVisible(false); menu.findItem(R.id.action_cancel).setVisible(false); getActionBar().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext)); //Change the KitKat system bar color. if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) getWindow().setBackgroundDrawable(UIElementsHelper.getGeneralActionBarBackground(mContext)); } LayoutInflater inflator = LayoutInflater.from(this); View view = inflator.inflate(R.layout.custom_actionbar_layout, null); TextView titleText = (TextView) view.findViewById(R.id.custom_actionbar_title); titleText.setText(filePath); titleText.setSelected(true); titleText.setTextColor(0xFFFFFFFF); //Inject the custom view into the ActionBar. getActionBar().setCustomView(view); }