-
Notifications
You must be signed in to change notification settings - Fork 14
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
second sample #6
Comments
My ideas to those questions:
|
@OyaCanli @GretaGri yes, we'd be using NewsApi for that purpose. Retrofit is good but as the focus here is to help people on Databinding mainly, so even simple http call is also fine. We've things implemented in simple form already in the first sample and so now we can have one example with best practice now. That's what I think here. |
I don't think retrofit is more complicated than making raw http request. But both are fine for me. |
@OyaCanli the use of included tag would be a nice addition here. For the ViewModel part, I'm not sure how you plan to do that because I've not done deep diving on this topic but I'm sure that you two have done enough research and so it must be something nice. So please go with what you find the best way there. For http request, I understand that, it's not easy itself but I've seen people working with it from beginning and so even if that's not easy, it look intuitive to them. Retrofit is really nice but people try it generally after already working with simple http request so maybe they'll find http request more natural to them 👍 |
Ok @rajtheinnovator. Let's go with http request. Frankly, I had found myself the underlying mechanisms of http request complicated as well. But it was a chunk of code that we could copy paste and reuse, so it was easy in that sense. I have been playing with viewmodels for a while, I'm comfortable with that. For passing the viewmodel to databinding vs passing directly the item, I'm not sure whichis better in fact. I guess it depends on case. I have seen both in google samples. I'll check them out again and compare. And we'll discuss it more as the project takes shape and we know more details. |
This sample is interesting: https://github.com/googlesamples/android-architecture/tree/todo-mvvm-databinding/todoapp/app/src |
One interesting thing is the implementation of BaseObservable to make the binding update itself. But I think we can do it with livedata as well. Once we decide the details of project structure, I'm voluntary to experiment with it. |
Looking at NewsApi, I see all articles have these attributes: source(name of journal), author, title, description, url(for the article), urlToImage, publishedAt, content. |
@GretaGri @rajtheinnovator Shall we finalize the structure of the app and share tasks to begin working? @GretaGri Do you want to again design layouts and reuse them on kotlin version? Or do you want to do something else this time? |
I recognized that we need to use special escape characters for logical operators, like in here: https://github.com/OyaCanli/TrainInventory-Firebase/blob/master/app/src/main/res/layout/fragment_train_list.xml#L34 |
I can work again with layouts and with Kotin codes. |
Ok, that sounds good @GretaGri. |
Shall we let you first make the layouts then @GretaGri ? Will you have time for that in the following days, for example? Otherwise I can make some parts without UI.. |
@OyaCanli I will try to work with it this weekend :) but you can start too on the parts that do not need layouts 💯 |
Ok, great @GretaGri. Yeah, I was thinking the same. I can work on different parts. Since we'll be working on different files, it won't be difficult to merge. Is it ok @rajtheinnovator ? |
@OyaCanli Yeah, I do think it's all fine. There should not be any issue when merging it. And obviously the approach looks good as this way we can avoid any delay and keep working on it continuously. |
@rajtheinnovator @GretaGri I worked on this today and added the parts not related to UI. I made a PR. I'll continue with the rest after Greta adds the layouts. I wonder something: I get this "Asynctask should be static.." warning. But the asynctask is inside the singleton repository, not inside the activity. Is there still a risk of memory leak? |
@OyaCanli if we're having something singleton, that's one of the best way to avoid memory leaks but if you'd like to really see in action if there is any memory leak, there is an awesome library which I like to use and you can check that yourself. Here's that: https://github.com/square/leakcanary. So give it a go and let me know what you find there. |
Thanks @rajtheinnovator ! I had heard LeakCanary, but haven't tried yet. I'll discover that when I have time. I have a pending PR by the way. |
@OyaCanli you can ask for any help if needed for LeakCanary, but I guess you can do that easily as it's not that tricky to use. |
@rajtheinnovator I tried out LeakCanary. No leaks are seen in our simple sample. |
That's great you found it helpful, @OyaCanli I too found that this helped me realize how and where the problems are in other parts of my various projects. Definitely a thing to have in our development toolbox :) |
@GretaGri I'm working on the second sample and once the data began to come from the api, the apperance of the layouts seem different than your intended designs. Titles are long and seem so huge all together. Sometimes authors are long.. And I felt the need to change some fields: descriptions are long for list items, so I want to remove them from there and add to details screen. And I want to seperate date and time either with an empty space or with a new line, or as two textboxes. So I'll make some adjustments in the layouts if you don't mind. You'll look at later and make further adjustments again if you wish, ok? |
So up to now, we have been saying that we want another databinding sample with network connection. Let's discuss the details of it.
-Are we using NewsApi ?
-How do we deal with network request? Retrofit? Raw http request?
-How will be the structure? Will we again show a list of items in recyclerview and a detail page?
-Normally, it is not good practice to make network request from main activity. It would be better to put it in ViewModel or a singleton Repository. But shall we avoid those for simplicity?
The text was updated successfully, but these errors were encountered: