<commit_before>package %%%JAVA_PACKAGE%%%.app;

import android.app.Activity;
import android.graphics.Point;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.Display;
import android.view.Window;

public class MainActivity extends Activity {

    private static boolean mainStarted = false;
    private CrayonWebView cwv;

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

        if (!mainStarted) {
            mainStarted = true;
            this.ensureCrayonViewInitialized();
        }
    }

    @Override
    protected void onStart() {
        super.onStart();
    }

    @Override
    protected void onResume() {
        super.onResume();
        this.ensureCrayonViewInitialized();
        this.cwv.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        this.cwv.onPause();
    }

    @Override
    protected void onStop() {
        super.onStop();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    private void ensureCrayonViewInitialized() {
        if (this.cwv == null) {
            Display display = this.getWindowManager().getDefaultDisplay();
            Point size = new Point();
            display.getSize(size);
            int actionBarHeight = this.getActionBarHeight();
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            this.cwv = new CrayonWebView(this, size.x, size.y - actionBarHeight);
            this.setContentView(this.cwv);
        }
    }

    private int getActionBarHeight() {
        TypedValue tv = new TypedValue();
        if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
        {
            return TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics());
        }
        return 0;
    }
}
<commit_msg>I now realize the bug that the previous commit addressed had a cause that was hiding in plain sight.<commit_after>package %%%JAVA_PACKAGE%%%.app;

import android.app.Activity;
import android.graphics.Point;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.Display;
import android.view.Window;

public class MainActivity extends Activity {

    private CrayonWebView cwv;

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

    @Override
    protected void onStart() {
        super.onStart();
    }

    @Override
    protected void onResume() {
        super.onResume();
        this.ensureCrayonViewInitialized();
        this.cwv.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
        this.cwv.onPause();
    }

    @Override
    protected void onStop() {
        super.onStop();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }

    private void ensureCrayonViewInitialized() {
        if (this.cwv == null) {
            Display display = this.getWindowManager().getDefaultDisplay();
            Point size = new Point();
            display.getSize(size);
            int actionBarHeight = this.getActionBarHeight();
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            this.cwv = new CrayonWebView(this, size.x, size.y - actionBarHeight);
            this.setContentView(this.cwv);
        }
    }

    private int getActionBarHeight() {
        TypedValue tv = new TypedValue();
        if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
        {
            return TypedValue.complexToDimensionPixelSize(tv.data,getResources().getDisplayMetrics());
        }
        return 0;
    }
}

{'fraction_non_alphanumeric': 0.09961489088575096, 'fraction_numerical': 0.0005134788189987163, 'mean_word_length': 2.190827190827191, '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': '24221', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1076, 'n_words': 221}