@Override public void onClick(View v) { Intent viewArticle = new Intent(); viewArticle.setClass(this, ArticleViewActivity.class); RssArticle article = (RssArticle) v.getTag(); viewArticle.putExtra("RUBRIC_ID", article.getRubricId()); viewArticle.putExtra("ID", article.getId()); startActivity(viewArticle); }
@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; }
private void refreshImages() { Bitmap thumbnailBitmap; RssArticle article; for (View articleView : listArticlesViews) { ImageView thumbnailImageView = (ImageView) articleView.findViewById(R.id.article_image); article = (RssArticle) articleView.getTag(); Boolean tag = (Boolean) thumbnailImageView.getTag(R.bool.image_empty); if (tag != null && tag == true) { thumbnailBitmap = ThumbnailCache.getInstance().getBitmap(article.getEnclosure()); if (thumbnailBitmap != null) { thumbnailImageView.setImageBitmap(thumbnailBitmap); } else { ThumbnailCache.getInstance().load(thumbnailImageView, article.getEnclosure()); } } } }