@@ -0,0 +1,2278 @@
+package eu.redray.trevie;%0A%0Aimport android.content.Context;%0Aimport android.database.Cursor;%0Aimport android.view.LayoutInflater;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0Aimport android.widget.CursorAdapter;%0Aimport android.widget.ImageView;%0Aimport android.widget.TextView;%0A%0Aimport com.squareup.picasso.Picasso;%0A%0A/**%0A * Creates custom CursorAdapter to display records from favourites database%0A */%0Apublic class FavouritesGridAdapter extends CursorAdapter %7B%0A    public FavouritesGridAdapter(Context context, Cursor c, int flags) %7B%0A        super(context, c, flags);%0A    %7D%0A%0A    @Override%0A    public View newView(Context context, Cursor cursor, ViewGroup parent) %7B%0A        View view = LayoutInflater.from(context).inflate(R.layout.movie_grid_item, parent, false);%0A        ViewHolder viewHolder = new ViewHolder(view);%0A        view.setTag(viewHolder);%0A%0A        return view;%0A    %7D%0A%0A    @Override%0A    public void bindView(View view, Context context, Cursor cursor) %7B%0A        ViewHolder viewHolder = (ViewHolder) view.getTag();%0A%0A        // Read title from cursor%0A        String title = cursor.getString(MovieGridFragment.COL_MOVIE_TITLE);%0A        viewHolder.titleView.setText(title);%0A        viewHolder.titleView.setSelected(true);%0A%0A        // Read release year from cursor%0A        String year = cursor.getString(MovieGridFragment.COL_MOVIE_RELEASE_DATE);%0A        viewHolder.yearView.setText(year.substring(0, 4));%0A%0A        // Read poster path%0A        Picasso.with(context).load(cursor.getString(MovieGridFragment.COL_MOVIE_POSTER_PATH)).%0A                placeholder(R.drawable.temp).error(R.drawable.error).fit().into(viewHolder.posterView);%0A    %7D%0A%0A    /**%0A     * Holds all the views used to display data in movie grid item.%0A     */%0A    private static class ViewHolder %7B%0A        ImageView posterView;%0A        ImageView favouriteIconView;%0A        TextView titleView;%0A        TextView yearView;%0A%0A        public ViewHolder(View view) %7B%0A            posterView = (ImageView) view.findViewById(R.id.grid_movie_poster);%0A            favouriteIconView = (ImageView) view.findViewById(R.id.grid_movie_favourite);%0A            titleView = (TextView) view.findViewById(R.id.grid_movie_title);%0A            yearView = (TextView) view.findViewById(R.id.grid_movie_genre);%0A        %7D%0A    %7D%0A%7D%0A

Add custom CursorAdapter to display records from favourites database