From 104ddfb8cb890811a631f4b194c684350bf59d17 Mon Sep 17 00:00:00 2001 From: Pierre Date: Thu, 12 Apr 2018 15:35:51 +0200 Subject: [PATCH] Fix a issue on Android 5.0 --- .../ui/fragments/NotificationsFragment.java | 8 ++++---- .../client/ui/fragments/SinglePostFragment.java | 17 ++++++----------- 2 files changed, 10 insertions(+), 15 deletions(-) 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 index 378a08d..e29c4e2 100644 --- 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 @@ -85,14 +85,14 @@ public class NotificationsFragment extends Fragment implements View.OnCreateCont private onPostOpenListener mOpenPostListener; @Override - public void onAttach(Context context) { - super.onAttach(context); + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); //Create notifications helper - mNotificationsHelper = new NotificationsHelper(context); + mNotificationsHelper = new NotificationsHelper(getActivity()); //Create get users helper - mUsersInfoHelper = new GetUsersHelper(context); + mUsersInfoHelper = new GetUsersHelper(getActivity()); } @Nullable diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/SinglePostFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/SinglePostFragment.java index 8c27d44..2ffa2d2 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/SinglePostFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/SinglePostFragment.java @@ -65,23 +65,18 @@ public class SinglePostFragment extends Fragment { */ private GetUsersHelper mGetUserHelper; - @Override - public void onAttach(Context context) { - super.onAttach(context); - - //Create post helper - mPostsHelper = new PostsHelper(context); - - //Create get user helper - mGetUserHelper = new GetUsersHelper(context); - } - @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Get post ID mPostID = getArguments().getInt(ARGUMENT_POST_ID); + + //Create post helper + mPostsHelper = new PostsHelper(getActivity()); + + //Create get user helper + mGetUserHelper = new GetUsersHelper(getActivity()); } @Nullable