<commit_before>package com.blntsoft.emailpopup;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.util.Date;

public class Main
    extends Activity
    implements OnClickListener {

    Button testOneButton;
    Button testMultipleButton;

    EditText emailEditText;
    Button searchByEmailButton;

    EditText nameEditText;
    Button searchByNameButton;

    Button viewEmailButton;

    Button testFromSelfButton;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        testOneButton = (Button)findViewById(R.id.test_one_button);
        testOneButton.setOnClickListener(this);
        
        testMultipleButton = (Button)findViewById(R.id.test_multiple_button);
        testMultipleButton.setOnClickListener(this);

        emailEditText = (EditText)findViewById(R.id.email_edit_text);
        searchByEmailButton = (Button)findViewById(R.id.search_by_email_button);
        searchByEmailButton.setOnClickListener(this);

        nameEditText = (EditText)findViewById(R.id.name_edit_text);
        searchByNameButton = (Button)findViewById(R.id.search_by_name_button);
        searchByNameButton.setOnClickListener(this);

        viewEmailButton = (Button)findViewById(R.id.view_email_button);
        viewEmailButton.setOnClickListener(this);

        testFromSelfButton = (Button)findViewById(R.id.test_from_self_button);
        testFromSelfButton.setOnClickListener(this);
    }//onCreate

    @Override
    public void onClick(View view) {
        //final String prefix = "com.fsck.k9.intent.";
        final String prefix = "com.android.email.intent.";

        if (view==testOneButton) {
            Thread t = new Thread() {
                @Override
                public void run() {

                    try {
                        Thread.sleep(2500);
                    }
                    catch (InterruptedException e) {
                        Log.w(prefix+EmailPopup.LOG_TAG, null, e);
                    }
                    

                    Uri uri = Uri.parse("email://messages/1/Inbox/123");
                    Intent intent = new Intent(prefix+EmailPopup.ACTION_EMAIL_RECEIVED, uri);
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    intent.putExtra(prefix+EmailPopup.EXTRA_FROM, "<NAME>. <<EMAIL>>");
                    intent.putExtra(prefix+EmailPopup.EXTRA_FOLDER, "Inbox");
                    intent.putExtra(prefix+EmailPopup.EXTRA_ACCOUNT, "Personal");
                    intent.putExtra(prefix+EmailPopup.EXTRA_SUBJECT, "Are we on tonight?");
                    intent.putExtra(prefix+EmailPopup.EXTRA_AUTO_CLOSE, false);
                    getApplicationContext().sendBroadcast(intent);
                }
            };
            t.start();
            finish();
        }
        else if (view==testMultipleButton) {
            Thread t = new Thread() {
                @Override
                public void run() {
                    try {
                        Thread.sleep(2500);
                    }
                    catch (InterruptedException e) {
                        Log.e(prefix+EmailPopup.LOG_TAG, null, e);
                    }

                    for (int i=0; i<5; i++) {
                        try {
                            Thread.sleep(500);
                        }
                        catch (InterruptedException e) {
                            Log.e(prefix+EmailPopup.LOG_TAG, null, e);
                        }

                        Uri uri = Uri.parse("email://messages/2/Inbox/"+1);
                        Intent intent = new Intent(prefix+EmailPopup.ACTION_EMAIL_RECEIVED, uri);
                        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        intent.putExtra(prefix+EmailPopup.EXTRA_ACCOUNT, "TEST");
                        intent.putExtra(prefix+EmailPopup.EXTRA_FROM, "May the Force be with you <<EMAIL>>");
                        intent.putExtra(prefix+EmailPopup.EXTRA_FOLDER, "Inbox");
                        intent.putExtra(prefix+EmailPopup.EXTRA_SUBJECT, "Email Popup Rocks! #" + i);
                        intent.putExtra(prefix+EmailPopup.EXTRA_SENT_DATE, new Date());
                        Main.this.sendBroadcast(intent);
                        Log.e(prefix+EmailPopup.LOG_TAG, i + "th broadcast sent");
                    }
                }//run
            };//Thread
            t.setPriority(Thread.MIN_PRIORITY);
            t.start();
            finish();
        }
        else if (view==searchByEmailButton) {
            String email = emailEditText.getText().toString();
            Log.d(prefix+EmailPopup.LOG_TAG, "Email: " + email);

            long contactId = ContactUtils.getIdByEmailAddress(this, email);
            Toast.makeText(this, "Contact id: " + contactId, Toast.LENGTH_SHORT).show();

            if (contactId!=-1) {
                boolean starred = ContactUtils.isContactStarred(this, contactId);
                Toast.makeText(this, "Contact Starred: " + starred, Toast.LENGTH_SHORT).show();
            }
        }
        else if (view==searchByNameButton) {
            String name = nameEditText.getText().toString();
            Log.d(prefix+EmailPopup.LOG_TAG, "Name: " + name);

            long contactId = ContactUtils.getIdByName(this, name);
            Toast.makeText(this, "Contact id: " + contactId, Toast.LENGTH_SHORT).show();

            if (contactId!=-1) {
                boolean starred = ContactUtils.isContactStarred(this, contactId);
                Toast.makeText(this, "Contact Starred: " + starred, Toast.LENGTH_SHORT).show();
            }
        }
        else if (view==viewEmailButton) {
            //Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("email://messages/0/INBOX/1255020785.890845.m1gemini00-01.prod.mesa1.1091393888"));
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("email://messages/0/INBOX/1255020785.890845.m1gemini00-01.prod.mesa1.109139388"));
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            this.startActivity(intent);
        }
        else if (view==testFromSelfButton) {
            Thread t = new Thread() {
                @Override
                public void run() {

                    try {
                        Thread.sleep(2500);
                    }
                    catch (InterruptedException e) {
                        Log.w(prefix+EmailPopup.LOG_TAG, null, e);
                    }


                    Uri uri = Uri.parse("email://messages/1/Inbox/123");
                    Intent intent = new Intent(prefix+EmailPopup.ACTION_EMAIL_RECEIVED, uri);
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    intent.putExtra(prefix+EmailPopup.EXTRA_FROM, "<NAME>. <<EMAIL>>");
                    intent.putExtra(prefix+EmailPopup.EXTRA_FOLDER, "Inbox");
                    intent.putExtra(prefix+EmailPopup.EXTRA_ACCOUNT, "Personal");
                    intent.putExtra(prefix+EmailPopup.EXTRA_SUBJECT, "Are we on tonight?");
                    intent.putExtra(prefix+EmailPopup.EXTRA_FROM_SELF, true);
                    getApplicationContext().sendBroadcast(intent);
                }
            };
            t.start();
            finish();
        }//if
    }
}<commit_msg>Test buttons now use name and email from form vs hard coded ones<commit_after>package com.blntsoft.emailpopup;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import java.util.Date;

public class Main
    extends Activity
    implements OnClickListener {

    Button testOneButton;
    Button testMultipleButton;

    EditText emailEditText;
    Button searchByEmailButton;

    EditText nameEditText;
    Button searchByNameButton;

    Button viewEmailButton;

    Button testFromSelfButton;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        testOneButton = (Button)findViewById(R.id.test_one_button);
        testOneButton.setOnClickListener(this);
        
        testMultipleButton = (Button)findViewById(R.id.test_multiple_button);
        testMultipleButton.setOnClickListener(this);

        emailEditText = (EditText)findViewById(R.id.email_edit_text);
        searchByEmailButton = (Button)findViewById(R.id.search_by_email_button);
        searchByEmailButton.setOnClickListener(this);

        nameEditText = (EditText)findViewById(R.id.name_edit_text);
        searchByNameButton = (Button)findViewById(R.id.search_by_name_button);
        searchByNameButton.setOnClickListener(this);

        viewEmailButton = (Button)findViewById(R.id.view_email_button);
        viewEmailButton.setOnClickListener(this);

        testFromSelfButton = (Button)findViewById(R.id.test_from_self_button);
        testFromSelfButton.setOnClickListener(this);
    }//onCreate

    @Override
    public void onClick(View view) {
        //final String prefix = "com.fsck.k9.intent.";
        final String prefix = "com.android.email.intent.";

        if (view==testOneButton) {
            Thread t = new Thread() {
                @Override
                public void run() {

                    try {
                        Thread.sleep(2500);
                    }
                    catch (InterruptedException e) {
                        Log.w(prefix+EmailPopup.LOG_TAG, null, e);
                    }
                    

                    Uri uri = Uri.parse("email://messages/1/Inbox/123");
                    Intent intent = new Intent(prefix+EmailPopup.ACTION_EMAIL_RECEIVED, uri);
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    intent.putExtra(prefix+EmailPopup.EXTRA_FROM, nameEditText.getText().toString() + " <" + emailEditText.getText().toString() + ">");
                    intent.putExtra(prefix+EmailPopup.EXTRA_FOLDER, "Inbox");
                    intent.putExtra(prefix+EmailPopup.EXTRA_ACCOUNT, "Personal");
                    intent.putExtra(prefix+EmailPopup.EXTRA_SUBJECT, "Are we on tonight?");
                    intent.putExtra(prefix+EmailPopup.EXTRA_AUTO_CLOSE, false);
                    getApplicationContext().sendBroadcast(intent);
                }
            };
            t.start();
            finish();
        }
        else if (view==testMultipleButton) {
            Thread t = new Thread() {
                @Override
                public void run() {
                    try {
                        Thread.sleep(2500);
                    }
                    catch (InterruptedException e) {
                        Log.e(prefix+EmailPopup.LOG_TAG, null, e);
                    }

                    for (int i=0; i<5; i++) {
                        try {
                            Thread.sleep(500);
                        }
                        catch (InterruptedException e) {
                            Log.e(prefix+EmailPopup.LOG_TAG, null, e);
                        }

                        Uri uri = Uri.parse("email://messages/2/Inbox/"+1);
                        Intent intent = new Intent(prefix+EmailPopup.ACTION_EMAIL_RECEIVED, uri);
                        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        intent.putExtra(prefix+EmailPopup.EXTRA_ACCOUNT, "TEST");
                        intent.putExtra(prefix+EmailPopup.EXTRA_FROM, nameEditText.getText().toString() + " <" + emailEditText.getText().toString() + ">");
                        intent.putExtra(prefix+EmailPopup.EXTRA_FOLDER, "Inbox");
                        intent.putExtra(prefix+EmailPopup.EXTRA_SUBJECT, "Email Popup Rocks! #" + i);
                        intent.putExtra(prefix+EmailPopup.EXTRA_SENT_DATE, new Date());
                        Main.this.sendBroadcast(intent);
                        Log.e(prefix+EmailPopup.LOG_TAG, i + "th broadcast sent");
                    }
                }//run
            };//Thread
            t.setPriority(Thread.MIN_PRIORITY);
            t.start();
            finish();
        }
        else if (view==searchByEmailButton) {
            String email = emailEditText.getText().toString();
            Log.d(prefix+EmailPopup.LOG_TAG, "Email: " + email);

            long contactId = ContactUtils.getIdByEmailAddress(this, email);
            Toast.makeText(this, "Contact id: " + contactId, Toast.LENGTH_SHORT).show();

            if (contactId!=-1) {
                boolean starred = ContactUtils.isContactStarred(this, contactId);
                Toast.makeText(this, "Contact Starred: " + starred, Toast.LENGTH_SHORT).show();
            }
        }
        else if (view==searchByNameButton) {
            String name = nameEditText.getText().toString();
            Log.d(prefix+EmailPopup.LOG_TAG, "Name: " + name);

            long contactId = ContactUtils.getIdByName(this, name);
            Toast.makeText(this, "Contact id: " + contactId, Toast.LENGTH_SHORT).show();

            if (contactId!=-1) {
                boolean starred = ContactUtils.isContactStarred(this, contactId);
                Toast.makeText(this, "Contact Starred: " + starred, Toast.LENGTH_SHORT).show();
            }
        }
        else if (view==viewEmailButton) {
            //Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("email://messages/0/INBOX/1255020785.890845.m1gemini00-01.prod.mesa1.1091393888"));
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("email://messages/0/INBOX/1255020785.890845.m1gemini00-01.prod.mesa1.109139388"));
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            this.startActivity(intent);
        }
        else if (view==testFromSelfButton) {
            Thread t = new Thread() {
                @Override
                public void run() {

                    try {
                        Thread.sleep(2500);
                    }
                    catch (InterruptedException e) {
                        Log.w(prefix+EmailPopup.LOG_TAG, null, e);
                    }


                    Uri uri = Uri.parse("email://messages/1/Inbox/123");
                    Intent intent = new Intent(prefix+EmailPopup.ACTION_EMAIL_RECEIVED, uri);
                    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    intent.putExtra(prefix+EmailPopup.EXTRA_FROM, "<NAME>. <<EMAIL>>");
                    intent.putExtra(prefix+EmailPopup.EXTRA_FOLDER, "Inbox");
                    intent.putExtra(prefix+EmailPopup.EXTRA_ACCOUNT, "Personal");
                    intent.putExtra(prefix+EmailPopup.EXTRA_SUBJECT, "Are we on tonight?");
                    intent.putExtra(prefix+EmailPopup.EXTRA_FROM_SELF, true);
                    getApplicationContext().sendBroadcast(intent);
                }
            };

            //Test delete
            //email://messages/0/INBOX/1379391488.340277.p3plgemini06-02.prod.phx.1104034112

            t.start();
            finish();
        }//if
    }
}
{'fraction_non_alphanumeric': 0.1069645371911407, 'fraction_numerical': 0.014210728459864295, 'mean_word_length': 1.8379654859218892, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 16, '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': '6329124', 'n_tokens_mistral': 4447, 'n_tokens_neox': 4141, 'n_words': 660}