mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 22:09:30 +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 it is the first time the application is launched, open notifications fragment
|
||||||
if (savedInstanceState == null){
|
if (savedInstanceState == null){
|
||||||
openNotificationsFragment();
|
openNotificationsFragment(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
|
|
||||||
//Notification fragment
|
//Notification fragment
|
||||||
if(id == R.id.action_notifications){
|
if(id == R.id.action_notifications){
|
||||||
openNotificationsFragment();
|
openNotificationsFragment(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Friends list
|
//Friends list
|
||||||
@ -425,11 +425,15 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Open notifications fragment
|
* 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();
|
NotificationsFragment notifications = new NotificationsFragment();
|
||||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||||
transaction.replace(R.id.main_fragment, notifications);
|
transaction.replace(R.id.main_fragment, notifications);
|
||||||
|
if(addToBackStack)
|
||||||
transaction.addToBackStack(null);
|
transaction.addToBackStack(null);
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ public class UserPageFragment extends Fragment {
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
//Check if we got information about the user
|
//Check if we got information about the user
|
||||||
if(userInfo == null){
|
if(userInfo == null || mTabLayout.getTabCount() < 2){
|
||||||
|
|
||||||
//Show loading alert dialog
|
//Show loading alert dialog
|
||||||
loadingDialog = UiUtils.create_loading_dialog(getActivity());
|
loadingDialog = UiUtils.create_loading_dialog(getActivity());
|
||||||
@ -197,5 +197,6 @@ public class UserPageFragment extends Fragment {
|
|||||||
|
|
||||||
mPager.setAdapter(adapter);
|
mPager.setAdapter(adapter);
|
||||||
mTabLayout.setupWithViewPager(mPager);
|
mTabLayout.setupWithViewPager(mPager);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user