package com.ccwangluo.cc_quickly.ui.quick

import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.ccwangluo.accelerator.utils.LoginUtils
import com.ccwangluo.cc_quickly.databinding.FragmentQuickBinding
import com.xuexiang.xpage.base.XPageFragment
import com.xuexiang.xpage.utils.TitleBar

class QuickFragment : XPageFragment() {
    private var _binding: FragmentQuickBinding? = null
    private val binding get() = _binding!!

    override fun initTitleBar(): TitleBar? {
        //不使用@Page标注的一定要注意覆盖这个方法
        return null
    }

    override fun inflateView(inflater: LayoutInflater?, container: ViewGroup?): View {
        _binding = FragmentQuickBinding.inflate(inflater!!, container, false)
        return binding.root
    }

    override fun initViews() {

    }

    override fun initListeners() {
        binding.btnExpend.setOnClickListener {
            if (binding.expandableLayout1.isExpanded) {
                binding.expandableLayout1.toggle()
                binding.expandableLayout2.expand()
            } else {
                binding.expandableLayout1.expand()
                binding.expandableLayout2.toggle()
            }
        }
        binding.btnQuick.setOnClickListener {
            if (!LoginUtils.hasToken()) {
                LoginUtils.login(this,{

                })
            } else {

            }
        }
    }

    companion object {
        fun newInstance(): QuickFragment {
            val fragment = QuickFragment()
            return fragment
        }
    }

}