package com.bxzk.afxj.View.BaseActivity;

import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.RelativeLayout;

import androidx.annotation.Nullable;

import com.tsy.sdk.myokhttp.util.LogUtils;
import com.bxzk.afxj.DaggerComponent.MainComponent;
import com.bxzk.afxj.DaggerComponent.MainModule;
import com.bxzk.afxj.R;
import com.bxzk.afxj.application.BApplication;
import com.bxzk.afxj.util.EventBusUtils;

import javax.inject.Inject;

import butterknife.ButterKnife;

//import com.shuanglu.green.dyf.DaggerComponent.DaggerMainComponent;

public abstract class BaseBarActivity<V, T extends BasePresenter<V>> extends BaseActivity {
    public RelativeLayout rl_title;
    @Inject
    protected T mPresenter;

    public View emptyvie;
    public View emptyvie1;
    protected View emptyvie_net;
    protected boolean disableBack; //是否禁用返回

    //Dagger2封装
    protected MainComponent getActivityComponent() {
        return BApplication.getBaseComponent().addSub(new MainModule(this));
    }

    @Override
    protected void initFirst() {
        inject();
        if (null != mPresenter) {
            mPresenter.attachView((V) this);
        }
    }

    @Override
    public void initView(@Nullable Bundle savedInstanceState) {
//        emptyvie = View.inflate(this, R.layout.emptyview_data, null);
        ButterKnife.bind(this);
        initLHView(savedInstanceState);
        initValue(savedInstanceState);
       /* int x = (int) SPUtils.get(BApplication.getContext(), SpManage.Language,0);
        LanguageUtils.switchLanguage(x);*/
        LogUtils.e("BaseActivity", getClass().getName());
    }

    protected abstract void initLHView(@Nullable Bundle savedInstanceState);

    public abstract void initValue(@Nullable Bundle savedInstanceState);

    public abstract void inject();

    @Override
    public void onDestroy() {
        super.onDestroy();
        emptyvie1 = null;
        emptyvie = null;
        emptyvie_net = null;
        if (null != mPresenter) {
            mPresenter.detachView();
        }
    }




    protected boolean interrupt;






}
