<commit_before>package mobi.acpm.inspeckage.receivers;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;

import mobi.acpm.inspeckage.Module;
import mobi.acpm.inspeckage.util.Config;

/**
 * Created by acpm on 20/01/16.
 */
public class InspeckageWebReceiver extends BroadcastReceiver {

    private Context mContext;
    public InspeckageWebReceiver(Context ctx){
        mContext = ctx;
    }
    @Override
    public void onReceive(Context context, Intent intent) {

        SharedPreferences mPrefs = mContext.getSharedPreferences(Module.PREFS, mContext.MODE_WORLD_READABLE);
        SharedPreferences.Editor edit = mPrefs.edit();

        String action = intent.getExtras().getString("action");

        if(action.equals("fileTree")){

            String sub1 = intent.getExtras().getString("tree");

            String script = "<script>\n" +
                    "$(document).ready(function() {\n" +
                    "\n" +
                    "    CollapsibleLists.apply();\n" +
                    "\n" +
                    "});\n" +
                    "</script>";

            String tree = script+"<ul class=\"collapsibleList\">"+sub1+"</ul>";
            edit.putString(Config.SP_DATA_DIR_TREE, tree);
            edit.apply();
        }

        if(action.equals("checkApp")){

            boolean isRunning = intent.getExtras().getBoolean("isRunning");
            int pid = intent.getExtras().getInt("PID");
            edit.putBoolean(Config.SP_APP_IS_RUNNING, isRunning);
            edit.putInt(Config.SP_APP_PID, pid);
            edit.apply();
        }
    }
}<commit_msg>add clipboard option<commit_after>package mobi.acpm.inspeckage.receivers;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;

import mobi.acpm.inspeckage.Module;
import mobi.acpm.inspeckage.util.Config;

/**
 * Created by acpm on 20/01/16.
 */
public class InspeckageWebReceiver extends BroadcastReceiver {

    private Context mContext;
    public InspeckageWebReceiver(Context ctx){
        mContext = ctx;
    }
    @Override
    public void onReceive(Context context, Intent intent) {

        SharedPreferences mPrefs = mContext.getSharedPreferences(Module.PREFS, mContext.MODE_WORLD_READABLE);
        SharedPreferences.Editor edit = mPrefs.edit();

        String action = intent.getExtras().getString("action");

        if(action.equals("fileTree")){

            String sub1 = intent.getExtras().getString("tree");

            String script = "<script>\n" +
                    "$(document).ready(function() {\n" +
                    "\n" +
                    "    CollapsibleLists.apply();\n" +
                    "\n" +
                    "});\n" +
                    "</script>";

            String tree = script+"<ul class=\"collapsibleList\">"+sub1+"</ul>";
            edit.putString(Config.SP_DATA_DIR_TREE, tree);
            edit.apply();
        }else if(action.equals("checkApp")){

            boolean isRunning = intent.getExtras().getBoolean("isRunning");
            int pid = intent.getExtras().getInt("PID");
            edit.putBoolean(Config.SP_APP_IS_RUNNING, isRunning);
            edit.putInt(Config.SP_APP_PID, pid);
            edit.apply();
        }else if(action.equals("clipboard")){

            String value = intent.getExtras().getString("value");

            android.content.ClipboardManager clipboard = (android.content.ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
            android.content.ClipData clip = android.content.ClipData
                    .newPlainText("simple text", value);
            clipboard.setPrimaryClip(clip);
        }
    }
}
{'fraction_non_alphanumeric': 0.12581742087365944, 'fraction_numerical': 0.00418519487313628, 'mean_word_length': 2.3960923623445827, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '3874940', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1061, 'n_words': 183}