BaseFragment抽取

public abstract class BaseFragment extends Fragment{
    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return getView(inflater,null);
    }

    protected  abstract View getLoadView(LayoutInflater inflater,ViewGroup containe);
    protected  abstract void initView(View view);
    protected  abstract void setOnClick();
    protected  abstract void progressLogic();

     View getView(LayoutInflater inflater, ViewGroup container) {
         View loadView = getLoadView(inflater, null);
         if(loadView!=null){
            initView(loadView);
            setOnClick();
            progressLogic();
        }
        return loadView;
    }
}

猜你喜欢

转载自blog.csdn.net/Zhangyz_521/article/details/85344934