<commit_before>package pl.jakubchmura.suchary.android.search;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import pl.jakubchmura.suchary.android.JokesBaseFragment;
import pl.jakubchmura.suchary.android.R;
import pl.jakubchmura.suchary.android.sql.JokeDbHelper;
import pl.jakubchmura.suchary.android.util.Analytics;

/**
 * A placeholder fragment containing a simple view.
 */
public class SearchFragment extends JokesBaseFragment<SearchActivity> {

    private static final String TAG = "SearchFragment";
    private String mQuery;
    private boolean mStar;

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

        Bundle arguments = getArguments();
        mQuery = arguments.getString("query");
        mStar = arguments.getBoolean("key");

        Analytics.setSearchQuery(getActivity(), mQuery);

        View createdView = createView(false);
        getJokes();

        return createdView;
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        setRetainInstance(true);
    }

    @Override
    protected void hideProgress() {
        mProgress.setVisibility(View.GONE);
        mCardListView.setVisibility(View.VISIBLE);<commit_msg>Don't recreate the search fragment on orientation change.<commit_after>package pl.jakubchmura.suchary.android.search;

import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import pl.jakubchmura.suchary.android.JokesBaseFragment;
import pl.jakubchmura.suchary.android.R;
import pl.jakubchmura.suchary.android.sql.JokeDbHelper;
import pl.jakubchmura.suchary.android.util.Analytics;

/**
 * A placeholder fragment containing a simple view.
 */
public class SearchFragment extends JokesBaseFragment<SearchActivity> {

    private static final String TAG = "SearchFragment";
    private String mQuery;
    private boolean mStar;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        boolean saved = true;
        if (mRootView == null) {
            mRootView = inflater.inflate(R.layout.fragment_search, container, false);
            saved = false;
        }

        Bundle arguments = getArguments();
        mQuery = arguments.getString("query");
        mStar = arguments.getBoolean("key");

        Analytics.setSearchQuery(getActivity(), mQuery);

        View createdView = createView(saved);
        if (!saved) {
            getJokes();
        }

        return createdView;
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        setRetainInstance(true);
    }

    @Override
    protected void hideProgress() {
        mProgress.setVisibility(View.GONE);
        mCardListView.setVisibility(View.VISIBLE);
{'fraction_non_alphanumeric': 0.09207240948813983, 'fraction_numerical': 0.0, 'mean_word_length': 3.28475935828877, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3112807', 'n_tokens_mistral': 922, 'n_tokens_neox': 881, 'n_words': 190}