mirror of
				https://github.com/pierre42100/ComunicAndroid
				synced 2025-11-04 11:34:06 +00:00 
			
		
		
		
	Created listener directory
This commit is contained in:
		@@ -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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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<Comment> {
 | 
			
		||||
     * @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<Comment> {
 | 
			
		||||
     * @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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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<Post>{
 | 
			
		||||
    private static final String TAG = "PostsAdapter";
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Informations about the users
 | 
			
		||||
     * Information about the users
 | 
			
		||||
     */
 | 
			
		||||
    private ArrayMap<Integer, UserInfo> mUsersInfos;
 | 
			
		||||
 | 
			
		||||
@@ -263,82 +264,4 @@ public class PostsAdapter extends ArrayAdapter<Post>{
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 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);
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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){
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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 !");
 | 
			
		||||
 
 | 
			
		||||
@@ -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());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
}
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -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);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -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);
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user