package com.hh.lib_base.activity;

import androidx.annotation.NonNull;

import com.hh.lib_base.base.BasePresenter;


/**
 * @Description:
 * @author: Xia WeiHao
 * @date: 2023/4/11
 */
public abstract class BaseMVPActivity<P extends BasePresenter> extends BaseActivity {

	protected P mPresenter;

    @NonNull
    public abstract P initPresenter();

	@Override
	public void init() {
		super.init();
		mPresenter = initPresenter();
		if (mPresenter != null) {
			mPresenter.attachMV(this);
		}
	}


	@Override
	protected void onDestroy() {
		super.onDestroy();
		if (mPresenter != null) {
			mPresenter.detachMV();

		}
	}

}
