public View getView(int position, View convertView, ViewGroup parent) { final View view = (convertView != null) ? convertView : LayoutInflater.from(parent.getContext()) .inflate(R.layout.bookmark_item, parent, false); final ImageView imageView = (ImageView) view.findViewById(R.id.bookmark_item_icon); final TextView textView = (TextView) view.findViewById(R.id.bookmark_item_text); final TextView bookTitleView = (TextView) view.findViewById(R.id.bookmark_item_booktitle); final Bookmark bookmark = getItem(position); if (bookmark == null) { imageView.setVisibility(View.VISIBLE); imageView.setImageResource(R.drawable.ic_list_plus); textView.setText(ZLResource.resource("bookmarksView").getResource("new").getValue()); bookTitleView.setVisibility(View.GONE); } else { imageView.setVisibility(View.GONE); textView.setText(bookmark.getText()); if (myCurrentBook) { bookTitleView.setVisibility(View.GONE); } else { bookTitleView.setVisibility(View.VISIBLE); bookTitleView.setText(bookmark.getBookTitle()); } } return view; }
@Override public HomeListAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()) .inflate(R.layout.listview_homemenu, viewGroup, false); ViewHolder vh = new ViewHolder(view); return vh; }