50 lines
1.3 KiB
Java
50 lines
1.3 KiB
Java
package com.sl.house_property;
|
|
|
|
import android.app.ProgressDialog;
|
|
|
|
import androidx.databinding.DataBindingUtil;
|
|
import androidx.databinding.ViewDataBinding;
|
|
import android.os.Bundle;
|
|
import androidx.annotation.LayoutRes;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.fragment.app.Fragment;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
|
|
/**
|
|
* Created by ximsfei on 17-1-7.
|
|
*/
|
|
|
|
public abstract class BaseFragment<VDB extends ViewDataBinding> extends Fragment {
|
|
protected VDB mDataBinding;
|
|
public ProgressDialog progressDialog;
|
|
@LayoutRes
|
|
protected abstract int getLayoutId();
|
|
|
|
@Override
|
|
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
|
super.onActivityCreated(savedInstanceState);
|
|
loadData();
|
|
}
|
|
|
|
@Nullable
|
|
@Override
|
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
View view = inflater.inflate(getLayoutId(), null);
|
|
|
|
mDataBinding = DataBindingUtil.bind(view);
|
|
onCreateVew(inflater, savedInstanceState);
|
|
progressDialog=new ProgressDialog(getActivity());
|
|
return view;
|
|
}
|
|
|
|
protected void onCreateVew(LayoutInflater inflater, Bundle savedInstanceState) {
|
|
|
|
}
|
|
|
|
|
|
protected abstract void loadData();
|
|
}
|
|
|