Class NewsfeedDetailsPresenter<T extends NewsfeedDetailsView>
- java.lang.Object
-
- com.cheetahdigital.uikit.architecture.mvp.MvpNullObjectBasePresenter<V>
-
- com.cheetahdigital.uikit.architecture.mvp.Presenter<V>
-
- com.cheetahdigital.uikit.architecture.lce.LcePresenter<V>
-
- com.cheetahdigital.uikit.architecture.refreshable.RefreshablePresenter<V>
-
- com.cheetahdigital.uikit.widget.list.ListPresenter<V>
-
- com.cheetahdigital.uikit.widget.list.EndlessListPresenter<T>
-
- com.cheetahdigital.newsfeed.ui.details.NewsfeedDetailsPresenter<T>
-
- Type Parameters:
T
- theMvpView
class
- All Implemented Interfaces:
MvpPresenter<T>
public class NewsfeedDetailsPresenter<T extends NewsfeedDetailsView> extends EndlessListPresenter<T>
TheMvpPresenter
class forNewsfeedDetailsActivity
-
-
Constructor Summary
Constructors Constructor Description NewsfeedDetailsPresenter(java.lang.String postId)
Constructor of this presenter.NewsfeedDetailsPresenter(java.lang.String postId, NewsfeedParams postParams, NewsfeedParams commentParams, NewsfeedParams flagParams)
Constructor of this presenter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addComment(java.lang.String message)
Add comment to the postvoid
addComment(java.lang.String message, NewsfeedParams postParams, NewsfeedFields fieldParams)
Add comment to the postvoid
deleteComment(int commentId)
Delete commentvoid
deleteComment(int commentId, NewsfeedParams queryParams)
Delete commentvoid
deletePost()
Delete postvoid
deletePost(NewsfeedParams queryParams)
Delete postvoid
flagComment(int commentId, java.lang.String flag)
Flag a commentvoid
flagComment(int commentId, java.lang.String flag, NewsfeedParams postParams, NewsfeedFields flagParams)
Flag a commentvoid
flagPost(java.lang.String flag)
Flags a postvoid
flagPost(java.lang.String flag, NewsfeedParams postParams, NewsfeedFields flagParams)
Flags a postprotected Listener<SuccessResponse>
getAddCommentListener()
Create a listener forNewsfeedAPI.addComment(NewsfeedParams, NewsfeedFields, Listener)
protected ListenerModel<BaseModel<Comments>,Comments>
getCommentsReceivedListener()
Create a listener forNewsfeedAPI.getComments(NewsfeedParams, boolean, ListenerModel)
protected ListenerModel<BaseModel<DeletedComment>,DeletedComment>
getDeleteCommentListener(int commentId)
Create a listener forNewsfeedAPI.deleteComment(NewsfeedParams, ListenerModel)
protected ListenerModel<BaseModel<Post>,Post>
getDeletePostListener()
Create a listener forNewsfeedAPI.deletePost(NewsfeedParams, ListenerModel)
protected Listener<SuccessResponse>
getFlagCommentListener(int commentId)
protected Listener<SuccessResponse>
getFlagPostListener()
protected ListenerModel<BaseModel<java.util.List<Flag>>,java.util.List<Flag>>
getFlagReceivedListener()
Create a listener forNewsfeedAPI.getFlags(NewsfeedParams, boolean, ListenerModel)
protected Listener<SuccessResponse>
getLikeCommentListener(int commentId)
Create a listener forNewsfeedAPI.likeComment(NewsfeedParams, Listener)
protected Listener<SuccessResponse>
getLikePostListener()
Create a listener forNewsfeedAPI.likePost(NewsfeedParams, Listener)
protected NewsfeedAPI
getNewsfeedAPI()
Get current instance ofNewsfeedAPI
protected ListenerModel<BaseModel<Post>,Post>
getPostReceivedListener()
Create a listener forNewsfeedAPI.getPost(NewsfeedParams, boolean, ListenerModel)
protected ListenerModel<BaseModel<SingleComment>,SingleComment>
getRefreshCommentListener()
Create a listener forNewsfeedAPI.getComments(NewsfeedParams, boolean, ListenerModel)
.protected ListenerModel<BaseModel<Post>,Post>
getRefreshPostListener()
Create a listener forNewsfeedAPI.getPost(NewsfeedParams, boolean, ListenerModel)
.protected Listener<SuccessResponse>
getUnlikeCommentListener(int commentId)
Create a listener forNewsfeedAPI.unlikeComment(NewsfeedParams, Listener)
void
likeComment(int commentId)
Like a commentvoid
likeComment(int commentId, NewsfeedParams queryParams)
Like a commentvoid
likePost()
Like a postvoid
likePost(NewsfeedParams queryParams)
Like a postvoid
loadData()
Load initial view data.void
loadMore(int currentPage)
protected void
onAddCommentFailure(java.lang.String error)
Called when adding a comment to a post failsprotected void
onAddCommentSuccess()
Called when adding a comment to a post is successfulprotected void
onDeleteCommentFailure(java.lang.String error, int commentId)
Called when delete a comment failsprotected void
onDeleteCommentSuccess(int commentId, DeletedComment deletedComment)
Called when deleting a comment is successfulprotected void
onDeletePostFailure(java.lang.String error)
Called when deleting a post failsprotected void
onDeletePostSuccess(Post post)
Called when deleting a post is successfulprotected void
onFlagCommentFailure(java.lang.String error, int commentId)
Called when flagging a comment failsprotected void
onFlagCommentSuccess(int commentId)
Called when flagging a comment is successfulprotected void
onFlagPostFailure(java.lang.String error)
Called when flagging a post failsprotected void
onFlagPostSuccess()
Called when flagging a post is successfulprotected void
onLikeCommentFailure(java.lang.String error, int commentId)
Called when liking a comment failsprotected void
onLikeCommentSuccess(int commentId)
Called when liking a comment is successfulprotected void
onLikePostFailure(java.lang.String error)
Called when liking a post failsprotected void
onLikePostSuccess()
Called when liking a post is successfulprotected void
onLoadCommentsFailed(java.lang.String error)
Called when GET comments failprotected void
onLoadCommentsSuccess(Comments data)
Called when GET comments is successfulprotected void
onLoadFlagFailed(java.lang.String error)
Called when GET flags failprotected void
onLoadFlagSuccess(java.util.List<Flag> data)
Called when GET flags is successfulvoid
onLoadMoreSuccess(BaseData data)
End of load more with success requestprotected void
onLoadPostFailed(java.lang.String error)
Called when GET post failsprotected void
onLoadPostSuccess(Post data)
Called when GET post is successfulvoid
onRefreshSuccess(BaseData data)
End of refresh with success request.protected void
onUnlikeCommentFailure(java.lang.String error, int commentId)
Called when unliking a comment failsprotected void
onUnlikeCommentSuccess(int commentId)
Called when unliking a comment is successfulvoid
refreshComment(int commentId)
Calls GET comment API and clears response cachevoid
refreshComment(int commentId, NewsfeedParams queryParams)
Calls GET comment API and clears response cachevoid
refreshData()
Start the refresh view data.void
refreshPost()
Calls GET post API and clears the response cachevoid
unflagComment(int commentId)
Unflag commentvoid
unflagComment(int commentId, NewsfeedParams postParams)
Unflag a commentvoid
unflagPost()
Unflag a postvoid
unflagPost(NewsfeedParams postParams)
Unflag a postvoid
unLikeComment(int commentId)
Unlike a commentvoid
unLikeComment(int commentId, NewsfeedParams queryParams)
Unlike a commentvoid
unLikePost()
Unlike a postvoid
unLikePost(NewsfeedParams queryParams)
Unlike a post-
Methods inherited from class com.cheetahdigital.uikit.widget.list.EndlessListPresenter
isAppending, onLoadMoreFailed
-
Methods inherited from class com.cheetahdigital.uikit.architecture.refreshable.RefreshablePresenter
isRefreshing, onRefreshFailed
-
Methods inherited from class com.cheetahdigital.uikit.architecture.lce.LcePresenter
onLoadFailed, onLoadSuccess
-
Methods inherited from class com.cheetahdigital.uikit.architecture.mvp.MvpNullObjectBasePresenter
attachView, detachView, getView
-
-
-
-
Constructor Detail
-
NewsfeedDetailsPresenter
public NewsfeedDetailsPresenter(java.lang.String postId)
Constructor of this presenter. Uses default query parameters to load data.- Parameters:
postId
- id ofPost
-
NewsfeedDetailsPresenter
public NewsfeedDetailsPresenter(java.lang.String postId, NewsfeedParams postParams, NewsfeedParams commentParams, NewsfeedParams flagParams)
Constructor of this presenter. Uses custom query parameters to load data.- Parameters:
postId
- id ofPost
postParams
- customNewsfeedParams
to retrieve the details of thePost
commentParams
- customNewsfeedParams
to retrieve the comments of thePost
flagParams
- customNewsfeedFields
to retrieve the list ofFlag
-
-
Method Detail
-
getPostReceivedListener
protected ListenerModel<BaseModel<Post>,Post> getPostReceivedListener()
Create a listener forNewsfeedAPI.getPost(NewsfeedParams, boolean, ListenerModel)
- Returns:
- listener to handle requests
-
getFlagReceivedListener
protected ListenerModel<BaseModel<java.util.List<Flag>>,java.util.List<Flag>> getFlagReceivedListener()
Create a listener forNewsfeedAPI.getFlags(NewsfeedParams, boolean, ListenerModel)
- Returns:
- listener to handle requests
-
getCommentsReceivedListener
protected ListenerModel<BaseModel<Comments>,Comments> getCommentsReceivedListener()
Create a listener forNewsfeedAPI.getComments(NewsfeedParams, boolean, ListenerModel)
- Returns:
- listener to handle requests
-
getLikePostListener
protected Listener<SuccessResponse> getLikePostListener()
Create a listener forNewsfeedAPI.likePost(NewsfeedParams, Listener)
- Returns:
- listener to handle requests
-
getFlagPostListener
protected Listener<SuccessResponse> getFlagPostListener()
Create a listener forNewsfeedAPI.flagPost(NewsfeedParams, NewsfeedFields, Listener)
andNewsfeedAPI.unflagPost(NewsfeedParams, Listener)
- Returns:
- listener to handle requests
-
getDeleteCommentListener
protected ListenerModel<BaseModel<DeletedComment>,DeletedComment> getDeleteCommentListener(int commentId)
Create a listener forNewsfeedAPI.deleteComment(NewsfeedParams, ListenerModel)
- Parameters:
commentId
- id of the comment- Returns:
- listener to handle requests
-
getLikeCommentListener
protected Listener<SuccessResponse> getLikeCommentListener(int commentId)
Create a listener forNewsfeedAPI.likeComment(NewsfeedParams, Listener)
- Parameters:
commentId
- id of the comment- Returns:
- listener to handle requests
-
getUnlikeCommentListener
protected Listener<SuccessResponse> getUnlikeCommentListener(int commentId)
Create a listener forNewsfeedAPI.unlikeComment(NewsfeedParams, Listener)
- Parameters:
commentId
- id of the comment- Returns:
- listener to handle requests
-
getAddCommentListener
protected Listener<SuccessResponse> getAddCommentListener()
Create a listener forNewsfeedAPI.addComment(NewsfeedParams, NewsfeedFields, Listener)
- Returns:
- listener to handle requests
-
getFlagCommentListener
protected Listener<SuccessResponse> getFlagCommentListener(int commentId)
Create a listener forNewsfeedAPI.flagComment(NewsfeedParams, NewsfeedFields, Listener)
andNewsfeedAPI.unflagComment(NewsfeedParams, Listener)
- Parameters:
commentId
- id of the comment- Returns:
- listener to handle requests
-
getRefreshPostListener
protected ListenerModel<BaseModel<Post>,Post> getRefreshPostListener()
Create a listener forNewsfeedAPI.getPost(NewsfeedParams, boolean, ListenerModel)
. This listener is used when response cache is cleared.- Returns:
- listener to handle requests
-
getRefreshCommentListener
protected ListenerModel<BaseModel<SingleComment>,SingleComment> getRefreshCommentListener()
Create a listener forNewsfeedAPI.getComments(NewsfeedParams, boolean, ListenerModel)
. This listener is used when response cache is cleared.- Returns:
- listener to handle requests
-
getNewsfeedAPI
protected NewsfeedAPI getNewsfeedAPI()
Get current instance ofNewsfeedAPI
- Returns:
NewsfeedAPI
used on this presenter
-
loadData
public void loadData()
Description copied from class:LcePresenter
Load initial view data.- Specified by:
loadData
in classLcePresenter<T extends NewsfeedDetailsView>
-
loadMore
public void loadMore(int currentPage)
- Overrides:
loadMore
in classEndlessListPresenter<T extends NewsfeedDetailsView>
-
refreshData
public void refreshData()
Description copied from class:RefreshablePresenter
Start the refresh view data.- Overrides:
refreshData
in classRefreshablePresenter<T extends NewsfeedDetailsView>
-
deleteComment
public void deleteComment(int commentId)
Delete comment- Parameters:
commentId
- id of comment
-
deleteComment
public void deleteComment(int commentId, NewsfeedParams queryParams)
Delete comment- Parameters:
commentId
- id of commentqueryParams
- customNewsfeedParams
to delete comment
-
deletePost
public void deletePost()
Delete post
-
deletePost
public void deletePost(NewsfeedParams queryParams)
Delete post- Parameters:
queryParams
- customNewsfeedParams
to delete post
-
getDeletePostListener
protected ListenerModel<BaseModel<Post>,Post> getDeletePostListener()
Create a listener forNewsfeedAPI.deletePost(NewsfeedParams, ListenerModel)
- Returns:
- listener to handle requests
-
likePost
public void likePost()
Like a post
-
likePost
public void likePost(NewsfeedParams queryParams)
Like a post- Parameters:
queryParams
- customNewsfeedParams
to like a post
-
unLikePost
public void unLikePost()
Unlike a post
-
unLikePost
public void unLikePost(NewsfeedParams queryParams)
Unlike a post- Parameters:
queryParams
- customNewsfeedParams
to unlike a post
-
likeComment
public void likeComment(int commentId)
Like a comment- Parameters:
commentId
- id of comment
-
likeComment
public void likeComment(int commentId, NewsfeedParams queryParams)
Like a comment- Parameters:
commentId
- id of commentqueryParams
- customNewsfeedParams
to like a comment
-
unLikeComment
public void unLikeComment(int commentId)
Unlike a comment- Parameters:
commentId
- id of comment
-
unLikeComment
public void unLikeComment(int commentId, NewsfeedParams queryParams)
Unlike a comment- Parameters:
commentId
- id of commentqueryParams
- customNewsfeedParams
to unlike a comment
-
addComment
public void addComment(java.lang.String message)
Add comment to the post- Parameters:
message
- content of the comment
-
addComment
public void addComment(java.lang.String message, NewsfeedParams postParams, NewsfeedFields fieldParams)
Add comment to the post- Parameters:
message
- content of the commentpostParams
- customNewsfeedParams
fieldParams
- customNewsfeedFields
-
flagPost
public void flagPost(java.lang.String flag)
Flags a post- Parameters:
flag
- the selected flag
-
flagPost
public void flagPost(java.lang.String flag, NewsfeedParams postParams, NewsfeedFields flagParams)
Flags a post- Parameters:
flag
- the selected flagpostParams
- customNewsfeedParams
flagParams
- customNewsfeedFields
-
unflagPost
public void unflagPost()
Unflag a post
-
unflagPost
public void unflagPost(NewsfeedParams postParams)
Unflag a post- Parameters:
postParams
- customNewsfeedParams
to unflag a post
-
flagComment
public void flagComment(int commentId, java.lang.String flag)
Flag a comment- Parameters:
commentId
- id of commentflag
- selected flag
-
flagComment
public void flagComment(int commentId, java.lang.String flag, NewsfeedParams postParams, NewsfeedFields flagParams)
Flag a comment- Parameters:
commentId
- id of commentflag
- selected flagpostParams
- customNewsfeedParams
flagParams
- customNewsfeedFields
-
unflagComment
public void unflagComment(int commentId)
Unflag comment- Parameters:
commentId
- id of the comment to unflag
-
unflagComment
public void unflagComment(int commentId, NewsfeedParams postParams)
Unflag a comment- Parameters:
commentId
- id of the comment to unflagpostParams
- customNewsfeedParams
to unflag a comment
-
onLoadMoreSuccess
public void onLoadMoreSuccess(BaseData data)
Description copied from class:EndlessListPresenter
End of load more with success request- Overrides:
onLoadMoreSuccess
in classEndlessListPresenter<T extends NewsfeedDetailsView>
- Parameters:
data
- instance ofBaseData
passed
-
onLoadCommentsSuccess
protected void onLoadCommentsSuccess(Comments data)
Called when GET comments is successful- Parameters:
data
-Comment
-
onLoadCommentsFailed
protected void onLoadCommentsFailed(java.lang.String error)
Called when GET comments fail- Parameters:
error
- error message
-
onLoadFlagSuccess
protected void onLoadFlagSuccess(java.util.List<Flag> data)
Called when GET flags is successful- Parameters:
data
- list ofFlag
-
onLoadFlagFailed
protected void onLoadFlagFailed(java.lang.String error)
Called when GET flags fail- Parameters:
error
- error message
-
onLoadPostSuccess
protected void onLoadPostSuccess(Post data)
Called when GET post is successful- Parameters:
data
-Post
-
onLoadPostFailed
protected void onLoadPostFailed(java.lang.String error)
Called when GET post fails- Parameters:
error
- error message
-
onRefreshSuccess
public void onRefreshSuccess(BaseData data)
Description copied from class:RefreshablePresenter
End of refresh with success request.- Overrides:
onRefreshSuccess
in classRefreshablePresenter<T extends NewsfeedDetailsView>
- Parameters:
data
- theBaseData
.
-
onLikePostSuccess
protected void onLikePostSuccess()
Called when liking a post is successful
-
onLikePostFailure
protected void onLikePostFailure(java.lang.String error)
Called when liking a post fails- Parameters:
error
- error message
-
onFlagPostSuccess
protected void onFlagPostSuccess()
Called when flagging a post is successful
-
onFlagPostFailure
protected void onFlagPostFailure(java.lang.String error)
Called when flagging a post fails- Parameters:
error
- error message
-
refreshPost
public void refreshPost()
Calls GET post API and clears the response cache
-
onDeletePostSuccess
protected void onDeletePostSuccess(Post post)
Called when deleting a post is successful- Parameters:
post
- deletedPost
-
onDeletePostFailure
protected void onDeletePostFailure(java.lang.String error)
Called when deleting a post fails- Parameters:
error
- error message
-
onAddCommentSuccess
protected void onAddCommentSuccess()
Called when adding a comment to a post is successful
-
onAddCommentFailure
protected void onAddCommentFailure(java.lang.String error)
Called when adding a comment to a post fails- Parameters:
error
- error message
-
onFlagCommentSuccess
protected void onFlagCommentSuccess(int commentId)
Called when flagging a comment is successful- Parameters:
commentId
- id of the flagged comment
-
onFlagCommentFailure
protected void onFlagCommentFailure(java.lang.String error, int commentId)
Called when flagging a comment fails- Parameters:
error
- error messagecommentId
- id of the comment the user attempted to flag
-
onLikeCommentSuccess
protected void onLikeCommentSuccess(int commentId)
Called when liking a comment is successful- Parameters:
commentId
- id of the liked comment
-
onLikeCommentFailure
protected void onLikeCommentFailure(java.lang.String error, int commentId)
Called when liking a comment fails- Parameters:
error
- error messagecommentId
- id of the comment the user attempted to like
-
onUnlikeCommentSuccess
protected void onUnlikeCommentSuccess(int commentId)
Called when unliking a comment is successful- Parameters:
commentId
- id of the liked comment
-
onUnlikeCommentFailure
protected void onUnlikeCommentFailure(java.lang.String error, int commentId)
Called when unliking a comment fails- Parameters:
error
- error messagecommentId
- id of the comment the user attempted to unlike
-
refreshComment
public void refreshComment(int commentId)
Calls GET comment API and clears response cache- Parameters:
commentId
- id of the comment to GET
-
refreshComment
public void refreshComment(int commentId, NewsfeedParams queryParams)
Calls GET comment API and clears response cache- Parameters:
commentId
- id of the comment to GETqueryParams
- customNewsfeedParams
-
onDeleteCommentSuccess
protected void onDeleteCommentSuccess(int commentId, DeletedComment deletedComment)
Called when deleting a comment is successful- Parameters:
commentId
- id of the commentdeletedComment
-DeletedComment
-
onDeleteCommentFailure
protected void onDeleteCommentFailure(java.lang.String error, int commentId)
Called when delete a comment fails- Parameters:
error
- error messagecommentId
- id of the comment the user attempted to delete
-
-