Class NewsfeedListFragment<A extends NewsfeedListAdapter,​V extends NewsfeedListView,​P extends NewsfeedListPresenter<V>>

    • Constructor Detail

      • NewsfeedListFragment

        public NewsfeedListFragment()
    • Method Detail

      • onActivityResult

        public void onActivityResult​(int requestCode,
                                     int resultCode,
                                     android.content.Intent data)
        Overrides:
        onActivityResult in class androidx.fragment.app.Fragment
      • onCreateOptionsMenu

        public void onCreateOptionsMenu​(android.view.Menu menu,
                                        android.view.MenuInflater inflater)
        Overrides:
        onCreateOptionsMenu in class androidx.fragment.app.Fragment
      • onPrepareOptionsMenu

        public void onPrepareOptionsMenu​(@NonNull
                                         android.view.Menu menu)
        Overrides:
        onPrepareOptionsMenu in class androidx.fragment.app.Fragment
      • onOptionsItemSelected

        public boolean onOptionsItemSelected​(android.view.MenuItem item)
        Overrides:
        onOptionsItemSelected in class androidx.fragment.app.Fragment
      • showNewsfeedList

        public void showNewsfeedList​(Post pinnedPost,
                                     java.util.List<Post> newsfeed,
                                     java.util.List<Flag> flags,
                                     int totalEntries,
                                     boolean isUserAllowedToPost,
                                     boolean isUserAllowedToComment)
        Description copied from interface: NewsfeedListView
        Notifies the view to show the list of Post. This also means the GET newsfeed API was successful.
        Specified by:
        showNewsfeedList in interface NewsfeedListView
        Parameters:
        pinnedPost - pinned post in the feed
        newsfeed - list of Post objects
        flags - list of Flag objects
        totalEntries - total number of posts regardless of pagination
        isUserAllowedToPost - member posting is allowed or not allowed
        isUserAllowedToComment - member commenting is allowed or not allowed
      • appendNews

        public void appendNews​(Post pinnedPost,
                               java.util.List<Post> newsfeed,
                               int totalEntries,
                               boolean isUserAllowedToPost,
                               boolean isUserAllowedToComment)
        Description copied from interface: NewsfeedListView
        Notifies the view to append list of Post to the existing post list. This also means that the GET newsfeed API with pagination was successful
        Specified by:
        appendNews in interface NewsfeedListView
        Parameters:
        pinnedPost - pinned post in the feed
        newsfeed - list of Post objects
        totalEntries - total number of posts regardless of pagination
        isUserAllowedToPost - member posting is allowed or not allowed
        isUserAllowedToComment - member commenting is allowed or not allowed
      • deletePost

        public void deletePost​(Post post)
        Description copied from interface: NewsfeedListView
        Notifies the view to delete the post from the list. This also means delete post API was successful.
        Specified by:
        deletePost in interface NewsfeedListView
        Parameters:
        post - deleted Post
      • showErrorDialog

        public void showErrorDialog​(java.lang.String error)
        Description copied from interface: NewsfeedListView
        Notifies the view to show a dialog with the provided error message
        Specified by:
        showErrorDialog in interface NewsfeedListView
        Parameters:
        error - error message
      • revertChanges

        public void revertChanges​(int postId)
        Description copied from interface: NewsfeedListView
        Notifies the view to revert any changes made to the post. This also means that Like/Unlike and Flag/Unflag of Post API failed
        Specified by:
        revertChanges in interface NewsfeedListView
        Parameters:
        postId - id of the post to revert
      • updatePost

        public void updatePost​(Post post)
        Description copied from interface: NewsfeedListView
        Notifies the view to update the Post. This also means that the GET post API with clearing of cache was successful.
        Specified by:
        updatePost in interface NewsfeedListView
        Parameters:
        post - updated Post
      • onDeletePost

        public void onDeletePost​(int postId)
        Description copied from interface: PostClickListener
        Method to handle deleting of post
        Specified by:
        onDeletePost in interface PostClickListener
        Parameters:
        postId - id of post
      • onLikePost

        public void onLikePost​(boolean isAttempToLike,
                               int postId)
        Description copied from interface: PostClickListener
        Method to handle liking of Post
        Specified by:
        onLikePost in interface PostClickListener
        Parameters:
        isAttempToLike - status if post is liked/unliked
        postId - id of post
      • onFlagNews

        public void onFlagNews​(int postId,
                               java.lang.String flag)
        Description copied from interface: PostClickListener
        Method to handle clicking of flag view
        Specified by:
        onFlagNews in interface PostClickListener
        Parameters:
        postId - id of post
        flag - key attribute of the selected flag from Flag
      • onViewUrl

        public void onViewUrl​(android.net.Uri uri)
        Description copied from interface: PostClickListener
        Method to handle viewing of url
        Specified by:
        onViewUrl in interface PostClickListener
        Parameters:
        uri - uri to view
      • onShareUrl

        public void onShareUrl​(android.net.Uri uri)
        Description copied from interface: PostClickListener
        Method to handle sharing of url
        Specified by:
        onShareUrl in interface PostClickListener
        Parameters:
        uri - uri for sharing
      • createItemDecoration

        protected androidx.recyclerview.widget.RecyclerView.ItemDecoration createItemDecoration()
        Create the item decoration used in the RecyclerView. This invoked when initializing the list for the first time
        Returns:
        instance of RecyclerView.ItemDecoration for the RecyclerView