package com.ez.ertc.meeting.widget

import android.app.Dialog
import android.content.Context
import android.os.Bundle
import com.ez.baselib.utils.NetLineConfigUtils
import com.ez.ertc.meeting.R
import kotlinx.android.synthetic.main.dialog_net_line_select.*

class NetLineSelectDialog(private val mContext: Context) : Dialog(mContext) {

    interface OnSaveNetLineListener {
        fun onSaveNetLine(lineId: Int)
    }

    var saveNetLineListener: OnSaveNetLineListener ? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.dialog_net_line_select)
        apiLineOutside.setOnClickListener {
            NetLineConfigUtils.setNetGroupLineId(mContext, NetLineConfigUtils.LINE_GROUP_ID_OUTSIDE)
            saveNetLineListener?.onSaveNetLine(NetLineConfigUtils.getNetGroupLineId(mContext))
            dismiss()
        }
        apiLineInside.setOnClickListener {
            NetLineConfigUtils.setNetGroupLineId(mContext, NetLineConfigUtils.LINE_GROUP_ID_INSIDE)
            saveNetLineListener?.onSaveNetLine(NetLineConfigUtils.getNetGroupLineId(mContext))
            dismiss()
        }
        cancel.setOnClickListener {
            dismiss()
        }
    }
}