aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-10-16 03:12:22 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-10-16 03:12:22 +0000
commita6f2899b758b689b6a5b018803bb7abe166a57a2 (patch)
tree52d1c995387dc5e205e1445268f4b2f7c286a0e6
parent79392bbeae9c70f4a2ff1a81848b3d3087e53344 (diff)
downloadinfinity-for-reddit-a6f2899b758b689b6a5b018803bb7abe166a57a2.tar
infinity-for-reddit-a6f2899b758b689b6a5b018803bb7abe166a57a2.tar.gz
infinity-for-reddit-a6f2899b758b689b6a5b018803bb7abe166a57a2.tar.bz2
infinity-for-reddit-a6f2899b758b689b6a5b018803bb7abe166a57a2.tar.lz
infinity-for-reddit-a6f2899b758b689b6a5b018803bb7abe166a57a2.tar.xz
infinity-for-reddit-a6f2899b758b689b6a5b018803bb7abe166a57a2.tar.zst
infinity-for-reddit-a6f2899b758b689b6a5b018803bb7abe166a57a2.zip
Fix crash in anonymous mode in MainActivity.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java7
1 files changed, 2 insertions, 5 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
index 4d42621e..79481f1e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/MainActivity.java
@@ -31,7 +31,6 @@ import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.lifecycle.Lifecycle;
-import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -64,7 +63,6 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
-import ml.docilealligator.infinityforreddit.Account.Account;
import ml.docilealligator.infinityforreddit.Account.AccountViewModel;
import ml.docilealligator.infinityforreddit.ActivityToolbarInterface;
import ml.docilealligator.infinityforreddit.Adapter.NavigationDrawerRecyclerViewAdapter;
@@ -835,9 +833,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
accountViewModel = new ViewModelProvider(this,
new AccountViewModel.Factory(getApplication(), mRedditDataRoomDatabase, mAccountName)).get(AccountViewModel.class);
accountViewModel.getAccountsExceptCurrentAccountLiveData().observe(this, adapter::changeAccountsDataset);
- accountViewModel.getCurrentAccountLiveData().observe(this, new Observer<Account>() {
- @Override
- public void onChanged(Account account) {
+ accountViewModel.getCurrentAccountLiveData().observe(this, account -> {
+ if (account != null) {
adapter.updateKarma(account.getKarma());
}
});