INTENTS
Normal:
val intent = Intent(this, SomeOtherActivity::class.java)
intent.putExtra("id", 5)
startActivity(intent)
Anko :
startActivity("id" to 5)
// startActivity("id" to 5, "name" to
"John")
Slide 13
Slide 13 text
Functions for Implicit Intents
Slide 14
Slide 14 text
Dialogs
Toast :
toast(R.string.message)
longToast("Wow, such duration")
Alerts :
alert("Hi, I'm Roy", "Have you tried
turning it off and on again?") {
yesButton { toast("Oh…") }
noButton {}
}.show()
Slide 17
Slide 17 text
No content
Slide 18
Slide 18 text
Selector :
val countries = listOf("Russia", "USA",
"Japan", "Australia")
selector("Where are you from?", countries, {
dialogInterface, i ->
toast("So you're living in
${countries[i]}, right?")
})
Slide 19
Slide 19 text
No content
Slide 20
Slide 20 text
Others ...
Logging
Misc
Slide 21
Slide 21 text
Anko Layouts
Slide 22
Slide 22 text
● rendered by creating view object
in memory from XML file
● create view objects
● find views by id with
findViewById
Slide 23
Slide 23 text
● rendered by creating view object in memory from XML file
● create view objects
● find views by id with findViewById
Slide 24
Slide 24 text
PERFORMANCE
Slide 25
Slide 25 text
https://github.com/frogermcs/AndroidDevMetrics
Slide 26
Slide 26 text
No content
Slide 27
Slide 27 text
THE DEMO
https://github.com/enzoftware/anko-example
Slide 28
Slide 28 text
Also...
Slide 29
Slide 29 text
No content
Slide 30
Slide 30 text
No content
Slide 31
Slide 31 text
“Anko offers several solutions to the
traditional way of building layouts in
XML. It could improve your MVVM setup,
or you could make your layouts more
dynamic by adding some logic. And this
all for a very small cost, considering
all the extreme effort we do for clean
and high performing apps.”
-Simon Vergauwen
https://medium.com/@vergauwen.simon