package com.sixin.module_p.ui.set

import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.lukouguoji.module_base.base.BaseBindingActivity
import com.lukouguoji.module_base.common.ConstantEvent
import com.lukouguoji.module_base.impl.FlowBus
import com.lukouguoji.module_base.impl.observe
import com.sixin.module_p.R
import com.sixin.module_p.base.BasePdaActivity
import com.sixin.module_p.databinding.ActivityPdaSetBinding
import com.sixin.module_p.helper.PDAHelper
import me.jessyan.autosize.internal.CustomAdapt

class PdaSetActivity : BasePdaActivity<ActivityPdaSetBinding, PdaSetViewModel>(),
    CustomAdapt {

    override fun layoutId(): Int {
        return R.layout.activity_pda_set
    }

    override fun viewModelClass(): Class<PdaSetViewModel> {
        return PdaSetViewModel::class.java
    }

    override fun initOnCreate(savedInstanceState: Bundle?) {
        setBackArrow("重置密码")

        binding.viewModel = viewModel
        FlowBus.with<Any>(ConstantEvent.LOGOUT)
            .observe(this) {
                finish()
            }
    }


    override fun isBaseOnWidth() = true

    override fun getSizeInDp(): Float = PDAHelper.PDA_WIDTH

    companion object {
        @JvmStatic
        fun start(context: Context) {
            val starter = Intent(context, PdaSetActivity::class.java)
            context.startActivity(starter)
        }
    }
}