List of usage examples for android.view View setTag
public void setTag(final Object tag)
From source file:com.cyanogenmod.settings.otgtoggle.OtgModeChooserActivity.java
private void inflateOption(final int titleResId, final int summaryResId, int mode, int currentMode, LinearLayout container) {// w w w. ja v a 2s .com View v = mLayoutInflater.inflate(R.layout.radio_with_summary, container, false); CheckedTextView title = (CheckedTextView) v.findViewById(android.R.id.title); TextView summary = (TextView) v.findViewById(android.R.id.summary); title.setText(titleResId); title.setChecked(mode == currentMode); summary.setText(summaryResId); v.setTag(mode); v.setOnClickListener(this); container.addView(v); }
From source file:com.dwdesign.tweetings.adapter.DirectMessagesConversationAdapter.java
@Override public View newView(final Context context, final Cursor cursor, final ViewGroup parent) { final View view = super.newView(context, cursor, parent); final Object tag = view.getTag(); if (!(tag instanceof DirectMessageConversationViewHolder)) { final DirectMessageConversationViewHolder holder = new DirectMessageConversationViewHolder(view); view.setTag(holder); holder.profile_image_left.setOnClickListener(this); holder.profile_image_right.setOnClickListener(this); }//from ww w .j a v a 2 s. c o m return view; }
From source file:com.groksolutions.grok.mobile.chart.AbstractAnomalyChartFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { final View view = inflater.inflate(getResourceView(), container, false); view.setTag(this); view.setOnClickListener(new View.OnClickListener() { @Override/*from www . j av a 2s . co m*/ public void onClick(final View v) { performClick(v); } }); view.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { return performLongClick(v); } }); this._sdf = new SimpleDateFormat(getString(R.string.date_format_chart), Locale.getDefault()); return view; }
From source file:net.idlesoft.android.apps.github.adapters.SearchUsersListAdapter.java
@Override public View doGetView(final int index, View convertView, final ViewGroup parent) { ViewHolder holder;//ww w. j a v a2 s . com if (convertView == null) { convertView = mInflater.inflate(R.layout.user_list_item, null); holder = new ViewHolder(); holder.text = (TextView) convertView.findViewById(R.id.tv_user_list_item_name); holder.gravatar = (ImageView) convertView.findViewById(R.id.iv_user_list_gravatar); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.text.setTextColor(R.color.textColor); try { final String username = ((JSONObject) getData().get(index)).getString("username"); holder.text.setText(username); holder.gravatar.setImageBitmap(mGravatars.get(username)); } catch (final JSONException e) { e.printStackTrace(); } return convertView; }
From source file:cn.bingoogolapple.androidcommon.adapter.BGAViewHolderHelper.java
public BGAViewHolderHelper setTag(@IdRes int viewId, Object tag) { View view = getView(viewId); view.setTag(tag); return this; }
From source file:com.henry.ecdemo.ui.chatting.model.DescriptionRxRow.java
@Override public View buildChatView(LayoutInflater inflater, View convertView) { //we have a don't have a converView so we'll have to create a new one if (convertView == null) { convertView = new ChattingItemContainer(inflater, R.layout.chatting_item_from); //use the view holder pattern to save of already looked up subviews DescriptionViewHolder holder = new DescriptionViewHolder(mRowType); convertView.setTag(holder.initBaseHolder(convertView, true)); }/*from w ww . java 2 s .c o m*/ return convertView; }
From source file:com.android.brainslam.DnDList.DragNDropCursorAdapter.java
@Override public View getView(int position, View view, ViewGroup group) { ViewHolder holder;/* w w w . j a v a 2 s .c o m*/ if (view == null) { view = inflater.inflate(R.layout.edit_mystream_listitem, group, false); holder = new ViewHolder(); holder.ivRemoveStream = (ImageView) view.findViewById(R.id.stream_close); holder.ivRemoveStream.setTag(position); view.setTag(holder); } else holder = (ViewHolder) view.getTag(); return super.getView(mPosition[position], view, group); }
From source file:com.hybris.mobile.app.commerce.adapter.OrderProductListAdapter.java
@Override public View getView(int position, View convertView, ViewGroup parent) { View rowView; if (convertView == null) { LayoutInflater inflater = (LayoutInflater) getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(R.layout.item_order_product, parent, false); rowView.setTag(new OrderViewHolder(rowView, position)); } else {//w w w . j av a 2s .c o m rowView = convertView; } final OrderViewHolder orderViewHolder = (OrderViewHolder) rowView.getTag(); final OrderEntry orderProduct = mProducts.get(position); if (orderProduct != null) { // Name orderViewHolder.productNameTextView.setText(orderProduct.getProduct().getName()); // Price if (orderProduct.getBasePrice() != null) { orderViewHolder.productPrice.setText(orderProduct.getBasePrice().getFormattedValue()); } // Promotion if (orderProduct.getPromotionResult() != null) { if (StringUtils.isNotBlank(orderProduct.getPromotionResult().getDescription())) { orderViewHolder.productPromotion.setText(orderProduct.getPromotionResult().getDescription()); } orderViewHolder.productPromotion.setVisibility(View.VISIBLE); } else { orderViewHolder.productPromotion.setVisibility(View.GONE); } // Variants if (orderProduct.getProduct().getBaseOptions() != null && !orderProduct.getProduct().getBaseOptions().isEmpty()) { orderViewHolder.linearLayoutVariants.setVisibility(View.VISIBLE); orderViewHolder.linearLayoutVariants.removeAllViews(); } // Redirecting to the product detail page when clicking on the image orderViewHolder.orderItemClickableLyout.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ProductHelper.redirectToProductDetail(getContext(), orderProduct.getProduct().getCode()); } }); // Loading the product image if (StringUtils.isNotBlank(orderProduct.getProduct().getImageThumbnailUrl())) { CommerceApplication.getContentServiceHelper().loadImage( orderProduct.getProduct().getImageThumbnailUrl(), null, orderViewHolder.productImageView, 0, 0, true, null, true); } // Quantity orderViewHolder.quantityTextView .setText(getContext().getString(R.string.order_confirmation_qty, orderProduct.getQuantity())); // Total price if (orderProduct.getTotalPrice() != null) { orderViewHolder.productTotalPrice.setText(orderProduct.getTotalPrice().getFormattedValue()); } } return rowView; }
From source file:com.kaliturin.blacklist.adapters.ContactsCursorAdapter.java
@Override public View newView(Context context, Cursor cursor, ViewGroup parent) { if (cursor == null) return null; LayoutInflater inflater = LayoutInflater.from(context); View view = inflater.inflate(R.layout.row_contacts, parent, false); // view holder for the new row ViewHolder viewHolder = new ViewHolder(context, view); // add view holder to the row view.setTag(viewHolder); // on click listeners for the row and checkbox (which is inside the row) view.setOnClickListener(rowOnClickListener); view.setOnLongClickListener(rowOnLongClickListener); return view;//from w w w . ja va 2 s. c om }
From source file:com.efan.notlonely_android.view.PagerSlidingTabStrip.java
@Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); ViewGroup tabViewGroup = getTabsLayout(); FirstPositionOffset = (float) tabViewGroup.getLeft(); if (tabViewGroup != null) { currentPosition = viewPager != null ? viewPager.getCurrentItem() : 0; if (!disableViewPager) { scrollToChild(currentPosition, 0); selectedTab(currentPosition); }//from ww w. j a va2 s. c o m for (int w = 0; w < tabViewGroup.getChildCount(); w++) { View itemView = tabViewGroup.getChildAt(w); itemView.setTag(w); itemView.setClickable(true); itemView.setOnClickListener(this); } } }