<commit_before>package com.pr0gramm.app;

import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;

/**
 * Text view with a custom font.
 */
public class Pr0grammFontTextView extends TextView {
    public Pr0grammFontTextView(Context context) {
        this(context, null);
    }

    public Pr0grammFontTextView(Context context, AttributeSet attrs) {
        super(context, attrs);

        if (!isInEditMode()) {
            Typeface customTypeface = Typeface.createFromAsset(
                    context.getAssets(), "fonts/pict0gramm-v3.ttf");

            setTypeface(customTypeface);
        }
    }<commit_msg>Schriftart nicht bei jedem Erzeugen der View neu laden<commit_after>package com.pr0gramm.app;

import android.content.Context;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.widget.TextView;

/**
 * Text view with a custom font.
 */
public class Pr0grammFontTextView extends TextView {
    public Pr0grammFontTextView(Context context) {
        this(context, null);
    }

    public Pr0grammFontTextView(Context context, AttributeSet attrs) {
        super(context, attrs);

        if (!isInEditMode()) {
            Typeface font = getFontfaceInstance(context);
            setTypeface(font);
        }
    }

    /**
     * Loads a the pr0gramm typeface. The font is only loaded once. This method
     * will then return the same instance on every further call.
     *
     * @param context The context to use for loading.
     */
    private static Typeface getFontfaceInstance(Context context) {
        if (INSTANCE == null) {
            INSTANCE = Typeface.createFromAsset(
                    context.getAssets(), "fonts/pict0gramm-v3.ttf");
        }

        return INSTANCE;
    }

    private static Typeface INSTANCE;
{'fraction_non_alphanumeric': 0.08817204301075268, 'fraction_numerical': 0.006989247311827957, 'mean_word_length': 2.8057259713701432, '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': '1691428', 'n_tokens_mistral': 532, 'n_tokens_neox': 522, 'n_words': 137}