package com.zswc.creativity.widget

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.databinding.DataBindingUtil
import com.zswc.creativity.R
import com.zswc.creativity.databinding.WidgetSearchBinding
import com.zswc.creativity.vmodel.SearchVModel
import com.ysnows.base.view.BView
import com.ysnows.base.view.BaseView

/**
 * 搜索的布局
 *Created by shihuiyun
 *on 2020/9/16
 */
class SearchView(context: Context, attrs: AttributeSet) : BaseLinearLayout(context, attrs) {
    var viewModel: SearchVModel? = null
        set(value) {
            binding?.vm = value
            field = value
        }
    private var binding: WidgetSearchBinding? = null
    private var view: BView? = null

    init {
        init(context)
    }

    private fun init(context: Context) {
        if (context is BaseView) {
            view = context as BView
        }
        binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.widget_search, this, true)

    }
}
