July 2018
Intermediate to advanced
242 pages
8h 6m
English
Let's start by testing how we can use our dialog() function in action. Let's use it to define a sample Dialog class instance:
val dialog = dialog { title { "Warning!" } message { text = "You have 99999 viruses on your computer!" color = "#FF0000" } image { File.createTempFile("red_alert", "png") } }
Now, we can invoke the show() function on the dialog variable, which is going print the following output to the console:
Dialog...Title: Warning! Image: [B@548c4f57 Message: You have 99999 viruses on your computer!
That's pretty cool! The DialogBuilder class allows us to compose instances of the Dialog type in a readable and natural way.
Implementing the new syntax for the Dialog class composition was possible by the use of higher-order ...
Read now
Unlock full access