<file_sep>package oo.max.noteslistexample.list;

import android.os.AsyncTask;

import java.util.List;

import oo.max.noteslistexample.apiclient.NotesApiClient;
import oo.max.noteslistexample.apiclient.RetrofitApiClientFactory;
import oo.max.noteslistexample.model.NoteListItem;
import oo.max.noteslistexample.model.NotesListResponse;
import retrofit2.Response;

public class GetNotesListAsyncTask extends AsyncTask<Void, Void, List<NoteListItem>> {

    private final NotesApiClient notesApiClient;
    private final OnNotesDownloadListener onNotesDownloadListener;

    public GetNotesListAsyncTask(OnNotesDownloadListener onNotesDownloadListener) {
        this.onNotesDownloadListener = onNotesDownloadListener;
        notesApiClient = new RetrofitApiClientFactory().create();
    }

    @Override
    protected List<NoteListItem> doInBackground(Void... voids) {
        try {
            Response<NotesListResponse> response = notesApiClient.getNotes().execute();
            if(response.isSuccessful()) {
                return response.body().getData();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    protected void onPostExecute(List<NoteListItem> noteListItems) {
        onNotesDownloadListener.notesDownloaded(noteListItems);
    }

    public interface OnNotesDownloadListener {
        void notesDownloaded(List<NoteListItem> noteListItems);
    }
}
<file_sep>package oo.max.noteslistexample.apiclient;

import android.widget.TextView;

import oo.max.noteslistexample.model.NotesListResponse;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Query;

public interface NotesApiClient {

    @GET("/plugin/notes.list")
    Call<NotesListResponse> getNotes();

    @GET("/plugin/notes.list")
    Call<NoteDetailRespons> getNoteDatails(@Query("id")String id);

TextView=(TextView) final
    class NoteDetailRespons {
    }
}<file_sep>package oo.max.noteslistexample.list;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;

import oo.max.noteslistexample.R;
import oo.max.noteslistexample.model.NoteListItem;

public class NotesListAdapter extends RecyclerView.Adapter<NotesListAdapter.NotesItemViewHolder> {

    private final Context context;
    private final List<NoteListItem> noteListItems;
    private final LayoutInflater layoutInflater;
    private final OnNoteClikedListner onNoteClikedListner;


    public NotesListAdapter(Context context, List<NoteListItem> noteListItems, OnNoteClikedListner onNoteClikedListner) {
        this.context = context;
        this.noteListItems = noteListItems;
        layoutInflater = LayoutInflater.from(context);
        this.onNoteClikedListner = onNoteClikedListner;
    }

    @Override
    public NotesItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = layoutInflater.inflate(R.layout.notes_list_item, parent, false);
        return new NotesItemViewHolder(view);
    }

    @Override
    public void onBindViewHolder(NotesItemViewHolder holder, int position) {
        NoteListItem noteListItem = noteListItems.get(position);

        holder.noteNameText.setText(noteListItem.getName());
        holder.noteListItem = noteListItem;
    }

    @Override
    public int getItemCount() {
        return noteListItems.size();
    }

    public static class NotesItemViewHolder extends RecyclerView.ViewHolder {

        TextView noteNameText;
        NoteListItem noteListItem;

        public NotesItemViewHolder(View itemView, final OnNoteClikedListner onNoteClikedListner) {
            super(itemView);
            noteNameText = (TextView) itemView.findViewById(R.id.note_name);
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    onNoteClikedListner.noteCliked(noteListItem);

                }
            });
        }

        public NotesItemViewHolder(View view) {
            super(view);
        }
    }
    public interface OnNoteClikedListner {
        void noteCliked(NoteListItem noteListItem);
    }
}
