<commit_before>package com.marverenic.reader.utils

import android.view.View

inline fun <V : View> V.whenMeasured(crossinline action: V.() -> Unit) {
    if (isLaidOut) {
        action()
    } else {
        viewTreeObserver.addOnGlobalLayoutListener {
            action()
        }
    }
}
<commit_msg>Fix listener not being released<commit_after>package com.marverenic.reader.utils

import android.view.View
import android.view.ViewTreeObserver

inline fun <V : View> V.whenMeasured(crossinline action: V.() -> Unit) {
    if (isLaidOut) {
        action()
    } else {
        viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
            override fun onGlobalLayout() {
                action()
                viewTreeObserver.removeOnGlobalLayoutListener(this)
            }
        })
    }
}

{'fraction_non_alphanumeric': 0.09799291617473435, 'fraction_numerical': 0.0, 'mean_word_length': 2.5780590717299576, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3224749', 'n_tokens_mistral': 249, 'n_tokens_neox': 244, 'n_words': 47}