package com.grkj.iscs.view.activity.test

import com.grkj.iscs.R
import com.grkj.iscs.databinding.ActivityWidgetTestBinding
import com.grkj.iscs.util.ToastUtils
import com.grkj.iscs.view.base.BaseActivity
import com.grkj.iscs.view.widget.SelectableInput
import com.grkj.iscs.view.widget.SnakeGridLayoutManager
import com.zhy.adapter.recyclerview.CommonAdapter
import com.zhy.adapter.recyclerview.base.ViewHolder

class WidgetTestActivity : BaseActivity<ActivityWidgetTestBinding>() {

    override val viewBinding: ActivityWidgetTestBinding
        get() = ActivityWidgetTestBinding.inflate(layoutInflater)

    override fun initView() {
        mBinding?.siTest?.setOptionList(mutableListOf("1", "2", "3"))
        mBinding?.siTest?.setOnSpinnerSelectListener(object : SelectableInput.OnSpinnerSelectListener {
            override fun onSelect(str: String?, index: Int) {
                ToastUtils.tip("$str - $index")
            }
        })

        mBinding?.tvTest?.setOnClickListener {
            mBinding?.tvTest?.isSelected = !mBinding?.tvTest?.isSelected!!
        }

        val list = mutableListOf<String>()
        for (i in 0..500) {
            list.add("$i")
        }
        mBinding?.rvSnake?.layoutManager = SnakeGridLayoutManager(this, 5)
        mBinding?.rvSnake?.adapter = object : CommonAdapter<String>(this, R.layout.item_rv_menu, list) {
            override fun convert(holder: ViewHolder, t: String?, position: Int) {
//                holder.setText(R.id.tv_number, t)
            }
        }
    }
}