<commit_before>package com.jclin.popularmovies.fragments;

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.Loader;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.jclin.popularmovies.R;
import com.jclin.popularmovies.adapters.ReviewAdapter;
import com.jclin.popularmovies.contentProviders.ReviewsContract;
import com.jclin.popularmovies.loaders.LoaderFactory;
import com.jclin.popularmovies.loaders.LoaderIDs;

import butterknife.Bind;
import butterknife.ButterKnife;

public final class MovieReviewsFragment
    extends Fragment
    implements LoaderManager.LoaderCallbacks<Cursor>
{
    protected @Bind(R.id.listView_reviews) ListView _reviewsListView;
    protected @Bind(R.id.progressBar_reviews_loading) ProgressBar _reviewsLoadingProgressBar;
    protected @Bind(R.id.textView_no_reviews) TextView _noReviewsTextView;

    private long _movieId;
    private CursorAdapter _reviewsAdapter;

    public MovieReviewsFragment()
    {
    }

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

        ButterKnife.bind(this, rootView);

        _movieId = getMovieIdFromIntent(savedInstanceState);
        initReviewsLoaderFor(_movieId);

        _reviewsAdapter = new ReviewAdapter(getActivity(), null, 0);
        _reviewsListView.setAdapter(_reviewsAdapter);

        return rootView;
    }

    @Override
    public Loader<Cursor> onCreateLoader(int id, Bundle args)
    {
        return LoaderFactory.createFor(LoaderIDs.parse(id), getActivity(), args);
    }

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

        _reviewsAdapter.swapCursor(data);

        _reviewsListView.setEmptyView(_noReviewsTextView);
    }

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

    @Override
    public void onSaveInstanceState(Bundle outState)
    {
        super.onSaveInstanceState(outState);

        outState.putLong(ReviewsContract.MOVIE_ID_BUNDLE_KEY, _movieId);
    }

    private long getMovieIdFromIntent(Bundle savedInstanceState)
    {
        if (savedInstanceState == null)
        {
            return getActivity()
                .getIntent()
                .getLongExtra(ReviewsContract.MOVIE_ID_BUNDLE_KEY, -1);
        }

        return savedInstanceState.getLong(ReviewsContract.MOVIE_ID_BUNDLE_KEY);
    }

    private void initReviewsLoaderFor(long movieId)
    {
        showLoadingProgress();

        Bundle movieIdArgs = new Bundle();
        movieIdArgs.putLong(ReviewsContract.MOVIE_ID_BUNDLE_KEY, movieId);

        getActivity().getSupportLoaderManager().initLoader(
            LoaderIDs.MovieReviews.id(),
            movieIdArgs,
            this
            );
    }

    private void showLoadingProgress()<commit_msg>Missed some cleanup<commit_after>package com.jclin.popularmovies.fragments;

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.Loader;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.jclin.popularmovies.R;
import com.jclin.popularmovies.adapters.ReviewAdapter;
import com.jclin.popularmovies.contentProviders.ReviewsContract;
import com.jclin.popularmovies.loaders.LoaderFactory;
import com.jclin.popularmovies.loaders.LoaderIDs;

import butterknife.Bind;
import butterknife.ButterKnife;

public final class MovieReviewsFragment
    extends Fragment
    implements LoaderManager.LoaderCallbacks<Cursor>
{
    protected @Bind(R.id.listView_reviews) ListView _reviewsListView;
    protected @Bind(R.id.progressBar_reviews_loading) ProgressBar _reviewsLoadingProgressBar;
    protected @Bind(R.id.textView_no_reviews) TextView _noReviewsTextView;

    private long _movieId;
    private CursorAdapter _reviewsAdapter;

    public MovieReviewsFragment()
    {
    }

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

        ButterKnife.bind(this, rootView);

        _movieId = getMovieIdFromIntent(savedInstanceState);
        initReviewsLoaderFor(_movieId);

        _reviewsAdapter = new ReviewAdapter(getActivity(), null, 0);
        _reviewsListView.setAdapter(_reviewsAdapter);

        return rootView;
    }

    @Override
    public Loader<Cursor> onCreateLoader(int id, Bundle args)
    {
        return LoaderFactory.createFor(LoaderIDs.parse(id), getActivity(), args);
    }

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

        _reviewsAdapter.swapCursor(data);

        _reviewsListView.setEmptyView(_noReviewsTextView);
    }

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

    @Override
    public void onSaveInstanceState(Bundle outState)
    {
        super.onSaveInstanceState(outState);

        outState.putLong(ReviewsContract.MOVIE_ID_BUNDLE_KEY, _movieId);
    }

    private long getMovieIdFromIntent(Bundle savedInstanceState)
    {
        if (savedInstanceState == null)
        {
            return getActivity()
                .getIntent()
                .getLongExtra(ReviewsContract.MOVIE_ID_BUNDLE_KEY, -1);
        }

        return savedInstanceState.getLong(ReviewsContract.MOVIE_ID_BUNDLE_KEY);
    }

    private void initReviewsLoaderFor(long movieId)
    {
        showLoadingProgress();

        Bundle movieIdArgs = new Bundle();
        movieIdArgs.putLong(ReviewsContract.MOVIE_ID_BUNDLE_KEY, movieId);

        getLoaderManager().initLoader(
            LoaderIDs.MovieReviews.id(),
            movieIdArgs,
            this
            );
    }

    private void showLoadingProgress()
{'fraction_non_alphanumeric': 0.08237811401497784, 'fraction_numerical': 0.0015283509093687911, 'mean_word_length': 3.5890603085554, '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': '5566007', 'n_tokens_mistral': 1994, 'n_tokens_neox': 1861, 'n_words': 325}