Skip to main content

Screen: LMFeedPollResultsFragment

LMFeedPollResultsFragment displays the results of a poll within the LikeMinds feed system. It allows users to view detailed results, including poll options, votes, and participant information.
GitHub Link to LMFeedPollResultsFragment


View Style: LMFeedPollResultsFragmentViewStyle

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

Field NameDescriptionType
headerViewStyleStyle for the header of the poll results screen.LMFeedHeaderViewStyle
pollResultsTabElevationElevation style for the poll results tabs.Int
noResultsLayoutViewStyleStyle for the "no results" layout.LMFeedNoEntityLayoutViewStyle
selectedPollResultsTabColorColor for the selected poll results tab.Int
unselectedPollResultsTabColorColor for unselected poll results tabs.Int
pollResultsTabTextViewStyleStyle for the text view in poll results tabs.LMFeedTextStyle
userViewStyleDefines the style for user views in the poll results.LMFeedUserViewStyle
backgroundColorBackground color for the poll results fragment.Int

GitHub Link to LMFeedPollResultsFragmentViewStyle


Customization available in LMFeedPollResultsFragment

Header Customizations

  • customizePollResultsHeaderView(headerViewPollResults: LMFeedHeaderView): Allows customization of the header view in the poll results fragment.

Tab Customizations

  • customizePollResultsTabTextView(tvPollOptionCount: LMFeedTextView, tvPollOptionText: LMFeedTextView): Customizes the text view style for poll results tabs.

Interactions available in LMFeedPollResultsFragment

No interaction methods were found in this fragment.

Usage Example

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

  • Header View Appearance: Change the title.
  • Click Listeners: Override behavior for navigation icon click.

Steps to customize

Step 1: Create CustomPollResultsFragment

Start by extending LMFeedPollResultsFragment and create a custom class, say CustomPollResultsFragment.

class CustomPollResultsFragment : LMFeedPollResultsFragment() {
// We will override methods in the next step
}

Step 2: Override and Customize Methods

You can customize various aspects of the poll results 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 CustomPollResultsFragment : LMFeedPollResultsFragment() {

override fun customizePollResultsHeaderView(headerViewPollResults: LMFeedHeaderView) {
super.customizePollResultsHeaderView(headerViewPollResults)

headerViewPollResults.setTitleText("Custom Title")
}

override fun onNavigationIconClick() {
super.onNavigationIconClick()

// Write your logic
}
}

Step 3: Pass CustomPollResultsFragment for Navigation

You now need to ensure that your fragment is returned wherever the poll results 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 poll results fragment here
LMFeedCore.setPollResultsFragment(CustomPollResultsFragment())