Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Databinding sample using NewsApi in Kotlin #28

Open
rajtheinnovator opened this issue Mar 4, 2019 · 7 comments
Open

Databinding sample using NewsApi in Kotlin #28

rajtheinnovator opened this issue Mar 4, 2019 · 7 comments
Assignees

Comments

@rajtheinnovator
Copy link
Member

@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?

@OyaCanli
Copy link
Member

OyaCanli commented Mar 5, 2019

@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.

@rajtheinnovator
Copy link
Member Author

@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.

@OyaCanli
Copy link
Member

OyaCanli commented Mar 9, 2019

@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.

@rajtheinnovator
Copy link
Member Author

Sure thing, @OyaCanli 👍 Please continue with it and let me know if any help is needed from my side.

@OyaCanli
Copy link
Member

@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?

@rajtheinnovator
Copy link
Member Author

@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.

@OyaCanli
Copy link
Member

We are returning only 10 items in fact. Ok, cool. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants