mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 13:59:29 +00:00
Fixed application navigation issues.
This commit is contained in:
parent
22c51480a6
commit
f856cc471f
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user