List of usage examples for android.widget TextView isSelected
@ViewDebug.ExportedProperty public boolean isSelected()
From source file:com.creationgroundmedia.popularmovies.reviews.ReviewFragment.java
@Override public void onLoadFinished(Loader<List<ReviewItem>> loader, final List<ReviewItem> data) { if (data != null) { for (ReviewItem review : data) { View tv = LayoutInflater.from(getContext()).inflate(R.layout.fragment_review, null); ((LinearLayout) mView).addView(tv); TextView authorView = (TextView) tv.findViewById(R.id.author); authorView.setText(String.format("Review by %s", review.getAuthor())); final TextView contentView = (TextView) tv.findViewById(R.id.content); contentView.setMaxLines(PREVIEW_LINES); contentView.setEllipsize(TextUtils.TruncateAt.END); contentView.setSelected(false); contentView.setText(review.getContent()); tv.setOnClickListener(new View.OnClickListener() { @Override/*from ww w . ja v a 2s . c o m*/ public void onClick(View v) { if (contentView.isSelected()) { contentView.setEllipsize(TextUtils.TruncateAt.END); contentView.setMaxLines(PREVIEW_LINES); contentView.setSelected(false); } else { contentView.setEllipsize(null); contentView.setMaxLines(Integer.MAX_VALUE); contentView.setSelected(true); } } }); } getLoaderManager().destroyLoader(URL_REVIEWLOADER); } }
From source file:com.hector.invoice.views.TabExportInvoiceOrder.java
/** * Mo ta chuc nang cua ham//from w ww . ja va 2 s. co m * * @author: TamPQ * @param context * @param tabName * @param type * @return * @return: View * @throws: */ private View createTabView(Context context, String tabName, int type) { TextView tvTitleTab = (TextView) LayoutInflater.from(context).inflate(R.layout.tab_item_top, null); // ImageView ivNumPage = (ImageView) view.findViewById(R.id.ivNumPage); switch (type) { case Constants.TAB_EXPORT_RECHNUNG: tvTitleTab.setText("Rechnung"); if (!tvTitleTab.isSelected()) { tvTitleTab.setBackgroundColor(ImageUtil.getColor(R.color.TRANSPARENT)); } else { tvTitleTab.setBackgroundResource(R.drawable.bg_button_green); } break; case Constants.TAB_EXPORT_LIEFERSCHEIN: tvTitleTab.setText("Lieferschein"); if (!tvTitleTab.isSelected()) { tvTitleTab.setBackgroundColor(ImageUtil.getColor(R.color.TRANSPARENT)); } else { tvTitleTab.setBackgroundResource(R.drawable.bg_button_green); } break; case Constants.TAB_EXPORT_ANGEBOT: tvTitleTab.setText("Angebot"); if (!tvTitleTab.isSelected()) { tvTitleTab.setBackgroundColor(ImageUtil.getColor(R.color.TRANSPARENT)); } else { tvTitleTab.setBackgroundResource(R.drawable.bg_button_green); } break; default: break; } return tvTitleTab; }
From source file:cc.wudoumi.framework.views.PagerSlidingTabStrip.java
private void updateTabTextSize(TextView tab) { if (tabTextSizeChange) { if (tab.isSelected()) { tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selecttabTextSize); } else {/*from w w w .ja v a 2 s . c o m*/ tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize); } } }
From source file:ru.adios.budgeter.widgets.DataTableLayout.java
private void setOrderByInternal(OrderBy orderBy, boolean doReloadIfNeeded) { checkState(!orderResolver.isPresent() || orderBy != null, "User ordering enabled, cannot set no ordering at all"); if ((this.orderBy.isPresent() && !this.orderBy.get().equals(orderBy)) || (!this.orderBy.isPresent() && orderBy != null)) { if (orderResolver.isPresent() && columnsRow.isPresent()) { final TableRow[] colsRow = columnsRow.get(); outer: for (final TableRow r : colsRow) { for (int j = 0; j < r.getChildCount(); j++) { final TextView col = (TextView) r.getChildAt(j); if (col.getText().toString() .equals(orderResolver.get().byField(orderBy.field).orElse(null))) { if (!col.isSelected()) { selectOrderByColumn(col); }/*from w ww .j av a 2 s. com*/ break outer; } } } } this.orderBy = Optional.ofNullable(orderBy); if (tablePopulated && doReloadIfNeeded) { clearContents(); loadTableProcedures(); } } }
From source file:yjbo.yy.ynewsrecycle.mainutil.PSFirst.java
private void updateTabStyles() { for (int i = 0; i < mTabCount; i++) { View v = mTabsContainer.getChildAt(i); // v.setBackgroundResource(mTabBackgroundResId); if (i == mTabCount - 1) {//?? float dimension = mcontext.getResources().getDimension(R.dimen.text_50); v.setPadding(mTabPadding, v.getPaddingTop(), (int) dimension, v.getPaddingBottom()); } else {/*from w w w. j a v a 2 s . co m*/ v.setPadding(mTabPadding, v.getPaddingTop(), mTabPadding, v.getPaddingBottom()); } TextView tab_title = (TextView) v.findViewById(R.id.psts_tab_title); if (tab_title != null) { tab_title.setTypeface(mTabTextTypeface, mTabTextTypefaceStyle); tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize); // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a // pre-ICS-build if (isTabTextAllCaps) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { tab_title.setAllCaps(true); } else { tab_title.setText(tab_title.getText().toString() .toUpperCase(getResources().getConfiguration().locale)); } } if (tab_title.isSelected()) { // LogUtils.i("------" + i); // tab_title.setTextColor(Color.parseColor("#ffffff")); tab_title.setTextColor(Color.parseColor("#29b4ed")); this.setIndicatorHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, getResources().getDisplayMetrics())); // tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX,mcontext.getResources().getDimension(R.dimen.honor_card_awesome_item_head_size)); // tab_title.setTextSize(16); // TextPaint tp = tab_title.getPaint(); // tp.setFakeBoldText(true); tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize); } else { // LogUtils.i("------" + i); this.setIndicatorHeight((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, getResources().getDisplayMetrics())); // tab_title.setTextColor(getResources().getColor(R.color.tab_default_text)); tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTabTextSize); tab_title.setTextColor(Color.parseColor("#666666")); // TextPaint tp = tab_title.getPaint(); // tp.setFakeBoldText(false); } } } }
From source file:ru.adios.budgeter.widgets.DataTableLayout.java
public void enableUserOrdering(OrderResolver orderResolver) { checkArgument(orderResolver != null, "orderResolver is null"); this.orderResolver = Optional.of(orderResolver); if (getChildCount() > 0) { final TableRow columnsRow = (TableRow) getChildAt(2); for (int i = 0; i < columnsRow.getChildCount(); i++) { final TextView col = (TextView) columnsRow.getChildAt(i); final String text = col.getText().toString(); if (!orderBy.isPresent()) { final Optional<OrderBy> possibleOrder = orderResolver.byColumnName(text, Order.DESC); if (!possibleOrder.isPresent()) { continue; }//from w w w.jav a 2 s .co m orderBy = Optional.of(possibleOrder.get()); selectOrderByColumn(col); if (tablePopulated) { clearContents(); loadTableProcedures(); } return; } if (text.equals(orderResolver.byField(orderBy.get().field).orElse(null))) { if (!col.isSelected()) { selectOrderByColumn(col); col.invalidate(); } break; } } } }