Skip to main content

Screen: LMFeedAdminDeleteDialogFragment

The LMFeedAdminDeleteDialogFragment handles the administrative delete dialog in the LikeMinds feed system. It enables administrators to confirm or cancel delete operations within the feed, providing a flexible and customizable user experience.

GitHub File: LMFeedAdminDeleteDialogFragment.kt


View Style: LMFeedAdminDeleteDialogFragmentStyle

The LMFeedAdminDeleteDialogFragmentStyle defines the visual style and structure of the LMFeedAdminDeleteDialogFragment. It provides various customization options for the dialog and its components.

GitHub File: LMFeedAdminDeleteDialogFragmentStyle.kt

FieldDescriptionType
adminDeleteDialogStyleStyle attributes for the admin delete dialog.LMFeedAlertDialogViewStyle
selectorIconStyleDefines the style for selector icons.LMFeedIconStyle
reasonTextStyleStyle for the text displaying reasons in the dialog.LMFeedTextStyle

Customization Available in LMFeedAdminDeleteDialogFragment

The fragment provides the following customization methods:

Dialog Customizations

  • customizeAdminDeleteDialog(dialog: LMFeedAlertDialogView) - Customize the appearance and behavior of the admin delete dialog, including its layout and components.

Interactions Available in LMFeedAdminDeleteDialogFragment

The fragment supports the following interaction methods:

Selector Click Interactions

  • onAdminDeleteAlertSelectorClicked()
    Handles clicks on selector options within the delete dialog.

Button Click Interactions

  • onAdminDeleteAlertPositiveButtonClicked()
    Handles the confirmation of a delete operation when the positive button is clicked.

  • onAdminDeleteAlertNegativeButtonClicked()
    Handles the cancellation of a delete operation when the negative button is clicked.

Usage Example

In this example, we're customizing the following elements of the admin delete dialog:

  • Dialog Appearance: Change the title of the dialog.
  • Click Listeners: Override behavior for alert positive button click.

Steps to customize

Step 1: Create CustomAdminDeleteDialogFragment

Start by extending LMFeedAdminDeleteDialogFragment and create a custom class, say CustomAdminDeleteDialogFragment.

class CustomAdminDeleteDialogFragment : LMFeedAdminDeleteDialogFragment() {
// We will override methods in the next step
}

Step 2: Override and Customize Methods

You can customize various aspects of the admin delete dialog 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 CustomAdminDeleteDialogFragment : LMFeedAdminDeleteDialogFragment() {

override fun customizeAdminDeleteDialog(alertDialogDelete: LMFeedAlertDialogView) {
super.customizeAdminDeleteDialog(alertDialogDelete)

alertDialogDelete.setAlertTitle("Custom Title")
}

override fun onAdminDeleteAlertPositiveButtonClicked() {
super.onAdminDeleteAlertPositiveButtonClicked()

// Write your logic
}
}

Step 3: Pass CustomAdminDeleteDialogFragment for Navigation

You now need to ensure that your fragment is returned wherever the admin delete dialog 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 admin delete dialog fragment here
LMFeedCore.setAdminDeleteDialogFragment(CustomAdminDeleteDialogFragment())