https://kotlinlang.org logo
#android
Title
# android
n

Nav Singh

05/02/2020, 4:45 PM
p

Paul Woitaschek

05/03/2020, 9:45 AM
You should write it more like a dsl
Its quite error prone like it is now:
Copy code
context: Context,
    themeId: Int,
    onPositiveClick: () -> Unit = {},
    onNegativeClick: () -> Unit = {},
    onNeutralClick: () -> Unit = {},
    messageStringId: Int,
    titleId: Int = -1,
    cancelable: Boolean = false,
    positiveButtonTextId: Int,
    negativeButtonTextId: Int = -1,
    showNegativeButton: Boolean = false,
    showNeutralButton: Boolean = false,
    neutralButtonTextId: Int = -1
You can set onNegativeClick and negativeButtonTextId but forget set showNegativeButton etc
s

shaktiman_droid

05/03/2020, 4:43 PM
@Paul Woitaschek what’s good example of converting something like that into DSL which you said in your first comment ?
n

Nav Singh

05/26/2020, 12:23 AM
thanks for you r feedback @Paul Woitaschek
2 Views