From 5112ece74894448aa1eaff746a1cec2b1ea12716 Mon Sep 17 00:00:00 2001 From: Pierre Date: Thu, 12 Apr 2018 11:35:43 +0200 Subject: [PATCH] Created listener directory --- .../data/helpers/ConversationsListHelper.java | 41 --------- .../client/data/helpers/GetUsersHelper.java | 19 ---- .../client/ui/activities/MainActivity.java | 10 ++- .../client/ui/adapters/CommentsAdapter.java | 5 +- .../client/ui/adapters/PostsAdapter.java | 81 +---------------- .../fragments/ConversationsListFragment.java | 4 +- .../ui/fragments/FriendsListFragment.java | 11 +-- .../ui/fragments/NotificationsFragment.java | 5 +- .../ui/fragments/PostsListFragment.java | 3 +- .../fragments/UpdateConversationFragment.java | 5 +- .../fragments/UserAccessDeniedFragment.java | 9 +- .../client/ui/fragments/UserPageFragment.java | 5 +- .../ui/listeners/onOpenUsersPageListener.java | 23 +++++ .../client/ui/listeners/onPostUpdate.java | 88 +++++++++++++++++++ .../listeners/openConversationListener.java | 26 ++++++ .../listeners/updateConversationListener.java | 21 +++++ 16 files changed, 192 insertions(+), 164 deletions(-) create mode 100644 app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/onOpenUsersPageListener.java create mode 100644 app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/onPostUpdate.java create mode 100644 app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/openConversationListener.java create mode 100644 app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/updateConversationListener.java diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/ConversationsListHelper.java b/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/ConversationsListHelper.java index b94a97f..9a12093 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/ConversationsListHelper.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/ConversationsListHelper.java @@ -418,45 +418,4 @@ public class ConversationsListHelper { return info; } - /** - * Handles the opening of a conversation - * - * This interface should be implemented in all the activity that should handle such action - */ - public interface openConversationListener { - - /** - * Open the conversation specified by its ID - * - * @param id The ID of the conversation to open - */ - void openConversation(int id); - - /** - * Open a private conversation with the specified user ID - * - * @param userID The ID with who to start a private conversation - */ - void openPrivateConversation(int userID); - - } - - /** - * Handles the creation and / or the update of a conversation - */ - public interface updateConversationListener { - - /** - * This method is called when a user wants to create a new conversation - */ - void createConversation(); - - /** - * This method is called when the user want to open a conversation - * - * @param convID The ID of the conversation to open - */ - void updateConversation(int convID); - } - } diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/GetUsersHelper.java b/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/GetUsersHelper.java index c8d2cef..2836884 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/GetUsersHelper.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/GetUsersHelper.java @@ -439,23 +439,4 @@ public class GetUsersHelper { } - /** - * This interface is implemented on activities that can open users page - */ - public interface onOpenUsersPageListener { - - /** - * On a user page specified by its id - * - * @param userID The ID of the user to create page - */ - void openUserPage(int userID); - - /** - * Open the page of a user for which the access has been denied - * - * @param userID The ID of the target user - */ - void openUserAccessDeniedPage(int userID); - } } 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 b151e12..cee0af5 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 @@ -20,11 +20,13 @@ import org.communiquons.android.comunic.client.data.helpers.APIRequestHelper; import org.communiquons.android.comunic.client.data.helpers.AccountHelper; import org.communiquons.android.comunic.client.data.utils.AccountUtils; import org.communiquons.android.comunic.client.data.helpers.DatabaseHelper; -import org.communiquons.android.comunic.client.data.helpers.GetUsersHelper; import org.communiquons.android.comunic.client.data.helpers.ConversationsListHelper; import org.communiquons.android.comunic.client.data.runnables.FriendRefreshLoopRunnable; import org.communiquons.android.comunic.client.data.services.NotificationsService; import org.communiquons.android.comunic.client.ui.fragments.UserAccessDeniedFragment; +import org.communiquons.android.comunic.client.ui.listeners.onOpenUsersPageListener; +import org.communiquons.android.comunic.client.ui.listeners.openConversationListener; +import org.communiquons.android.comunic.client.ui.listeners.updateConversationListener; import org.communiquons.android.comunic.client.ui.utils.UiUtils; import org.communiquons.android.comunic.client.ui.fragments.ConversationFragment; import org.communiquons.android.comunic.client.ui.fragments.ConversationsListFragment; @@ -42,9 +44,9 @@ import org.communiquons.android.comunic.client.ui.fragments.UserPageFragment; * @author Pierre HUBERT */ public class MainActivity extends AppCompatActivity - implements ConversationsListHelper.openConversationListener, - ConversationsListHelper.updateConversationListener, - GetUsersHelper.onOpenUsersPageListener { + implements openConversationListener, + updateConversationListener, + onOpenUsersPageListener { /** * Debug tag diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/CommentsAdapter.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/CommentsAdapter.java index 536bd8d..046b251 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/CommentsAdapter.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/CommentsAdapter.java @@ -13,6 +13,7 @@ import org.communiquons.android.comunic.client.R; import org.communiquons.android.comunic.client.data.helpers.ImageLoadHelper; import org.communiquons.android.comunic.client.data.models.UserInfo; import org.communiquons.android.comunic.client.data.models.Comment; +import org.communiquons.android.comunic.client.ui.listeners.onPostUpdate; import org.communiquons.android.comunic.client.ui.utils.UiUtils; import org.communiquons.android.comunic.client.ui.views.LikeButtonView; @@ -48,7 +49,7 @@ class CommentsAdapter extends ArrayAdapter { * @return Generated view */ static View getInflatedView(Context context, Comment comment, - PostsAdapter.onPostUpdate listener, + onPostUpdate listener, @Nullable UserInfo user, ViewGroup viewGroup){ //Inflate a view @@ -70,7 +71,7 @@ class CommentsAdapter extends ArrayAdapter { * @return Updated view */ private static View fillView(final Context context, final View view, final Comment comment, - @Nullable UserInfo user, final PostsAdapter.onPostUpdate listener) { + @Nullable UserInfo user, final onPostUpdate listener) { //Update user name and account image ImageView accountImage = view.findViewById(R.id.user_account_image); diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/PostsAdapter.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/PostsAdapter.java index 5180714..67fffcf 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/PostsAdapter.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/adapters/PostsAdapter.java @@ -19,6 +19,7 @@ import org.communiquons.android.comunic.client.data.models.Comment; import org.communiquons.android.comunic.client.data.models.Post; import org.communiquons.android.comunic.client.data.enums.PostTypes; import org.communiquons.android.comunic.client.data.arrays.PostsList; +import org.communiquons.android.comunic.client.ui.listeners.onPostUpdate; import org.communiquons.android.comunic.client.ui.utils.UiUtils; import org.communiquons.android.comunic.client.data.utils.Utilities; import org.communiquons.android.comunic.client.ui.views.EditCommentContentView; @@ -41,7 +42,7 @@ public class PostsAdapter extends ArrayAdapter{ private static final String TAG = "PostsAdapter"; /** - * Informations about the users + * Information about the users */ private ArrayMap mUsersInfos; @@ -263,82 +264,4 @@ public class PostsAdapter extends ArrayAdapter{ } - /** - * This interface is used to redirect post update events to the fragment managing the - * rendering of the posts - */ - public interface onPostUpdate { - - /** - * This method is called when a comment creation request is made - * - * @param pos The position of the post in the list - * @param button The button triggered to submit comment creation - * @param post Information about the target post - * @param input The input where the comment comment was typed - */ - void onCreateComment(int pos, View button, Post post, EditCommentContentView input); - - /** - * Show the available actions for a post - * - * @param button The button that provoked event - * @param pos The position of the comment - * @param post the target post - */ - void showPostActions(View button, int pos, Post post); - - /** - * Handles the update of the likes of a post - * - * @param post The target post - * @param is_liking New liking status - */ - void onPostLikeUpdate(Post post, boolean is_liking); - - /** - * Handles the update request of the content of a post - * - * @param post Target post - */ - void onPostContentUpdate(Post post); - - /** - * Handles the deletion process of a post - * - * @param pos The position of the post to delete - */ - void deletePost(int pos); - - /** - * Show the available actions for a comment - * - * @param button The button that provoked the event - * @param comment Target comment for the actions - */ - void showCommentActions(View button, Comment comment); - - /** - * Handles the update of the likes of a comment - * - * @param comment The comment to update - * @param is_liking The new liking status - */ - void onCommentLikeUpdate(Comment comment, boolean is_liking); - - /** - * Handles the update of the content of a comment - * - * @param comment The target comment - */ - void onUpdateCommentContent(Comment comment); - - /** - * Handles the process of deletion of a comment. - * - * @param comment The comment to delete - */ - void deleteComment(Comment comment); - - } } diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/ConversationsListFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/ConversationsListFragment.java index 9cac10e..0689421 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/ConversationsListFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/ConversationsListFragment.java @@ -28,8 +28,8 @@ import org.communiquons.android.comunic.client.data.models.UserInfo; import org.communiquons.android.comunic.client.data.models.ConversationsInfo; import org.communiquons.android.comunic.client.ui.adapters.ConversationsListAdapter; import org.communiquons.android.comunic.client.data.helpers.ConversationsListHelper; -import org.communiquons.android.comunic.client.data.helpers.ConversationsListHelper.openConversationListener; -import org.communiquons.android.comunic.client.data.helpers.ConversationsListHelper.updateConversationListener; +import org.communiquons.android.comunic.client.ui.listeners.openConversationListener; +import org.communiquons.android.comunic.client.ui.listeners.updateConversationListener; import java.util.ArrayList; diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/FriendsListFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/FriendsListFragment.java index 690d76b..3abb3b8 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/FriendsListFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/FriendsListFragment.java @@ -23,12 +23,13 @@ import org.communiquons.android.comunic.client.R; import org.communiquons.android.comunic.client.data.helpers.DatabaseHelper; import org.communiquons.android.comunic.client.data.helpers.GetUsersHelper; import org.communiquons.android.comunic.client.data.models.UserInfo; -import org.communiquons.android.comunic.client.data.helpers.ConversationsListHelper; import org.communiquons.android.comunic.client.data.models.Friend; import org.communiquons.android.comunic.client.data.models.FriendUser; import org.communiquons.android.comunic.client.ui.adapters.FriendsAdapter; import org.communiquons.android.comunic.client.data.helpers.FriendsListHelper; import org.communiquons.android.comunic.client.data.utils.FriendsUtils; +import org.communiquons.android.comunic.client.ui.listeners.onOpenUsersPageListener; +import org.communiquons.android.comunic.client.ui.listeners.openConversationListener; import java.util.ArrayList; @@ -80,12 +81,12 @@ public class FriendsListFragment extends Fragment /** * Conversation opener */ - private ConversationsListHelper.openConversationListener convOpener; + private openConversationListener convOpener; /** * Users page opener */ - private GetUsersHelper.onOpenUsersPageListener usersPageOpener; + private onOpenUsersPageListener usersPageOpener; /** * Friend adapter @@ -110,8 +111,8 @@ public class FriendsListFragment extends Fragment //Cast activity to convOpener try { - convOpener = (ConversationsListHelper.openConversationListener) getActivity(); - usersPageOpener = (GetUsersHelper.onOpenUsersPageListener) getActivity(); + convOpener = (openConversationListener) getActivity(); + usersPageOpener = (onOpenUsersPageListener) getActivity(); } catch (ClassCastException e){ e.printStackTrace(); 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 92ad9fa..dcc34b5 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 @@ -26,6 +26,7 @@ import org.communiquons.android.comunic.client.data.arrays.NotifsList; import org.communiquons.android.comunic.client.data.models.Notif; import org.communiquons.android.comunic.client.ui.activities.MainActivity; import org.communiquons.android.comunic.client.ui.adapters.NotificationsAdapter; +import org.communiquons.android.comunic.client.ui.listeners.onOpenUsersPageListener; /** * Notifications fragment @@ -75,7 +76,7 @@ public class NotificationsFragment extends Fragment implements View.OnCreateCont /** * User page opener */ - private GetUsersHelper.onOpenUsersPageListener mUserPageOpener; + private onOpenUsersPageListener mUserPageOpener; @Override public void onAttach(Context context) { @@ -126,7 +127,7 @@ public class NotificationsFragment extends Fragment implements View.OnCreateCont .setSelectedNavigationItem(R.id.main_bottom_navigation_notif); //Get user page opener - mUserPageOpener = (GetUsersHelper.onOpenUsersPageListener) getActivity(); + mUserPageOpener = (onOpenUsersPageListener) getActivity(); //Check if it is required to fetch the list of notifications if(mNotificationsList == null){ diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/PostsListFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/PostsListFragment.java index e229187..84a54fc 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/PostsListFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/PostsListFragment.java @@ -32,6 +32,7 @@ import org.communiquons.android.comunic.client.data.helpers.PostsHelper; import org.communiquons.android.comunic.client.data.arrays.PostsList; import org.communiquons.android.comunic.client.data.utils.StringsUtils; import org.communiquons.android.comunic.client.ui.adapters.PostsAdapter; +import org.communiquons.android.comunic.client.ui.listeners.onPostUpdate; import org.communiquons.android.comunic.client.ui.views.EditCommentContentView; import java.util.ArrayList; @@ -46,7 +47,7 @@ import java.util.ArrayList; */ public class PostsListFragment extends Fragment - implements PostsAdapter.onPostUpdate { + implements onPostUpdate { /** * Menu action : no action diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UpdateConversationFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UpdateConversationFragment.java index f47c208..591b7e3 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UpdateConversationFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UpdateConversationFragment.java @@ -31,6 +31,7 @@ import org.communiquons.android.comunic.client.data.models.UserInfo; import org.communiquons.android.comunic.client.ui.adapters.UsersAsysncInfoAdapter; import org.communiquons.android.comunic.client.data.models.ConversationsInfo; import org.communiquons.android.comunic.client.data.helpers.ConversationsListHelper; +import org.communiquons.android.comunic.client.ui.listeners.openConversationListener; import java.util.ArrayList; @@ -141,7 +142,7 @@ public class UpdateConversationFragment extends Fragment { /** * Conversation opener */ - private ConversationsListHelper.openConversationListener convOpener; + private openConversationListener convOpener; /** * Conversation members list context menu @@ -173,7 +174,7 @@ public class UpdateConversationFragment extends Fragment { //Get conversation opener try { - convOpener = (ConversationsListHelper.openConversationListener) getActivity(); + convOpener = (openConversationListener) getActivity(); } catch (ClassCastException e){ throw new RuntimeException(getActivity().getClass().getName() + " must implement the" + " ConversationsListHelper.openConversationListener interface !"); diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserAccessDeniedFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserAccessDeniedFragment.java index 76ddbd7..2816e01 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserAccessDeniedFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserAccessDeniedFragment.java @@ -1,8 +1,6 @@ package org.communiquons.android.comunic.client.ui.fragments; -import android.app.Activity; import android.app.Fragment; -import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.Nullable; @@ -22,6 +20,7 @@ import org.communiquons.android.comunic.client.data.helpers.ImageLoadHelper; import org.communiquons.android.comunic.client.data.models.FriendshipStatus; import org.communiquons.android.comunic.client.data.models.UserInfo; import org.communiquons.android.comunic.client.ui.activities.MainActivity; +import org.communiquons.android.comunic.client.ui.listeners.onOpenUsersPageListener; /** * User access denied fragment @@ -55,7 +54,7 @@ public class UserAccessDeniedFragment extends Fragment implements View.OnClickLi /** * User page opener */ - private GetUsersHelper.onOpenUsersPageListener mOpenUsersPageListener; + private onOpenUsersPageListener mOpenUsersPageListener; /** * Information about the user @@ -117,11 +116,11 @@ public class UserAccessDeniedFragment extends Fragment implements View.OnClickLi //Get user page opener try { - mOpenUsersPageListener = (GetUsersHelper.onOpenUsersPageListener) getActivity(); + mOpenUsersPageListener = (onOpenUsersPageListener) getActivity(); } catch (ClassCastException e){ e.printStackTrace(); throw new RuntimeException(getActivity().getClass().getName() + "must implement " - + GetUsersHelper.onOpenUsersPageListener.class.getName()); + + onOpenUsersPageListener.class.getName()); } } diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserPageFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserPageFragment.java index 5ebb284..f6ce622 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserPageFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserPageFragment.java @@ -23,6 +23,7 @@ import org.communiquons.android.comunic.client.data.models.UserInfo; import org.communiquons.android.comunic.client.data.models.Post; import org.communiquons.android.comunic.client.data.helpers.PostsHelper; import org.communiquons.android.comunic.client.data.arrays.PostsList; +import org.communiquons.android.comunic.client.ui.listeners.onOpenUsersPageListener; import org.communiquons.android.comunic.client.ui.utils.UiUtils; import org.communiquons.android.comunic.client.ui.activities.MainActivity; @@ -110,7 +111,7 @@ public class UserPageFragment extends Fragment implements PostsCreateFormFragmen /** * User page open listener */ - private GetUsersHelper.onOpenUsersPageListener mOpenUsersPageListener; + private onOpenUsersPageListener mOpenUsersPageListener; @Override @@ -130,7 +131,7 @@ public class UserPageFragment extends Fragment implements PostsCreateFormFragmen mPostsHelper = new PostsHelper(getActivity()); //Get the open user page listener - mOpenUsersPageListener = (GetUsersHelper.onOpenUsersPageListener) getActivity(); + mOpenUsersPageListener = (onOpenUsersPageListener) getActivity(); } @Nullable diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/onOpenUsersPageListener.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/onOpenUsersPageListener.java new file mode 100644 index 0000000..1e55614 --- /dev/null +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/onOpenUsersPageListener.java @@ -0,0 +1,23 @@ +package org.communiquons.android.comunic.client.ui.listeners; + +/** + * This interface is implemented on activities that can open users page + * + * @author Pierre HUBERT + */ +public interface onOpenUsersPageListener { + + /** + * On a user page specified by its id + * + * @param userID The ID of the user to create page + */ + void openUserPage(int userID); + + /** + * Open the page of a user for which the access has been denied + * + * @param userID The ID of the target user + */ + void openUserAccessDeniedPage(int userID); +} diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/onPostUpdate.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/onPostUpdate.java new file mode 100644 index 0000000..5242a9a --- /dev/null +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/onPostUpdate.java @@ -0,0 +1,88 @@ +package org.communiquons.android.comunic.client.ui.listeners; + +import android.view.View; + +import org.communiquons.android.comunic.client.data.models.Comment; +import org.communiquons.android.comunic.client.data.models.Post; +import org.communiquons.android.comunic.client.ui.views.EditCommentContentView; + +/** + * This interface is used to redirect post update events to the fragment managing the + * rendering of the posts + * + * @author Pierre HUBERT + */ +public interface onPostUpdate { + + /** + * This method is called when a comment creation request is made + * + * @param pos The position of the post in the list + * @param button The button triggered to submit comment creation + * @param post Information about the target post + * @param input The input where the comment comment was typed + */ + void onCreateComment(int pos, View button, Post post, EditCommentContentView input); + + /** + * Show the available actions for a post + * + * @param button The button that provoked event + * @param pos The position of the comment + * @param post the target post + */ + void showPostActions(View button, int pos, Post post); + + /** + * Handles the update of the likes of a post + * + * @param post The target post + * @param is_liking New liking status + */ + void onPostLikeUpdate(Post post, boolean is_liking); + + /** + * Handles the update request of the content of a post + * + * @param post Target post + */ + void onPostContentUpdate(Post post); + + /** + * Handles the deletion process of a post + * + * @param pos The position of the post to delete + */ + void deletePost(int pos); + + /** + * Show the available actions for a comment + * + * @param button The button that provoked the event + * @param comment Target comment for the actions + */ + void showCommentActions(View button, Comment comment); + + /** + * Handles the update of the likes of a comment + * + * @param comment The comment to update + * @param is_liking The new liking status + */ + void onCommentLikeUpdate(Comment comment, boolean is_liking); + + /** + * Handles the update of the content of a comment + * + * @param comment The target comment + */ + void onUpdateCommentContent(Comment comment); + + /** + * Handles the process of deletion of a comment. + * + * @param comment The comment to delete + */ + void deleteComment(Comment comment); + +} diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/openConversationListener.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/openConversationListener.java new file mode 100644 index 0000000..2a28861 --- /dev/null +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/openConversationListener.java @@ -0,0 +1,26 @@ +package org.communiquons.android.comunic.client.ui.listeners; + +/** + * Handles the opening of a conversation + * + * This interface should be implemented in all the activity that should handle such action + * + * @author Pierre HUBERT + */ +public interface openConversationListener { + + /** + * Open the conversation specified by its ID + * + * @param id The ID of the conversation to open + */ + void openConversation(int id); + + /** + * Open a private conversation with the specified user ID + * + * @param userID The ID with who to start a private conversation + */ + void openPrivateConversation(int userID); + +} diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/updateConversationListener.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/updateConversationListener.java new file mode 100644 index 0000000..b9d16c3 --- /dev/null +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/listeners/updateConversationListener.java @@ -0,0 +1,21 @@ +package org.communiquons.android.comunic.client.ui.listeners; + +/** + * Handles the creation and / or the update of a conversation + * + * @author Pierre HUBERT + */ +public interface updateConversationListener { + + /** + * This method is called when a user wants to create a new conversation + */ + void createConversation(); + + /** + * This method is called when the user want to open a conversation + * + * @param convID The ID of the conversation to open + */ + void updateConversation(int convID); +}