Created notifications fragment.

This commit is contained in:
Pierre 2018-04-01 10:34:13 +02:00
parent de05f52ffd
commit e29f33d696
5 changed files with 63 additions and 0 deletions

View File

@ -27,6 +27,7 @@ import org.communiquons.android.comunic.client.data.utils.UiUtils;
import org.communiquons.android.comunic.client.ui.fragments.ConversationFragment;
import org.communiquons.android.comunic.client.ui.fragments.ConversationsListFragment;
import org.communiquons.android.comunic.client.ui.fragments.FriendsListFragment;
import org.communiquons.android.comunic.client.ui.fragments.NotificationsFragment;
import org.communiquons.android.comunic.client.ui.fragments.UpdateConversationFragment;
import org.communiquons.android.comunic.client.ui.fragments.UserInfosFragment;
import org.communiquons.android.comunic.client.ui.fragments.UserPageFragment;
@ -188,6 +189,11 @@ public class MainActivity extends AppCompatActivity
openFriendsFragment();
return true;*/
//If the user wants to open notifications
case R.id.main_bottom_navigation_notif:
openNotificationsFragment();
return true;
//If the user chose to show information about him
case R.id.main_bottom_navigation_me_view:
@ -265,6 +271,17 @@ public class MainActivity extends AppCompatActivity
}
/**
* Open notifications fragment
*/
void openNotificationsFragment(){
NotificationsFragment notifications = new NotificationsFragment();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.main_fragment, notifications);
transaction.addToBackStack(null);
transaction.commit();
}
/**
* Open the user information fragment
*/

View File

@ -0,0 +1,39 @@
package org.communiquons.android.comunic.client.ui.fragments;
import android.app.Fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.communiquons.android.comunic.client.R;
import org.communiquons.android.comunic.client.ui.activities.MainActivity;
/**
* Notifications fragment
*
* @author Pierre HUBERT
* Created by pierre on 4/1/18.
*/
public class NotificationsFragment extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_notifications, container, false);
}
@Override
public void onResume() {
super.onResume();
//Update the title of the application
getActivity().setTitle(R.string.fragment_notifications_title);
//Update the bottom navigation menu
((MainActivity) getActivity())
.setSelectedNavigationItem(R.id.main_bottom_navigation_notif);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>

View File

@ -126,4 +126,5 @@
<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>
<string name="fragment_notifications_title">Notifications</string>
</resources>