List of usage examples for android.widget TextView setTag
public void setTag(final Object tag)
From source file:com.zhongsou.souyue.ui.indicator.IcommonTabPageIndicator.java
private void addTab(CharSequence text, int index) { // final TabView tabView = new TabView(getContext()); // tabView.mIndex = index; final TextView tabView = new TextView(getContext()); tabView.setTag(index); // if (index == 0){ // doSetTextStyle(tabView, R.drawable.sy_indicator_icommentary_left); // } else if (index == count - 1){ // doSetTextStyle(tabView, R.drawable.sy_indicator_icommentary_right); // } else { // doSetTextStyle(tabView, R.drawable.sy_indicator_icommentary_middle); // }/*from ww w.ja va2s .co m*/ tabView.setBackgroundResource(R.drawable.vpi__tab_indicator_blue_line); tabView.setTextColor(getResources().getColor(R.color.bar_center_title_color)); tabView.setGravity(Gravity.CENTER); tabView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18); tabView.setPadding(30, 0, 30, 0); tabView.setFocusable(true); tabView.setOnClickListener(mTabClickListener); tabView.setText(text); mTabLayout.addView(tabView, new LinearLayout.LayoutParams(0, FILL_PARENT, 1)); }
From source file:com.bt.download.android.gui.adapters.SearchResultListAdapter.java
protected void populateAppiaPart(View view, AppiaSearchResult sr) { TextView adIndicator = findView(view, R.id.view_bittorrent_search_result_list_item_ad_indicator); adIndicator.setVisibility(View.VISIBLE); TextView extra = findView(view, R.id.view_bittorrent_search_result_list_item_text_extra); extra.setText(sr.getCategoryName() + " : " + sr.getDescription()); //TextView seeds = findView(view, R.id.view_bittorrent_search_result_list_item_text_seeds); //String license = sr.getLicense().equals(License.UNKNOWN) ? "" : " - " + sr.getLicense(); TextView sourceLink = findView(view, R.id.view_bittorrent_search_result_list_item_text_source); sourceLink.setText(sr.getSource());// ww w . j a v a 2 s . c o m sourceLink.setTag(sr.getDetailsUrl()); sourceLink.setPaintFlags(sourceLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); sourceLink.setOnClickListener(linkListener); }
From source file:com.brodev.socialapp.view.BlogDetail.java
private void initView() { ImageView userImage = (ImageView) this.findViewById(R.id.image_user); if (!"".equals(blog.getUser_image_path())) { networkUntil.drawImageUrl(userImage, blog.getUser_image_path(), R.drawable.loading); }//from ww w .j ava2 s.c o m // set title TextView title = (TextView) this.findViewById(R.id.title); title.setText(blog.getTitle()); colorView.changeColorText(title, user.getColor()); // set content TextView content = (TextView) this.findViewById(R.id.blog_content_detail); // interesting part starts from here here: Html.ImageGetter ig = imageGetter.create(0, blog.getText(), content); content.setTag(0); content.setText(Html.fromHtml(blog.getText(), ig, null)); TextView timestamp = (TextView) findViewById(R.id.time_stamp); timestamp.setText(blog.getTime_stamp()); // set short text TextView shortText = (TextView) findViewById(R.id.fullName); shortText.setText(blog.getFull_name()); TextView total_like = (TextView) findViewById(R.id.total_like); total_like.setText(String.valueOf(blog.getTotal_like())); colorView.changeColorText(total_like, user.getColor()); TextView total_comment = (TextView) findViewById(R.id.total_comment); total_comment.setText(String.valueOf(blog.getTotal_comment())); colorView.changeColorText(total_comment, user.getColor()); ImageView likeImg = (ImageView) this.findViewById(R.id.likes_feed_txt); ImageView commentImg = (ImageView) this.findViewById(R.id.comments_feed_txt); colorView.changeColorLikeCommnent(likeImg, commentImg, user.getColor()); }
From source file:cn.wander.Utils.views.pageindicator.TabPageIndicator.java
private void addTab(int index, CharSequence text, int iconResId) { RelativeLayout tablayout = (RelativeLayout) View.inflate(getContext(), R.layout.tab_item_layout, null); final TextView tabView = (TextView) tablayout.findViewById(R.id.tab_item_title); tabView.setTag(index); tabView.setFocusable(true);/* w w w. ja v a 2s .c om*/ tabView.setOnClickListener(mTabClickListener); tabView.setTextSize(TypedValue.COMPLEX_UNIT_PX, 19); tabView.setText(text); tabView.setTextColor(getResources().getColor(R.color.kw_common_cl_white)); if (iconResId != 0) { // tabView.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0); ImageView iconView = (ImageView) tablayout.findViewById(R.id.tab_item_icon); iconView.setImageResource(iconResId); iconView.setVisibility(View.VISIBLE); } mTabLayout.addView(tablayout, new LinearLayout.LayoutParams(0, MATCH_PARENT, 1)); }
From source file:com.money.manager.ex.assetallocation.AssetClassEditFragment.java
private void displaySortOrder() { View view = getView();//from w w w .java 2 s .c o m if (view == null) return; TextView textView = (TextView) view.findViewById(R.id.sortOrderEdit); if (textView != null) { Integer sortOrder = assetClass.getSortOrder(); textView.setText(sortOrder.toString()); textView.setTag(sortOrder.toString()); } }
From source file:org.ounl.lifelonglearninghub.learntracker.gis.ou.swipe.DayFragment.java
public void inflateLayout(int iPos) { String sIdSubject = Session.getSingleInstance().getDatabaseHandler().getSubjects().get(iPos).getsId(); // String sIdSubject = Session.getSingleInstance().getActivity(iPos).getId_subject(); long lDuration = Session.getSingleInstance().getDatabaseHandler().getAccumulatedTime(sIdSubject); // List of activities to inflate history List<ActividadDb> lADb = Session.getSingleInstance().getDatabaseHandler().getActivities(sIdSubject); // Duration// w w w.j av a 2 s. c o m DateUtils du = new DateUtils(); TextView t = (TextView) rootView.findViewById(R.id.tvDuration); t.setText(du.duration(lDuration)); // Time picker TimePicker timePicker = (TimePicker) rootView.findViewById(R.id.tpTask); timePicker.setIs24HourView(true); timePicker.setCurrentHour(0); timePicker.setCurrentMinute(45); // Button image view ImageView iv = (ImageView) rootView.findViewById(R.id.ivActionActivity); int currentStatus = Session.getSingleInstance().getActivity(iPos).getStatus(); if (currentStatus == ActivitySession.STATUS_STOPPED) { Drawable d = getResources().getDrawable(R.drawable.play); iv.setImageDrawable(d); } else { Drawable d = getResources().getDrawable(R.drawable.stop); iv.setImageDrawable(d); } // History if (lADb.size() != 0) { LinearLayout llHistory = (LinearLayout) rootView.findViewById(R.id.llHistory); TextView tvHeader = (TextView) llHistory.findViewById(R.id.tvHeaderHisory); tvHeader.setVisibility(View.VISIBLE); for (int i = 0; i < lADb.size(); i++) { ActividadDb adb = lADb.get(i); LinearLayout llCheckItemWrapper = (LinearLayout) mInflater.inflate(R.layout.check_item, null); // Passing order as param so it can be removed llCheckItemWrapper.setTag(i); LinearLayout liContent = (LinearLayout) llCheckItemWrapper.getChildAt(0); TextView tvTimeStamp = (TextView) liContent.findViewById(R.id.textViewTimeStamp); tvTimeStamp.setText(Constants.TIME_FORMAT.format(adb.getlDateCheckIn())); // Passing checkin time in mills as tag tvTimeStamp.setTag(Long.valueOf(adb.getlDateCheckIn())); TextView tvDurRecord = (TextView) liContent.findViewById(R.id.textViewDuration); tvDurRecord.setText(" [" + du.duration(adb.getlDateCheckIn(), adb.getlDateCheckOut()) + "]"); // Passing subject id as parameter tvDurRecord.setTag(adb.getsIdSubject()); llHistory.addView(mInflater.inflate(R.layout.tag_divider, llHistory, false), 1); llHistory.addView(llCheckItemWrapper, 2); } } }
From source file:org.adaway.util.RedirectionCursorAdapter.java
/** * Bind cursor to view using the checkboxes *//* w w w .ja v a 2 s . c o m*/ @Override public void bindView(View v, Context context, Cursor cursor) { CheckBox cBox = (CheckBox) v.findViewById(R.id.checkbox_list_two_checkbox); TextView hostnameTextView = (TextView) v.findViewById(R.id.checkbox_list_two_text); TextView ipTextView = (TextView) v.findViewById(R.id.checkbox_list_two_subtext); if (cBox != null) { // bind cursor position to tag of list item int cursorPosition = cursor.getPosition(); cBox.setTag("checkbox_" + cursorPosition); hostnameTextView.setTag("hostname_" + cursorPosition); ipTextView.setTag("ip_" + cursorPosition); int enabledCol = cursor.getColumnIndexOrThrow(RedirectionList.ENABLED); String enabled = cursor.getString(enabledCol); if (Integer.parseInt(enabled) == 1) { cBox.setChecked(true); } else { cBox.setChecked(false); } // set hostname int hostnameCol = cursor.getColumnIndexOrThrow(RedirectionList.HOSTNAME); String hostname = cursor.getString(hostnameCol); hostnameTextView.setText(hostname); // set ip int ipCol = cursor.getColumnIndexOrThrow(RedirectionList.IP); String ip = cursor.getString(ipCol); ipTextView.setText(ip); } }
From source file:com.androzic.waypoint.WaypointDetails.java
@SuppressLint("NewApi") private void updateWaypointDetails(double lat, double lon) { Androzic application = Androzic.getApplication(); AppCompatActivity activity = (AppCompatActivity) getActivity(); activity.getSupportActionBar().setTitle(waypoint.name); View view = getView();/*from w w w.jav a 2s. c o m*/ final TextView coordsView = (TextView) view.findViewById(R.id.coordinates); coordsView.requestFocus(); coordsView.setTag(Integer.valueOf(StringFormatter.coordinateFormat)); coordsView.setText(StringFormatter.coordinates(" ", waypoint.latitude, waypoint.longitude)); coordsView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int format = ((Integer) coordsView.getTag()).intValue() + 1; if (format == 5) format = 0; coordsView.setText(StringFormatter.coordinates(format, " ", waypoint.latitude, waypoint.longitude)); coordsView.setTag(Integer.valueOf(format)); } }); if (waypoint.altitude != Integer.MIN_VALUE) { ((TextView) view.findViewById(R.id.altitude)) .setText("\u2336 " + StringFormatter.elevationH(waypoint.altitude)); view.findViewById(R.id.altitude).setVisibility(View.VISIBLE); } else { view.findViewById(R.id.altitude).setVisibility(View.GONE); } if (waypoint.proximity > 0) { ((TextView) view.findViewById(R.id.proximity)) .setText("~ " + StringFormatter.distanceH(waypoint.proximity)); view.findViewById(R.id.proximity).setVisibility(View.VISIBLE); } else { view.findViewById(R.id.proximity).setVisibility(View.GONE); } double dist = Geo.distance(lat, lon, waypoint.latitude, waypoint.longitude); double bearing = Geo.bearing(lat, lon, waypoint.latitude, waypoint.longitude); bearing = application.fixDeclination(bearing); String distance = StringFormatter.distanceH(dist) + " " + StringFormatter.angleH(bearing); ((TextView) view.findViewById(R.id.distance)).setText(distance); ((TextView) view.findViewById(R.id.waypointset)).setText(waypoint.set.name); if (waypoint.date != null) { view.findViewById(R.id.date_row).setVisibility(View.VISIBLE); ((TextView) view.findViewById(R.id.date)) .setText(DateFormat.getDateFormat(activity).format(waypoint.date) + " " + DateFormat.getTimeFormat(activity).format(waypoint.date)); } else { view.findViewById(R.id.date_row).setVisibility(View.GONE); } if ("".equals(waypoint.description)) { view.findViewById(R.id.description_row).setVisibility(View.GONE); } else { WebView description = (WebView) view.findViewById(R.id.description); String descriptionHtml; try { TypedValue tv = new TypedValue(); Theme theme = activity.getTheme(); Resources resources = getResources(); theme.resolveAttribute(android.R.attr.textColorPrimary, tv, true); int secondaryColor = resources.getColor(tv.resourceId); String css = String.format( "<style type=\"text/css\">html,body{margin:0;background:transparent} *{color:#%06X}</style>\n", (secondaryColor & 0x00FFFFFF)); descriptionHtml = css + waypoint.description; description.setWebViewClient(new WebViewClient() { @SuppressLint("NewApi") @Override public void onPageFinished(WebView view, String url) { view.setBackgroundColor(Color.TRANSPARENT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) view.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null); } }); description.setBackgroundColor(Color.TRANSPARENT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) description.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null); } catch (Resources.NotFoundException e) { description.setBackgroundColor(Color.LTGRAY); descriptionHtml = waypoint.description; } WebSettings settings = description.getSettings(); settings.setDefaultTextEncodingName("utf-8"); settings.setAllowFileAccess(true); Uri baseUrl = Uri.fromFile(new File(application.dataPath)); description.loadDataWithBaseURL(baseUrl.toString() + "/", descriptionHtml, "text/html", "utf-8", null); view.findViewById(R.id.description_row).setVisibility(View.VISIBLE); } }
From source file:com.bt.download.android.gui.adapters.SearchResultListAdapter.java
protected void populateFilePart(View view, FileSearchResult sr) { ImageView fileTypeIcon = findView(view, R.id.view_bittorrent_search_result_list_item_filetype_icon); fileTypeIcon.setImageResource(getFileTypeIconId()); TextView adIndicator = findView(view, R.id.view_bittorrent_search_result_list_item_ad_indicator); adIndicator.setVisibility(View.GONE); TextView title = findView(view, R.id.view_bittorrent_search_result_list_item_title); title.setText(sr.getDisplayName());/*from ww w . j a v a2s. co m*/ // if marked as downloading // title.setTextColor(GlobalConstants.COLOR_DARK_BLUE); TextView fileSize = findView(view, R.id.view_bittorrent_search_result_list_item_file_size); if (sr.getSize() > 0) { fileSize.setText(UIUtils.getBytesInHuman(sr.getSize())); } else { fileSize.setText(""); } TextView extra = findView(view, R.id.view_bittorrent_search_result_list_item_text_extra); extra.setText(FilenameUtils.getExtension(sr.getFilename())); TextView seeds = findView(view, R.id.view_bittorrent_search_result_list_item_text_seeds); seeds.setText(""); String license = sr.getLicense().equals(License.UNKNOWN) ? "" : " - " + sr.getLicense(); TextView sourceLink = findView(view, R.id.view_bittorrent_search_result_list_item_text_source); sourceLink.setText(sr.getSource() + license); // TODO: ask for design sourceLink.setTag(sr.getDetailsUrl()); sourceLink.setPaintFlags(sourceLink.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG); sourceLink.setOnClickListener(linkListener); }
From source file:org.adaway.util.HostsSourcesCursorAdapter.java
/** * Bind cursor to view using the checkboxes *///from w ww .ja v a2s . co m @Override public void bindView(View v, Context context, Cursor cursor) { CheckBox cBox = (CheckBox) v.findViewById(R.id.checkbox_list_two_checkbox); TextView hostnameTextView = (TextView) v.findViewById(R.id.checkbox_list_two_text); TextView lastModifiedTextView = (TextView) v.findViewById(R.id.checkbox_list_two_subtext); if (cBox != null) { // bind cursor position to tag of list item int cursorPosition = cursor.getPosition(); cBox.setTag("checkbox_" + cursorPosition); hostnameTextView.setTag("url_" + cursorPosition); lastModifiedTextView.setTag("last_modified_" + cursorPosition); int enabledCol = cursor.getColumnIndexOrThrow(HostsSources.ENABLED); String enabled = cursor.getString(enabledCol); if (Integer.parseInt(enabled) == 1) { cBox.setChecked(true); } else { cBox.setChecked(false); } // set hostname int urlCol = cursor.getColumnIndex(HostsSources.URL); String url = cursor.getString(urlCol); hostnameTextView.setText(url); // set last modified int lastModifiedLocalCol = cursor.getColumnIndexOrThrow(HostsSources.LAST_MODIFIED_LOCAL); long lastModifiedLocal = cursor.getLong(lastModifiedLocalCol); int lastModifiedOnlineCol = cursor.getColumnIndexOrThrow(HostsSources.LAST_MODIFIED_ONLINE); long lastModifiedOnline = cursor.getLong(lastModifiedOnlineCol); lastModifiedTextView.setText(context.getString(R.string.hosts_last_modified_local) + " " + DateUtils.longToDateString(context, lastModifiedLocal) + ", " + context.getString(R.string.hosts_last_modified_online) + " " + DateUtils.longToDateString(context, lastModifiedOnline)); } }