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

Sabrina/loadfrom api #17

Merged
merged 6 commits into from Mar 10, 2020
Merged

Sabrina/loadfrom api #17

merged 6 commits into from Mar 10, 2020

Conversation

@sabrina-li
Copy link
Contributor

sabrina-li commented Mar 9, 2020

adding network call in ProductRepository to fetch a list of product available for store during on create
refactor repository product in cart to 'item', and product for market as 'product'
use view model to pass product list to market fragment, which in turn observes the live data

market fragment will then populate the recycler view using the data received via recycler adapter(to be added)

import java.util.List;

public class ProductRepository {

private ProductDao mProductDao;
private LiveData<List<Product>> mAllProducts;
private LiveData<List<Product>> mAllItems; //items are in cart
private MutableLiveData<List<Product>> mAllProducts; //products are sold in shop, fetched from API

This comment has been minimized.

Copy link
@patrick-fs

patrick-fs Mar 10, 2020

Member

Just curious: why use LiveData for cart items but MutableLiveData for products?

Copy link
Member

patrick-fs left a comment

LGTM. I had one question, me: leveling up in Android.

@sabrina-li sabrina-li merged commit 0d8a0fb into master Mar 10, 2020
@sabrina-li sabrina-li deleted the sabrina/loadfromAPI branch Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.