Moved friends bottom menu item to activity menu.

This commit is contained in:
Pierre 2018-04-01 10:18:12 +02:00
parent d9b8c4d98e
commit de05f52ffd
5 changed files with 26 additions and 5 deletions

View File

@ -105,7 +105,7 @@ public class MainActivity extends AppCompatActivity
//Initialize DatabaseHelper //Initialize DatabaseHelper
dbHelper = DatabaseHelper.getInstance(this); dbHelper = DatabaseHelper.getInstance(this);
//Intialize conversation list helper //Initialize conversation list helper
conversationsListHelper = new ConversationsListHelper(this, dbHelper); conversationsListHelper = new ConversationsListHelper(this, dbHelper);
//If it is the first time the application is launched, start the user friends tab //If it is the first time the application is launched, start the user friends tab
@ -155,6 +155,12 @@ public class MainActivity extends AppCompatActivity
//Get action id //Get action id
int id = item.getItemId(); int id = item.getItemId();
//To display the list of friends
if(id == R.id.action_friends_list){
openFriendsFragment();
return true;
}
//Check for logout request //Check for logout request
if(id == R.id.action_logout){ if(id == R.id.action_logout){
confirmUserLogout(); confirmUserLogout();
@ -178,9 +184,9 @@ public class MainActivity extends AppCompatActivity
switch (item.getItemId()) { switch (item.getItemId()) {
//If the user clicked to show the friends list //If the user clicked to show the friends list
case R.id.main_bottom_navigation_friends_list: /*case R.id.main_bottom_navigation_friends_list:
openFriendsFragment(); openFriendsFragment();
return true; return true;*/
//If the user chose to show information about him //If the user chose to show information about him
case R.id.main_bottom_navigation_me_view: case R.id.main_bottom_navigation_me_view:

View File

@ -148,7 +148,8 @@ public class FriendsListFragment extends Fragment
//Update the bottom navigation menu //Update the bottom navigation menu
((MainActivity) getActivity()) ((MainActivity) getActivity())
.setSelectedNavigationItem(R.id.main_bottom_navigation_friends_list); //.setSelectedNavigationItem(R.id.main_bottom_navigation_friends_list);
.setSelectedNavigationItem(R.id.main_bottom_navigation_me_view);
//Refresh the friends list //Refresh the friends list
refresh_friend_list(); refresh_friend_list();

View File

@ -1,10 +1,16 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"> <menu xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:id="@+id/main_bottom_navigation_notif"
android:title="@string/navigation_bottom_notif_item"
android:icon="@drawable/ic_notif"/>
<!--<item
android:id="@+id/main_bottom_navigation_friends_list" android:id="@+id/main_bottom_navigation_friends_list"
android:title="@string/navigation_bottom_friends_item" android:title="@string/navigation_bottom_friends_item"
android:icon="@drawable/ic_menu_allfriends" android:icon="@drawable/ic_menu_allfriends"
/> />-->
<!--<item <!--<item
android:id="@+id/main_bottom_navigation_users_view" android:id="@+id/main_bottom_navigation_users_view"

View File

@ -2,6 +2,12 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<!-- Display friends list -->
<item
android:id="@+id/action_friends_list"
android:title="@string/main_menu_friends_list" />
<!-- Sign out -->
<item <item
android:id="@+id/action_logout" android:id="@+id/action_logout"
android:title="@string/main_menu_logout" android:title="@string/main_menu_logout"

View File

@ -124,4 +124,6 @@
<string name="btn_show_create_form_description">Show / Hide create post form.</string> <string name="btn_show_create_form_description">Show / Hide create post form.</string>
<string name="err_post_content_too_short">The content of the post is too short!</string> <string name="err_post_content_too_short">The content of the post is too short!</string>
<string name="err_submit_post">An error occurred while trying to create the post!</string> <string name="err_submit_post">An error occurred while trying to create the post!</string>
<string name="navigation_bottom_notif_item">Notifications</string>
<string name="main_menu_friends_list">Friends list</string>
</resources> </resources>