Android Open Source - android-location-notes Notes Adapter






From Project

Back to project page android-location-notes.

License

The source code is released under:

Apache License

If you think the Android project android-location-notes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.nearsoft.examenboom;
//  ww w. j  av  a 2 s  .  co m
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.EditText;
import android.widget.TextView;

import com.nearsoft.examenboom.common.Note;
import com.nearsoft.examenboom.database.repository.NoteRepository;
import com.nearsoft.examenboom.database.repository.NoteRepositoryImpl;

import java.util.List;

/**
 * Created by jsalcido on 7/27/14.
 */
public class NotesAdapter extends BaseAdapter {

    private LayoutInflater mInflater;
    private List<Note> mNotes;
    private Context mContext;

    public NotesAdapter(Context context, List<Note> notes) {
        mContext = context;
        mNotes = notes;
        mInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return mNotes.size();
    }

    @Override
    public Object getItem(int position) {
        return mNotes.get(position);
    }

    @Override
    public long getItemId(int position) {
        return ((Note)getItem(position)).getId();
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        NoteViewHolder holder;
        if(convertView == null){
            convertView = mInflater.inflate(R.layout.row_adapter, null);
            holder = new NoteViewHolder();
            holder.title = (TextView) convertView.findViewById(R.id.notes_list_title_text);
            holder.text = (TextView) convertView.findViewById(R.id.notes_list_note_text);
            convertView.setTag(holder);
        }else{
            holder = (NoteViewHolder) convertView.getTag();
        }
        holder.title.setText(mNotes.get(position).getTitle());
        holder.text.setText(mNotes.get(position).getText());
        return convertView;
    }

    private class NoteViewHolder {
        TextView title;
        TextView text;
    }
}




Java Source Code List

com.nearsoft.examenboom.ApplicationTest.java
com.nearsoft.examenboom.DrawerAdapter.java
com.nearsoft.examenboom.ExamenApplication.java
com.nearsoft.examenboom.MainActivity.java
com.nearsoft.examenboom.NewNoteActivity.java
com.nearsoft.examenboom.NoteMapFragment.java
com.nearsoft.examenboom.NotesAdapter.java
com.nearsoft.examenboom.NotesFragment.java
com.nearsoft.examenboom.NotesMapFragment.java
com.nearsoft.examenboom.ViewNoteActivity.java
com.nearsoft.examenboom.common.Note.java
com.nearsoft.examenboom.database.NoteDatabaseAccess.java
com.nearsoft.examenboom.database.NotesSQLite.java
com.nearsoft.examenboom.database.repository.NoteRepositoryImpl.java
com.nearsoft.examenboom.database.repository.NoteRepository.java