aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/Account/AccountViewModel.java
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-08-08 12:05:45 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-08-08 12:05:45 +0000
commite542ac51388b9293297bb74b851dcb5ded621a3e (patch)
treec6c7073946063ca1a430f85ce0335d51d8d0812b /app/src/main/java/Account/AccountViewModel.java
parent5b5da3d3fd44d79bc301546b7be94de0a206e020 (diff)
downloadinfinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.tar
infinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.tar.gz
infinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.tar.bz2
infinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.tar.lz
infinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.tar.xz
infinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.tar.zst
infinity-for-reddit-e542ac51388b9293297bb74b851dcb5ded621a3e.zip
Log in other reddit accounts are available. Add an account switcher in the navigation drawer in MainActivity.
Diffstat (limited to 'app/src/main/java/Account/AccountViewModel.java')
-rw-r--r--app/src/main/java/Account/AccountViewModel.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/src/main/java/Account/AccountViewModel.java b/app/src/main/java/Account/AccountViewModel.java
index ab6e9663..15fe6143 100644
--- a/app/src/main/java/Account/AccountViewModel.java
+++ b/app/src/main/java/Account/AccountViewModel.java
@@ -8,22 +8,30 @@ import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;
+import java.util.List;
+
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
public class AccountViewModel extends AndroidViewModel {
private AccountRepository mAccountRepository;
private LiveData<Account> mAccountLiveData;
+ private LiveData<List<Account>> mAccountsExceptCurrentAccountLiveData;
public AccountViewModel(Application application, RedditDataRoomDatabase redditDataRoomDatabase, String id) {
super(application);
mAccountRepository = new AccountRepository(redditDataRoomDatabase, id);
mAccountLiveData = mAccountRepository.getAccountLiveData();
+ mAccountsExceptCurrentAccountLiveData = mAccountRepository.getAccountsExceptCurrentAccountLiveData();
}
public LiveData<Account> getAccountLiveData() {
return mAccountLiveData;
}
+ public LiveData<List<Account>> getAccountsExceptCurrentAccountLiveData() {
+ return mAccountsExceptCurrentAccountLiveData;
+ }
+
public void insert(Account userData) {
mAccountRepository.insert(userData);
}