Screen: LMFeedPostDetailFragment
The LMFeedPostDetailFragment
provides a detailed view of a post. It includes the post's content, comments, likes, and interaction options, enabling users to interact with posts in various ways.
GitHub Link to LMFeedPostDetailFragment
View Style: LMFeedPostDetailFragmentViewStyle
The LMFeedPostDetailFragmentViewStyle
defines the visual presentation of the fragment. Below are the customizable fields:
Field Name | Description | Type |
---|---|---|
headerViewStyle | Style for the header of the post detail screen. | LMFeedHeaderViewStyle |
commentsCountViewStyle | Style for the comments count view. | LMFeedTextStyle |
commentViewStyle | Style for individual comments. | LMFeedCommentViewStyle |
replyViewStyle | Style for replies to comments. | LMFeedCommentViewStyle |
noCommentsFoundViewStyle | Style for the "no comments found" message. | LMFeedNoEntityLayoutViewStyle |
commentComposerStyle | Style for the comment composer area. | LMFeedCommentComposerViewStyle |
viewMoreReplyStyle | Style for the "view more replies" button. | LMFeedViewMoreViewStyle |
GitHub Link to LMFeedPostDetailFragmentViewStyle
Customization Available in LMFeedPostDetailFragment
Header Customizations
- customizePostDetailHeaderView(headerViewPostDetail: LMFeedHeaderView)
Customizes the header view of the post detail screen.
Comment Composer Customizations
- customizeCommentComposer(commentComposer: LMFeedCommentComposerView)
Customizes the composer for creating comments.
List View Customizations
- customizePostDetailListView(rvPostDetailListView: LMFeedPostDetailListView)
Customizes the list view that displays posts and comments.
Interactions Available in LMFeedPostDetailFragment
Post Interactions
onPostCommentsCountClicked(position: Int, postViewData: LMFeedPostViewData)
Triggered when the comments count is clicked.onPostLikeClicked(position: Int, postViewData: LMFeedPostViewData)
Triggered when the like button is clicked.onPostLikesCountClicked(position: Int, postViewData: LMFeedPostViewData)
Triggered when the likes count is clicked.onPostSaveClicked(position: Int, postViewData: LMFeedPostViewData)
Triggered when the save button is clicked.onPostContentSeeMoreClicked(position: Int, postViewData: LMFeedPostViewData)
Triggered when "See More" on post content is clicked.onPostTaggedMemberClicked(position: Int, uuid: String)
Triggered when a tagged member in the post is clicked.
Comment Interactions
onCommentContentLinkClicked(url: String)
Triggered when a link in a comment is clicked.onCommentContentSeeMoreClicked(position: Int, comment: LMFeedCommentViewData)
Triggered when "See More" in a comment is clicked.onCommentLikesCountClicked(position: Int, comment: LMFeedCommentViewData)
Triggered when the likes count of a comment is clicked.onCommentReplyClicked(position: Int, comment: LMFeedCommentViewData)
Triggered when a reply button on a comment is clicked.onCommentReplyCountClicked(position: Int, comment: LMFeedCommentViewData)
Triggered when the reply count for a comment is clicked.onCommentMenuIconClicked(position: Int, comment: LMFeedCommentViewData)
Opens the comment menu.onCommentMenuItemClicked(position: Int, action: String)
Handles actions from the comment menu.
Poll Interactions
onPollOptionClicked(position: Int, optionId: String)
Triggered when a poll option is clicked.onPollOptionVoteCountClicked(position: Int, optionId: String)
Shows the vote count for a poll option.onPostAddPollOptionClicked(position: Int, postViewData: LMFeedPostViewData)
Triggered when a new poll option is added.onPostSubmitPollVoteClicked(position: Int, postViewData: LMFeedPostViewData)
Triggered when a poll vote is submitted.onPostEditPollVoteClicked(position: Int, postViewData: LMFeedPostViewData)
Triggered when a poll vote is edited.
User Interactions
onCommenterHeaderClicked(position: Int, commentViewData: LMFeedCommentViewData)
Triggered when a commenter's profile header is clicked.onReplierHeaderClicked(position: Int, replyViewData: LMFeedCommentViewData)
Triggered when a replier's profile header is clicked.onReplyTaggedMemberClicked(position: Int, uuid: String)
Triggered when a tagged member in a reply is clicked.
Menu Interactions
onPostMenuIconClicked(position: Int, postViewData: LMFeedPostViewData)
Opens the post menu.onPostMenuItemClicked(position: Int, action: String)
Handles actions from the post menu.onReplyMenuIconClicked(position: Int, replyViewData: LMFeedCommentViewData)
Opens the reply menu.onReplyMenuItemClicked(position: Int, action: String)
Handles actions from the reply menu.onDeletePostMenuClicked(position: Int)
Deletes a post.onEditPostMenuClicked(position: Int)
Edits a post.onPinPostMenuClicked(position: Int)
Pins a post.onUnpinPostMenuClicked(position: Int)
Unpins a post.onReportPostMenuClicked(position: Int)
Reports a post.
Additional Interactions
onPostLinkMediaClicked(position: Int, postViewData: LMFeedPostViewData)
Triggered when a media link in a post is clicked.onPostDocumentMediaClicked(position: Int, postViewData: LMFeedPostViewData)
Triggered when a document in a post is clicked.onPostShareClicked(position: Int, postViewData: LMFeedPostViewData)
Triggered when a post is shared.onPostHeadingSeeMoreClicked(position: Int, postViewData: LMFeedPostViewData)
Triggered when "See More" in the post heading is clicked.onViewMoreRepliesClicked(position: Int, comment: LMFeedCommentViewData)
Triggered when "View More Replies" is clicked.
Usage Example
In this example, we're customizing the following elements of the post detail screen:
- Header View Appearance: Change the title.
- Click Listeners: Override behavior for comment like.
Steps to customize
Step 1: Create CustomLMFeedPostDetailFragment
Start by extending LMFeedPostDetailFragment
and create a custom class, say CustomLMFeedPostDetailFragment
.
class CustomLMFeedPostDetailFragment : LMFeedPostDetailFragment() {
// We will override methods in the next step
}
Step 2: Override and Customize Methods
You can customize various aspects of the post detail screen by overriding specific functions.
If you're providing your own custom layout or binding, you must override all lifecycle functions, especially:
onCreateView
onViewCreated
onResume
onPause
onDestroyView
class CustomLMFeedPostDetailFragment : LMFeedPostDetailFragment() {
override fun customizePostDetailHeaderView(headerViewPostDetail: LMFeedHeaderView) {
super.customizePostDetailHeaderView(headerViewPostDetail)
headerViewPostDetail.setTitleText("Custom Title")
}
override fun onCommentLiked(position: Int, comment: LMFeedCommentViewData) {
super.onCommentLiked(position, comment)
// Write your logic
}
}
Step 3: Pass CustomLMFeedPostDetailFragment
for Navigation
You now need to ensure that your fragment is returned wherever the post detail screen is launched.
val application = this
val theme = LMFeedTheme.SOCIAL_FEED
val enablePushNotifications = false
val deviceId = null
val domain = "ENTER YOUR DOMAIN HERE"
val lmFeedCoreCallback = null
LMFeedCore.setup(
application = application,
theme,
enablePushNotifications = enablePushNotifications,
deviceId = deviceId,
domain = domain,
lmFeedCoreCallback = lmFeedCoreCallback
)
// Set your custom post detail fragment here
LMFeedCore.setPostDetailFragment(CustomLMFeedPostDetailFragment())