<commit_before>package com.maxiee.heartbeat.ui;

import android.content.Context;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ImageSpan;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import com.maxiee.heartbeat.R;
import com.maxiee.heartbeat.support.CrashHandler;
import com.maxiee.heartbeat.ui.common.BaseActivity;
import com.maxiee.heartbeat.ui.fragments.EventListFragment;
import com.maxiee.heartbeat.ui.fragments.EventTodayFragment;
import com.maxiee.heartbeat.ui.fragments.LabelCloudFragment;
import com.maxiee.heartbeat.ui.fragments.StatisticsFragment;
import com.quinny898.library.persistentsearch.SearchBox;
import com.quinny898.library.persistentsearch.SearchResult;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends BaseActivity {
    private static final String TAG = MainActivity.class.getSimpleName();
    private static final int SEARCH_HISTORY_SIZE = 5;

    private Toolbar mToolbar;
    private FloatingActionButton mFab;
    private ViewPagerAdapter mViewPagerAdapter;
    private SearchBox mSearchBox;
    private ArrayList<String> mSearchHistory;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        CrashHandler.register(this);

        mToolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(mToolbar);
        setTitle("");

        final ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
        setupViewPager(viewPager);
        TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
        tabLayout.setupWithViewPager(viewPager);
        tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {

            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                viewPager.setCurrentItem(tab.getPosition());
                setTitle(mViewPagerAdapter.getFragmentTitle(tab.getPosition()));
                tab.setContentDescription(
                        mViewPagerAdapter.getPageIcon(
                                tab.getPosition(),
                                getThemeAccentColor(MainActivity.this)));
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {
                tab.setContentDescription(
                        mViewPagerAdapter.getPageIcon(
                                tab.getPosition(),
                                getResources().getColor(R.color.tab_white_trans)
                        )
                );
            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {
            }
        });
        // init TabLayout
        setTitle(mViewPagerAdapter.getFragmentTitle(0));
        tabLayout.getTabAt(0).setContentDescription(
                mViewPagerAdapter.getPageIcon(
                        0,
                        getThemeAccentColor(this)
                )
        );

        mSearchBox = (SearchBox) findViewById(R.id.searchbox);

        mFab = (FloatingActionButton) findViewById(R.id.fab);
        mFab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent();
                i.setAction(Intent.ACTION_MAIN);
                i.setClass(MainActivity.this, AddEventActivity.class);
                startActivityForResult(i, AddEventActivity.ADD_EVENT_REQUEST);
            }
        });

        mSearchHistory = new ArrayList<>();
        mSearchBox.setLogoText(getString(R.string.search_hint));
        mSearchBox.setSearchListener(new SearchBox.SearchListener() {
            @Override
            public void onSearchOpened() {

            }

            @Override
            public void onSearchCleared() {

            }

            @Override
            public void onSearchClosed() {
                mSearchBox.hideCircularly(MainActivity.this);
            }

            @Override
            public void onSearchTermChanged() {

            }<commit_msg>MainActivity: remove unused code.<commit_after>package com.maxiee.heartbeat.ui;

import android.content.Context;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.DrawableRes;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ImageSpan;
import android.util.TypedValue;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import com.maxiee.heartbeat.R;
import com.maxiee.heartbeat.support.CrashHandler;
import com.maxiee.heartbeat.ui.common.BaseActivity;
import com.maxiee.heartbeat.ui.fragments.EventListFragment;
import com.maxiee.heartbeat.ui.fragments.EventTodayFragment;
import com.maxiee.heartbeat.ui.fragments.LabelCloudFragment;
import com.maxiee.heartbeat.ui.fragments.StatisticsFragment;
import com.quinny898.library.persistentsearch.SearchBox;
import com.quinny898.library.persistentsearch.SearchResult;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

public class MainActivity extends BaseActivity {
    private static final String TAG = MainActivity.class.getSimpleName();
    private static final int SEARCH_HISTORY_SIZE = 5;

    @Bind(R.id.toolbar)     Toolbar mToolbar;
    @Bind(R.id.fab)         FloatingActionButton mFab;
    @Bind(R.id.searchbox)   SearchBox mSearchBox;

    private ViewPagerAdapter mViewPagerAdapter;
    private ArrayList<String> mSearchHistory;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        CrashHandler.register(this);

        setSupportActionBar(mToolbar);
        setTitle("");

        final ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
        setupViewPager(viewPager);
        TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
        tabLayout.setupWithViewPager(viewPager);
        tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {

            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                viewPager.setCurrentItem(tab.getPosition());
                setTitle(mViewPagerAdapter.getFragmentTitle(tab.getPosition()));
                tab.setContentDescription(
                        mViewPagerAdapter.getPageIcon(
                                tab.getPosition(),
                                getThemeAccentColor(MainActivity.this)));
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {
                tab.setContentDescription(
                        mViewPagerAdapter.getPageIcon(
                                tab.getPosition(),
                                getResources().getColor(R.color.tab_white_trans)
                        )
                );
            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {
            }
        });
        // init TabLayout
        setTitle(mViewPagerAdapter.getFragmentTitle(0));
        tabLayout.getTabAt(0).setContentDescription(
                mViewPagerAdapter.getPageIcon(
                        0,
                        getThemeAccentColor(this)
                )
        );

        mFab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent();
                i.setAction(Intent.ACTION_MAIN);
                i.setClass(MainActivity.this, AddEventActivity.class);
                startActivity(i);
            }
        });

        mSearchHistory = new ArrayList<>();
        mSearchBox.setLogoText(getString(R.string.search_hint));
        mSearchBox.setSearchListener(new SearchBox.SearchListener() {
            @Override
            public void onSearchOpened() {

            }

            @Override
            public void onSearchCleared() {

            }

            @Override
            public void onSearchClosed() {
                mSearchBox.hideCircularly(MainActivity.this);
            }

            @Override
            public void onSearchTermChanged() {

            }
{'fraction_non_alphanumeric': 0.08656495020131384, 'fraction_numerical': 0.0033905488450943, 'mean_word_length': 2.4436337103246992, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4439247', 'n_tokens_mistral': 2588, 'n_tokens_neox': 2483, 'n_words': 400}