<commit_before>package com.vinnypalumbo.popularmovies;

import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
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.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.vinnypalumbo.popularmovies.data.MovieContract;

/**
 * Created by Vincent on 2016-01-21.
 */

public class DetailActivityFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {

    private static final String LOG_TAG = DetailActivityFragment.class.getSimpleName();
    private String mMovie;

    private static final int DETAIL_LOADER = 0;

    private static final String[] MOVIE_COLUMNS = {
            MovieContract.MovieEntry._ID,
            MovieContract.MovieEntry.COLUMN_MOVIE_ID,
            MovieContract.MovieEntry.COLUMN_TITLE,
            MovieContract.MovieEntry.COLUMN_POSTER,
            MovieContract.MovieEntry.COLUMN_PLOT,
            MovieContract.MovieEntry.COLUMN_RATING,
            MovieContract.MovieEntry.COLUMN_DATE
    };

    // these constants correspond to the projection defined above, and must change if the
    // projection changes
    static final int COL_ID = 0;
    static final int COL_MOVIE_ID = 1;
    static final int COL_MOVIE_TITLE = 2;
    static final int COL_MOVIE_POSTER = 3;
    static final int COL_MOVIE_PLOT = 4;
    static final int COL_MOVIE_RATING = 5;
    static final int COL_MOVIE_DATE = 6;

    public DetailActivityFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
//      final String IMAGE_BASE_URL = "http://image.tmdb.org/t/p/w342/";

//            String posterStr = intent.getStringExtra("poster");
//            ImageView posterImageView = (ImageView) rootView.findViewById(R.id.detail_poster);
//            Picasso.with(getContext()).load(IMAGE_BASE_URL + posterStr).into(posterImageView);

        return inflater.inflate(R.layout.fragment_detail, container, false);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        getLoaderManager().initLoader(DETAIL_LOADER, null, this);
        super.onActivityCreated(savedInstanceState);
    }

    @Override
    public Loader<Cursor> onCreateLoader(int id, Bundle args) {
        Log.v(LOG_TAG, "In onCreateLoader");
        Intent intent = getActivity().getIntent();
        if (intent == null) {
            return null;
        }

        // Now create and return a CursorLoader that will take care of
        // creating a Cursor for the data being displayed.
        return new CursorLoader(
                getActivity(),
                intent.getData(),
                MOVIE_COLUMNS,
                null,
                null,
                null
        );
    }

    @Override
    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
        Log.v(LOG_TAG, "In onLoadFinished");
        if (!data.moveToFirst()) { return; }

        String movieId = Utility.formatMovieId(
                data.getInt(COL_MOVIE_ID));

        String title = data.getString(COL_MOVIE_TITLE);

        String poster = data.getString(COL_MOVIE_POSTER);

        String plot = data.getString(COL_MOVIE_PLOT);

        String rating = Utility.formatVoteAverage(getActivity(),
                data.getDouble(COL_MOVIE_RATING));

        String year = Utility.formatReleaseDate(
                data.getInt(COL_MOVIE_DATE));

        mMovie = String.format("%s \n %s \n %s \n %s \n %s \n %s ", movieId, title, poster, plot, rating, year);

        TextView detailTextView = (TextView)getView().findViewById(R.id.detail_plot);
        detailTextView.setText(mMovie);
    }

    @Override
    public void onLoaderReset(Loader<Cursor> loader) { }
}<commit_msg>Feed the data to the DetailFragment views with the cursor<commit_after>package com.vinnypalumbo.popularmovies;

import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
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.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;
import com.vinnypalumbo.popularmovies.data.MovieContract;

/**
 * Created by Vincent on 2016-01-21.
 */

public class DetailActivityFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {

    private static final String LOG_TAG = DetailActivityFragment.class.getSimpleName();

    private static final int DETAIL_LOADER = 0;

    private static final String[] DETAIL_COLUMNS = {
            MovieContract.MovieEntry._ID,
            MovieContract.MovieEntry.COLUMN_MOVIE_ID,
            MovieContract.MovieEntry.COLUMN_TITLE,
            MovieContract.MovieEntry.COLUMN_POSTER,
            MovieContract.MovieEntry.COLUMN_PLOT,
            MovieContract.MovieEntry.COLUMN_RATING,
            MovieContract.MovieEntry.COLUMN_DATE
    };

    // these constants correspond to the projection defined above, and must change if the
    // projection changes
    static final int COL_ID = 0;
    static final int COL_MOVIE_ID = 1;
    static final int COL_MOVIE_TITLE = 2;
    static final int COL_MOVIE_POSTER = 3;
    static final int COL_MOVIE_PLOT = 4;
    static final int COL_MOVIE_RATING = 5;
    static final int COL_MOVIE_DATE = 6;

    private TextView mTitleView;
    private ImageView mPosterView;
    private TextView mPlotView;
    private TextView mRatingView;
    private TextView mYearView;

    public DetailActivityFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_detail, container, false);

        mTitleView = (TextView) rootView.findViewById(R.id.detail_title);
        mPosterView = (ImageView) rootView.findViewById(R.id.detail_poster);
        mPlotView = (TextView) rootView.findViewById(R.id.detail_plot);
        mRatingView = (TextView) rootView.findViewById(R.id.detail_rating);
        mYearView = (TextView) rootView.findViewById(R.id.detail_year);

        return rootView;
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        getLoaderManager().initLoader(DETAIL_LOADER, null, this);
        super.onActivityCreated(savedInstanceState);
    }

    @Override
    public Loader<Cursor> onCreateLoader(int id, Bundle args) {
        Log.v(LOG_TAG, "In onCreateLoader");
        Intent intent = getActivity().getIntent();
        if (intent == null) {
            return null;
        }

        // Now create and return a CursorLoader that will take care of
        // creating a Cursor for the data being displayed.
        return new CursorLoader(
                getActivity(),
                intent.getData(),
                DETAIL_COLUMNS,
                null,
                null,
                null
        );
    }

    @Override
    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {

        final String IMAGE_BASE_URL = "http://image.tmdb.org/t/p/w342/";

        if (data != null && data.moveToFirst()) {
            // Read movie ID from cursor
            int movieId = data.getInt(COL_MOVIE_ID);

            // Read title from cursor and update view
            String title = data.getString(COL_MOVIE_TITLE);
            mTitleView.setText(title);

            // Read poster path from cursor and update view using Picasso
            String poster = data.getString(COL_MOVIE_POSTER);
            Picasso.with(getContext()).load(IMAGE_BASE_URL + poster).into(mPosterView);

            // Read plot synopsis from cursor and update view
            String plot = data.getString(COL_MOVIE_PLOT);
            mPlotView.setText(plot);

            // Read rating from cursor and update view
            String rating = Utility.formatVoteAverage(getActivity(),
                    data.getDouble(COL_MOVIE_RATING));
            mRatingView.setText(rating);

            // Read release date from cursor and update view
            String year = Utility.formatReleaseDate(
                    data.getInt(COL_MOVIE_DATE));
            mYearView.setText(year);
        }
    }

    @Override
    public void onLoaderReset(Loader<Cursor> loader) { }
}
{'fraction_non_alphanumeric': 0.08558404558404559, 'fraction_numerical': 0.005242165242165242, 'mean_word_length': 2.699831365935919, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3230814', 'n_tokens_mistral': 2603, 'n_tokens_neox': 2405, 'n_words': 582}