Search in sources :

Example 1 with DefaultRefreshFooterCreator

use of com.scwang.smart.refresh.layout.listener.DefaultRefreshFooterCreator 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();
}
Also used : RefreshHeader(com.scwang.smart.refresh.layout.api.RefreshHeader) XXFJumpRefreshHeader(com.xxf.view.refresh.XXFJumpRefreshHeader) XXFJumpRefreshFooter(com.xxf.view.refresh.XXFJumpRefreshFooter) XXF(com.xxf.arch.XXF) ArrayList(java.util.ArrayList) Fragment(androidx.fragment.app.Fragment) XXFUserInfoProvider(com.xxf.arch.core.XXFUserInfoProvider) XXFLoadingDialog(com.xxf.view.loading.XXFLoadingDialog) DefaultRefreshFooterCreator(com.scwang.smart.refresh.layout.listener.DefaultRefreshFooterCreator) RefreshLayout(com.scwang.smart.refresh.layout.api.RefreshLayout) SmartRefreshLayout(com.scwang.smart.refresh.layout.SmartRefreshLayout) NonNull(androidx.annotation.NonNull) Context(android.content.Context) XXFJumpRefreshFooter(com.xxf.view.refresh.XXFJumpRefreshFooter) RefreshFooter(com.scwang.smart.refresh.layout.api.RefreshFooter) DefaultRefreshHeaderCreator(com.scwang.smart.refresh.layout.listener.DefaultRefreshHeaderCreator) XXFJumpRefreshHeader(com.xxf.view.refresh.XXFJumpRefreshHeader) FragmentActivity(androidx.fragment.app.FragmentActivity) BiConsumer(io.reactivex.rxjava3.functions.BiConsumer) LifecycleOwner(androidx.lifecycle.LifecycleOwner)

Aggregations

Context (android.content.Context)1 NonNull (androidx.annotation.NonNull)1 Fragment (androidx.fragment.app.Fragment)1 FragmentActivity (androidx.fragment.app.FragmentActivity)1 LifecycleOwner (androidx.lifecycle.LifecycleOwner)1 SmartRefreshLayout (com.scwang.smart.refresh.layout.SmartRefreshLayout)1 RefreshFooter (com.scwang.smart.refresh.layout.api.RefreshFooter)1 RefreshHeader (com.scwang.smart.refresh.layout.api.RefreshHeader)1 RefreshLayout (com.scwang.smart.refresh.layout.api.RefreshLayout)1 DefaultRefreshFooterCreator (com.scwang.smart.refresh.layout.listener.DefaultRefreshFooterCreator)1 DefaultRefreshHeaderCreator (com.scwang.smart.refresh.layout.listener.DefaultRefreshHeaderCreator)1 XXF (com.xxf.arch.XXF)1 XXFUserInfoProvider (com.xxf.arch.core.XXFUserInfoProvider)1 XXFLoadingDialog (com.xxf.view.loading.XXFLoadingDialog)1 XXFJumpRefreshFooter (com.xxf.view.refresh.XXFJumpRefreshFooter)1 XXFJumpRefreshHeader (com.xxf.view.refresh.XXFJumpRefreshHeader)1 BiConsumer (io.reactivex.rxjava3.functions.BiConsumer)1 ArrayList (java.util.ArrayList)1