package com.yidianling.medical.popwindow

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.PopupWindow
import com.yidianling.im.R
import kotlinx.android.synthetic.main.medical_im_chat_popup_window.view.*


/**
 * Created by xj on 2019/10/14.
 */
class MedicalChatSettingPopupWindow(
    context: Context,
    chatSettingClickListener: OnChatSettingClickListener?
) : PopupWindow(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT) {
    init {
        val view = LayoutInflater.from(context).inflate(R.layout.medical_im_chat_popup_window, null)
        this.contentView = view
        this.isFocusable = true
        this.isOutsideTouchable = true

        view.ll_all_read.setOnClickListener {
            chatSettingClickListener?.onAllReadClick()
            dismiss()
        }
        view.ll_chat_setting.setOnClickListener {
            chatSettingClickListener?.onChatSettingClick()
            dismiss()
        }

        setOnDismissListener {
            chatSettingClickListener?.onDismissAction()
        }
    }

    interface OnChatSettingClickListener {
        fun onAllReadClick() //全部已读
        fun onChatSettingClick() //消息设置
        fun onDismissAction() //取消
    }
}