@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(getActivity()).inflate(R.layout.item_song, null); holder.mTvName = (TextView) convertView.findViewById(R.id.tv_name); holder.mTvArtist = (TextView) convertView.findViewById(R.id.tv_artist); holder.mTvDuration = (TextView) convertView.findViewById(R.id.tv_duration); holder.aboveView = convertView.findViewById(R.id.item_root); holder.behindView = convertView.findViewById(R.id.behind); convertView.setTag(holder); convertViewList.add((PullRightLayout) convertView); } else { holder = (ViewHolder) convertView.getTag(); } if (HideApplication.showListAnim) { startAnim(convertView); } SongInfo info = SongManager.with(getActivity()).getSongByIndex(position); holder.mTvName.setText(info.getTitle()); holder.mTvArtist.setText(info.getArtist() + " - " + info.getAlbum()); holder.mTvDuration.setText( CommonUtils.durationToString(info.getDuration()) + " - " + CommonUtils.getFileSize(info.getPath())); setItemSelected(holder, info.getId() == playingId); convertView.setOnClickListener(new OnItemClick(position)); holder.behindView.setOnClickListener(new OnBehindClick(position)); return convertView; }
@Override public View getView(int position, View convertView, final ViewGroup parent) { final Item item = getItem(position); final View view; if (convertView != null && item.getClass().equals(convertView.getTag())) { view = convertView; } else { view = getLayoutInflater() .inflate( item instanceof SectionItem ? R.layout.catalog_manager_section_head : R.layout.catalog_manager_item, null); view.setTag(item.getClass()); } if (item instanceof SectionItem) { ((TextView) view.findViewById(R.id.catalog_manager_section_head_title)) .setText(((SectionItem) item).Title); } else /* if (item instanceof CatalogItem) */ { final CatalogItem catalogItem = (CatalogItem) item; if (myCoverManager == null) { view.measure(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); final int coverHeight = view.getMeasuredHeight(); myCoverManager = new CoverManager(CatalogManagerActivity.this, coverHeight * 15 / 22, coverHeight); view.requestLayout(); } final INetworkLink link = catalogItem.Tree.getLink(); ((TextView) view.findViewById(R.id.catalog_manager_item_title)).setText(link.getTitle()); ((TextView) view.findViewById(R.id.catalog_manager_item_subtitle)) .setText(link.getSummary()); final ImageView coverView = (ImageView) view.findViewById(R.id.catalog_manager_item_icon); if (!myCoverManager.trySetCoverImage(coverView, catalogItem.Tree)) { coverView.setImageResource(R.drawable.ic_list_library_books); } final CheckBox checkBox = (CheckBox) view.findViewById(R.id.catalog_manager_item_checkbox); checkBox.setChecked(catalogItem.IsChecked); checkBox.setOnClickListener( new View.OnClickListener() { public void onClick(View v) { catalogItem.IsChecked = checkBox.isChecked(); setResultIds(catalogItem, 0); } }); } return view; }
@Override public void onClick(final View v) { int position = (int) v.getTag(); AlertDialog.Builder builder = new AlertDialog.Builder( new ContextThemeWrapper(v.getContext(), R.style.HomePageDialogboxCustom)); if (position == 0) { Intent gotolistofpet = new Intent(v.getContext(), PetList.class); v.getContext().startActivity(gotolistofpet); } if (position == 1) { Intent gotoShopProduct = new Intent(v.getContext(), Pet_Shop_List.class); v.getContext().startActivity(gotoShopProduct); } if (position == 2) { Intent gotoCampaign = new Intent(v.getContext(), Campaign_List_ForAll.class); v.getContext().startActivity(gotoCampaign); } if (position == 3) { Intent gotoPetServices = new Intent(v.getContext(), PetServices.class); v.getContext().startActivity(gotoPetServices); } if (position == 4) { adapter = new DialogListAdapter(dialogListForPetClinic); final Intent gotoPetClinic = new Intent(v.getContext(), PetClinic.class); builder.setAdapter( adapter, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (i == 0) { state = 0; gotoPetClinic.putExtra("STATE_OF_CLICK", state); v.getContext().startActivity(gotoPetClinic); } else if (i == 1) { state = 1; gotoPetClinic.putExtra("STATE_OF_CLICK", state); v.getContext().startActivity(gotoPetClinic); } } }); alertDialog = builder.create(); alertDialog.show(); } if (position == 5) { Intent gotolistofpet = new Intent(v.getContext(), PetMateList.class); v.getContext().startActivity(gotolistofpet); } }
protected View getView(int position, View convertView, ViewGroup parent) { AccountHolder holder; if (convertView == null) { convertView = layoutInflater.inflate(layoutResourceId, parent, false); holder = new AccountHolder(); holder.accountRow1 = (TextView) convertView.findViewById(R.id.accountRow1); holder.accountRow1.setTypeface(GothamFont.BOLD); holder.accountRow2 = (TextView) convertView.findViewById(R.id.accountRow2); convertView.setTag(holder); } else holder = (AccountHolder) convertView.getTag(); Account account = getItem(position); holder.accountRow2.setText(getAccountRow2(account)); holder.accountRow1.setText(getAccountRow1(account)); return convertView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; PhotoGridHolder holder = null; if (row == null) { LayoutInflater inflater = ((Activity) context).getLayoutInflater(); row = inflater.inflate(layoutResourceId, parent, false); holder = new PhotoGridHolder(); holder.itemImageView = (ImageView) row.findViewById(R.id.galleryGridImage); row.setTag(holder); } else { holder = (PhotoGridHolder) row.getTag(); } String filename = getItem(position); String path = context.getFilesDir().getAbsolutePath() + "/images/" + filename; holder.itemImageView.setImageURI(Uri.parse(path)); return row; }
private ViewHolder getViewHolder(final View workingView) { final Object tag = workingView.getTag(); ViewHolder viewHolder = null; if (null == tag || !(tag instanceof ViewHolder)) { viewHolder = new ViewHolder(); viewHolder.nameView = (TextView) workingView.findViewById(R.id.name); viewHolder.dateView = (TextView) workingView.findViewById(R.id.date); viewHolder.sizeView = (TextView) workingView.findViewById(R.id.size); viewHolder.imageView = (ImageView) workingView.findViewById(R.id.image); workingView.setTag(viewHolder); } else { viewHolder = (ViewHolder) tag; } return viewHolder; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHodler holder = null; if (null == convertView) { convertView = View.inflate(context, R.layout.li_child_click_item, null); holder = new ViewHodler(); holder.mCountry = (Button) convertView.findViewById(R.id.licc_btn_country); holder.mName = (TextView) convertView.findViewById(R.id.licc_tv_name); convertView.setTag(holder); } else { holder = (ViewHodler) convertView.getTag(); } LiData data = list.get(position); holder.mCountry.setText(data.country); holder.mCountry.setOnClickListener(new OnItemChildClickListener(CLICK_INDEX_COUNTRY, position)); holder.mName.setText(data.name); holder.mName.setOnClickListener(new OnItemChildClickListener(CLICK_INDEX_NAME, position)); convertView.setOnClickListener(new OnItemChildClickListener(CLICK_INDEX_ITEM, position)); return convertView; }
public View getItemView(int itemPosition, View convertView, ViewGroup parent) { FolderInfoHolder folder = (FolderInfoHolder) getItem(itemPosition); View view; if (convertView != null) { view = convertView; } else { view = mInflater.inflate(R.layout.folder_list_item, parent, false); } FolderViewHolder holder = (FolderViewHolder) view.getTag(); if (holder == null) { holder = new FolderViewHolder(); holder.folderName = (TextView) view.findViewById(R.id.folder_name); holder.newMessageCount = (TextView) view.findViewById(R.id.folder_unread_message_count); holder.flaggedMessageCount = (TextView) view.findViewById(R.id.folder_flagged_message_count); holder.folderStatus = (TextView) view.findViewById(R.id.folder_status); holder.activeIcons = (RelativeLayout) view.findViewById(R.id.active_icons); holder.chip = view.findViewById(R.id.chip); holder.folderListItemLayout = (LinearLayout) view.findViewById(R.id.folder_list_item_layout); holder.rawFolderName = folder.name; view.setTag(holder); } if (folder == null) { return view; } holder.folderName.setText(folder.displayName); String statusText = ""; if (folder.loading) { statusText = getString(R.string.status_loading); } else if (folder.status != null) { statusText = folder.status; } else if (folder.lastChecked != 0) { Date lastCheckedDate = new Date(folder.lastChecked); statusText = getTimeFormat().format(lastCheckedDate) + " " + getDateFormat().format(lastCheckedDate); } if (folder.pushActive) { statusText = getString(R.string.folder_push_active_symbol) + " " + statusText; } if (statusText != null) { holder.folderStatus.setText(statusText); holder.folderStatus.setVisibility(View.VISIBLE); } else { holder.folderStatus.setText(null); holder.folderStatus.setVisibility(View.GONE); } if (folder.unreadMessageCount != 0) { holder.newMessageCount.setText(Integer.toString(folder.unreadMessageCount)); holder.newMessageCount.setOnClickListener( new FolderClickListener( mAccount, folder.name, folder.displayName, SearchModifier.UNREAD)); holder.newMessageCount.setVisibility(View.VISIBLE); } else { holder.newMessageCount.setVisibility(View.GONE); } if (K9.messageListStars() && folder.flaggedMessageCount > 0) { holder.flaggedMessageCount.setText(Integer.toString(folder.flaggedMessageCount)); holder.flaggedMessageCount.setOnClickListener( new FolderClickListener( mAccount, folder.name, folder.displayName, SearchModifier.FLAGGED)); holder.flaggedMessageCount.setVisibility(View.VISIBLE); } else { holder.flaggedMessageCount.setVisibility(View.GONE); } if (K9.useCompactLayouts() && holder.folderListItemLayout != null) { holder.folderListItemLayout.setMinimumHeight(0); } holder.activeIcons.setOnClickListener( new OnClickListener() { public void onClick(View v) { Toast toast = Toast.makeText( getApplication(), getString(R.string.tap_hint), Toast.LENGTH_SHORT); toast.show(); } }); holder.chip.setBackgroundDrawable(mAccount.generateColorChip().drawable()); holder.chip.getBackground().setAlpha(folder.unreadMessageCount == 0 ? 127 : 255); holder.folderName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getFolderName()); holder.folderStatus.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getFolderStatus()); return view; }