Fixes some crashes when clicking on a notification

This commit is contained in:
tom79 2017-05-31 07:40:55 +02:00
parent 18da5dde02
commit 7992f6e133
2 changed files with 13 additions and 7 deletions

View File

@ -148,9 +148,8 @@ public class MainActivity extends AppCompatActivity
} }
}); });
boolean menuWasSelected = false;
mamageNewIntent(getIntent()); mamageNewIntent(getIntent());
if (savedInstanceState == null && !menuWasSelected) { if (savedInstanceState == null) {
navigationView.setCheckedItem(R.id.nav_home); navigationView.setCheckedItem(R.id.nav_home);
navigationView.getMenu().performIdentifierAction(R.id.nav_home, 0); navigationView.getMenu().performIdentifierAction(R.id.nav_home, 0);
} }

View File

@ -614,6 +614,8 @@ public class Helper {
.cacheOnDisk(true).resetViewBeforeLoading(true).build(); .cacheOnDisk(true).resetViewBeforeLoading(true).build();
imageLoader = ImageLoader.getInstance(); imageLoader = ImageLoader.getInstance();
NavigationView navigationView = (NavigationView) activity.findViewById(R.id.nav_view); NavigationView navigationView = (NavigationView) activity.findViewById(R.id.nav_view);
navigationView.getMenu().clear();
navigationView.inflateMenu(R.menu.activity_main_drawer);
updateHeaderAccountInfo(activity, account, navigationView, imageLoader, options); updateHeaderAccountInfo(activity, account, navigationView, imageLoader, options);
} }
@ -640,11 +642,16 @@ public class Helper {
activity.startActivity(myIntent); activity.startActivity(myIntent);
activity.finish(); //User is logged out to get a new token activity.finish(); //User is logged out to get a new token
}else { }else {
ownerStatus.setText(String.valueOf(account.getStatuses_count())); if (ownerStatus != null)
ownerFollowers.setText(String.valueOf(account.getFollowers_count())); ownerStatus.setText(String.valueOf(account.getStatuses_count()));
ownerFollowing.setText(String.valueOf(account.getFollowing_count())); if (ownerFollowers != null)
username.setText(String.format("@%s",account.getUsername())); ownerFollowers.setText(String.valueOf(account.getFollowers_count()));
displayedName.setText(account.getDisplay_name()); if (ownerFollowing != null)
ownerFollowing.setText(String.valueOf(account.getFollowing_count()));
if (username != null)
username.setText(String.format("@%s",account.getUsername()));
if (displayedName != null)
displayedName.setText(account.getDisplay_name());
imageLoader.displayImage(account.getAvatar(), profilePicture, options); imageLoader.displayImage(account.getAvatar(), profilePicture, options);
} }
} }