Live data from Hacker News

Anko – Pleasant Android development in Kotlin

github.com

1–10 of 38 posts

Re: Anko – Pleasant Android development in Kotlin

#2
After a quick skim this seems great, but just one piece of a much bigger puzzle. Android activities, regardless of whether the view is constructed declaratively or in code, seem to always become an untestable mess that does way too much. At least, that's what happens if activities are used as intended. IMO, the bare minimum necessary to fix this is some more elegant alternative to AXML that, crucially, has some kind of declarative databinding support. Roll that into Anko and we're on our way to taming the activity.

Re: Anko – Pleasant Android development in Kotlin

#3
post #2

After a quick skim this seems great, but just one piece of a much bigger puzzle. Android activities, regardless of whether the view is constructed declaratively or in code, seem to always become an untestable mess that does way too much. At least, that's what happens if activities are used as intended. IMO, the bare minimum necessary to fix this is some more elegant alternative to AXML that, crucially, has some kind…

You might like Anvil: it's a declarative react-like UI library for Android. I personally use it a lot, and I normally write single-activity applications (e.g. I have my own backstack of views inside a single activity):

https://github.com/zserge/anvil

http://zserge.com/blog/anvil-2.html

Kotlin is supported as well (http://zserge.com/blog/anvil-kotlin.html)

Re: Anko – Pleasant Android development in Kotlin

#4
post #3
post #2

After a quick skim this seems great, but just one piece of a much bigger puzzle. Android activities, regardless of whether the view is constructed declaratively or in code, seem to always become an untestable mess that does way too much. At least, that's what happens if activities are used as intended. IMO, the bare minimum necessary to fix this is some more elegant alternative to AXML that, crucially, has some kind…

You might like Anvil: it's a declarative react-like UI library for Android. I personally use it a lot, and I normally write single-activity applications (e.g. I have my own backstack of views inside a single activity): https://github.com/zserge/anvil http://zserge.com/blog/anvil-2.html Kotlin is supported as well ( http://zserge.com/blog/anvil-kotlin.html )

Anvil looks really promising. I wonder why doesn't it use "linearLayout {}" instead "v {}" syntax?

Re: Anko – Pleasant Android development in Kotlin

#8
post #3
post #2

After a quick skim this seems great, but just one piece of a much bigger puzzle. Android activities, regardless of whether the view is constructed declaratively or in code, seem to always become an untestable mess that does way too much. At least, that's what happens if activities are used as intended. IMO, the bare minimum necessary to fix this is some more elegant alternative to AXML that, crucially, has some kind…

You might like Anvil: it's a declarative react-like UI library for Android. I personally use it a lot, and I normally write single-activity applications (e.g. I have my own backstack of views inside a single activity): https://github.com/zserge/anvil http://zserge.com/blog/anvil-2.html Kotlin is supported as well ( http://zserge.com/blog/anvil-kotlin.html )

Looks really promising, thanks for the hint. It's on my to-evaluate list along with: http://robobinding.github.io/RoboBinding/

Also, if you're open to Xamarin, there's a great library there called MvvmCross that gives you in-AXML databinding and a general feel similar to Angular.

Re: Anko – Pleasant Android development in Kotlin

#9
> XML is parsed on the device wasting CPU time and battery

It was my understanding the XML was compiled into a binary format for faster parsing on device, am I wrong on that?

EDIT: http://en.wikipedia.org/wiki/Android_application_package "resources.arsc: a file containing precompiled resources, such as binary XML for example." Ah yes, I think it does.

> Most of all, it allows no code reuse.

If we are talking code reuse in terms of having one common bit of layout that is used across several different layouts, actually you can: http://developer.android.com/training/improving-layouts/reus...

Also, the Android view system as it stands is incredible flexible.

You can provide different layouts and style rules for different screensizes and device configs - an kinda equivalent to the webs responsive design using CSS media queries.

Also, every view component is just a Java class. As well as allowing you to create your own class from scratch that you can just use as part of a view, you can also extend an existing view class and just change one bit of it's behaviour.

I don't especially mean to have a go at Anko - sorry. It's just that I think the Android views are actually pretty good, and certainly when I'm working on Android apps this isn't one of the major problems I have!

Re: Anko – Pleasant Android development in Kotlin

#10

> XML is parsed on the device wasting CPU time and battery It was my understanding the XML was compiled into a binary format for faster parsing on device, am I wrong on that? EDIT: http://en.wikipedia.org/wiki/Android_application_package "resources.arsc: a file containing precompiled resources, such as binary XML for example." Ah yes, I think it does. > Most of all, it allows no code reuse. If we are talking code reu…

[deleted]
Post reply on HN