package com.amz.genie.helpers

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import androidx.emoji2.emojipicker.EmojiPickerView

class EmojiPickerBottomSheet(
    private val onEmojiPicked: (String) -> Unit
) : BottomSheetDialogFragment() {

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        val picker = EmojiPickerView(requireContext())

        picker.setOnEmojiPickedListener { emojiViewItem ->
            onEmojiPicked(emojiViewItem.emoji)
            dismiss()
        }

        return picker
    }
}
