package com.remax.visualnovel.ui.chat.call

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import com.remax.visualnovel.databinding.LayoutChatCallViewBinding


class ChatCallView @JvmOverloads constructor(
    context: Context,
    attrs: AttributeSet? = null,
    defStyleAttr: Int = 0
) : LinearLayout(context, attrs, defStyleAttr) {

    private var mBinding: LayoutChatCallViewBinding

    private lateinit var mEventListener: IEventListener


    interface IEventListener {
        fun onExitCall()
    }


    init {
        mBinding = LayoutChatCallViewBinding.inflate(LayoutInflater.from(context), this, true)
        setupClickListeners()
        mBinding.lottieSpeaking.playAnimation()
    }



    private fun setupClickListeners() {
        with (mBinding) {
            tvHangUp.setOnClickListener {
                mEventListener.onExitCall()
            }
        }
    }

    fun setEventListener(listener: IEventListener) {
        mEventListener = listener
    }




}