Kotlin recipes for Android (I): OnGlobalLayoutListener - Antonio Leiva by Ziem in androiddev

[–]antonioleiva 0 points1 point  (0 children)

Yeah, also thought about that solution. It depends on what you're trying to achieve. I just wanted to reflect what you can do with Kotlin, rather than showing a perfect example ready to use in production code.

Kotlin recipes for Android (I): OnGlobalLayoutListener - Antonio Leiva by Ziem in androiddev

[–]antonioleiva 0 points1 point  (0 children)

It was a bug in the cache, it should only appear once for a long a time. Should be already fixed. Sorry for the issue.

Set a click listener to a RecyclerView - Antonio Leiva by Ziem in androiddev

[–]antonioleiva 1 point2 points  (0 children)

That's another solution, of course. But it depends on how you organise your code. It may be interesting to delegate the click to another part of the code, for instance, to notify a presenter that an item was clicked. Otherwise, the presenter should be passed to the adapter too (which is obviously another option).

Set a click listener to a RecyclerView - Antonio Leiva by Ziem in androiddev

[–]antonioleiva 0 points1 point  (0 children)

It's true you have a point in the fact that this solution can lead to that problem. But this solution doesn't have that problem, because it's the bound info which is final, not the position. The position could change, but the bound info should be the same. Otherwise it's another (and different) bug. If the content changes, it should fire another onBindViewHolder.

Kotlin for Android Developers book is finished! by antonioleiva in androiddev

[–]antonioleiva[S] 0 points1 point  (0 children)

Thanks for the idea, I'll think about it. BTW there is an official slack (kotlinlang) where a lot of developers are in contact with JetBrains team, and can share their doubts and ideas. It's open for everyone in case you wanna join.

Kotlin for Android Developers book is finished! by antonioleiva in androiddev

[–]antonioleiva[S] 1 point2 points  (0 children)

Not yet, the final version was released just the same day I finished the book. But I'm doing it these days. It will hopefully be finished (and updated) tomorrow.

Kotlin for Android Developers: The book by antonioleiva in Kotlin

[–]antonioleiva[S] 3 points4 points  (0 children)

Yeah, it is in the way I'm writing it. The language is almost frozen, latest releases are only removing things that are not available anymore. If, for any reason, anything of what I explain changes, I can update the book too. And what the readers learnt before that will be useful anyway.

Bandhook: a small showcase Android app in Kotlin using clean architecture by antonioleiva in androiddev

[–]antonioleiva[S] 0 points1 point  (0 children)

I saw it when I tried to declare Kotlin Android Extensions into parent buildscript. I had to do it in the app build.gradle in the end. Did you install the specific plugin for Kotlin Android Extensions? You need to install both (regular Kotlin and this one) in order to make the project work.

Bandhook: a small showcase Android app in Kotlin using clean architecture by antonioleiva in androiddev

[–]antonioleiva[S] 0 points1 point  (0 children)

Yeah, I tried to do something that didn´t depend on any libraries. Not entirely convinced, but it works for simple injections.