blob: 9ed8ac934335d2a482c2d74c579c1bcd94617787 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package SubscribedSubredditDatabase;
import android.app.Application;
import androidx.lifecycle.AndroidViewModel;
import androidx.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);
}
}
|