package com.zswc.creativity.fragment

import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.hwangjr.rxbus.annotation.Subscribe
import com.hwangjr.rxbus.annotation.Tag
import com.zswc.creativity.adapter.ConsignOrderListFragmentAdapter
import com.zswc.creativity.adapter.OrderListFragmentAdapter
import com.zswc.creativity.base.MBRFragment
import com.zswc.creativity.config.ConfigRx
import com.zswc.creativity.config.MIntentAction
import com.zswc.creativity.databinding.FragmentConsignorderListBinding
import com.zswc.creativity.databinding.FragmentOrderListBinding
import com.zswc.creativity.vmodel.ConsignOrderListFragmentVModel
import com.zswc.creativity.vmodel.OrderListFragmentVModel

/**
 *
 *on 2021/3/15
 */
class ConsignOrderListFragment: MBRFragment<ConsignOrderListFragmentVModel, ConsignOrderListFragmentAdapter, FragmentConsignorderListBinding>() {


    override fun __before(savedInstanceState: Bundle?) {
        super.__before(savedInstanceState)
        vm.state=arguments?.getString("state")

    }

    override fun init(savedInstanceState: Bundle?) {
        super.init(savedInstanceState)
        vm.fragment=this
    }

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)

        if (resultCode != Activity.RESULT_OK) {
            return
        }
        if (requestCode == MIntentAction.REQUEST_CODE_ONE) {//刷新
            onRefresh()
        }
    }
    override fun vmClass(): Class<ConsignOrderListFragmentVModel> {
        return ConsignOrderListFragmentVModel::class.java
    }

    override fun binding(inflater: LayoutInflater, container: ViewGroup?): FragmentConsignorderListBinding {
        return FragmentConsignorderListBinding.inflate(layoutInflater)
    }

    override fun initAdapter(): ConsignOrderListFragmentAdapter {
        return ConsignOrderListFragmentAdapter(vm)
    }

    override fun title(): String? {
        return null
    }

    override val isRxbus: Boolean
        get() = true


//    @Subscribe(tags = [Tag(ConfigRx.ORDER_SEARCH)])
//    fun setOrderSearch(k: String) {
//        vm.k=k
//        onRefresh()
//
//    }
//
//
//    @Subscribe(tags = [Tag(ConfigRx.ORDER_REFRESH)])
//    fun setOrderRefresh(type: String) {
//
//        onRefresh()
//
//    }
}
