package com.ahau.againstpest.view;

import android.app.Activity;
import android.os.Bundle;

import com.ahau.againstpest.presenter.BasePresenter;

/**
 * 注释:
 *
 * @author fanchunchun
 * @date 2018/4/3
 */

public abstract class BaseActivity<V,T extends BasePresenter<V>> extends Activity{

    //表示层的引用
    public T pestPresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        pestPresenter = createPresenter();
        pestPresenter.attachView((V) this);
    }

    protected abstract T createPresenter();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        pestPresenter.detachView();
    }
}
