package com.joker.fourfun.base;

import android.app.Activity;

import com.joker.fourfun.di.component.AppComponent;
import com.joker.fourfun.di.component.DaggerFragmentComponent;
import com.joker.fourfun.di.component.FragmentComponent;
import com.joker.fourfun.di.module.FragmentModule;

import javax.inject.Inject;

import me.yokeyword.fragmentation.SupportActivity;
import me.yokeyword.fragmentation.SupportFragment;

public abstract class BaseMvpFragment<V extends BaseView, T extends BaseMvpPresenter<V>> extends
        SupportFragment implements
        BaseView {
    @Inject
    protected T mPresenter;
    protected SupportActivity mActivity;

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        initInject();
        mActivity = _mActivity;
        mPresenter.attach((V) this);
    }

    protected FragmentComponent getComponent() {
        return DaggerFragmentComponent.builder().appComponent(AppComponent.getInstance()).fragmentModule
                (getModule()).build();
    }

    protected FragmentModule getModule() {
        return new FragmentModule(this);
    }

    @Override
    public void onDestroy() {
        mPresenter.detach();
        super.onDestroy();
    }

    protected abstract void initInject();
}

@@ -54,16 +54,179 @@
 ctivity;
+%0Aimport android.os.Bundle;%0Aimport android.support.annotation.Nullable;%0Aimport android.view.LayoutInflater;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;
 %0A%0Aimport
@@ -808,16 +808,381 @@
 ivity;%0A%0A
+    @Nullable%0A    @Override%0A    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle%0A            savedInstanceState) %7B%0A        return createView(inflater, container, savedInstanceState);%0A    %7D%0A%0A    protected abstract View createView(LayoutInflater inflater, ViewGroup container, Bundle%0A            savedInstanceState);%0A%0A
     @Ove

refactor code