Skip to main content

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 NameDescriptionType
headerViewStyleStyle for the header of the edit post screen.LMFeedHeaderViewStyle
postHeaderViewStyleStyle for the post header view.LMFeedPostHeaderViewStyle
postComposerStyleStyle for the main post composer.LMFeedEditTextStyle
postHeadingComposerStyleStyle for the heading composer in posts.LMFeedEditTextStyle
postHeadingLimitTextStyleStyle for the heading character limit display.LMFeedTextStyle
progressBarStyleStyle for the progress bar used during edits.LMFeedProgressBarStyle
selectTopicsChipStyleStyle for the topic selection chip.LMFeedChipStyle
editTopicsChipStyleStyle for the edit topics chip.LMFeedChipStyle
disabledTopicsAlertDialogStyleStyle 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

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.

note

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())