package me.jessyan.mvparms.demo.mvp.ui.common;

import com.jess.arms.base.BaseFragment;
import com.jess.arms.mvp.BasePresenter;
import com.squareup.leakcanary.RefWatcher;

import me.jessyan.mvparms.demo.app.WEApplication;
import me.jessyan.mvparms.demo.di.component.AppComponent;

/**
 * Created by jess on 8/5/16 14:11
 * contact with jess.yan.effort@gmail.com
 */
public abstract class WEFragment<P extends BasePresenter> extends BaseFragment<P> {
    protected WEApplication mWeApplication;
    @Override
    protected void ComponentInject() {
        mWeApplication = (WEApplication)mActivity.getApplication();
        setupFragmentComponent(mWeApplication.getAppComponent());
    }

    //提供AppComponent(提供所有的单例对象)给子类，进行Component依赖
    protected abstract void setupFragmentComponent(AppComponent appComponent);

    @Override
    public void onDestroy() {
        super.onDestroy();
        RefWatcher watcher = WEApplication.getRefWatcher(getActivity());
        if (watcher != null) {
            watcher.watch(this);
        }
    }
}

@@ -949,24 +949,53 @@
 Activity());
+//%E4%BD%BF%E7%94%A8leakCanary%E6%A3%80%E6%B5%8Bfragment%E7%9A%84%E5%86%85%E5%AD%98%E6%B3%84%E6%BC%8F
 %0A        if 

improve debug mode