package com.kennyc.adapters;

import android.content.Context;
import android.database.Cursor;
import android.support.annotation.LayoutRes;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by kcampagna on 3/16/16.
 */
public abstract class CursorRecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    protected final String TAG = getClass().getSimpleName();

    private LayoutInflater mInflater;

    @Nullable
    private Cursor mCursor;

    public CursorRecyclerAdapter(@NonNull Context context, @Nullable Cursor cursor) {
        mInflater = LayoutInflater.from(context);
        mCursor = cursor;
    }

    @Override
    public int getItemCount() {
        return mCursor != null ? mCursor.getCount() : 0;
    }

    /**
     * Replaces the cursor of the adapter. Null is allowed
     *
     * @param newCursor
     */
    public void swapCursor(Cursor newCursor) {
        if (newCursor == mCursor) return;

        Cursor oldCursor = mCursor;
        mCursor = newCursor;
        if (oldCursor != null) oldCursor.close();
    }

    public boolean isEmpty() {
        return getItemCount() <= 0;
    }

    /**
     * Moves the cursor to the given position
     *
     * @param position
     * @return If the cursor was successfully moved to the desired position
     */
    protected boolean moveToPosition(int position) {
        if (mCursor != null) {
            return mCursor.moveToPosition(position);
        }

        return false;
    }

    /**
     * Inflates a view from the given layout resource
     *
     * @param layoutId Layout resource to inflate
     * @param parent   Optional parent view
     * @return
     */
    protected View inflateView(@LayoutRes int layoutId, @Nullable ViewGroup parent) {
        if (parent == null) {
            return mInflater.inflate(layoutId, null);
        }

        return mInflater.inflate(layoutId, parent, false);
    }
}

@@ -1242,24 +1242,101 @@
 e();%0A    %7D%0A%0A
+    /**%0A     * Returns if the adapter is empty%0A     *%0A     * @return%0A     */%0A
     public b
@@ -2173,11 +2173,208 @@
 );%0A    %7D
+%0A%0A    /**%0A     * Returns the %7B@link Cursor%7D currently in use by the adapter. May be null%0A     *%0A     * @return%0A     */%0A    @Nullable%0A    protected Cursor getCursor() %7B%0A        return mCursor;%0A    %7D
 %0A%7D%0A

Add getCursor to CursorRecyclerAdapter