<commit_before>package co.zsmb.materialdrawerkt.draweritems

import android.graphics.drawable.Drawable
import co.zsmb.materialdrawerkt.DrawerMarker
import co.zsmb.materialdrawerkt.draweritems.badgeable.BadgeableKt
import co.zsmb.materialdrawerkt.nonReadable
import com.mikepenz.materialdrawer.holder.BadgeStyle
import com.mikepenz.materialdrawer.holder.DimenHolder
import com.mikepenz.materialdrawer.holder.StringHolder

/**
 * Adds a badge with the given [text].
 */
fun BadgeableKt.badge(text: String = "", setup: BadgeKt.() -> Unit = {}) {
    val badge = BadgeKt(text)
    badge.setup()
    this.badgeHolder = badge.holder
    this.badgeStyle = badge.style
}

@DrawerMarker
class BadgeKt(text: String) {

    internal val style = BadgeStyle()
    internal val holder = StringHolder(text)

    /**
     * The text of the badge given by a String.
     *
     * Wraps the withBadge function. Non readable property.
     */
    var text: String
        get() = nonReadable()
        set(value) {
            holder.text = value
        }

    /**
     * The text of the badge given by a String resource.
     *
     * Wraps the withBadge function. Non readable property.
     */
    var textRes: Int
        get() = nonReadable()
        set(value) {
            holder.textRes = value
        }

    /**
     * The background of the badge as a Drawable.
     *
     * Wraps the withBadgeBackground function. Non readable property.
     */
    var backgroundDrawable: Drawable
        get() = nonReadable()
        set(value) {
            style.withBadgeBackground(value)
        }

    /**
     * The color of the badge, given as a Long in argb format.
     *
     * Wraps the withColor function. Non readable property.
     */
    var color: Long
        get() = nonReadable()
        set(value) {
            style.withColor(value.toInt())
        }

    /**
     * The color of the badge, given with a color resource.
     *
     * Wraps the withColor function. Non readable property.
     */
    var colorRes: Int
        get() = nonReadable()
        set(value) {
            style.withColor(value)
        }

    /**
     * The color of the badge when it's tapped, given as a Long in argb format.
     *
     * Wraps the withColorPressed function. Non readable property.
     */
    var colorPressed: Long
        get() = nonReadable()
        set(value) {
            style.withColorPressed(value.toInt())
        }

    /**
     * The color of the badge when it's tapped, given with a color resource.
     *
     * Wraps the withColorPressedRes function. Non readable property.
     */
    var colorPressedRes: Int
        get() = nonReadable()
        set(value) {
            style.withColorPressedRes(value)
        }

    /**
     * The corner radius of the badge, in pixels.
     *
     * Wraps the withCorners function. Non readable property.
     */
    var cornersPx: Int
        get() = nonReadable()
        set(value) {
            style.withCorners(value)
        }

    /**
     * The corner radius of the badge, in dps.
     *
     * Wraps the withCornersDp function. Non readable property.
     */
    var cornersDp: Int
        get() = nonReadable()
        set(value) {
            style.withCornersDp(value)
        }

    /**
     * The background of the badge as a GradientDrawable resource.
     *
     * Wraps the withGradientDrawable function. Non readable property.
     */
    var gradientDrawableRes: Int
        get() = nonReadable()
        set(value) {
            style.withGradientDrawable(value)
        }

    /**
     * The minimum width of the badge (more precisely, the badge's text), in pixels.
     *
     * Wraps the withMinWidth function. Non readable property.
     */
    var minWidthPx: Int
        get() = nonReadable()
        set(value) {<commit_msg>Last Px / Dp / Res properties sorted out, fixed #30<commit_after>package co.zsmb.materialdrawerkt.draweritems

import android.graphics.drawable.Drawable
import co.zsmb.materialdrawerkt.DrawerMarker
import co.zsmb.materialdrawerkt.draweritems.badgeable.BadgeableKt
import co.zsmb.materialdrawerkt.nonReadable
import com.mikepenz.materialdrawer.holder.BadgeStyle
import com.mikepenz.materialdrawer.holder.DimenHolder
import com.mikepenz.materialdrawer.holder.StringHolder

/**
 * Adds a badge with the given [text].
 */
fun BadgeableKt.badge(text: String = "", setup: BadgeKt.() -> Unit = {}) {
    val badge = BadgeKt(text)
    badge.setup()
    this.badgeHolder = badge.holder
    this.badgeStyle = badge.style
}

@DrawerMarker
class BadgeKt(text: String) {

    internal val style = BadgeStyle()
    internal val holder = StringHolder(text)

    /**
     * The text of the badge given by a String.
     *
     * Wraps the withBadge function. Non readable property.
     */
    var text: String
        get() = nonReadable()
        set(value) {
            holder.text = value
        }

    /**
     * The text of the badge given by a String resource.
     *
     * Wraps the withBadge function. Non readable property.
     */
    var textRes: Int
        get() = nonReadable()
        set(value) {
            holder.textRes = value
        }

    /**
     * The background of the badge as a Drawable.
     *
     * Wraps the withBadgeBackground function. Non readable property.
     */
    var backgroundDrawable: Drawable
        get() = nonReadable()
        set(value) {
            style.withBadgeBackground(value)
        }

    /**
     * The color of the badge, given as a Long in argb format.
     *
     * Wraps the withColor function. Non readable property.
     */
    var color: Long
        get() = nonReadable()
        set(value) {
            style.withColor(value.toInt())
        }

    /**
     * The color of the badge, given with a color resource.
     *
     * Wraps the withColor function. Non readable property.
     */
    var colorRes: Int
        get() = nonReadable()
        set(value) {
            style.withColor(value)
        }

    /**
     * The color of the badge when it's tapped, given as a Long in argb format.
     *
     * Wraps the withColorPressed function. Non readable property.
     */
    var colorPressed: Long
        get() = nonReadable()
        set(value) {
            style.withColorPressed(value.toInt())
        }

    /**
     * The color of the badge when it's tapped, given with a color resource.
     *
     * Wraps the withColorPressedRes function. Non readable property.
     */
    var colorPressedRes: Int
        get() = nonReadable()
        set(value) {
            style.withColorPressedRes(value)
        }

    /**
     * The corner radius of the badge, in pixels.
     *
     * Wraps the withCorners function. Non readable property.
     */
    var cornersPx: Int
        get() = nonReadable()
        set(value) {
            style.withCorners(value)
        }

    /**
     * The corner radius of the badge, in dps.
     *
     * Wraps the withCornersDp function. Non readable property.
     */
    var cornersDp: Int
        get() = nonReadable()
        set(value) {
            style.withCornersDp(value)
        }

    /**
     * The corner radius of the badge, as a dimension resource.
     *
     * Wraps the withCornersDp function. Non readable property.
     */
    var cornersRes: Int
        get() = nonReadable()
        set(value) {
            style.javaClass.declaredFields.find { it.name == "mCorners" }?.let {
                it.isAccessible = true
                it.set(style, DimenHolder.fromResource(value))
            }
        }

    /**
     * The background of the badge as a GradientDrawable resource.
     *
     * Wraps the withGradientDrawable function. Non readable property.
     */
    var gradientDrawableRes: Int
        get() = nonReadable()
        set(value) {
            style.withGradientDrawable(value)
        }

    /**
     * The minimum width of the badge (more precisely, the badge's text), in pixels.
     *
     * Wraps the withMinWidth function. Non readable property.
     */
    var minWidthPx: Int
        get() = nonReadable()
        set(value) {
{'fraction_non_alphanumeric': 0.09512617516081148, 'fraction_numerical': 0.00024740227610094015, 'mean_word_length': 2.0066939382670137, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4556309', 'n_tokens_mistral': 2486, 'n_tokens_neox': 2395, 'n_words': 677}