Fixed application navigation issues.

This commit is contained in:
Pierre HUBERT 2018-08-01 11:41:35 +02:00
parent 22c51480a6
commit f856cc471f
2 changed files with 11 additions and 6 deletions

View File

@ -135,7 +135,7 @@ public class MainActivity extends AppCompatActivity implements
//If it is the first time the application is launched, open notifications fragment
if (savedInstanceState == null){
openNotificationsFragment();
openNotificationsFragment(false);
}
}
@ -305,7 +305,7 @@ public class MainActivity extends AppCompatActivity implements
//Notification fragment
if(id == R.id.action_notifications){
openNotificationsFragment();
openNotificationsFragment(true);
}
//Friends list
@ -425,11 +425,15 @@ public class MainActivity extends AppCompatActivity implements
/**
* Open notifications fragment
*
* @param addToBackStack Specify whether the change must
* be added to backstack or not
*/
void openNotificationsFragment() {
void openNotificationsFragment(boolean addToBackStack) {
NotificationsFragment notifications = new NotificationsFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.main_fragment, notifications);
if(addToBackStack)
transaction.addToBackStack(null);
transaction.commit();
}

View File

@ -116,7 +116,7 @@ public class UserPageFragment extends Fragment {
super.onResume();
//Check if we got information about the user
if(userInfo == null){
if(userInfo == null || mTabLayout.getTabCount() < 2){
//Show loading alert dialog
loadingDialog = UiUtils.create_loading_dialog(getActivity());
@ -197,5 +197,6 @@ public class UserPageFragment extends Fragment {
mPager.setAdapter(adapter);
mTabLayout.setupWithViewPager(mPager);
}
}