<commit_before>package net.randby.simon.positionrecorder;

import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TableLayout;
import android.widget.TextView;


public class MainActivity extends ActionBarActivity {

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

    }

    private void addTableEntry() {
        AwesomeLocationModule awesomeLocationModule = new AwesomeLocationModule().invoke();
        double latitude = awesomeLocationModule.getLatitude();
        double longitude = awesomeLocationModule.getLongitude();


//        Table inflation:
        TableLayout logTable = (TableLayout) findViewById(R.id.space_time_rows);
        LayoutInflater layoutInflater = getLayoutInflater();
        View theInflatedRow;


        theInflatedRow = layoutInflater.inflate(R.layout.table_log_entry, logTable, false);

        TextView idContent = (TextView)theInflatedRow.findViewById(R.id.id_column_content);
        idContent.setText("" + 1);

        TextView xContent = (TextView)theInflatedRow.findViewById(R.id.x_coordinate_column_content);
        xContent.setText("" + latitude);

        TextView yContent = (TextView)theInflatedRow.findViewById(R.id.y_coordinate_column_content);
        yContent.setText("" + longitude);

        TextView timeContent = (TextView)theInflatedRow.findViewById(R.id.time_column_content);
        timeContent.setText("" + System.currentTimeMillis());

        logTable.addView(theInflatedRow);

    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    /**Remove all current entries (use with care!)*/
    public void flushSpaceTimeCoordinates(View view){
        TableLayout spaceTimeRows = (TableLayout) findViewById(R.id.space_time_rows);
        spaceTimeRows.removeAllViews();
    }

    /**Add new entry when the trigger has been clicked*/
    public void triggerSpaceTimeRecording(View view){
        addTableEntry();
    }<commit_msg>Add confirm dialog to flush log button<commit_after>package net.randby.simon.positionrecorder;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TableLayout;
import android.widget.TextView;


public class MainActivity extends ActionBarActivity {

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

    }

    private void addTableEntry() {
        AwesomeLocationModule awesomeLocationModule = new AwesomeLocationModule().invoke();
        double latitude = awesomeLocationModule.getLatitude();
        double longitude = awesomeLocationModule.getLongitude();


//        Table inflation:
        TableLayout logTable = (TableLayout) findViewById(R.id.space_time_rows);
        LayoutInflater layoutInflater = getLayoutInflater();
        View theInflatedRow;


        theInflatedRow = layoutInflater.inflate(R.layout.table_log_entry, logTable, false);

        TextView idContent = (TextView)theInflatedRow.findViewById(R.id.id_column_content);
        idContent.setText("" + 1);

        TextView xContent = (TextView)theInflatedRow.findViewById(R.id.x_coordinate_column_content);
        xContent.setText("" + latitude);

        TextView yContent = (TextView)theInflatedRow.findViewById(R.id.y_coordinate_column_content);
        yContent.setText("" + longitude);

        TextView timeContent = (TextView)theInflatedRow.findViewById(R.id.time_column_content);
        timeContent.setText("" + System.currentTimeMillis());

        logTable.addView(theInflatedRow);

    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    /**Remove all current entries (use with care!)*/
    public void flushSpaceTimeCoordinates(View view){

        new AlertDialog.Builder(this)
                .setTitle("Flush Log")
                .setMessage("Are you sure you want to delete all the entries in the current log?")
                .setPositiveButton("Yes, delete", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        TableLayout spaceTimeRows = (TableLayout) findViewById(R.id.space_time_rows);
                        spaceTimeRows.removeAllViews();
                    }
                })
                .setNegativeButton("No, abort", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        //Just nothing?
                    }
                })
                .show();


    }

    /**Add new entry when the trigger has been clicked*/
    public void triggerSpaceTimeRecording(View view){
        addTableEntry();
    }
{'fraction_non_alphanumeric': 0.08761152552289016, 'fraction_numerical': 0.000585051923358198, 'mean_word_length': 2.9732713538640327, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '2654232', 'n_tokens_mistral': 1842, 'n_tokens_neox': 1696, 'n_words': 421}