aboutsummaryrefslogblamecommitdiff
path: root/app/src/main/java/SubscribedSubredditDatabase/SubscribedSubredditViewModel.java
blob: 8598dd557dabe459b8022ebbdd81587be45afc6b (plain) (tree)
1
                                    
























                                                                                               
package SubscribedSubredditDatabase;

import android.app.Application;
import android.arch.lifecycle.AndroidViewModel;
import android.arch.lifecycle.LiveData;

import java.util.List;

public class SubscribedSubredditViewModel extends AndroidViewModel {
    private SubscribedSubredditRepository mSubscribedSubredditRepository;
    private LiveData<List<SubscribedSubredditData>> mAllSubscribedSubreddits;

    public SubscribedSubredditViewModel(Application application) {
        super(application);
        mSubscribedSubredditRepository = new SubscribedSubredditRepository(application);
        mAllSubscribedSubreddits = mSubscribedSubredditRepository.getAllSubscribedSubreddits();
    }

    public LiveData<List<SubscribedSubredditData>> getAllSubscribedSubreddits() {
        return mAllSubscribedSubreddits;
    }

    public void insert(SubscribedSubredditData subscribedSubredditData) {
        mSubscribedSubredditRepository.insert(subscribedSubredditData);
    }
}