mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-27 15:59:29 +00:00
Fixed application navigation issues.
This commit is contained in:
parent
22c51480a6
commit
f856cc471f
@ -134,8 +134,8 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
conversationsListHelper = new ConversationsListHelper(this, dbHelper);
|
conversationsListHelper = new ConversationsListHelper(this, dbHelper);
|
||||||
|
|
||||||
//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