Screen: LMFeedSelfDeleteDialogFragment
The LMFeedSelfDeleteDialogFragment
is a dialog fragment that provides users with options to confirm or cancel the deletion of their own posts. It displays a customizable alert dialog with positive and negative actions.
GitHub Link to LMFeedSelfDeleteDialogFragment
View Style: LMFeedSelfDeleteDialogFragmentStyle
The LMFeedSelfDeleteDialogFragmentStyle
defines the visual style for the dialog fragment. Below are the customizable fields:
Field Name | Description | Type |
---|---|---|
selfDeleteDialogStyle | Style for the self-delete alert dialog. | LMFeedAlertDialogViewStyle |
GitHub Link to LMFeedSelfDeleteDialogFragmentStyle
Customization Available in LMFeedSelfDeleteDialogFragment
Dialog Customizations
- customizeSelfDeleteDialog(alertDialogDelete: LMFeedAlertDialogView)
Customizes the self-delete alert dialog view.
Interactions Available in LMFeedSelfDeleteDialogFragment
Alert Dialog Interactions
- onSelfDeleteAlertPositiveButtonClicked()
Triggered when the positive button in the self-delete alert dialog is clicked. - onSelfDeleteAlertNegativeButtonClicked()
Triggered when the negative button in the self-delete alert dialog is clicked.
Usage Example
In this example, we're customizing the following elements of the self 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 CustomSelfDeleteDialogFragment
Start by extending LMFeedSelfDeleteDialogFragment
and create a custom class, say CustomSelfDeleteDialogFragment
.
class CustomSelfDeleteDialogFragment : LMFeedSelfDeleteDialogFragment() {
// We will override methods in the next step
}
Step 2: Override and Customize Methods
You can customize various aspects of the self delete dialog 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 CustomSelfDeleteDialogFragment : LMFeedSelfDeleteDialogFragment() {
override fun customizeSelfDeleteDialog(alertDialogDelete: LMFeedAlertDialogView) {
super.customizeSelfDeleteDialog(alertDialogDelete)
alertDialogDelete.setAlertTitle("Custom Title")
}
override fun onSelfDeleteAlertPositiveButtonClicked() {
super.onSelfDeleteAlertPositiveButtonClicked()
// Write your logic
}
}
Step 3: Pass CustomSelfDeleteDialogFragment
for Navigation
You now need to ensure that your fragment is returned wherever the self 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 seld delete dialog fragment here
LMFeedCore.setSelfDeleteDialogFragment(CustomSelfDeleteDialogFragment())