public String getItemStringId(int position) { ImogBeanCursor<?> c = (ImogBeanCursor<?>) getItem(position); if (c != null) { return c.getId(); } return null; }
@Override public void bindView(View view, Context context, Cursor cursor) { ImogBeanCursor<?> c = (ImogBeanCursor<?>) cursor; view.findViewById(android.R.id.background).setBackgroundDrawable(mColor); TextView main = (TextView) view.findViewById(android.R.id.text1); TextView secondary = (TextView) view.findViewById(android.R.id.text2); main.setText(null); secondary.setText(null); if (c.getFlagRead()) { view.setBackgroundResource(android.R.drawable.list_selector_background); main.setTextAppearance(context, android.R.style.TextAppearance_Medium); main.setTypeface(Typeface.DEFAULT); secondary.setTextAppearance(context, android.R.style.TextAppearance_Small); secondary.setTypeface(Typeface.DEFAULT); } else { view.setBackgroundResource(R.drawable.imog__list_selector_background_inverse); main.setTextAppearance(context, android.R.style.TextAppearance_Medium_Inverse); main.setTypeface(Typeface.DEFAULT_BOLD); secondary.setTextAppearance(context, android.R.style.TextAppearance_Small_Inverse); secondary.setTypeface(Typeface.DEFAULT_BOLD); } ImageView icon = (ImageView) view.findViewById(android.R.id.icon); if (icon != null) { icon.setImageResource(android.R.drawable.stat_notify_sync); icon.setVisibility(c.getFlagSynchronized() ? View.GONE : View.VISIBLE); } main.setText(c.getMainDisplay(context)); String sec = c.getSecondaryDisplay(context); if (TextUtils.isEmpty(sec.trim())) { secondary.setVisibility(View.GONE); } else { secondary.setVisibility(View.VISIBLE); secondary.setText(sec); } }