Screen: LMFeedEditPostFragment
LMFeedEditPostFragment
provides an interface for editing existing posts in the LikeMinds feed system. It supports modifying text, images, videos, documents, and polls within a post.
GitHub Link to LMFeedEditPostFragment
View Style: LMFeedEditPostFragmentViewStyle
LMFeedEditPostFragmentViewStyle
defines the visual style and structure of the LMFeedEditPostFragment. The following fields are available for customization:
Field Name | Description | Type |
---|---|---|
headerViewStyle | Style for the header of the edit post screen. | LMFeedHeaderViewStyle |
postHeaderViewStyle | Style for the post header view. | LMFeedPostHeaderViewStyle |
postComposerStyle | Style for the main post composer. | LMFeedEditTextStyle |
postHeadingComposerStyle | Style for the heading composer in posts. | LMFeedEditTextStyle |
postHeadingLimitTextStyle | Style for the heading character limit display. | LMFeedTextStyle |
progressBarStyle | Style for the progress bar used during edits. | LMFeedProgressBarStyle |
selectTopicsChipStyle | Style for the topic selection chip. | LMFeedChipStyle |
editTopicsChipStyle | Style for the edit topics chip. | LMFeedChipStyle |
disabledTopicsAlertDialogStyle | Style for the alert dialog when topics are disabled. | LMFeedAlertDialogViewStyle |
GitHub Link to LMFeedEditPostFragmentViewStyle
Customization available in LMFeedEditPostFragment
Header Customizations
- customizeEditPostHeaderView(headerViewEditPost: LMFeedHeaderView): Allows customization of the edit post header.
Post Content Customizations
- customizePostHeaderView(postHeader: LMFeedPostHeaderView): Customizes the post header.
- customizePostComposer(etPostComposer: LMFeedEditText): Customizes the post composer for text content.
- customizePostHeadingComposer(etPostHeadingComposer: LMFeedEditText): Customizes the heading composer in the post.
- customizePostHeadingLimit(tvPostHeadingLimitTextView: LMFeedTextView): Customizes the character limit display for the heading.
Attachments Customizations
- customizePostImageAttachment(postSingleImageView: LMFeedPostImageMediaView): Customizes the image attachment section.
- customizePostVideoAttachment(postSingleVideoView: LMFeedPostVideoMediaView): Customizes the video attachment section.
- customizePostLinkViewAttachment(linkMediaView: LMFeedPostLinkMediaView): Customizes the link view attachment section.
- customizePostDocumentsAttachment(postDocumentsView: LMFeedPostDocumentsMediaView): Customizes the document attachment section.
- customizePostMultipleMedia(postMultipleMediaView: LMFeedPostMultipleMediaView): Customizes the display of multiple media attachments.
- customizePostPollAttachmentView(pollView: LMFeedPostPollView): Customizes the poll attachment section.
Progress Bar Customization
- customizeEditPostProgressbar(progressBar: LMFeedProgressBar): Customizes the progress bar shown during post edits.
Interactions available in LMFeedEditPostFragment
Post Actions
- onSavePostClicked(): Handles the save action for the edited post.
Media and Document Interactions
- onPostDocumentMediaClicked(position: Int, parentPosition: Int, attachmentViewData: LMFeedAttachmentViewData): Handles clicks on document or media attachments within the post.
Usage Example
In this example, we're customizing the following elements of the edit post screen:
- Header View Appearance: Change the title.
- Click Listeners: Override behavior for save editted post click.
Steps to customize
Step 1: Create CustomEditPostFragment
Start by extending LMFeedEditPostFragment
and create a custom class, say CustomEditPostFragment
.
class CustomEditPostFragment : LMFeedEditPostFragment() {
// We will override methods in the next step
}
Step 2: Override and Customize Methods
You can customize various aspects of the edit post 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 CustomEditPostFragment : LMFeedEditPostFragment() {
override fun customizeEditPostHeaderView(headerViewEditPost: LMFeedHeaderView) {
super.customizeEditPostHeaderView(headerViewEditPost)
headerViewEditPost.setTitleText("Custom Title")
}
override fun onSavePostClicked() {
super.onSavePostClicked()
// Write your logic
}
}
Step 3: Pass CustomEditPostFragment
for Navigation
You now need to ensure that your fragment is returned wherever the edit post 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 edit post fragment here
LMFeedCore.setEditPostFragment(CustomEditPostFragment())