@SuppressWarnings("deprecation") @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { convertView = LayoutInflater.from(mInstance).inflate(R.layout.listview_item, null); holder = new ViewHolder(); holder.checkBox = (CheckBox) convertView.findViewById(R.id.check_box); holder.textView = (TextView) convertView.findViewById(R.id.app_name); holder.imageView = (ImageView) convertView.findViewById(R.id.app_logo); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } final PackageInfo packageInfo = mInstalledList.get(position); holder.textView.setText( packageInfo.applicationInfo.loadLabel(mInstance.getPackageManager()).toString()); holder.imageView.setImageResource(packageInfo.applicationInfo.icon); Drawable drawable = packageInfo.applicationInfo.loadIcon(mInstance.getPackageManager()); holder.imageView.setBackgroundDrawable(drawable); if (contains(mCheckedList, packageInfo)) { holder.checkBox.setChecked(true); } else { holder.checkBox.setChecked(false); } convertView.setOnClickListener( new OnClickListener() { @Override public void onClick(View view) { if (contains(mCheckedList, packageInfo)) { remove(mCheckedList, packageInfo); } else { mCheckedList.add(packageInfo.packageName); } BlockUtils.save(mInstance, mCheckedList); notifyDataSetChanged(); } }); return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; int rowType = getItemViewType(position); if (convertView == null) { holder = new ViewHolder(); switch (rowType) { case TYPE_ITEM: convertView = mInflater.inflate(R.layout.snippet_item1, null); holder.textView = (TextView) convertView.findViewById(R.id.text); if (contactids.get(position) != null) { Uri photo = getPhotoUriFromID(contactids.get(position)); if (photo != null) { Drawable drawable = getDrawableFromUri(photo); } } break; case TYPE_SEPARATOR: convertView = mInflater.inflate(R.layout.snippet_item2, null); holder.textView = (TextView) convertView.findViewById(R.id.textSeparator); break; } convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.textView.setText(mData.get(position)); return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; int type = getItemViewType(position); System.out.println("getView " + position + " " + convertView + " type = " + type); if (convertView == null) { holder = new ViewHolder(); switch (type) { case TYPE_ITEM: convertView = mInflater.inflate(R.layout.settings_item, null); holder.textView = (TextView) convertView.findViewById(R.id.text); holder.textView.setTypeface(MainApplicationStartup.font_HelveticaLTStdBold); break; case TYPE_SEPARATOR: convertView = mInflater.inflate(R.layout.settings_header, null); holder.textView = (TextView) convertView.findViewById(R.id.textSeparator); holder.textView.setTypeface(MainApplicationStartup.font_HelveticaLTStdBold); break; } convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.textView.setText(mData.get(position)); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { PromptListItem item = getItem(position); ViewHolder viewHolder = null; if (convertView == null) { int resourceId = mResourceId; if (item.isGroup) { resourceId = R.layout.list_item_header; } convertView = mInflater.inflate(resourceId, null); viewHolder = new ViewHolder(); viewHolder.textView = (TextView) convertView.findViewById(android.R.id.text1); viewHolder.paddingLeft = viewHolder.textView.getPaddingLeft(); viewHolder.paddingRight = viewHolder.textView.getPaddingRight(); viewHolder.paddingTop = viewHolder.textView.getPaddingTop(); viewHolder.paddingBottom = viewHolder.textView.getPaddingBottom(); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.textView.setText(item.label); maybeUpdateCheckedState(position, item, viewHolder); maybeUpdateIcon(item, viewHolder.textView); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { convertView = LayoutInflater.from(mcontext).inflate(R.layout.item_horizaontal_index, null); viewHolder = new ViewHolder(); viewHolder.imageView = (ImageView) convertView.findViewById(R.id.imageView_item_hor_index); viewHolder.textView = (TextView) convertView.findViewById(R.id.text_item_hor_index); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } IndexItemInfo investment = list.get(position); String imageUrl = Url.prePic + investment.getLogo(); String name = investment.getCompany_name(); // Picasso.with(mcontext) // .load(imageUrl) // .into(viewHolder.imageView); imageLoader.displayImage( imageUrl, viewHolder.imageView, MyDisplayImageOptions.getdefaultImageOptions()); // viewHolder.imageView.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // Intent intent=new Intent(mcontext, CPDetailActivity.class); // intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // mcontext.startActivity(intent); // Activity activity= (Activity) mcontext; // activity.overridePendingTransition(R.anim.in_from_right,R.anim.out_to_left); // } // }); viewHolder.textView.setText(name); return convertView; }
@SuppressLint("InflateParams") @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { // Inflate layout from layout resource // Passing parent instead of null ends in java.lang.UnsupportedOperationException: // addView(View, LayoutParams) is not supported in AdapterView convertView = mInflater.inflate(R.layout.liked_grid_item, null); viewHolder = new ViewHolder(); viewHolder.imageView = (ImageView) convertView.findViewById(R.id.liked_avatar); viewHolder.textView = (TextView) convertView.findViewById(R.id.liked_name); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } ExoPicasso.picasso(getApplicationContext()) .load(Uri.parse(likeList.get(position).likedImageUrl)) .error(R.drawable.default_avatar) .into(viewHolder.imageView); viewHolder.textView.setText(likeList.get(position).getLikeName()); return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; View row_view = convertView; if (row_view == null) { LayoutInflater inflater = context.getLayoutInflater(); row_view = inflater.inflate(R.layout.row_layout, null, true); holder = new ViewHolder(); holder.textView = (TextView) row_view.findViewById(R.id.textView_sd_list_view); holder.imageview = (ImageView) row_view.findViewById(R.id.image_sd_list_view); row_view.setTag(holder); } else holder = (ViewHolder) row_view.getTag(); holder.textView.setText(names[position]); File file = new File(path[position]); if (file.isDirectory()) { holder.imageview.setImageResource(R.drawable.folder_icon_sd_list_view); } else { String temp = GetFileExtension(path[position]); if (temp.equalsIgnoreCase("PDF")) holder.imageview.setImageResource(R.drawable.fil_icon_sd_list_view); else if (temp.equalsIgnoreCase("EPUB")) holder.imageview.setImageResource(R.drawable.fil_icon_sd_list_view_for_epub); else if (temp.equalsIgnoreCase("txt")) holder.imageview.setImageResource(R.drawable.fil_icon_sd_list_view_for_epub); } return row_view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { convertView = inflater.inflate(R.layout.item, parent, false); viewHolder = new ViewHolder(); viewHolder.textView = (TextView) convertView.findViewById(R.id.testText); viewHolder.itemView = convertView; viewHolder.setBackgroundImage( (ParallaxImageView) convertView.findViewById(R.id.parallaxImageView)); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.getBackgroundImage().setImageResource(imageIds[position % imageIds.length]); viewHolder.textView.setText("Row " + position); // # CAUTION: // Important to call this method viewHolder.getBackgroundImage().reuse(); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate(R.layout.listview_sign_layout, null); viewHolder = new ViewHolder(); viewHolder.textView = (TextView) convertView.findViewById(R.id.usernameItem); viewHolder.imageView = (ImageView) convertView.findViewById(R.id.currentFlag); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } Map<String, String> map = mData.get(position); String item = map.get(mContext.getString(R.string.sign_detail_key)); String flag = map.get(mContext.getString(R.string.sign_issuccess_key)); boolean is_success = Boolean.valueOf(flag); viewHolder.textView.setText(item); if (is_success) { viewHolder.imageView.setImageResource(R.drawable.ic_check); } else { viewHolder.imageView.setImageResource(R.drawable.ic_close); } long id = getItemId(position); if (!itemAnims.contains(id)) { itemAnims.add(id); convertView.startAnimation(mAnim); } return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = null; ViewHolder holder = null; if (convertView != null) { view = convertView; } else { view = LayoutInflater.from(context).inflate(R.layout.common_layout, parent, false); } holder = (ViewHolder) view.getTag(); if (holder == null) { holder = new ViewHolder(); holder.imageView = (ImageView) view.findViewById(R.id.common_image); holder.textView = (TextView) view.findViewById(R.id.common_text); holder.button = (Button) view.findViewById(R.id.common_button); view.setTag(holder); } Myself myself01 = (Myself) getItem(position); holder.imageView.setImageResource(myself01.getImageId()); holder.textView.setText(myself01.getName()); return view; }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(com.jgh.androidssh.R.layout.listview_item, null); TextView textView = (TextView) convertView.findViewById(com.jgh.androidssh.R.id.textview_item); holder.textView = textView; // change text color for directories convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.textView.setText(mFiles.get(position).getName()); if (mFiles.get(position).isDirectory()) { holder.color = 0xff009999; } else { holder.color = 0xffff8888; ; } holder.textView.setTextColor(holder.color); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { convertView = LayoutInflater.from(context).inflate(R.layout.disk_list_item, null); viewHolder = new ViewHolder(); viewHolder.textView = (TextView) convertView.findViewById(R.id.disk_text); viewHolder.textSize = (TextView) convertView.findViewById(R.id.disk_text_size); viewHolder.linearLayout = (LinearLayout) convertView.findViewById(R.id.disk_lin); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } if (selectedPosition == position) { viewHolder.textView.setSelected(true); viewHolder.linearLayout.setBackgroundColor(context.getResources().getColor(R.color.skyblue)); } else { viewHolder.textView.setSelected(false); viewHolder.linearLayout.setBackgroundColor(Color.TRANSPARENT); } viewHolder.textView.setText(list.get(position).getFileName()); viewHolder.textSize.setText("剩余:" + list.get(position).getFreeSpace()); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater mInflater = (LayoutInflater) ((Activity) context).getLayoutInflater(); ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.tv_grid_item, null); holder.imageView = (TextView) convertView.findViewById(R.id.videotvbg); holder.textView = (TextView) convertView.findViewById(R.id.videotvName); // courseBeans[position].textView = tv; convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.imageView.setText(videobeans.get(position).videoDetail); if ("".equals(videobeans.get(position).resourceUrl) != true) holder.imageView.setBackgroundDrawable( Drawable.createFromPath(videobeans.get(position).resourceUrl)); else holder.imageView.setBackgroundResource(R.drawable.program_loading_bg); holder.textView.setText(videobeans.get(position).videoName); // convertView.setPadding(0, 15, 0, 15); // Log.i("getView", "+++ postion" + selectedPosition); convertView.setPadding(15, 5, 15, 5); return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { System.out.println("getView " + position + " " + convertView); if (convertView == null) { convertView = mInflater.inflate(R.layout.cell_toscroll, null); holder = new ViewHolder(); holder.textView = (TextView) convertView.findViewById(R.id.myitem_title); holder.textView.setTextSize(20); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } String text_to_vis = mData.get(position); if (text_to_vis.indexOf("#") > 0) { text_to_vis.replace("\n", ""); text_to_vis.replace("\r", ""); holder.textView.setTextAppearance(c, R.style.Title); holder.textView.setPadding(0, getPixels(15), 0, 0); holder.textView.setGravity(Gravity.CENTER_HORIZONTAL); holder.textView.setText(text_to_vis.substring(0, text_to_vis.length() - 1)); } else { holder.textView.setTextAppearance(c, R.style.Authortext); holder.textView.setPadding(0, 0, 0, 0); holder.textView.setGravity(Gravity.FILL_HORIZONTAL); holder.textView.setTypeface(Typeface.SERIF); holder.textView.setText(text_to_vis); } convertView.setBackgroundResource(color); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = layoutInflater.inflate(R.layout.list_class_min, null); holder.textView = (TextView) convertView.findViewById(R.id.class_min_name); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, ApplicationTool.dip2px(36)); holder.textView.setLayoutParams(layoutParams); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } if (timeSelection == position) { holder.textView.setTextColor(getResources().getColor(R.color.textColorCompany)); holder.textView.setBackgroundResource(R.drawable.back_white_rec_border_orange); } else { holder.textView.setTextColor(getResources().getColor(R.color.textColorSecond)); holder.textView.setBackgroundResource(R.drawable.selector_white_rec_border); } if (times[position] > 1) { holder.textView.setText((int) times[position] + "小时"); } else { holder.textView.setText(times[position] + "小时"); } return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { final View aView; if (convertView == null) { final ViewHolder viewHolder = new ViewHolder(); aView = getLayoutInflater().inflate(R.layout.item_category_grid, parent, false); viewHolder.imageView = (ImageView) aView.findViewById( R.id .image_item_category); // (ImageView) // getLayoutInflater().inflate(R.layout.item_grid_image, parent, false); viewHolder.weView = (WebView) aView.findViewById( R.id .web); // (ImageView) getLayoutInflater().inflate(R.layout.item_grid_image, // parent, false); int ww = viewHolder.imageView.getLayoutParams().width = (ConstantValues.DEVICE_WIDTH / 3) - 3; int wh = viewHolder.imageView.getLayoutParams().height = (int) (((ConstantValues.DEVICE_WIDTH / 2) * 0.75) - 2); String h = Html.replace("ximgurl", imageUrls[position]) .replace("xW", ww + "") .replace("xH", wh + ""); viewHolder.weView.loadData(h, "text/html; charset=UTF-8", null); viewHolder.textView = (TextView) aView.findViewById(R.id.text_item_cat_desc); viewHolder.textView.setText(Imageurl.title.get(position)); // viewHolder.imageView.setMaxWidth(150); imageLoader.displayImage( imageUrls[position], viewHolder.imageView, options, new SimpleImageLoadingListener() { @Override public void onLoadingComplete(Bitmap loadedImage) { Animation anim = AnimationUtils.loadAnimation(CategoryGridActivity.this, R.anim.fade_in); viewHolder.imageView.setAnimation(anim); anim.start(); } }); } else { aView = convertView; } return aView; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { final ViewHolder holder; CmMatch cmMatch = mCmItems.get(position); View view = convertView; int imageId = 0; if (null == view) { LayoutInflater inflater = LayoutInflater.from(mActivity); view = inflater.inflate(R.layout.row_adapter_cm_list, parent, false); holder = new ViewHolder(); holder.imageView = (ImageView) view.findViewById(R.id.image_cm_item); holder.textView = (TextView) view.findViewById(R.id.textview_cm); holder.textViewInfo = (TextView) view.findViewById(R.id.textview_user_info); holder.imageViewReason1 = (ImageView) view.findViewById(R.id.image_cm_reason1); holder.imageViewReason2 = (ImageView) view.findViewById(R.id.image_cm_reason2); holder.imageViewReason3 = (ImageView) view.findViewById(R.id.image_cm_reason3); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } imageId = UiHelpers.getCmImageId(cmMatch.getCmIdx()); if (R.drawable.transparent != imageId) { holder.imageView.setImageDrawable(mActivity.getResources().getDrawable(imageId)); } else { holder.imageView.setVisibility(View.GONE); } CmIdx cmIdx = CmIdxItems.getCmIdx(cmMatch.getCmIdx()); String cmString = cmIdx.getCmString(); holder.textView.setText(cmString); if (null == cmMatch.getCmInfoString()) { holder.textViewInfo.setVisibility(View.GONE); } else { String cmInfo = cmMatch.getCmInfoString(); holder.textViewInfo.setText(cmInfo); } if (null == cmMatch.getCmReasons()) { holder.imageViewReason1.setVisibility(View.GONE); holder.imageViewReason2.setVisibility(View.GONE); holder.imageViewReason3.setVisibility(View.GONE); } else { imageId = UiHelpers.getStateImageId(cmMatch.getCmReasons()[0]); if (R.drawable.transparent != imageId) { holder.imageViewReason1.setImageDrawable(mActivity.getResources().getDrawable(imageId)); } else holder.imageViewReason1.setVisibility(View.GONE); imageId = UiHelpers.getStateImageId(cmMatch.getCmReasons()[1]); if (R.drawable.transparent != imageId) { holder.imageViewReason2.setImageDrawable(mActivity.getResources().getDrawable(imageId)); } else holder.imageViewReason2.setVisibility(View.GONE); imageId = UiHelpers.getStateImageId(cmMatch.getCmReasons()[2]); if (R.drawable.transparent != imageId) { holder.imageViewReason3.setImageDrawable(mActivity.getResources().getDrawable(imageId)); } else holder.imageViewReason3.setVisibility(View.GONE); } return view; }
@Override public View newView(Context context, Cursor cursor, ViewGroup parent) { View view = inflater.inflate(R.layout.simple_list_item_1_material, parent, false); ViewHolder holder = new ViewHolder(); holder.textView = (TextView) view.findViewById(android.R.id.text1); view.setTag(holder); return view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; View view = convertView; if (view == null) { view = LayoutInflater.from(mContext) .inflate(R.layout.activity_googlecards_card, parent, false); viewHolder = new ViewHolder(); viewHolder.textView = (TextView) view.findViewById(R.id.activity_googlecards_card_textview); viewHolder.textView_mail = (TextView) view.findViewById(R.id.activity_googlecards_card_mail); viewHolder.textView_git = (TextView) view.findViewById(R.id.activity_googlecards_card_github); view.setTag(viewHolder); viewHolder.imageView = (ImageView) view.findViewById(R.id.activity_googlecards_card_imageview); } else { viewHolder = (ViewHolder) view.getTag(); } viewHolder.textView.setText("This is card " + (getItem(position) + 1)); switch (position) { case 0: viewHolder.textView.setText("Arpith"); viewHolder.textView_mail.setText("*****@*****.**"); viewHolder.textView_git.setText("github.com/arpith20"); break; case 1: viewHolder.textView.setText("Gregoire Decorvet"); viewHolder.textView_mail.setText("*****@*****.**"); viewHolder.textView_git.setText("github.com/GregoireDec"); break; case 2: viewHolder.textView.setText("Nagabharan N"); viewHolder.textView_mail.setText("*****@*****.**"); viewHolder.textView_git.setText("github.com/nagabharan"); break; case 3: viewHolder.textView.setText("Thomas Schweizer"); viewHolder.textView_mail.setText("*****@*****.**"); viewHolder.textView_git.setText("github.com/Thomas-Sch"); break; } setImageView(viewHolder, position); return view; }
@Override public View getView(int i, View view, ViewGroup viewGroup) { if (view == null) { view = View.inflate(HomeActivity.this, R.layout.activity_home_gridview_simple_item, null); ViewHolder viewHolder = new ViewHolder(); viewHolder.imageView = (ImageView) view.findViewById(R.id.imageview); viewHolder.textView = (TextView) view.findViewById(R.id.textview); view.setTag(viewHolder); } ViewHolder viewHolder = (ViewHolder) view.getTag(); viewHolder.imageView.setImageResource(Modules.moduleIconRes[modules.get(i).getIconid()]); viewHolder.textView.setText(modules.get(i).getName()); return view; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub final ViewHolder holder; if (convertView == null) { convertView = inflater.inflate(R.layout.category_detail_item, null); holder = new ViewHolder(); holder.textView = (TextView) convertView.findViewById(R.id.category_detail_feed_title); holder.imageButton = (ImageButton) convertView.findViewById(R.id.category_detail_add); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Feed feed = feeds.get(position); holder.textView.setText(feed.getTitle()); holder.imageButton.setImageResource(addIcons[feed.getSelectState()]); holder.imageButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(); Feed feed = feeds.get(position); String url = feed.getUrl(); String title = feed.getTitle(); int selectState = feed.getSelectState(); if (selectState == 0) { selectState = 1; holder.imageButton.setImageResource(addIcons[selectState]); intent.setAction(HomeActivity.ACTION_ADD_SECTION); SectionHelper.insertRecord(context, title, url, tableName); } else if (selectState == 1) { selectState = 0; holder.imageButton.setImageResource(addIcons[selectState]); intent.setAction(HomeActivity.ACTION_DELETE_SECTION); SectionHelper.removeRecord(context, url); } FeedsDBHelper feedsDBHelper = new FeedsDBHelper(context, FeedsDBHelper.DB_NAME, null, 1); feedsDBHelper.updateState(tableName, url, selectState); intent.putExtra("url", url); context.sendBroadcast(intent); feed.setSelectState(selectState); } }); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { // ViewHolder will buffer the assess to the individual fields of the row // layout ViewHolder holder; // Recycle existing view if passed as parameter // This will save memory and time on Android // This only works if the base layout for all classes are the same View rowView = convertView; if (rowView == null) { LayoutInflater inflater = context.getLayoutInflater(); rowView = inflater.inflate(R.layout.rowlayout, null, true); holder = new ViewHolder(); holder.textView = (TextView) rowView.findViewById(R.id.label); holder.imageView = (ImageView) rowView.findViewById(R.id.icon); holder.txtDistance = (TextView) rowView.findViewById(R.id.distance); holder.txtAddress = (TextView) rowView.findViewById(R.id.address); rowView.setTag(holder); } else { holder = (ViewHolder) rowView.getTag(); } try { Log.i("JSON", names.get(position).toString()); ImageLoader drawable = new ImageLoader(); holder.imageView.setImageDrawable( drawable.loadImageUrl(names.get(position).getString("icon"))); holder.textView.setText(names.get(position).getString("name")); holder.txtAddress.setText(names.get(position).getString("address")); holder.txtDistance.setText("" + names.get(position).getInt("distance") + " feet"); } catch (JSONException e) { Log.e("JSON", e.getMessage()); } // Change the icon for Windows and iPhone // String s = names[position]; // if (s.startsWith("Windows7") || s.startsWith("iPhone") // || s.startsWith("Solaris")) { // // holder.imageView.setImageResource(R.drawable.no); // } else { // holder.imageView.setImageResource(R.drawable.ok); // } return rowView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { final int index = position; ViewHolder holder; if (convertView == null) { convertView = layoutInflater.inflate(R.layout.list_area_selected, null); holder = new ViewHolder(); holder.textView = (TextView) convertView.findViewById(R.id.list_area_selected); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.textView.setText(areas.get(position).getName()); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder; if (convertView == null) { convertView = LayoutInflater.from(context).inflate(R.layout.simple_item, null); viewHolder = new ViewHolder(); viewHolder.textView = (TextView) convertView.findViewById(R.id.simple_item_text); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.textView.setText(list.get(position)); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { IsoItem item = mList.get(position); ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); int layout = (item.isHeader() ? R.layout.row_header_iso : R.layout.row_iso); convertView = LayoutInflater.from(context).inflate(layout, parent, false); holder.textView = (TextView) convertView.findViewById(R.id.tv_1); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } switch (idFragment) { case IsoFragment.ISO_DIAMETER_ID: holder.textView.setText("M " + UtilsConvert.doubleToString(item.getNomDiam())); break; case IsoFragment.ISO_PITCH_ID: if (item.getPitch() == IsoFragment.COARSE_PITCH) { holder.textView.setText(context.getResources().getString(R.string.сoarse_pitch)); } else if (item.getPitch() == IsoFragment.FINE_PITCH) { holder.textView.setText(context.getResources().getString(R.string.fine_pitch)); } else if (item.getPitch() == IsoFragment.SUPER_FINE_PITCH) { holder.textView.setText(context.getResources().getString(R.string.super_fine_pitch)); } else { holder.textView.setText( "M " + UtilsConvert.doubleToString(item.getNomDiam()) + " x " + UtilsConvert.doubleToString(item.getPitch())); } break; case IsoFragment.ISO_TOLERANCE_ID: holder.textView.setText( "M " + UtilsConvert.doubleToString(item.getNomDiam()) + " x " + UtilsConvert.doubleToString(item.getPitch()) + " - " + item.getTolerance()); break; } return convertView; }
/** Assign the label to the view. */ @Override public void setupInnerViewElements(ViewGroup parent, View view) { if (view == null || mLabel == null) { return; } // We use here a view holder to reduce expensive findViewById calls // when getView is called on the arrayadapter which calls setupInnerViewElements. // Simply just check if the given view was already tagged. If yes we know it has // the appIconView we want to have. If not we search it, give it to the viewholder // and tag the view for the next call to reuse the holded information later. ViewHolder holder; holder = (ViewHolder) view.getTag(); if (holder == null) { holder = new ViewHolder(); holder.textView = (TextView) view.findViewById(R.id.card_header_inner_simple_title); // Take scale factor into account if it is different then default or it has changed. if (mScaleFactor != RecentController.DEFAULT_SCALE_FACTOR || mScaleFactorChanged) { mScaleFactorChanged = false; int diff = 0; // We have on static element in the header (expanded icon button). Take this into // account to calculate the needed width. if (mScaleFactor < RecentController.DEFAULT_SCALE_FACTOR) { diff = (int) ((mExpandedButtonWidth - mExpandedButtonWidth * mScaleFactor) * 2); } final ViewGroup.LayoutParams layoutParams = holder.textView.getLayoutParams(); layoutParams.width = mHeaderWidth - diff; layoutParams.height = mHeaderHeight; holder.textView.setLayoutParams(layoutParams); holder.textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mHeaderTextSize); } view.setTag(holder); } int defaultCardText = mContext.getResources().getColor(R.color.card_text_color_header); int textColor = Settings.System.getIntForUser( mContext.getContentResolver(), Settings.System.RECENT_CARD_TEXT_COLOR, defaultCardText, UserHandle.USER_CURRENT); holder.textView.setText(mLabel); if (textColor != 0x00ffffff) { holder.textView.setTextColor(textColor); } else { holder.textView.setTextColor(getDefaultTextColor()); } }
@Override public View getView(final int position, View convertView, ViewGroup parent) { View rowView = null; convertView = null; if (convertView == null) { // Not recycled, inflate a new view LayoutInflater li = (LayoutInflater) _c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = li.inflate(R.layout.profile_listitems, null); // rowView = getLayoutInflater().inflate(R.layout.profile_listitems, null); rowView.setTag(holder); } holder.textView = (TextView) rowView.findViewById(R.id.labels); holder.editText = (EditText) rowView.findViewById(R.id.values1); ViewHolder holder = (ViewHolder) rowView.getTag(); // Remove any existing TextWatcher that will be keyed to the wrong ListItem if (holder.textWatcher != null) holder.editText.removeTextChangedListener(holder.textWatcher); final ListItem listItem = groupItem.get(position); // Keep a reference to the TextWatcher so that we can remove it later holder.textWatcher = new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void onTextChanged(CharSequence s, int start, int before, int count) { listItem.value = s.toString(); System.out.println(listItem.value + "" + groupItem.get(position)); } @Override public void afterTextChanged(Editable s) {} }; holder.editText.addTextChangedListener(holder.textWatcher); holder.editText.setText(listItem.value); holder.textView.setText(listItem.getLabel().toString()); // holder.editText.setEnabled(false); if (clickCount == 0) { actv(false); } return rowView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater layoutInflater = LayoutInflater.from(activity.getApplicationContext()); ViewHolder holder; final int type = getItemViewType(position); if (convertView == null) { convertView = layoutInflater.inflate(type == PRESSABLE_TYPE ? itemLayout : dividerLayout, null); if (type == DIVIDER_TYPE) { convertView.setOnClickListener(null); } holder = new ViewHolder(); holder.textView = (TextView) convertView.findViewById(R.id.title); holder.imageView = (ImageView) convertView.findViewById(R.id.imageView); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } if (type == DIVIDER_TYPE) { return convertView; } switch (typeForPosition(position)) { case CHANNEL: Link link = (Link) getItem(position); holder.textView.setText(link.getTitle()); holder.imageView.setImageDrawable(iconForPosition(position)); break; case SETTINGS: holder.textView.setText("Settings"); holder.imageView.setImageDrawable(iconForPosition(position)); break; case ABOUT: holder.textView.setText("About"); holder.imageView.setImageDrawable(iconForPosition(position)); break; default: holder.textView.setText("Bookmarks"); holder.imageView.setImageDrawable(iconForPosition(position)); } return convertView; }
@SuppressLint("InflateParams") @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater mInflater = LayoutInflater.from(mContext); ViewHolder mViewHolder; if (convertView == null) { mViewHolder = new ViewHolder(); convertView = mInflater.inflate(R.layout.item_city_list, null); mViewHolder.textView = (TextView) convertView.findViewById(R.id.tv_name); convertView.setTag(mViewHolder); } else { mViewHolder = (ViewHolder) convertView.getTag(); } mViewHolder.textView.setText(mCityList.get(position)); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = inflater.inflate(R.layout.row, parent, false); holder = new ViewHolder(); holder.textView = (TextView) convertView.findViewById(R.id.note_body); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Note note = (Note) getItem(position); holder.textView.setText(note.getBody()); return convertView; }