@@ -0,0 +1,2042 @@
+/**%0A * %0A */%0Apackage com.simplenote.android.widget;%0A%0Aimport android.content.Context;%0Aimport android.view.LayoutInflater;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0Aimport android.widget.BaseAdapter;%0Aimport android.widget.LinearLayout;%0Aimport android.widget.TextView;%0A%0Aimport com.simplenote.android.R;%0Aimport com.simplenote.android.model.Note;%0A%0A/**%0A * Specialized ListAdapter for converting Note objects into views based on the notes_row layout%0A * @author bryanjswift%0A */%0Apublic class NotesAdapter extends BaseAdapter %7B%0A%09private final Context context;%0A%09private Note%5B%5D notes;%0A%09/**%0A%09 * Default constructor for converting Note objects to ListView rows%0A%09 * @param context where the notes are being viewed%0A%09 * @param notes to use as data%0A%09 */%0A%09public NotesAdapter(Context context, Note%5B%5D notes) %7B%0A%09%09this.context = context;%0A%09%09this.notes = notes;%0A%09%7D%0A%09/**%0A%09 * @see android.widget.Adapter#getCount()%0A%09 */%0A%09public int getCount() %7B%0A%09%09return notes.length;%0A%09%7D%0A%09/**%0A%09 * @see android.widget.Adapter#getItem(int)%0A%09 */%0A%09public Object getItem(int position) %7B%0A%09%09return notes%5Bposition%5D;%0A%09%7D%0A%09/**%0A%09 * @see android.widget.Adapter#getItemId(int)%0A%09 */%0A%09public long getItemId(int position) %7B%0A%09%09return notes%5Bposition%5D.getId();%0A%09%7D%0A%09/**%0A%09 * @see android.widget.Adapter#getView(int, android.view.View, android.view.ViewGroup)%0A%09 */%0A%09public View getView(int position, View convertView, ViewGroup parent) %7B%0A%09%09final View result;%0A%09%09if (convertView == null) %7B%0A%09%09%09LayoutInflater inflater = LayoutInflater.from(context);%0A%09%09%09LinearLayout row = (LinearLayout) inflater.inflate(R.layout.notes_row, parent, false);%0A%09%09%09((TextView) row.findViewById(R.id.text_title)).setText(notes%5Bposition%5D.getTitle());%0A%09%09%09((TextView) row.findViewById(R.id.text_date)).setText(notes%5Bposition%5D.getDateModified());%0A%09%09%09result = row;%0A%09%09%7D else %7B%0A%09%09%09result = convertView;%0A%09%09%7D%0A%09%09return result;%0A%09%7D%0A%09/**%0A%09 * @return the notes%0A%09 */%0A%09public final Note%5B%5D getNotes() %7B%0A%09%09return notes;%0A%09%7D%0A%09/**%0A%09 * @param notes the notes to set%0A%09 */%0A%09public final void setNotes(Note%5B%5D notes) %7B%0A%09%09this.notes = notes;%0A%09%7D%0A%7D%0A

Create NotesAdapter class to be able to create a ListView from a Note[]