maxkeppeler / sheets

⭐ ‎‎‎‏‏‎ ‎Offers a range of beautiful sheets (dialogs & bottom sheets) for quick use in your project. Includes many ways to customize sheets.
https://maxkeppeler.github.io/sheets/
Apache License 2.0
921 stars 77 forks source link

Option constructor with long click listener without specifying sub-text. #110

Closed GraxCode closed 2 years ago

GraxCode commented 2 years ago

Can't find a constructor that allows specifying a long click listener without a subtitle text.

maxkeppeler commented 2 years ago

Will be added

maxkeppeler commented 2 years ago

I just checked. There are some constructors for your use case. subtitleText can be null.

constructor(
        @DrawableRes drawableRes: Int,
        titleText: String,
        subtitleText: String? = null,
        longClickListener: OptionLongClickListener? = null
    ) : this() {
        this.drawableRes = drawableRes
        this.titleText = titleText
        this.subtitleText = subtitleText
        this.longClickListener = longClickListener
    }

    constructor(
        drawable: Drawable,
        @StringRes titleTextRes: Int,
        subtitleText: String? = null,
        longClickListener: OptionLongClickListener? = null
    ) : this() {
        this.drawable = drawable
        this.titleTextRes = titleTextRes
        this.subtitleText = subtitleText
        this.longClickListener = longClickListener
    }

So your call would look something like this:

Option(R.drawable.icon, "Title of the option") { /* onLongClick */  }