@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(EditCategoryActivity.this) .inflate(R.layout.item_setting_edit_category, null); holder.imgLogo = (ImageView) convertView.findViewById(R.id.img_item_edit_category); holder.txtName = (TextView) convertView.findViewById(R.id.txt_item_edit_categoty); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } String label = mCategoryList.get(position).getLabel(); String firstWord = null; if (label.length() > 0) { firstWord = label.substring(0, 1); } else { firstWord = "N"; } if (mCurrentPosition == position) { holder.imgLogo.setImageDrawable( TextDrawable.builder() .buildRound(firstWord, getResources().getColor(R.color.red_colorPrimary))); holder.txtName.setTextColor(getResources().getColor(R.color.red_colorPrimary)); } else { holder.imgLogo.setImageDrawable( TextDrawable.builder().buildRound(firstWord, mColor.getColor(firstWord))); holder.txtName.setTextColor(getResources().getColor(R.color.txt_gray)); } holder.txtName.setText(mCategoryList.get(position).getLabel()); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; if (convertView == null) { convertView = inflater.inflate(R.layout.item_nearbyrestaurant, null); viewHolder = new ViewHolder(); viewHolder.imageView = (ImageView) convertView.findViewById(R.id.item_nearbyrestaurant_img); viewHolder.txtAverage = (TextView) convertView.findViewById(R.id.item_nearbyrestaurant_average); viewHolder.txtAverage.setTypeface(fontFace); viewHolder.txtName = (TextView) convertView.findViewById(R.id.item_nearbyrestaurant_name); viewHolder.txtName.setTypeface(fontFace); viewHolder.txtSpecialty = (TextView) convertView.findViewById(R.id.item_nearbyrestaurant_specialty); viewHolder.txtSpecialty.setTypeface(fontFace); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } Restaurant restaurant = list.get(position); imageLoader.storeLoadImage(restaurant.getImage(), this, viewHolder); viewHolder.txtAverage.setText("人均:" + restaurant.getAverage()); // viewHolder.txtLike.setText(restaurant.getLike() + "人喜欢"); viewHolder.txtName.setText(restaurant.getName()); viewHolder.txtSpecialty.setText("招牌菜:" + restaurant.getSpecialty()); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup arg2) { ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.list_school, null); holder.txtName = (TextView) convertView.findViewById(R.id.text_school); holder.vDot = (View) convertView.findViewById(R.id.list_dot); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } if (position == dotPosition) { holder.vDot.setVisibility(View.VISIBLE); holder.txtName.setTextColor(context.getResources().getColor(R.color.word_head_color)); } else { holder.vDot.setVisibility(View.INVISIBLE); holder.txtName.setTextColor(context.getResources().getColor(R.color.order_text_color)); } holder.txtName.setText(scList.get(position)); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.matching_custom_row_view, null); holder = new ViewHolder(); holder.txtName = (TextView) convertView.findViewById(R.id.matching_name); holder.txtIdentity = (TextView) convertView.findViewById(R.id.matching_identity); holder.txtValue = (TextView) convertView.findViewById(R.id.matching_value); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.txtName.setText(matchingList.get(position).getName()); holder.txtIdentity.setText(matchingList.get(position).getIdentity()); holder.txtValue.setText(matchingList.get(position).getValue()); return convertView; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.news_reply_item_white, null); holder.txtBody = (TextView) convertView.findViewById(R.id.txt_replay_body); holder.txtTime = (TextView) convertView.findViewById(R.id.txt_reply_time); holder.txtName = (TextView) convertView.findViewById(R.id.txt_reply_name); holder.btnReply = (Button) convertView.findViewById(R.id.btn_reply); holder.btnTop = (Button) convertView.findViewById(R.id.btn_reply_top); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.txtBody.setText(mData.get(position).get("body").toString()); holder.txtName.setText(mData.get(position).get("name").toString()); holder.txtTime.setText(mData.get(position).get("time").toString()); holder.btnTop.setText( context.getString(R.string.top) + mData.get(position).get("top").toString()); holder.btnTop.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Message message = new Message(); message.what = NewsDetailsActivity.MSG_PUSH_TOP; Bundle bundle = new Bundle(); bundle.putString("fid", "" + mData.get(position).get("fid")); message.setData(bundle); handler.sendMessage(message); } }); holder.btnReply.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Message message = new Message(); message.what = NewsDetailsActivity.MSG_REPLY; Bundle bundle = new Bundle(); bundle.putString("fid", "" + mData.get(position).get("fid")); bundle.putBoolean("isReply", false); message.setData(bundle); handler.sendMessage(message); } }); return convertView; }
@SuppressLint("SetJavaScriptEnabled") @Override public View getView(final int position, View convertView, ViewGroup parent) { if (comment_Lists.size() == 0) { if (convertView == null) { convertView = inflater.inflate(R.layout.search_item_ebook_noresult, null); TextView txtName = (TextView) convertView.findViewById(R.id.txt_noresult); // txtName.setTypeface(StaticUtils.getTypeface(context, Font.DB_Helvethaica_X_Med)); } return convertView; } ViewHolder viewHolder = null; if (convertView == null) { viewHolder = new ViewHolder(); convertView = inflater.inflate(R.layout.listview_item_comment, null); viewHolder.txtName = (TextView) convertView.findViewById(R.id.ptxtName_Sebook_comment); viewHolder.txtdate = (TextView) convertView.findViewById(R.id.ptxtdate_Sebook_comment); viewHolder.txtcommentr = (TextView) convertView.findViewById(R.id.ptxtcomment_Sebook_comment); viewHolder.iv_cover = (WebView) convertView.findViewById(R.id.img_ebook_pcover_comment); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } viewHolder.txtName.setText(comment_Lists.get(position).getName() + ""); viewHolder.txtcommentr.setText(comment_Lists.get(position).getComment() + ""); viewHolder.txtdate.setText(comment_Lists.get(position).getUpdateDateTime() + ""); viewHolder.txtName.setTypeface(StaticUtils.getTypeface(getContext(), Font.THSarabanNew)); viewHolder.txtcommentr.setTypeface(StaticUtils.getTypeface(getContext(), Font.THSarabanNew)); viewHolder.txtdate.setTypeface(StaticUtils.getTypeface(getContext(), Font.THSarabanNew)); appCachePath = getContext().getApplicationContext().getCacheDir().getAbsolutePath(); readRawTextFile = StaticUtils.readRawTextFile(getContext(), R.raw.bg_cover_html); if (comment_Lists.get(position).getPictrueUrl().length() <= 0 || comment_Lists.get(position).getPictrueUrl() == "") { readRawTextFile = readRawTextFile.replace("{{{url}}}", "http://www.ebooks.in.th/images/no_avt.jpg"); } else { readRawTextFile = readRawTextFile.replace("{{{url}}}", comment_Lists.get(position).getPictrueUrl()); } viewHolder.iv_cover.setVisibility(View.VISIBLE); viewHolder.iv_cover.getSettings().setJavaScriptEnabled(true); viewHolder.iv_cover.loadDataWithBaseURL(null, readRawTextFile, "text/html", "UTF-8", null); viewHolder.iv_cover.setWebViewClient(new MyWebViewClient(null)); viewHolder.iv_cover.getSettings().setAppCacheMaxSize(1024 * 1024 * 8); viewHolder.iv_cover.getSettings().setAppCachePath(appCachePath); viewHolder.iv_cover.getSettings().setAppCacheEnabled(true); viewHolder.iv_cover.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); viewHolder.iv_cover.getSettings().setDomStorageEnabled(true); viewHolder.iv_cover.getSettings().setAllowFileAccess(true); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.bactivity_main_section_rows, null); holder = new ViewHolder(); holder.txtName = (TextView) convertView.findViewById(R.id.name); holder.txtAccount = (TextView) convertView.findViewById(R.id.account); holder.txtBank = (TextView) convertView.findViewById(R.id.bank); holder.right = (ImageView) convertView.findViewById(R.id.right); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } try { JSONObject f = (JSONObject) searchBrandArrayList.get(position); holder.txtName.setText(("JM").concat(f.getString("order_ID"))); holder.txtAccount.setText( f.getString("RecipientsFirstName") .concat(" ") .concat(f.getString("RecipientsLastName")) .concat("-") .concat(" ") .concat("NGN") .concat(f.getString("TotalDueNGN"))); holder.txtBank.setText(f.getString("Date")); holder.right.setImageResource(Right[0]); } catch (JSONException e) { e.printStackTrace(); } return convertView; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder; // if(convertView==null){ convertView = inflater.inflate(R.layout.contact_info_item, null); holder = new ViewHolder(); holder.txtName = (TextView) convertView.findViewById(R.id.txtName); holder.checkBox = (CheckBox) convertView.findViewById(R.id.checkBox); convertView.setTag(holder); // }else{ // holder = (ViewHolder) convertView.getTag(); // } final UserInfo myContact = getItem(position); holder.txtName.setText(myContact.getUserName()); holder.checkBox.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { if (!listToHide.contains(myContact)) { listToHide.add(getItem(position)); } } else { listToHide.remove(getItem(position)); } } }); convertView.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent( Intent.ACTION_VIEW, Uri.withAppendedPath( ContactsContract.Contacts.CONTENT_URI, "" + myContact.getUserId())); context.startActivity(intent); } }); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { convertView = inflater.inflate(R.layout.grid_image, null); holder = new ViewHolder(); holder.txtName = (TextView) convertView.findViewById(R.id.txtName); holder.imflag = (ImageView) convertView.findViewById(R.id.imgflag); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.txtName.setText(array_countries[position]); holder.imflag.setImageBitmap( decodeSampledBitmapFromResource(resources, arrayFlags[position], 400, 200)); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { LayoutInflater inflater = LayoutInflater.from(ListView2Activity.this); convertView = inflater.inflate(R.layout.basic_list, parent, false); holder = new ViewHolder(); holder.image = (ImageView) convertView.findViewById(R.id.imageView1); holder.txtName = (TextView) convertView.findViewById(R.id.textView1); holder.txtNumber = (TextView) convertView.findViewById(R.id.textView2); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } String name = object.get(position).getName(); String phonenumber = object.get(position).getPhoneNumber(); int image = object.get(position).getImage(); holder.image.setImageResource(image); holder.txtName.setText(name); holder.txtNumber.setText(phonenumber); return convertView; }
public View getView(final int position, View view, ViewGroup parent) { // TODO Auto-generated method stub final ViewHolder holder; // LayoutInflater inflator = activity.getLayoutInflater(); if (view == null) { holder = new ViewHolder(); view = inflater.inflate( R.layout.drawer_list_item, null); // gridview_row //fra_browse_gridview_item holder.txtName = (CustomTextView) view.findViewById(R.id.txt_item_name); holder.imgIcon = (ImageView) view.findViewById(R.id.icon); view.setTag(holder); } else { // holder = (ViewHolder) view.getTag(); holder = (ViewHolder) view.getTag(); } holder.txtName.setText(listName[position]); if (mstr_lang.equals(org.undp_iwomen.iwomen.utils.Utils.ENG_LANG)) { holder.txtName.setTypeface(MyTypeFace.get(mContext, MyTypeFace.NORMAL)); } else if (mstr_lang.equals(org.undp_iwomen.iwomen.utils.Utils.MM_LANG)) { holder.txtName.setTypeface(MyTypeFace.get(mContext, MyTypeFace.ZAWGYI)); } holder.imgIcon.setImageResource(listicon[position]); // For transparent bg alpha 51=20% , 127=50% , 191=75% , 204 = 80% ,229=90% , 242=95% // holder.txtName.setBackgroundColor (Color.argb(229, 175, 42, 43));// Color.argb(0, 175, 42, // 43)); // background transparency // holder.txtName.setTextColor (Color.argb (255, 255, 255, 255));//Color.argb (0, 255, 255, // 255)); // transparency of the text return view; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); if (convertView == null) { convertView = mInflater.inflate(R.layout.row_dialog_new_transaction, null); holder = new ViewHolder(); holder.customerId = (TextView) convertView.findViewById(R.id.newTransactionItemId); holder.txtName = (TextView) convertView.findViewById(R.id.newTransactionItemId); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Customer rowItem = (Customer) getItem(position); holder.customerId.setText("" + rowItem.getCode()); holder.txtName.setText(rowItem.getName()); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { final ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = layoutInflater.inflate(R.layout.search_history_listitem, null); holder.baseLayout = (RelativeLayout) convertView.findViewById(R.id.baseLayout); holder.listLayout = (RelativeLayout) convertView.findViewById(R.id.listLayout); holder.optionLayout = (LinearLayout) convertView.findViewById(R.id.optionLayout); holder.ivSearchPhoto = (ImageView) convertView.findViewById(R.id.imgPhoto); holder.txtName = (TextView) convertView.findViewById(R.id.txtName); holder.txtDesc = (TextView) convertView.findViewById(R.id.txtDesc); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } final SearchBean bean = searchBeanArrayList.get(position); holder.txtName.setText(bean.getSearchText()); holder.txtDesc.setText(bean.getSearchDate()); lazyLoad.LoadImagesFromURI(holder.ivSearchPhoto, bean.getSearchImageThumbnailPath()); holder.baseLayout.setOnTouchListener( new OnSwipeTouchListener() { @Override public void onMove(float difference) { if (!bean.getSwiped()) { if (difference > 0 && difference < optionLayoutWidth) { ObjectAnimator.ofFloat(holder.listLayout, "translationX", difference) .setDuration(0) .start(); params = new RelativeLayout.LayoutParams( Math.round(difference), LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.CENTER_IN_PARENT, 0); holder.optionLayout.setLayoutParams(params); } } else { if (difference < 0 && difference > -optionLayoutWidth) { ObjectAnimator.ofFloat( holder.listLayout, "translationX", optionLayoutWidth + difference) .setDuration(0) .start(); params = new RelativeLayout.LayoutParams( Math.round(optionLayoutWidth + difference), LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.CENTER_IN_PARENT, 0); holder.optionLayout.setLayoutParams(params); } } } @Override public void onUp(float difference) { if (!bean.getSwiped()) { if (difference > (optionLayoutWidth / 2)) { bean.setSwiped(true); ObjectAnimator.ofFloat(holder.listLayout, "translationX", optionLayoutWidth) .start(); params = new RelativeLayout.LayoutParams( Math.round(optionLayoutWidth), LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.CENTER_IN_PARENT, 0); holder.optionLayout.setLayoutParams(params); } else { bean.setSwiped(false); ObjectAnimator.ofFloat(holder.listLayout, "translationX", 0).start(); params = new RelativeLayout.LayoutParams(Math.round(0), LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.CENTER_IN_PARENT, 0); holder.optionLayout.setLayoutParams(params); } } else { if (difference > -(optionLayoutWidth / 2)) { bean.setSwiped(true); ObjectAnimator.ofFloat(holder.listLayout, "translationX", optionLayoutWidth) .start(); params = new RelativeLayout.LayoutParams( Math.round(optionLayoutWidth), LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.CENTER_IN_PARENT, 0); holder.optionLayout.setLayoutParams(params); } else { bean.setSwiped(false); ObjectAnimator.ofFloat(holder.listLayout, "translationX", 0).start(); params = new RelativeLayout.LayoutParams(Math.round(0), LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.CENTER_IN_PARENT, 0); holder.optionLayout.setLayoutParams(params); } } } @Override public void onCancel(float difference) { if (!bean.getSwiped()) { if (difference > (optionLayoutWidth / 2)) { bean.setSwiped(true); ObjectAnimator.ofFloat(holder.listLayout, "translationX", optionLayoutWidth) .start(); params = new RelativeLayout.LayoutParams( Math.round(optionLayoutWidth), LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.CENTER_IN_PARENT, 0); holder.optionLayout.setLayoutParams(params); } else { bean.setSwiped(false); ObjectAnimator.ofFloat(holder.listLayout, "translationX", 0).start(); params = new RelativeLayout.LayoutParams(Math.round(0), LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.CENTER_IN_PARENT, 0); holder.optionLayout.setLayoutParams(params); } } else { if (difference > -(optionLayoutWidth / 2)) { bean.setSwiped(true); ObjectAnimator.ofFloat(holder.listLayout, "translationX", optionLayoutWidth) .start(); params = new RelativeLayout.LayoutParams( Math.round(optionLayoutWidth), LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.CENTER_IN_PARENT, 0); holder.optionLayout.setLayoutParams(params); } else { bean.setSwiped(false); ObjectAnimator.ofFloat(holder.listLayout, "translationX", 0).start(); params = new RelativeLayout.LayoutParams(Math.round(0), LayoutParams.MATCH_PARENT); params.addRule(RelativeLayout.CENTER_IN_PARENT, 0); holder.optionLayout.setLayoutParams(params); } } } @Override public void onSwipeRight() {} @Override public void onSwipeLeft() {} }); return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = mInflater.inflate(R.layout.suggestion, null); holder = new ViewHolder(); holder.icon = (ImageView) convertView.findViewById(R.id.suggestion_app_icon); holder.txtName = (TextView) convertView.findViewById(R.id.actionName); holder.txtType = (TextView) convertView.findViewById(R.id.suggestion_type); holder.txtBenefit = (TextView) convertView.findViewById(R.id.expectedBenefit); holder.moreInfo = (ImageView) convertView.findViewById(R.id.jscore_info); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } if (indexes == null || position < 0 || position >= indexes.length) return convertView; SimpleHogBug item = indexes[position]; if (item == null) return convertView; final String raw = item.getAppName(); Drawable icon = CaratApplication.iconForApp(a.getApplicationContext(), raw); if (raw.equals(FAKE_ITEM)) { holder.txtName.setText(a.getString(R.string.osupgrade)); holder.txtType.setText(a.getString(R.string.information)); holder.txtBenefit.setText(a.getString(R.string.unknown)); } else { String label = CaratApplication.labelForApp(a.getApplicationContext(), raw); if (label == null) label = a.getString(R.string.unknown); holder.icon.setImageDrawable(icon); Constants.Type type = item.getType(); if (type == Constants.Type.BUG) holder.txtName.setText(a.getString(R.string.restart) + " " + label); else if (type == Constants.Type.HOG) holder.txtName.setText(a.getString(R.string.kill) + " " + label); else { // Other action holder.txtName.setText(label); } if (type == Constants.Type.OTHER) holder.txtType.setText(item.getAppPriority()); else holder.txtType.setText(CaratApplication.translatedPriority(item.getAppPriority())); /*if (raw.equals(a.getString(R.string.disablebluetooth))){ double benefitOther=SamplingLibrary.bluetoothBenefit(a.getApplicationContext()); hours = (int) (benefitOther); min= (int) ((benefitOther- hours)*60); } else if(raw.equals(a.getString(R.string.disablewifi))){ double benefitOther=SamplingLibrary.wifiBenefit(a.getApplicationContext()); hours = (int) (benefitOther); min= (int) ((benefitOther- hours)*60); } else if(raw.equals(a.getString(R.string.dimscreen))){ double benefitOther=SamplingLibrary.screenBrightnessBenefit(a.getApplicationContext()); hours = (int) (benefitOther); min = (int) ((benefitOther- hours)*60); }*/ // Do not show a benefit for things that have none. if (item.getExpectedValue() == 0 && item.getExpectedValueWithout() == 0) { holder.txtBenefit.setText(""); TextView bl = (TextView) convertView.findViewById(R.id.benefitLegend); bl.setText(""); } else holder.txtBenefit.setText(item.getBenefitText()); // holder.moreInfo... } // } return convertView; }