From f3a49693a20560ea142b5d607c2b6bfd31b39162 Mon Sep 17 00:00:00 2001 From: Pierre Date: Mon, 25 Dec 2017 17:56:50 +0100 Subject: [PATCH] Fragments can update the title of the activity. --- .../client/fragments/ConversationsListFragment.java | 7 +++++++ .../comunic/client/fragments/FriendsListFragment.java | 8 ++++++++ .../comunic/client/fragments/UserInfosFragment.java | 8 ++++++++ app/src/main/res/values/strings.xml | 3 +++ 4 files changed, 26 insertions(+) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationsListFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationsListFragment.java index 44e533b..174ab03 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationsListFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationsListFragment.java @@ -122,6 +122,13 @@ public class ConversationsListFragment extends Fragment implements AdapterView.O } } + @Override + public void onResume() { + super.onResume(); + + getActivity().setTitle(R.string.fragment_conversationslist_title); + } + /** * Process the conversation list * diff --git a/app/src/main/java/org/communiquons/android/comunic/client/fragments/FriendsListFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/fragments/FriendsListFragment.java index 9cf0147..a6ad498 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/fragments/FriendsListFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/fragments/FriendsListFragment.java @@ -103,6 +103,14 @@ public class FriendsListFragment extends Fragment { } + @Override + public void onResume() { + super.onResume(); + + //Update the title of the application + getActivity().setTitle(R.string.fragment_friendslist_title); + } + @Override public void onStart() { super.onStart(); diff --git a/app/src/main/java/org/communiquons/android/comunic/client/fragments/UserInfosFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/fragments/UserInfosFragment.java index 168a68b..850b7aa 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/fragments/UserInfosFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/fragments/UserInfosFragment.java @@ -83,4 +83,12 @@ public class UserInfosFragment extends Fragment { }); } + + @Override + public void onResume() { + super.onResume(); + + //Update the title + getActivity().setTitle(R.string.fragment_userinfos_title); + } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4779808..c8a0c44 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -62,4 +62,7 @@ Do you want to remove selected image ? Yes No + Friends + Conversations + About me