From 4e90fd9793f05197d452a2984c6f75a1b0e723a8 Mon Sep 17 00:00:00 2001 From: Pierre Date: Wed, 6 Dec 2017 18:46:49 +0100 Subject: [PATCH] Created conversation list fragment --- .../android/comunic/client/MainActivity.java | 19 ++++++++++++++++++- .../fragments/ConversationsListFragment.java | 17 +++++++++++++++++ .../main/res/menu/main_bottom_navigation.xml | 5 +++++ app/src/main/res/values/strings.xml | 1 + 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationsListFragment.java diff --git a/app/src/main/java/org/communiquons/android/comunic/client/MainActivity.java b/app/src/main/java/org/communiquons/android/comunic/client/MainActivity.java index 77e830e..9d551b8 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/MainActivity.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/MainActivity.java @@ -17,6 +17,7 @@ import org.communiquons.android.comunic.client.data.Account.Account; import org.communiquons.android.comunic.client.data.Account.AccountUtils; import org.communiquons.android.comunic.client.data.DatabaseHelper; import org.communiquons.android.comunic.client.data.friendsList.FriendRefreshLoopRunnable; +import org.communiquons.android.comunic.client.fragments.ConversationsListFragment; import org.communiquons.android.comunic.client.fragments.FriendsListFragment; import org.communiquons.android.comunic.client.fragments.UserInfosFragment; @@ -151,11 +152,16 @@ public class MainActivity extends AppCompatActivity { openFriendsFragment(); return true; - //If the user choosed to show informations about him + //If the user chose to show information about him case R.id.main_bottom_navigation_me_view: openUserInfosFragment(); return true; + //If the user wants to switch to the conversation fragment + case R.id.main_bottom_navigation_conversations: + openConversationsListFragment(); + return true; + } //Selected element not found @@ -219,4 +225,15 @@ public class MainActivity extends AppCompatActivity { transaction.addToBackStack(null); transaction.commit(); } + + /** + * Open the conversation list fragment + */ + void openConversationsListFragment(){ + ConversationsListFragment conversationsListFragment = new ConversationsListFragment(); + FragmentTransaction transaction = getFragmentManager().beginTransaction(); + transaction.replace(R.id.main_fragment, conversationsListFragment); + transaction.addToBackStack(null); + transaction.commit(); + } } 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 new file mode 100644 index 0000000..dbdd460 --- /dev/null +++ b/app/src/main/java/org/communiquons/android/comunic/client/fragments/ConversationsListFragment.java @@ -0,0 +1,17 @@ +package org.communiquons.android.comunic.client.fragments; + +import android.app.Fragment; + +/** + * Conversation list fragment + * + * Display all the conversations list + * + * @author Pierre HUBERT + * Created by pierre on 12/6/17. + */ + +public class ConversationsListFragment extends Fragment { + + +} diff --git a/app/src/main/res/menu/main_bottom_navigation.xml b/app/src/main/res/menu/main_bottom_navigation.xml index 6ecd4e8..0e86601 100644 --- a/app/src/main/res/menu/main_bottom_navigation.xml +++ b/app/src/main/res/menu/main_bottom_navigation.xml @@ -12,4 +12,9 @@ android:icon="@drawable/ic_menu_home" /> + \ 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 fde8b6c..0594113 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -27,4 +27,5 @@ Cancel Accept User Image Account + Conversations