Skip to main content

Screen: LMFeedLikesFragment

LMFeedLikesFragment is responsible for displaying the list of users who have liked a specific post or content within the LikeMinds feed system. It provides options for viewing user profiles and interacting with the list of likes.
GitHub Link to LMFeedLikesFragment


View Style: LMFeedLikesFragmentViewStyle​

LMFeedLikesFragmentViewStyle defines the visual style and structure of the LMFeedLikesFragment. The following fields are available for customization:

Field NameDescriptionType
headerViewStyleStyle attributes for the header view.LMFeedHeaderViewStyle
userViewStyleDefines the style for displaying user views.LMFeedUserViewStyle
backgroundColorBackground color for the likes fragment.Int

GitHub Link to LMFeedLikesFragmentViewStyle


Customization available in LMFeedLikesFragment​

Header Customizations​

  • customizeLikesFragmentHeaderView(headerViewLikes: LMFeedHeaderView): Allows customization of the header view in the likes fragment.

Interactions available in LMFeedLikesFragment​

Item Click Interactions​

  • onUserLikeItemClicked(position: Int, likesViewData: LMFeedLikeViewData): Handles clicks on individual user items within the likes list.

Usage Example​

In this example, we're customizing the following elements of the likes screen:

  • Header View Appearance: Change the title.
  • Click Listeners: Override behavior for like item click.

Steps to customize​

Step 1: Create CustomLikesFragment​

Start by extending LMFeedLikesFragment and create a custom class, say CustomLikesFragment.

class CustomLikesFragment : LMFeedLikesFragment() {
// We will override methods in the next step
}

Step 2: Override and Customize Methods​

You can customize various aspects of the likes 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 CustomLikesFragment : LMFeedLikesFragment() {

override fun customizeLikesFragmentHeaderView(headerViewLikes: LMFeedHeaderView) {
super.customizeLikesFragmentHeaderView(headerViewLikes)

headerViewLikes.setTitleText("Custom Title")
}

override fun onUserLikeItemClicked(position: Int, likesViewData: LMFeedLikeViewData) {
super.onUserLikeItemClicked(position, likesViewData)

// Write your logic
}
}

Step 3: Pass CustomLikesFragment for Navigation​

You now need to ensure that your fragment is returned wherever the likes 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 likes fragment here
LMFeedCore.setLikesFragment(CustomLikesFragment())