package com.zztrapp.zztrapp.base;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

;


/**
 * Describe 公共Fragment基类
 * Created by Bby on 2020/5/12
 * Email bby0856@163.com
 */
public abstract class BaseFragment extends Fragment {

    private Context context;

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        this.context = context;
    }

    public Context getFActivity() {
        return context;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(getLayoutId(), container, false);
//        AdaptScreenUtils.adaptWidth(getResources(), 375);
        initView();
        initData();

        return view;
    }

    public abstract int getLayoutId();

    public abstract void initView();

    public abstract void initData();

    @Override
    public void onResume() {
        super.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
//        EventBus.getDefault().unregister(this);
//        ButterKnife.unbind(this);
    }
}
