package com.bc_chat.contacts.view

import android.view.View
import com.bc_chat.contacts.R
import com.bc_chat.contacts.databinding.DialogMessageReminderBinding
import com.zhaohaoting.framework.abs.AbsBottomDialogFragment
import com.zhaohaoting.framework.abs.contract.BaseContract

/**
 * Created by zhaoting on 2019/3/2.
 * Desc：消息提醒设置
 */
class MessageReminderDialog : AbsBottomDialogFragment<BaseContract.BasePresenter>() {

    private val binding by lazy {
        rootDataBinding as DialogMessageReminderBinding
    }
    private var onClickListener: View.OnClickListener? = null

    override fun initPresenter(): BaseContract.BasePresenter? = null

    override fun getLayoutResId(): Int = R.layout.dialog_message_reminder

    override fun initialize() {
        binding.onClickEvent = onClickListener
    }

    fun setMessageReminderResultListener(listener: (position: Int) -> Unit) {
        onClickListener = View.OnClickListener { v ->
            when (v?.id) {
                R.id.tv_open -> {
                    listener(1)
                }
                R.id.tv_close_1h -> {
                    listener(2)
                }
                R.id.tv_close_8h -> {
                    listener(3)
                }
                R.id.tv_close_2d -> {
                    listener(4)
                }
                R.id.tv_close -> {
                    listener(5)
                }
                R.id.tv_cancel -> {
                }
            }
            dismissAllowingStateLoss()
        }
    }
}
