<commit_before>package mozilla.org.webmaker;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.JavascriptInterface;
import android.widget.RelativeLayout;

import mozilla.org.webmaker.view.WebmakerWebView;
import org.json.JSONException;
import org.json.JSONObject;

public class WebmakerActivity extends Activity {

    protected WebmakerWebView view;
    protected JSONObject routeParams;
    protected String pageName;
    protected int id, layoutResID, menuResId;

    public WebmakerActivity(String pageName, int id, int layoutResID, int menuResId) {
        this.pageName = pageName;
        this.id = id;
        this.layoutResID = layoutResID;
        this.menuResId = menuResId;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Extract route information from intent extras
        routeParams = new JSONObject();

        Bundle intentExtras = getIntent().getExtras();
        if (intentExtras != null) {
            try {
                routeParams.put("project", intentExtras.get("project"));
                routeParams.put("page", intentExtras.get("page"));
                routeParams.put("element", intentExtras.get("element"));
                routeParams.put("attribute", intentExtras.get("attribute"));
                routeParams.put("editor", intentExtras.get("editor"));
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        // Add webview to layout
        setContentView(layoutResID);
        view = new WebmakerWebView(this, pageName, routeParams);
        RelativeLayout layout = (RelativeLayout) findViewById(id);
        layout.addView(view);
    }

    @Override
    public void onDestroy() {
        Log.v("wm", "onDestroy");
        if (view == null) return;
        view.destroy();
        view = null;
        super.onDestroy();
    }
}
<commit_msg>Assign 'home' button to back button behavior. Resolves GH-1695<commit_after>package mozilla.org.webmaker;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.webkit.JavascriptInterface;
import android.widget.RelativeLayout;

import mozilla.org.webmaker.view.WebmakerWebView;
import org.json.JSONException;
import org.json.JSONObject;

public class WebmakerActivity extends Activity {

    protected WebmakerWebView view;
    protected JSONObject routeParams;
    protected String pageName;
    protected int id, layoutResID, menuResId;

    public WebmakerActivity(String pageName, int id, int layoutResID, int menuResId) {
        this.pageName = pageName;
        this.id = id;
        this.layoutResID = layoutResID;
        this.menuResId = menuResId;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Extract route information from intent extras
        routeParams = new JSONObject();

        Bundle intentExtras = getIntent().getExtras();
        if (intentExtras != null) {
            try {
                routeParams.put("project", intentExtras.get("project"));
                routeParams.put("page", intentExtras.get("page"));
                routeParams.put("element", intentExtras.get("element"));
                routeParams.put("attribute", intentExtras.get("attribute"));
                routeParams.put("editor", intentExtras.get("editor"));
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

        // Add webview to layout
        setContentView(layoutResID);
        view = new WebmakerWebView(this, pageName, routeParams);
        RelativeLayout layout = (RelativeLayout) findViewById(id);
        layout.addView(view);
    }

    @Override
    public void onDestroy() {
        Log.v("wm", "onDestroy");
        if (view == null) return;
        view.destroy();
        view = null;
        super.onDestroy();
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch(item.getItemId()) {
            case android.R.id.home:
                onBackPressed();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

{'fraction_non_alphanumeric': 0.10362930837708285, 'fraction_numerical': 0.0009130335539831089, 'mean_word_length': 2.6155115511551155, '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': '3313465', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1160, 'n_words': 267}