<commit_before>package fr.masciulli.drinks.activity;

import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v13.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;

import java.util.Locale;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.Optional;
import fr.masciulli.drinks.R;
import fr.masciulli.drinks.fragment.AboutDialogFragment;
import fr.masciulli.drinks.fragment.DrinksListFragment;
import fr.masciulli.drinks.fragment.LiquorsListFragment;
import fr.masciulli.drinks.view.SlidingTabLayout;

public class MainActivity extends ToolbarActivity {

    private DrinksListFragment mDrinksFragment;
    private LiquorsListFragment mLiquorsFragment;

    /**
     * The {@link android.support.v4.view.PagerAdapter} that will provide
     * fragments for each of the sections. We use a
     * {@link android.support.v4.app.FragmentPagerAdapter} derivative, which
     * will keep every loaded fragment in memory. If this becomes too memory
     * intensive, it may be best to switch to a
     * {@link android.support.v4.app.FragmentStatePagerAdapter}.
     */
    SectionsPagerAdapter mSectionsPagerAdapter;

    /**
     * The {@link ViewPager} that will host the section contents.
     */
    @Optional
    @InjectView(R.id.pager)
    ViewPager mViewPager;

    @Optional
    @InjectView(R.id.tabs)
    SlidingTabLayout mSlidingTabLayout;

    private MenuItem mRetryAction;
    private boolean mDualPane;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.inject(this);

        mDualPane = getResources().getBoolean(R.bool.dualpane);

        if (mDualPane && savedInstanceState != null) {
            mDrinksFragment = (DrinksListFragment) getFragmentManager().findFragmentById(R.id.drinks_list_container);
            mLiquorsFragment = (LiquorsListFragment) getFragmentManager().findFragmentById(R.id.liquors_list_container);
        } else {
            mDrinksFragment = new DrinksListFragment();
            mLiquorsFragment = new LiquorsListFragment();
        }

        if (mDualPane) {
            if (savedInstanceState == null) {
                getFragmentManager().beginTransaction().
                        add(R.id.drinks_list_container, mDrinksFragment).
                        add(R.id.liquors_list_container, mLiquorsFragment).
                        commit();
            }
        } else {
            mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
            mViewPager.setAdapter(mSectionsPagerAdapter);

            mSlidingTabLayout.setOnPageChangeListener(mSectionsPagerAdapter);
            mSlidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.white));
            mSlidingTabLayout.setDividerColors(getResources().getColor(android.R.color.transparent));
            mSlidingTabLayout.setCustomTabViewTextColor(getResources().getColor(R.color.white));
            mSlidingTabLayout.setViewPager(mViewPager);
        }
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_main;
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {<commit_msg>Hot fix app compat alpha bug<commit_after>package fr.masciulli.drinks.activity;

import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v13.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;

import java.util.Locale;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.Optional;
import fr.masciulli.drinks.BuildConfig;
import fr.masciulli.drinks.R;
import fr.masciulli.drinks.fragment.AboutDialogFragment;
import fr.masciulli.drinks.fragment.DrinksListFragment;
import fr.masciulli.drinks.fragment.LiquorsListFragment;
import fr.masciulli.drinks.view.SlidingTabLayout;

public class MainActivity extends ToolbarActivity {

    private DrinksListFragment mDrinksFragment;
    private LiquorsListFragment mLiquorsFragment;

    /**
     * The {@link android.support.v4.view.PagerAdapter} that will provide
     * fragments for each of the sections. We use a
     * {@link android.support.v4.app.FragmentPagerAdapter} derivative, which
     * will keep every loaded fragment in memory. If this becomes too memory
     * intensive, it may be best to switch to a
     * {@link android.support.v4.app.FragmentStatePagerAdapter}.
     */
    SectionsPagerAdapter mSectionsPagerAdapter;

    /**
     * The {@link ViewPager} that will host the section contents.
     */
    @Optional
    @InjectView(R.id.pager)
    ViewPager mViewPager;

    @Optional
    @InjectView(R.id.tabs)
    SlidingTabLayout mSlidingTabLayout;

    private MenuItem mRetryAction;
    private boolean mDualPane;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ButterKnife.inject(this);

        mDualPane = getResources().getBoolean(R.bool.dualpane);

        if (mDualPane && savedInstanceState != null) {
            mDrinksFragment = (DrinksListFragment) getFragmentManager().findFragmentById(R.id.drinks_list_container);
            mLiquorsFragment = (LiquorsListFragment) getFragmentManager().findFragmentById(R.id.liquors_list_container);
        } else {
            mDrinksFragment = new DrinksListFragment();
            mLiquorsFragment = new LiquorsListFragment();
        }

        if (mDualPane) {
            if (savedInstanceState == null) {
                getFragmentManager().beginTransaction().
                        add(R.id.drinks_list_container, mDrinksFragment).
                        add(R.id.liquors_list_container, mLiquorsFragment).
                        commit();
            }
        } else {
            mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
            mViewPager.setAdapter(mSectionsPagerAdapter);

            mSlidingTabLayout.setOnPageChangeListener(mSectionsPagerAdapter);
            mSlidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.white));
            mSlidingTabLayout.setDividerColors(getResources().getColor(android.R.color.transparent));
            mSlidingTabLayout.setCustomTabViewTextColor(getResources().getColor(R.color.white));
            mSlidingTabLayout.setViewPager(mViewPager);
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        if (Build.VERSION.SDK_INT >= 21) {
            // hack to fix bug in appcompat
            getToolbar().getBackground().setAlpha(255);
        }
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_main;
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
{'fraction_non_alphanumeric': 0.08901462876069556, 'fraction_numerical': 0.002622136351090257, 'mean_word_length': 3.2629411764705885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '3523065', 'n_tokens_mistral': 2120, 'n_tokens_neox': 2071, 'n_words': 380}