package com.tonicartos.superslimdbexample;

import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;


/**
 * A placeholder fragment containing a simple view.
 */
public class ContentFragment extends Fragment {

    private static final int LOADER = 0;

    private static final Uri URI = Uri
            .parse("content://com.tonicartos.superslimdbexample.provider/all");

    private LoaderManager.LoaderCallbacks<Cursor> mLoaderCallbacks
            = new LoaderManager.LoaderCallbacks<Cursor>() {

        @Override
        public Loader<Cursor> onCreateLoader(int id, Bundle args) {
            return new CursorLoader(getActivity(), URI, null, null, null, null);
        }

        @Override
        public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
            mAdapter.swapCursor(data);
        }

        @Override
        public void onLoaderReset(Loader<Cursor> loader) {
            mAdapter.swapCursor(null);
        }
    };

    Adapter mAdapter;

    public ContentFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_main, container, false);
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        getLoaderManager().initLoader(LOADER, null, mLoaderCallbacks);
        mAdapter = new Adapter();

        RecyclerView rv = (RecyclerView) view.findViewById(R.id.recycler_view);
        rv.setLayoutManager(new LinearLayoutManager(getActivity()));
        rv.setAdapter(mAdapter);

//        SuperSLiM.Helper sslmHelper = new SuperSLiM.Helper(getActivity())
//                .setAdapter(mAdapter)
//                .setRecyclerView((RecyclerView) view.findViewById(R.id.recycler_view))
//                .init();
//
//        sslmHelper.getRecyclerView();
//        sslmHelper.getAdapter();
//        sslmHelper.getLayoutManager();
    }
}

@@ -1829,19 +1829,22 @@
 nager().
-ini
+restar
 tLoader(
@@ -1876,16 +1876,17 @@
 backs);%0A
+%0A
         

Fix double load on orientation change.