diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java index 4d3b6d4c6..865a45572 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/MainActivity.java @@ -148,9 +148,8 @@ public class MainActivity extends AppCompatActivity } }); - boolean menuWasSelected = false; mamageNewIntent(getIntent()); - if (savedInstanceState == null && !menuWasSelected) { + if (savedInstanceState == null) { navigationView.setCheckedItem(R.id.nav_home); navigationView.getMenu().performIdentifierAction(R.id.nav_home, 0); } diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java index ecc3f69d6..87ff7df11 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java @@ -614,6 +614,8 @@ public class Helper { .cacheOnDisk(true).resetViewBeforeLoading(true).build(); imageLoader = ImageLoader.getInstance(); 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); } @@ -640,11 +642,16 @@ public class Helper { activity.startActivity(myIntent); activity.finish(); //User is logged out to get a new token }else { - ownerStatus.setText(String.valueOf(account.getStatuses_count())); - ownerFollowers.setText(String.valueOf(account.getFollowers_count())); - ownerFollowing.setText(String.valueOf(account.getFollowing_count())); - username.setText(String.format("@%s",account.getUsername())); - displayedName.setText(account.getDisplay_name()); + if (ownerStatus != null) + ownerStatus.setText(String.valueOf(account.getStatuses_count())); + if (ownerFollowers != null) + ownerFollowers.setText(String.valueOf(account.getFollowers_count())); + 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); } }