From e29f33d6967a3c9804b7f1f9eaa81cbb476a013b Mon Sep 17 00:00:00 2001 From: Pierre Date: Sun, 1 Apr 2018 10:34:13 +0200 Subject: [PATCH] Created notifications fragment. --- .../client/ui/activities/MainActivity.java | 17 ++++++++ .../ui/fragments/NotificationsFragment.java | 39 ++++++++++++++++++ app/src/main/res/drawable/ic_notif.png | Bin 0 -> 2149 bytes .../res/layout/fragment_notifications.xml | 6 +++ app/src/main/res/values/strings.xml | 1 + 5 files changed, 63 insertions(+) create mode 100644 app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/NotificationsFragment.java create mode 100644 app/src/main/res/drawable/ic_notif.png create mode 100644 app/src/main/res/layout/fragment_notifications.xml 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 0000000000000000000000000000000000000000..f9201118ad157b19606175875c7db33ba8efde7d GIT binary patch literal 2149 zcmV-r2%7haP)UM9Ze5<#0QT=3A6nnEp=a^g));c6Uv!ytSB9A}*N91A+Z zv5=Z*b!r5HQYnS8Ivu7C##8HPnRX`e1S+Sfnc)%?1_qfBqL+j-(QIHPyUB&^hxTr$ zgS>9YK4Jggb~f{5_s7HYvYUMtCI|we6ZtS`0veizrZfM%1L}c09FFb%{r#(?QmH>F zDe2!dG|4fW&C2@v`aNE+H=Q5|CJe)2kx0~2US57VGc(gj)#H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H{-{(c{}dM&_iDanvRJG!l}Z)Ww^uMvo;*n@ zXrWMO@9pi4ce~wbQ?OIo+uMJnQmO9d=jXS*diClnf*|}X7Rw(91QKSu4wI3Q@mWDZ zK}%FGfKc^4EPMCv{p*`|apL0Qd{U{@v~%Z9i$bCJCj>#zu3fu2F$_zXVY2nbrAwFg zNBevz3+?rKKRS5u;BUNM?~kYbS7b6V27?g{g+gy#fnd#=HD8`TfBrAgeE$mNp&{tM zKQ%jY+^tBha2`|8-=?LdrMR`VwQw#=BMStA{=B@rzn7Gh zd`6{n0P4k&Mx!yWt*tHH?RKxnaeP%M6ymX1tO+)o?O(TUoh>IPr$?z&{)39g4%6=i bUz+>}q|TFi9&-aV00000NkvXXu0mjfs(KkM literal 0 HcmV?d00001 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