package com.swago.room.dialog

import android.os.Bundle
import android.view.Gravity
import android.view.View
import com.alibaba.android.arouter.launcher.ARouter
import com.gyf.immersionbar.ImmersionBar
import com.swago.baseswago.constant.ARouteConstant
import com.swago.baseswago.dialog.BaseXDFragment
import com.swago.baseswago.util.NoDoubleClickListener
import com.swago.room.databinding.DialogMessageListBinding
import com.tencent.imsdk.v2.V2TIMConversation

/**
 *@date 2021/11/11 21:03
 *description:
 */
class MessageListDialog : BaseXDFragment<DialogMessageListBinding>() {

    override fun onActivityCreated(savedInstanceState: Bundle?) {
        super.onActivityCreated(savedInstanceState)
        setDimAmount(0f)
        setHeightMatchParent()
        setGravity(Gravity.BOTTOM)
    }

    override fun initOther() {
        binding.conversation.initDefault()
        binding.conversation.conversationList.setOnItemClickListener { view, position, messageInfo ->
            ARouter.getInstance().build(ARouteConstant.Home.chatDetail)
                .withInt("type", V2TIMConversation.V2TIM_C2C)
                .withString("account",messageInfo.id)
                .withString("chatName",messageInfo.title).navigation()
        }

        binding.conversation.conversationList.setOnItemLongClickListener { view, position, messageInfo ->

        }

        binding.cl.setOnClickListener(object : NoDoubleClickListener() {
            override fun onClick() {
                dismissAllowingStateLoss()
            }
        })
    }

    override fun initLiveData() {}

}