diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java index f716332..4e2bfbc 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/activities/MainActivity.java @@ -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 */ diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/NotificationsFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/NotificationsFragment.java new file mode 100644 index 0000000..e1c3941 --- /dev/null +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/NotificationsFragment.java @@ -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); + } +} diff --git a/app/src/main/res/drawable/ic_notif.png b/app/src/main/res/drawable/ic_notif.png new file mode 100644 index 0000000..f920111 Binary files /dev/null and b/app/src/main/res/drawable/ic_notif.png differ diff --git a/app/src/main/res/layout/fragment_notifications.xml b/app/src/main/res/layout/fragment_notifications.xml new file mode 100644 index 0000000..3509b84 --- /dev/null +++ b/app/src/main/res/layout/fragment_notifications.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a08f207..6d55db8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -126,4 +126,5 @@ An error occurred while trying to create the post! Notifications Friends list + Notifications