use of com.xxf.view.refresh.XXFJumpRefreshHeader in project xxf_android by NBXXF.
the class BaseApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
Log.d("====>app", "app:" + ApplicationInitializer.applicationContext);
Toast.makeText(this, "yes:" + ApplicationInitializer.applicationContext, Toast.LENGTH_LONG).show();
INSTANCE = this;
RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
Log.e("=============>", "t:" + Thread.currentThread().getName(), throwable);
}
});
XXF.init(new XXF.Builder(this, new ProgressHUDFactory.ProgressHUDProvider() {
@Override
public ProgressHUD onCreateProgressHUD(LifecycleOwner lifecycleOwner) {
if (lifecycleOwner instanceof FragmentActivity) {
return new XXFLoadingDialog((FragmentActivity) lifecycleOwner);
} else if (lifecycleOwner instanceof Fragment) {
return new XXFLoadingDialog(((Fragment) lifecycleOwner).getContext());
}
return null;
}
}).setUserInfoProvider(new XXFUserInfoProvider() {
@Override
public String getUserId() {
return "xxx_7764";
}
}).setErrorHandler(new BiConsumer<Integer, Throwable>() {
@Override
public void accept(Integer flag, Throwable throwable) throws Throwable {
ToastUtils.showToast("error:" + throwable, ToastUtils.ToastType.ERROR, flag);
}
}));
// 可做本module 相关sdk初始化
// 设置全局的Header构建器
SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() {
@NonNull
@Override
public RefreshHeader createRefreshHeader(@NonNull Context context, @NonNull RefreshLayout layout) {
return new XXFJumpRefreshHeader(context);
}
});
SmartRefreshLayout.setDefaultRefreshFooterCreator(new DefaultRefreshFooterCreator() {
@NonNull
@Override
public RefreshFooter createRefreshFooter(@NonNull Context context, @NonNull RefreshLayout layout) {
return new XXFJumpRefreshFooter(context);
}
});
// XXFStateLayout.setDefaultEmptyText(R.string.app_name);
List<Integer> ignores = new ArrayList<>();
ignores.addAll(ResourcesUtil.getStringResources(androidx.appcompat.R.class));
ignores.addAll(ResourcesUtil.getDrawableResources(androidx.appcompat.R.class));
// ResourcesUtil.checkResources(ignores);
setVmPolicy();
}
Aggregations