@Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; int type = getItemViewType(position); if (view == null) { if (type == LOADING) view = inflater.inflate(R.layout.uv_loading_item, null); else if (type == FORUM) view = inflater.inflate(R.layout.uv_text_item, null); else if (type == KB_HEADER) view = inflater.inflate(R.layout.uv_header_item_light, null); else if (type == TOPIC) view = inflater.inflate(R.layout.uv_text_item, null); else if (type == CONTACT) view = inflater.inflate(R.layout.uv_text_item, null); else if (type == ARTICLE) view = inflater.inflate(R.layout.uv_text_item, null); else if (type == POWERED_BY) view = inflater.inflate(R.layout.uv_powered_by_item, null); } if (type == FORUM) { TextView textView = (TextView) view.findViewById(R.id.uv_text); textView.setText(R.string.uv_feedback_forum); TextView text2 = (TextView) view.findViewById(R.id.uv_text2); text2.setText( Utils.getQuantityString( text2, R.plurals.uv_ideas, Session.getInstance().getForum().getNumberOfOpenSuggestions())); } else if (type == KB_HEADER) { TextView textView = (TextView) view.findViewById(R.id.uv_header_text); textView.setText(R.string.uv_knowledge_base); } else if (type == TOPIC) { Topic topic = (Topic) getItem(position); TextView textView = (TextView) view.findViewById(R.id.uv_text); textView.setText(topic.getName()); textView = (TextView) view.findViewById(R.id.uv_text2); if (topic.getId() == -1) { textView.setVisibility(View.GONE); } else { textView.setVisibility(View.VISIBLE); textView.setText( String.format( "%d %s", topic.getNumberOfArticles(), context .getResources() .getQuantityString(R.plurals.uv_articles, topic.getNumberOfArticles()))); } } else if (type == CONTACT) { TextView textView = (TextView) view.findViewById(R.id.uv_text); textView.setText(R.string.uv_contact_us); view.findViewById(R.id.uv_text2).setVisibility(View.GONE); } else if (type == ARTICLE) { TextView textView = (TextView) view.findViewById(R.id.uv_text); Article article = (Article) getItem(position); textView.setText(article.getTitle()); } else if (type == POWERED_BY) { TextView textView = (TextView) view.findViewById(R.id.uv_version); textView.setText(context.getString(R.string.uv_android_sdk) + " v" + UserVoice.getVersion()); } View divider = view.findViewById(R.id.uv_divider); if (divider != null) divider.setVisibility( (position == getCount() - 2 && getItemViewType(getCount() - 1) == POWERED_BY) || position == getCount() - 1 ? View.GONE : View.VISIBLE); if (type == FORUM) divider.setVisibility(View.GONE); return view; }