package com.yidianling.ydlcommon.custom.mvp

import com.yidianling.ydlcommon.custom.base.BaseActivity

/**
 * author : Zhangwenchao
 * e-mail : zhangwch@yidianling.com
 * time   : 2018/01/29
 *
 * 使用 mvp 的 Activity
 */
abstract class MVPActivity<out P: MVPPresenter<*, *>>: BaseActivity(),
    MVPView {

    protected val presenter: P by lazy { createPresenter() }

    override fun onDestroy() {
        super.onDestroy()
        presenter.onViewDestroy()
    }

    protected abstract fun createPresenter(): P
}