<commit_before>package sun.bob.mcalendar.activities;

import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;

import com.readystatesoftware.systembartint.SystemBarTintManager;

import java.util.ArrayList;

import sun.bob.mcalendar.App;
import sun.bob.mcalendar.R;
import sun.bob.mcalendar.beans.TaskBean;
import sun.bob.mcalendar.content.CalendarResolver;
import sun.bob.mcalendar.fragments.FragmentCalendar;
import sun.bob.mcalendar.fragments.FragmentSetting;
import sun.bob.mcalendar.fragments.FragmentTask;
import sun.bob.mcalendarview.utils.CalendarUtil;
import sun.bob.mcalendarview.utils.CurrentCalendar;
import sun.bob.mcalendarview.vo.MarkedDates;
import sun.bob.tabbar.OnTabClickedListener;
import sun.bob.tabbar.TabBar;

public class MainActivity extends AppCompatActivity {

    private Fragment currentFragment;
    private ArrayList<Fragment> fragments;
    public Toolbar toolbar;
    private FloatingActionButton fab;

    private FragmentCalendar fragmentCalendar;
    private FragmentTask fragmentTask;
    private FragmentSetting fragmentSetting;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (App.appContext == null){
            App.appContext = getApplicationContext();
        }

        setContentView(R.layout.activity_main);
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setTitle(new StringBuilder().append("").append(CurrentCalendar.getCurrentDateData().getYear()).append(" - ").append(CurrentCalendar.getCurrentDateData().getMonth()).toString());

        setSupportActionBar(toolbar);

        fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent newTaskIntent = new Intent(MainActivity.this, TaskActivity.class);
                newTaskIntent.putExtra("year", CurrentCalendar.getCurrentDateData().getYear());
                newTaskIntent.putExtra("month", CurrentCalendar.getCurrentDateData().getMonth());
                newTaskIntent.putExtra("day", CurrentCalendar.getCurrentDateData().getDay());
                startActivity(newTaskIntent);
            }
        });
        initUI();
        populateCalendar();
    }

    private void initUI(){
        ((TabBar) findViewById(R.id.id_tabbar))
                .addTab(R.drawable.calendar, R.drawable.calendar_filled, "Calendar", Color.GRAY, Color.rgb(34, 145, 255))
                .addTab(R.drawable.checklist, R.drawable.checklist_filled, "CheckList", Color.GRAY, Color.rgb(34, 145, 255))
                .addTab(R.drawable.settings, R.drawable.settings_filled, "Settings", Color.GRAY, Color.rgb(34, 145, 255))
                .setOnTabClickedListener(new OnTabClickedAction());

        fragmentCalendar = new FragmentCalendar();
        fragmentTask = new FragmentTask();
        fragmentSetting = new FragmentSetting();
        fragments = new ArrayList<>();
        fragments.add(fragmentCalendar);
        fragments.add(fragmentTask);
        fragments.add(fragmentSetting);
        getSupportFragmentManager().beginTransaction().add(R.id.id_fragment_container, fragmentCalendar)
                .add(R.id.id_fragment_container, fragmentTask)
                .hide(fragmentTask)
                .add(R.id.id_fragment_container, fragmentSetting)
                .hide(fragmentSetting)
                .commit();
        currentFragment = fragmentCalendar;

        changeStatusBarColor();
    }

    private void populateCalendar(){
        for(TaskBean taskBean : CalendarResolver.getStaticInstance(this).getAllEvents()){
            MarkedDates.getInstance().add(taskBean.getStartDate());
        }
    }

    private void changeStatusBarColor(){
        if (Build.VERSION.SDK_INT > 18){
            Window window = getWindow();
            window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

            window.setFlags(
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            SystemBarTintManager tintManager = new SystemBarTintManager(this);
            tintManager.setStatusBarTintEnabled(true);
            tintManager.setNavigationBarTintEnabled(false);<commit_msg>Fix the awful navigation bar.<commit_after>package sun.bob.mcalendar.activities;

import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;
import android.view.WindowManager;

import com.readystatesoftware.systembartint.SystemBarTintManager;

import java.util.ArrayList;

import sun.bob.mcalendar.App;
import sun.bob.mcalendar.R;
import sun.bob.mcalendar.beans.TaskBean;
import sun.bob.mcalendar.content.CalendarResolver;
import sun.bob.mcalendar.fragments.FragmentCalendar;
import sun.bob.mcalendar.fragments.FragmentSetting;
import sun.bob.mcalendar.fragments.FragmentTask;
import sun.bob.mcalendarview.utils.CalendarUtil;
import sun.bob.mcalendarview.utils.CurrentCalendar;
import sun.bob.mcalendarview.vo.MarkedDates;
import sun.bob.tabbar.OnTabClickedListener;
import sun.bob.tabbar.TabBar;

public class MainActivity extends AppCompatActivity {

    private Fragment currentFragment;
    private ArrayList<Fragment> fragments;
    public Toolbar toolbar;
    private FloatingActionButton fab;

    private FragmentCalendar fragmentCalendar;
    private FragmentTask fragmentTask;
    private FragmentSetting fragmentSetting;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (App.appContext == null){
            App.appContext = getApplicationContext();
        }

        setContentView(R.layout.activity_main);
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setTitle(new StringBuilder().append("").append(CurrentCalendar.getCurrentDateData().getYear()).append(" - ").append(CurrentCalendar.getCurrentDateData().getMonth()).toString());

        setSupportActionBar(toolbar);

        fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent newTaskIntent = new Intent(MainActivity.this, TaskActivity.class);
                newTaskIntent.putExtra("year", CurrentCalendar.getCurrentDateData().getYear());
                newTaskIntent.putExtra("month", CurrentCalendar.getCurrentDateData().getMonth());
                newTaskIntent.putExtra("day", CurrentCalendar.getCurrentDateData().getDay());
                startActivity(newTaskIntent);
            }
        });
        initUI();
        populateCalendar();
    }

    private void initUI(){
        ((TabBar) findViewById(R.id.id_tabbar))
                .addTab(R.drawable.calendar, R.drawable.calendar_filled, "Calendar", Color.GRAY, Color.rgb(34, 145, 255))
                .addTab(R.drawable.checklist, R.drawable.checklist_filled, "CheckList", Color.GRAY, Color.rgb(34, 145, 255))
                .addTab(R.drawable.settings, R.drawable.settings_filled, "Settings", Color.GRAY, Color.rgb(34, 145, 255))
                .setOnTabClickedListener(new OnTabClickedAction());

        fragmentCalendar = new FragmentCalendar();
        fragmentTask = new FragmentTask();
        fragmentSetting = new FragmentSetting();
        fragments = new ArrayList<>();
        fragments.add(fragmentCalendar);
        fragments.add(fragmentTask);
        fragments.add(fragmentSetting);
        getSupportFragmentManager().beginTransaction().add(R.id.id_fragment_container, fragmentCalendar)
                .add(R.id.id_fragment_container, fragmentTask)
                .hide(fragmentTask)
                .add(R.id.id_fragment_container, fragmentSetting)
                .hide(fragmentSetting)
                .commit();
        currentFragment = fragmentCalendar;

        changeStatusBarColor();
    }

    private void populateCalendar(){
        for(TaskBean taskBean : CalendarResolver.getStaticInstance(this).getAllEvents()){
            MarkedDates.getInstance().add(taskBean.getStartDate());
        }
    }

    private void changeStatusBarColor(){
        if (Build.VERSION.SDK_INT > 18){
            Window window = getWindow();
            window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);

            SystemBarTintManager tintManager = new SystemBarTintManager(this);
            tintManager.setStatusBarTintEnabled(true);
            tintManager.setNavigationBarTintEnabled(false);
{'fraction_non_alphanumeric': 0.10276266220175806, 'fraction_numerical': 0.006069485140226036, 'mean_word_length': 3.3839449541284403, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '6986927', 'n_tokens_mistral': 2662, 'n_tokens_neox': 2499, 'n_words': 418}