List of usage examples for android.view View getTag
@ViewDebug.ExportedProperty
public Object getTag()
From source file:Main.java
public static void setFontAllView(ViewGroup vg) { for (int i = 0; i < vg.getChildCount(); ++i) { View child = vg.getChildAt(i); if (child instanceof ViewGroup) { setFontAllView((ViewGroup) child); } else if (child != null) { Typeface face;// w w w . jav a 2s .c om if (child.getTag() != null && child.getTag().toString().toLowerCase().equals("bold")) { face = boldFont; } else { face = regularFont; } if (child instanceof TextView) { TextView textView = (TextView) child; textView.setTypeface(face); } else if (child instanceof EditText) { EditText editView = (EditText) child; editView.setTypeface(face); } else if (child instanceof RadioButton) { RadioButton radioView = (RadioButton) child; radioView.setTypeface(face); } else if (child instanceof CheckBox) { CheckBox checkboxView = (CheckBox) child; checkboxView.setTypeface(face); } else if (child instanceof Button) { Button button = (Button) child; button.setTypeface(face); } } } }
From source file:android.support.v7.app.MediaRouterThemeHelper.java
public static void setVolumeSliderColor(Context context, MediaRouteVolumeSlider volumeSlider, View backgroundView) { int controllerColor = getControllerColor(context, 0); if (Color.alpha(controllerColor) != 0xFF) { // Composite with the background in order not to show the underlying progress bar // through the thumb. int backgroundColor = (int) backgroundView.getTag(); controllerColor = ColorUtils.compositeColors(controllerColor, backgroundColor); }/* w w w . ja va2 s . com*/ volumeSlider.setColor(controllerColor); }
From source file:Main.java
/** * Walks ViewGroups, finds TextViews and applies Typefaces taking styling in consideration * * @param context - to reach assets/*from www . j a va 2 s .c o m*/ * @param view - root view to apply typeface to */ public static void setRobotoFont(Context context, View view) { if (view instanceof ViewGroup) { for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) { setRobotoFont(context, ((ViewGroup) view).getChildAt(i)); } } else if (view instanceof TextView) { Typeface currentTypeface = ((TextView) view).getTypeface(); ((TextView) view).setTypeface(getRobotoTypeface(context, (String) view.getTag(), currentTypeface)); } }
From source file:biz.bokhorst.xprivacy.Util.java
public static List<View> getViewsByTag(ViewGroup root, String tag) { List<View> views = new ArrayList<View>(); for (int i = 0; i < root.getChildCount(); i++) { View child = root.getChildAt(i); if (child instanceof ViewGroup) views.addAll(getViewsByTag((ViewGroup) child, tag)); if (tag.equals(child.getTag())) views.add(child);/*ww w .ja v a 2 s . co m*/ } return views; }
From source file:ch.teamuit.android.soundplusplus.LibraryPagerAdapter.java
/** * Creates the row data used by LibraryActivity. *//*from w w w . j av a 2 s . c om*/ private static Intent createHeaderIntent(View header) { header = (View) header.getParent(); // tag is set on parent view of header int type = (Integer) header.getTag(); Intent intent = new Intent(); intent.putExtra(LibraryAdapter.DATA_ID, LibraryAdapter.HEADER_ID); intent.putExtra(LibraryAdapter.DATA_TYPE, type); return intent; }
From source file:com.nickandjerry.dynamiclayoutinflator.DynamicLayoutInflator.java
private static DynamicLayoutInfo getDynamicLayoutInfo(View parent) { DynamicLayoutInfo info;//from ww w . jav a 2 s .c om if (parent.getTag() != null && parent.getTag() instanceof DynamicLayoutInfo) { info = (DynamicLayoutInfo) parent.getTag(); } else { info = new DynamicLayoutInfo(); parent.setTag(info); } return info; }
From source file:cat.terrones.devops.radiofx.ui.MediaItemViewHolder.java
static View setupListView(Activity activity, View convertView, ViewGroup parent, MediaBrowserCompat.MediaItem item) { if (sColorStateNotPlaying == null || sColorStatePlaying == null) { initializeColorStateLists(activity); }//from w w w.ja va 2 s .c o m MediaItemViewHolder holder; Integer cachedState = STATE_INVALID; if (convertView == null) { convertView = LayoutInflater.from(activity).inflate(R.layout.media_list_item, parent, false); holder = new MediaItemViewHolder(); holder.mImageView = (ImageView) convertView.findViewById(R.id.play_eq); holder.mTitleView = (TextView) convertView.findViewById(R.id.title); holder.mDescriptionView = (TextView) convertView.findViewById(R.id.description); convertView.setTag(holder); } else { holder = (MediaItemViewHolder) convertView.getTag(); cachedState = (Integer) convertView.getTag(R.id.tag_mediaitem_state_cache); } MediaDescriptionCompat description = item.getDescription(); holder.mTitleView.setText(description.getTitle()); holder.mDescriptionView.setText(description.getSubtitle()); // If the state of convertView is different, we need to adapt the view to the // new state. int state = getMediaItemState(activity, item); if (cachedState == null || cachedState != state) { Drawable drawable = getDrawableByState(activity, state); if (drawable != null) { holder.mImageView.setImageDrawable(drawable); holder.mImageView.setVisibility(View.VISIBLE); } else { holder.mImageView.setVisibility(View.GONE); } convertView.setTag(R.id.tag_mediaitem_state_cache, state); } return convertView; }
From source file:com.nickandjerry.dynamiclayoutinflator.DynamicLayoutInflator.java
public static void setDelegate(View root, Object delegate) { DynamicLayoutInfo info;//w w w. j a va2 s. co m if (root.getTag() == null || !(root.getTag() instanceof DynamicLayoutInfo)) { info = new DynamicLayoutInfo(); root.setTag(info); } else { info = (DynamicLayoutInfo) root.getTag(); } info.delegate = delegate; }
From source file:com.nickandjerry.dynamiclayoutinflator.DynamicLayoutInflator.java
public static int idNumFromIdString(View view, String id) { if (!(view instanceof ViewGroup)) return 0; Object tag = view.getTag(); if (!(tag instanceof DynamicLayoutInfo)) return 0; // not inflated by this class DynamicLayoutInfo info = (DynamicLayoutInfo) view.getTag(); if (!info.nameToIdNumber.containsKey(id)) { ViewGroup grp = (ViewGroup) view; for (int i = 0; i < grp.getChildCount(); i++) { int val = idNumFromIdString(grp.getChildAt(i), id); if (val != 0) return val; }// w w w . j a v a2s. c om return 0; } return info.nameToIdNumber.get(id); }
From source file:cn.newgxu.android.notty.adapter.UsersAdapter.java
@Override public void bindView(View view, Context context, Cursor cursor) { ViewHolder holder = (ViewHolder) view.getTag(); holder.authedName.setText(cursor.getString(holder.authedNameIndex)); }