@Override public void bindView(final View view, final Context context, final Cursor cursor) { final ViewHolder holder = (ViewHolder) view.getTag(); final Favori item = mFavoriManager.getSingleFromCursor(cursor); if (item.getBackground() == null) { final GradientDrawable background = ColorUtils.getRoundedGradiant(item.getCouleurBackground()); item.setBackground(background); } holder.ligneCode.setText(item.getLettre()); holder.ligneCode.setBackgroundDrawable(item.getBackground()); holder.ligneCode.setTextColor(item.getCouleurTexte()); if (item.getNomFavori() == null) { holder.itemTitle.setText(item.getNomArret()); holder.itemDescription.setText(FormatUtils.formatSens(item.getNomSens())); } else { holder.itemTitle.setText(item.getNomFavori()); holder.itemDescription.setText( FormatUtils.formatArretSens(item.getNomArret(), item.getNomSens())); } if (item.getDelay() == null) { holder.nextHoraire.setVisibility(View.GONE); holder.progressBar.setVisibility(View.VISIBLE); } else { holder.progressBar.setVisibility(View.GONE); holder.nextHoraire.setText(item.getDelay()); holder.nextHoraire.setVisibility(View.VISIBLE); } }
public FavoriCursorAdapter(final Context context, final Cursor c) { super(context, c, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); mLayoutInflater = LayoutInflater.from(context); mFavoriManager = FavoriManager.getInstance(); }