Open rajtheinnovator opened 5 years ago
@rajtheinnovator It was Greta who was going to do kotlin version of NewsApi. But I don't know where she is regarding that. If you are too busy @GretaGri, I can make that as well. I learned kotlin in the meanwhile.
@OyaCanli for now let's go with the article and when Greta gets time, she can do the sample. But just in case, it she'd not be free by that time, one of me or you can do that Kotlin version.
@rajtheinnovator Sorry I forgot to inform you. I have talked to Greta, she was still in hospital then. (Hopefully they returned home now) She said she'll be busy for a while and that I can do it if I am willing and if I want it to be done sooner. So I'll be doing that one as well. No big deal, kotlin practice for me ;) And I copy paste resources from java version. It''s not gonna take much time.
Sure thing, @OyaCanli :+1: Please continue with it and let me know if any help is needed from my side.
@rajtheinnovator Already made it up and running :) But I need to polish kotlin code. I found that there is an extension function URL("yourUrl").readText() in Kotlin, which replaces quite a large chunk of code in our NetworkUtils. But it is not advised for large data streams. I'm not sure if ours count as a large api request. Do you have any idea about this? (I tried and it works fine, by the way) Another question: shall we use coroutines instead of asynctask?
@OyaCanli as the api we're using is returning 20 items in a single call, so I think it's safe to use the method readText()
. However, if the api is not paginated and can return lot more result set, then in that case, it'd be preferred not to use it. To conclude, we can use this method in our sample and to make it clear further, we can leave a comment there regarding the issue/risk it involves.
For the part of coroutines, I think it's a special topic in itself and not many developers are still used to it, specially the ones trying Kotlin first time. So maybe we should leave it for other separate repository.
We are returning only 10 items in fact. Ok, cool. Thanks!
@GretaGri I think you were working on this branch: https://github.com/enpassio/Databinding/tree/dev-databinding-newsapi-kotlin Have you done it? If so, can you make a PR in the respective branch? Or is it that, this is already implemented by you @OyaCanli on your side?