<commit_before>/*
 * Copyright 2020 <NAME>. Use of this source code is governed by the Apache 2.0 license.
 */

package splitties.alertdialog.material

import android.content.Context
import android.graphics.drawable.Drawable
import androidx.annotation.DrawableRes
import androidx.appcompat.app.AlertDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import splitties.alertdialog.appcompat.message
import splitties.alertdialog.appcompat.title

/**
 * Instantiates an [MaterialAlertDialogBuilder] for the [Context], applies the [dialogConfig] lambda to
 * it, then creates an [AlertDialog] from the builder, and returns it, so you can call
 * [AlertDialog.show] on the created dialog.
 */
inline fun Context.materialAlertDialog(dialogConfig: MaterialAlertDialogBuilder.() -> Unit): AlertDialog {
    return MaterialAlertDialogBuilder(this)
        .apply(dialogConfig)
        .create()
}

/**
 * Instantiates an [MaterialAlertDialogBuilder] for the [Context], sets the passed [title], [message] and
 * [iconResource], applies the [dialogConfig] lambda to it, then creates an [AlertDialog] from
 * the builder, and returns it, so you can call [AlertDialog.show] on the created dialog.
 */
inline fun Context.materialAlertDialog(
    title: CharSequence? = null,
    message: CharSequence? = null,
    @DrawableRes iconResource: Int = 0,
    dialogConfig: MaterialAlertDialogBuilder.() -> Unit = {}
): AlertDialog {
    return MaterialAlertDialogBuilder(this).apply {
        this.title = title
        this.message = message
        setIcon(iconResource)
        dialogConfig()
    }.create()
}

/**
 * Instantiates an [MaterialAlertDialogBuilder] for the [Context], sets the passed [title], [message] and
 * [icon], applies the [dialogConfig] lambda to it, then creates an [AlertDialog] from
 * the builder, and returns it, so you can call [AlertDialog.show] on the created dialog.
 */
inline fun Context.materialAlertDialog(
    title: CharSequence? = null,
    message: CharSequence? = null,
    icon: Drawable? = null,
    dialogConfig: MaterialAlertDialogBuilder.() -> Unit = {}
): AlertDialog {
    return MaterialAlertDialogBuilder(this).apply {
        this.title = title
        this.message = message
        setIcon(icon)
        dialogConfig()
    }.create()
}

/** Write only property that sets backgroundInsetStart. */
inline var MaterialAlertDialogBuilder.backgroundInsetStart: Int
    @Deprecated(NO_GETTER, level = DeprecationLevel.HIDDEN) get() = noGetter
    set(value) {
        setBackgroundInsetStart(value)
    }
<commit_msg>Fix article not update in KDoc<commit_after>/*
 * Copyright 2020 <NAME>. Use of this source code is governed by the Apache 2.0 license.
 */

package splitties.alertdialog.material

import android.content.Context
import android.graphics.drawable.Drawable
import androidx.annotation.DrawableRes
import androidx.appcompat.app.AlertDialog
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import splitties.alertdialog.appcompat.message
import splitties.alertdialog.appcompat.title

/**
 * Instantiates a [MaterialAlertDialogBuilder] for the [Context], applies the [dialogConfig] lambda to
 * it, then creates an [AlertDialog] from the builder, and returns it, so you can call
 * [AlertDialog.show] on the created dialog.
 */
inline fun Context.materialAlertDialog(dialogConfig: MaterialAlertDialogBuilder.() -> Unit): AlertDialog {
    return MaterialAlertDialogBuilder(this)
        .apply(dialogConfig)
        .create()
}

/**
 * Instantiates a [MaterialAlertDialogBuilder] for the [Context], sets the passed [title], [message] and
 * [iconResource], applies the [dialogConfig] lambda to it, then creates an [AlertDialog] from
 * the builder, and returns it, so you can call [AlertDialog.show] on the created dialog.
 */
inline fun Context.materialAlertDialog(
    title: CharSequence? = null,
    message: CharSequence? = null,
    @DrawableRes iconResource: Int = 0,
    dialogConfig: MaterialAlertDialogBuilder.() -> Unit = {}
): AlertDialog {
    return MaterialAlertDialogBuilder(this).apply {
        this.title = title
        this.message = message
        setIcon(iconResource)
        dialogConfig()
    }.create()
}

/**
 * Instantiates a [MaterialAlertDialogBuilder] for the [Context], sets the passed [title], [message] and
 * [icon], applies the [dialogConfig] lambda to it, then creates an [AlertDialog] from
 * the builder, and returns it, so you can call [AlertDialog.show] on the created dialog.
 */
inline fun Context.materialAlertDialog(
    title: CharSequence? = null,
    message: CharSequence? = null,
    icon: Drawable? = null,
    dialogConfig: MaterialAlertDialogBuilder.() -> Unit = {}
): AlertDialog {
    return MaterialAlertDialogBuilder(this).apply {
        this.title = title
        this.message = message
        setIcon(icon)
        dialogConfig()
    }.create()
}

/** Write only property that sets backgroundInsetStart. */
inline var MaterialAlertDialogBuilder.backgroundInsetStart: Int
    @Deprecated(NO_GETTER, level = DeprecationLevel.HIDDEN) get() = noGetter
    set(value) {
        setBackgroundInsetStart(value)
    }

{'fraction_non_alphanumeric': 0.09813809154383243, 'fraction_numerical': 0.0027152831652443757, 'mean_word_length': 4.095849802371541, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '2376398', 'n_tokens_mistral': 1403, 'n_tokens_neox': 1376, 'n_words': 439}