<commit_before>package net.xisberto.work_schedule;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

import net.xisberto.work_schedule.database.Database;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.NavUtils;
import android.support.v4.view.ViewPager;
import android.util.Log;

import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.doomonafireball.betterpickers.calendardatepicker.CalendarDatePickerDialog;
import com.doomonafireball.betterpickers.calendardatepicker.CalendarDatePickerDialog.OnDateSetListener;
import com.viewpagerindicator.TabPageIndicator;

public class ViewHistoryActivity extends SherlockFragmentActivity implements
		OnDateSetListener {

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

		getSupportActionBar().setDisplayHomeAsUpEnabled(true);

		ViewPager view_pager = (ViewPager) findViewById(R.id.pager);
		TabPageIndicator pager_indicator = (TabPageIndicator) findViewById(R.id.pager_indicator);

		HistoryPagerAdapter pager_adapter = new HistoryPagerAdapter(
				getSupportFragmentManager());
		view_pager.setAdapter(pager_adapter);

		pager_indicator.setViewPager(view_pager);
		view_pager.setCurrentItem(HistoryPagerAdapter.SIZE);

	}

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

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getSupportMenuInflater().inflate(R.menu.activity_history, menu);
		return true;
	}

	@Override
	public boolean onPrepareOptionsMenu(Menu menu) {
		if (!BuildConfig.DEBUG) {
			menu.findItem(R.id.menu_fake_data).setVisible(false);
		}
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		if (item.getItemId() == android.R.id.home) {
			NavUtils.navigateUpFromSameTask(this);
			return true;
		}
		ViewPager view_pager;
		switch (item.getItemId()) {
		case R.id.menu_go_today:
			view_pager = (ViewPager) findViewById(R.id.pager);
			view_pager.setCurrentItem(HistoryPagerAdapter.SIZE);
			break;
		case R.id.menu_share:
			view_pager = (ViewPager) findViewById(R.id.pager);
			HistoryPagerAdapter adapter = (HistoryPagerAdapter) view_pager
					.getAdapter();
			Calendar selected_day = adapter.getSelectedDay(view_pager
					.getCurrentItem());
			CalendarDatePickerDialog dialog = CalendarDatePickerDialog
					.newInstance(this, selected_day.get(Calendar.YEAR),
							selected_day.get(Calendar.MONTH),
							selected_day.get(Calendar.DAY_OF_MONTH));
			dialog.show(getSupportFragmentManager(), "date_picker");
			break;
		case R.id.menu_fake_data:
//			dialog = DatePickerFragment
//					.newInstance(new DatePickerFragment.OnDateSelectedListener() {
//						@Override
//						public void onDateSelected(int year, int monthOfYear,
//								int dayOfMonth) {
//							Calendar date = Calendar.getInstance();
//							date.set(Calendar.YEAR, year);
//							date.set(Calendar.MONTH, monthOfYear);
//							date.set(Calendar.DAY_OF_MONTH, dayOfMonth);
//
//							while (date.before(Calendar.getInstance())) {
//								if ((date.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY)
//										&& (date.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY)) {
//									for (int id : Period.ids) {
//										Period period = new Period(id, date);
//										period.persist(ViewHistoryActivity.this);
//									}
//								}
//								date.add(Calendar.DAY_OF_MONTH, 1);
//							}
//						}
//					});
//			dialog.show(getSupportFragmentManager(), "select_date");
			break;

		default:
			return super.onOptionsItemSelected(item);
		}
		return true;
	}

	@Override<commit_msg>Reenabling option to build fake data on debug release<commit_after>package net.xisberto.work_schedule;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;

import net.xisberto.work_schedule.database.Database;
import net.xisberto.work_schedule.database.Period;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.NavUtils;
import android.support.v4.view.ViewPager;
import android.util.Log;

import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import com.doomonafireball.betterpickers.calendardatepicker.CalendarDatePickerDialog;
import com.doomonafireball.betterpickers.calendardatepicker.CalendarDatePickerDialog.OnDateSetListener;
import com.viewpagerindicator.TabPageIndicator;

public class ViewHistoryActivity extends SherlockFragmentActivity implements
		OnDateSetListener {

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

		getSupportActionBar().setDisplayHomeAsUpEnabled(true);

		ViewPager view_pager = (ViewPager) findViewById(R.id.pager);
		TabPageIndicator pager_indicator = (TabPageIndicator) findViewById(R.id.pager_indicator);

		HistoryPagerAdapter pager_adapter = new HistoryPagerAdapter(
				getSupportFragmentManager());
		view_pager.setAdapter(pager_adapter);

		pager_indicator.setViewPager(view_pager);
		view_pager.setCurrentItem(HistoryPagerAdapter.SIZE);

	}

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

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getSupportMenuInflater().inflate(R.menu.activity_history, menu);
		return true;
	}

	@Override
	public boolean onPrepareOptionsMenu(Menu menu) {
		if (!BuildConfig.DEBUG) {
			menu.findItem(R.id.menu_fake_data).setVisible(false);
		}
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		if (item.getItemId() == android.R.id.home) {
			NavUtils.navigateUpFromSameTask(this);
			return true;
		}
		ViewPager view_pager = (ViewPager) findViewById(R.id.pager);
		HistoryPagerAdapter adapter = (HistoryPagerAdapter) view_pager
				.getAdapter();
		Calendar selected_day = adapter.getSelectedDay(view_pager
				.getCurrentItem());
		CalendarDatePickerDialog dialog;
		switch (item.getItemId()) {
		case R.id.menu_go_today:
			view_pager = (ViewPager) findViewById(R.id.pager);
			view_pager.setCurrentItem(HistoryPagerAdapter.SIZE);
			break;
		case R.id.menu_share:
			dialog = CalendarDatePickerDialog.newInstance(this,
					selected_day.get(Calendar.YEAR),
					selected_day.get(Calendar.MONTH),
					selected_day.get(Calendar.DAY_OF_MONTH));
			dialog.show(getSupportFragmentManager(), "date_picker");
			break;
		case R.id.menu_fake_data:
			dialog = CalendarDatePickerDialog.newInstance(
					new OnDateSetListener() {
						@Override
						public void onDateSet(CalendarDatePickerDialog dialog,
								int year, int monthOfYear, int dayOfMonth) {
							Calendar date = Calendar.getInstance();
							date.set(Calendar.YEAR, year);
							date.set(Calendar.MONTH, monthOfYear);
							date.set(Calendar.DAY_OF_MONTH, dayOfMonth);

							while (date.before(Calendar.getInstance())) {
								if ((date.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY)
										&& (date.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY)) {
									for (int id : Period.ids) {
										Period period = new Period(id, date);
										period.persist(ViewHistoryActivity.this);
									}
								}
								date.add(Calendar.DAY_OF_MONTH, 1);
							}
						}
					}, selected_day.get(Calendar.YEAR), selected_day
							.get(Calendar.MONTH), selected_day
							.get(Calendar.DAY_OF_MONTH));
			dialog.show(getSupportFragmentManager(), "date_picker");
			break;
		default:
			return super.onOptionsItemSelected(item);
		}
		return true;
	}

	@Override
{'fraction_non_alphanumeric': 0.10678666990999756, 'fraction_numerical': 0.0007297494526879105, 'mean_word_length': 4.632191780821918, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6537432', 'n_tokens_mistral': 3054, 'n_tokens_neox': 2596, 'n_words': 415}