<commit_before>package com.example.smartmirror;

import android.annotation.TargetApi;
import android.content.Intent;
import android.os.Build;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.facebook.FacebookSdk;

public class MainActivity extends AppCompatActivity {
    final String TAG = "SmartMirror";
    Button sumbit;
    EditText username;
    EditText password;
    TextView pleaseSignIn;
    Bundle saved;

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        Log.d(TAG, "App started on build version " + Build.VERSION.SDK_INT);
        saved = savedInstanceState;
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sign_in);
        //setContentView(R.layout.activity_main);
        if (android.os.Build.VERSION.SDK_INT > 9)
        {
            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
            StrictMode.setThreadPolicy(policy);
        }
        Button button1 = (Button)findViewById(R.id.button);
        EditText editText = (EditText) findViewById(R.id.editText);
        EditText editText2 = (EditText) findViewById(R.id.editText2);
        sumbit = button1;
        username = editText;
        password = <PASSWORD>2;

        TextView textView = (TextView) findViewById(R.id.textView);
        pleaseSignIn = textView;

    }

    public void clicked(View v){
        Log.d(TAG, "Button %s has been clicked");
        login login = new login();
        int test1 = login.start(username,password,this,pleaseSignIn);
        if(test1 != 0){ return; }


        int test = post();
        if (test == 0){
            setContentView(R.layout.activity_main);
        }
        else { return; }

        //setContentView(R.layout.activity_main);
        //return 0;
    }

    private int post()
    {
        final String server = "http://jarvis.cse.buffalo.edu/mine/mypage.php";
        Log.d(TAG, "Post to server");
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost(server);
        try {
            Log.i(TAG, "Attempting to post to: "+server);
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(4);

            nameValuePairs.add(new BasicNameValuePair("fname", "John"));
            nameValuePairs.add(new BasicNameValuePair("fphone", "no #"));
            nameValuePairs.add(new BasicNameValuePair("femail", "<EMAIL>"));
            nameValuePairs.add(new BasicNameValuePair("fcomment", "It worked!!!! :)"));
            Log.i(TAG, "Items: " + nameValuePairs);

            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            httpclient.execute(httppost);

        } catch (ClientProtocolException e) {

            // TODO Auto-generated catch block
            return 1;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            return 1;
        }
        return 0;
    }


    public int twitter(View v)
    {
        Intent intent = new Intent(getBaseContext(), Twitter_fncts.class);
        MainActivity.this.startActivity(intent);

        return 0;
    }


    public int facebook(View v){
        FacebookSdk.sdkInitialize(this.getApplicationContext());
        Intent intent = new Intent(getBaseContext(), FacebookBackend.class);
        MainActivity.this.startActivity(intent);
        return 0;
    }

    public int startCalendar(View v){

        Intent myIntent = new Intent(getBaseContext(),calendar.class);
        startActivity(myIntent);

        //calendar calendar = new calendar();
        //calendar.onCreate(saved);

        return 0;
    }

    public int startZip(View v){

        Intent myIntent = new Intent(getBaseContext(),zipcode.class);
        startActivity(myIntent);
        return 0;
    }
}

<commit_msg>calendar API stays logged in #92 #59<commit_after>package com.example.smartmirror;

import android.annotation.TargetApi;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.StrictMode;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.facebook.FacebookSdk;

public class MainActivity extends AppCompatActivity {
    final String TAG = "SmartMirror";
    Button sumbit;
    EditText username;
    EditText password;
    TextView pleaseSignIn;
    Bundle saved;
    static Context context;

    @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        context = this;
        Log.d(TAG, "App started on build version " + Build.VERSION.SDK_INT);
        saved = savedInstanceState;
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sign_in);
        //setContentView(R.layout.activity_main);
        if (android.os.Build.VERSION.SDK_INT > 9)
        {
            StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
            StrictMode.setThreadPolicy(policy);
        }
        Button button1 = (Button)findViewById(R.id.button);
        EditText editText = (EditText) findViewById(R.id.editText);
        EditText editText2 = (EditText) findViewById(R.id.editText2);
        sumbit = button1;
        username = editText;
        password = <PASSWORD>;

        TextView textView = (TextView) findViewById(R.id.textView);
        pleaseSignIn = textView;

    }

    public void clicked(View v){
        Log.d(TAG, "Button %s has been clicked");
        login login = new login();
        int test1 = login.start(username,password,this,pleaseSignIn);
        if(test1 != 0){ return; }


        int test = post();
        if (test == 0){
            setContentView(R.layout.activity_main);
        }
        else { return; }

        //setContentView(R.layout.activity_main);
        //return 0;
    }

    private int post()
    {
        final String server = "http://jarvis.cse.buffalo.edu/mine/mypage.php";
        Log.d(TAG, "Post to server");
        HttpClient httpclient = new DefaultHttpClient();
        HttpPost httppost = new HttpPost(server);
        try {
            Log.i(TAG, "Attempting to post to: "+server);
            List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(4);

            nameValuePairs.add(new BasicNameValuePair("fname", "John"));
            nameValuePairs.add(new BasicNameValuePair("fphone", "no #"));
            nameValuePairs.add(new BasicNameValuePair("femail", "<EMAIL>"));
            nameValuePairs.add(new BasicNameValuePair("fcomment", "It worked!!!! :)"));
            Log.i(TAG, "Items: " + nameValuePairs);

            httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
            httpclient.execute(httppost);

        } catch (ClientProtocolException e) {

            // TODO Auto-generated catch block
            return 1;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            return 1;
        }
        return 0;
    }


    public int twitter(View v)
    {
        Intent intent = new Intent(getBaseContext(), Twitter_fncts.class);
        MainActivity.this.startActivity(intent);

        return 0;
    }


    public int facebook(View v){
        FacebookSdk.sdkInitialize(this.getApplicationContext());
        Intent intent = new Intent(getBaseContext(), FacebookBackend.class);
        MainActivity.this.startActivity(intent);
        return 0;
    }

    public int startCalendar(View v){

        //calendar c = new calendar();
        //c.passContext(this);
        Intent myIntent = new Intent(getBaseContext(),calendar.class);
        startActivity(myIntent);

        //calendar calendar = new calendar();
        //calendar.onCreate(saved);

        return 0;
    }

    public int startZip(View v){

        Intent myIntent = new Intent(getBaseContext(),zipcode.class);
        startActivity(myIntent);
        return 0;
    }
}


{'fraction_non_alphanumeric': 0.10982532751091703, 'fraction_numerical': 0.004694323144104804, 'mean_word_length': 2.7792904290429044, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7395059', 'n_tokens_mistral': 2678, 'n_tokens_neox': 2564, 'n_words': 552}