Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

ENZO LIZAMA PAREDES @enzoftware

Slide 3

Slide 3 text

KOTLIN?

Slide 4

Slide 4 text

Android is stuck in Java 6 purgatory. https://twitter.com/donnfelker

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

compile "org.jetbrains.anko:anko-sdk15:$anko_version" compile "org.jetbrains.anko:anko-support-v4:$anko_version" compile 'org.jetbrains.anko:anko-appcompat-v7:0.9.1'

Slide 7

Slide 7 text

HELLO WORLD

Slide 8

Slide 8 text

verticalLayout { val name = editText() button("Say Hello") { onClick { toast("Hello, ${name.text}!")} } }

Slide 9

Slide 9 text

verticalLayout { var title = editText { id = R.id.todo_title hintResource = R.string.title_hint } button { textResource = R.string.add_todo onClick { view -> { // do something here } } } }

Slide 10

Slide 10 text

ANKO COMMONS

Slide 11

Slide 11 text

dependencies { compile "org.jetbrains.anko:anko-commons:$anko_version" }

Slide 12

Slide 12 text

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")

Slide 15

Slide 15 text

SnackBar : snackbar(view, "Hi there!") snackbar(view, R.string.message)

Slide 16

Slide 16 text

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

Slide 32

Slide 32 text

https://www.youtube.com/playlist?list=PLQ176F UIyIUY6UK1cgVsbdPYA3X5WLam5

Slide 33

Slide 33 text

@enzoftware