A lightweight, good expandability Android library used for displaying different pages like loading, error, empty, timeout or even your custom page when you load a page

Overview

中文 | English

LoadSir

👉 👈

LoadSir是一个高效易用,低碳环保,扩展性良好的加载反馈页管理框架,在加载网络或其他数据时候,根据需求切换状态页面, 可添加自定义状态页面,如加载中,加载失败,无数据,网络超时,如占位图,登录失效等常用页面。可配合网络加载框架,结合返回 状态码,错误码,数据进行状态页自动切换,封装使用效果更佳。

使用场景

in Activity in View in Fragment
Placeholder Muitl-Fragment ViewPage+Fragment

下载 Demo

(密码:9517)

流程图

LoadSir的功能及特点

  • 支持Activity,Fragment,Fragment(v4),View状态回调
  • 适配多个Fragment切换,及Fragment+ViewPager切换,不会布局叠加或者布局错乱
  • 利用泛型转换输入信号和输出状态,可根据网络返回体的状态码或者数据返回自动适配状态页,实现全局自动状态切换
  • 无需修改布局文件
  • 只加载唯一一个状态视图,不会预加载全部视图
  • 不需要设置枚举或者常量状态值,直接用状态页类类型(xxx.class)作为状态码
  • 可对单个状态页单独设置点击事件,根据返回boolean值覆盖或者结合OnReloadListener使用,如网络错误可跳转设置页
  • 无预设页面,低耦合,开发者随心配置
  • 可保留标题栏(Toolbar,titile view等)
  • 可设置重新加载点击事件(OnReloadListener)
  • 可自定义状态页(继承Callback类)
  • 可在子线程直接切换状态
  • 可设置初始状态页(常用进度页作为初始状态)
  • 可扩展状态页面,在配置中添加自定义状态页
  • 可全局单例配置,也可以单独配置

开始使用LoadSir

LoadSir的使用,只需要简单的三步

添加依赖

compile 'com.kingja.loadsir:loadsir:1.3.8'

第一步:配置

全局配置方式

全局配置方式,使用的是单例模式,即获取的配置都是一样的。可在Application中配置,添加状态页,设置默认状态页

public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        LoadSir.beginBuilder()
                .addCallback(new ErrorCallback())//添加各种状态页
                .addCallback(new EmptyCallback())
                .addCallback(new LoadingCallback())
                .addCallback(new TimeoutCallback())
                .addCallback(new CustomCallback())
                .setDefaultCallback(LoadingCallback.class)//设置默认状态页
                .commit();
    }
}
单独配置方式

如果你即想保留全局配置,又想在某个特殊页面加点不同的配置,可采用该方式。

LoadSir loadSir = new LoadSir.Builder()
                .addCallback(new LoadingCallback())
                .addCallback(new EmptyCallback())
                .addCallback(new ErrorCallback())
                .build();
        loadService = loadSir.register(this, new Callback.OnReloadListener() {
            @Override
            public void onReload(View v) {
                // 重新加载逻辑
            }
        });

第二步:注册

在Activity中使用
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_content);
    // Your can change the callback on sub thread directly.
    LoadService loadService = LoadSir.getDefault().register(this, new Callback.OnReloadListener() {
        @Override
        public void onReload(View v) {
            // 重新加载逻辑
        }
    });
}}
在View 中使用
ImageView imageView = (ImageView) findViewById(R.id.iv_img);
LoadSir loadSir = new LoadSir.Builder()
        .addCallback(new TimeoutCallback())
        .setDefaultCallback(LoadingCallback.class)
        .build();
loadService = loadSir.register(imageView, new Callback.OnReloadListener() {
    @Override
    public void onReload(View v) {
        loadService.showCallback(LoadingCallback.class);
        // 重新加载逻辑
    }
});
Ps:
[1]要注册RelativeLayoutConstraintLayout的子View,如果该子View被其它子View约束,建议在子View外层再包一层布局,参考
acitivy_view.xm和activity_constraintlayout.xml
在Fragment 中使用

由于Fragment添加到Activitiy方式多样,比较特别,所以在Fragment注册方式不同于上面两种,大家先看模板代码:

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle
        savedInstanceState) {
    //第一步:获取布局View
    rootView = View.inflate(getActivity(), R.layout.fragment_a_content, null);
    //第二步:注册布局View
    LoadService loadService = LoadSir.getDefault().register(rootView, new Callback.OnReloadListener() {
        @Override
        public void onReload(View v) {
            // 重新加载逻辑
        }
    });
    //第三步:返回LoadSir生成的LoadLayout
    return loadService.getLoadLayout();
}

第三步: 回调

直接回调
protected void loadNet() {
        // 进行网络访问...
        // 进行回调
        loadService.showSuccess();//成功回调
        loadService.showCallback(EmptyCallback.class);//其他回调
    }
转换器回调 (推荐使用)

如果你不想再每次回调都要手动进行的话,可以选择注册的时候加入转换器,可根据返回的数据,适配对应的状态页。

LoadService loadService = LoadSir.getDefault().register(this, new Callback.OnReloadListener() {
    @Override
    public void onReload(View v) {
            // 重新加载逻辑
    }}, new Convertor<HttpResult>() {
    @Override
    public ClassCallback> map(HttpResult httpResult) {
        ClassCallback> resultCode = SuccessCallback.class;
        switch (httpResult.getResultCode()) {
            case SUCCESS_CODE://成功回调
                if (httpResult.getData().size() == 0) {
                    resultCode = EmptyCallback.class;
                }else{
                    resultCode = SuccessCallback.class;
                }
                break;
            case ERROR_CODE:
                resultCode = ErrorCallback.class;
                break;
        }
        return resultCode;
    }
});

回调的时候直接传入转换器指定的数据类型。

loadService.showWithConvertor(httpResult);

自定义回调页

LoadSir为了完全解耦,没有预设任何状态页,需要自己实现,开发者自定义自己的回调页面,比如加载中,没数据,错误,超时等常用页面, 设置布局及自定义点击逻辑

public class CustomCallback extends Callback {

    //填充布局
    @Override
    protected int onCreateView() {
        return R.layout.layout_custom;
    }
    //当前Callback的点击事件,如果返回true则覆盖注册时的onReloa(),如果返回false则两者都执行,先执行onReloadEvent()。
    @Override
    protected boolean onReloadEvent(final Context context, View view) {
        Toast.makeText(context.getApplicationContext(), "Hello buddy! :p", Toast.LENGTH_SHORT).show();
        (view.findViewById(R.id.iv_gift)).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(context.getApplicationContext(), "It's your gift! :p", Toast.LENGTH_SHORT).show();
            }
        });
        return true;
    }

    //是否在显示Callback视图的时候显示原始图(SuccessView),返回true显示,false隐藏
    @Override
    public boolean getSuccessVisible() {
        return super.getSuccessVisible();
    }

    //将Callback添加到当前视图时的回调,View为当前Callback的布局View
    @Override
    public void onAttach(Context context, View view) {
        super.onAttach(context, view);
    }

    //将Callback从当前视图删除时的回调,View为当前Callback的布局View
    @Override
    public void onDetach() {
        super.onDetach(context, view);
    }

}

动态修改Callback

loadService = LoadSir.getDefault().register(...);
loadService.setCallBack(EmptyCallback.class, new Transport() {
   @Override
   public void order(Context context, View view) {
       TextView mTvEmpty = (TextView) view.findViewById(R.id.tv_empty);
       mTvEmpty.setText("fine, no data. You must fill it!");
   }
});

LoadSir自带便携式Callback

ProgressCallback loadingCallback = new ProgressCallback.Builder()
        .setTitle("Loading", R.style.Hint_Title)
        .build();

HintCallback hintCallback = new HintCallback.Builder()
        .setTitle("Error", R.style.Hint_Title)
        .setSubTitle("Sorry, buddy, I will try it again.")
        .setHintImg(R.drawable.error)
        .build();

LoadSir loadSir = new LoadSir.Builder()
        .addCallback(loadingCallback)
        .addCallback(hintCallback)
        .setDefaultCallback(ProgressCallback.class)
        .build();

在使用过程中,遇到问题可以先去FAQ和Issues看看有没解决方案,如果没有的话,请给我提Issue吧。

💡 About placeholder effect

placeholder效果状态页类似ShimmerRecyclerView的效果. LoadSir只用了一个 自定义状态页PlaceHolderCallback就完成类似的效果,是不是很棒 👻

Docs

代码混淆

-dontwarn com.kingja.loadsir.**
-keep class com.kingja.loadsir.** {*;}

Contact Me

Any questions,Welcome to contact me.

License

Copyright 2017 KingJA

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • 如果替换的布局里有margin的属性 在回来的成功的时候显示会多一个margin

    如果替换的布局里有margin的属性 在回来的成功的时候显示会多一个margin

    如果替换的布局里有margin的属性 在回来的成功的时候显示会多一个margin 比如 我替换一个线性布局 里面有个margintop=“10dp” 替换回来的时候 loadsir 会把自己的布局添加一个margintop="10" 然后加载的布局也有个margintop 这样 就造成了2倍的距离

    opened by wilder-ness 8
  • 和SmartRefreshLayout一起使用时的问题

    和SmartRefreshLayout一起使用时的问题

    不知道作者有没有使用过SmartRefreshLayout,一起使用的时候不显示内容,只显示success的,切换之后就不显示了 这是我的布局代码:

    <include layout="@layout/toobar" />
        <com.scwang.smartrefresh.layout.SmartRefreshLayout
            android:id="@+id/smart_refresh_layout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            app:srlDragRate="0.7"
            app:srlHeaderMaxDragRate="1.3"
            app:srlHeaderTriggerRate="0.5">
    
            <com.scwang.smartrefresh.header.MaterialHeader
                android:id="@+id/header"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:wshPrimaryColor="@color/white" />
            <FrameLayout
                android:id="@+id/fl_content"
                android:layout_width="match_parent"
                android:layout_height="match_parent">
    
                <android.support.v7.widget.RecyclerView
                    android:id="@+id/recycler_view"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@color/white">
                </android.support.v7.widget.RecyclerView>
    
            </FrameLayout>
    
            <com.scwang.smartrefresh.layout.footer.ClassicsFooter
                android:layout_width="match_parent"
                android:layout_height="@dimen/dimen35"
                app:srlAccentColor="@color/toolbar_bg">
    
            </com.scwang.smartrefresh.layout.footer.ClassicsFooter>
    
        </com.scwang.smartrefresh.layout.SmartRefreshLayout>
    

    这是baseActivity里的代码:

    private void addContent() { boolean needLoadService = isNeedLoadService(); if (needLoadService) { FrameLayout flContent = rootView.findViewById(R.id.fl_content); if (flContent != null) { ButterKnife.bind(this, rootView); mBaseLoadService = LoadSir.getDefault().register(flContent, new Callback.OnReloadListener() { @Override public void onReload(View v) { onNetReload(v); } }); } setContentView(rootView); }else { setContentView(rootView); ButterKnife.bind(this); } }

    使用时: mBaseLoadService.showCallback(ErrorCallback.class); 这时布局里framelayout包裹的区域就什么都不显示了,其他的地方用都是好好的。我也找不到原因了,还请作者帮忙看看

    opened by superzhangbao 8
  • 请问activity可以像fragment那样把title放出来么

    请问activity可以像fragment那样把title放出来么

    您当时说抽出来放在基类,是可以实现,但是我的基类里面已经有这些方法了,有的时候,动态添加View,太容易报错了,出现异常,有没有别的办法实现呢,简单点的, 有些地方我的最外层布局是一些特殊的布局,
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);

    您这个方法又强制的改了我的最外层布局,我不想改布局呢

    opened by liguangze 8
  • 两层constraintlayout,以内层的constraintlayout为targetview在我们项目中报错

    两层constraintlayout,以内层的constraintlayout为targetview在我们项目中报错

    报错信息是说Framealayout.layoutparams不能强转成ConstraintLayout.layoutparams 但是按照loadersir的思路我写了个demo也是两层Constraintlayout,没有报错正常运行。想知道是不是loadsir还是不能支持ConstraintLayout?如果不支持为什么有的情况下与constraintLayout结合可以使用。具体哪些情况不能用呢 报错信息: java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to androidx.constraintlayout.widget.ConstraintLayout$LayoutParams at androidx.constraintlayout.widget.ConstraintLayout.getTargetWidget(ConstraintLayout.java:1144) at androidx.constraintlayout.widget.ConstraintLayout.setChildrenConstraints(ConstraintLayout.java:1038) at androidx.constraintlayout.widget.ConstraintLayout.updateHierarchy(ConstraintLayout.java:803) at androidx.constraintlayout.widget.ConstraintLayout.onMeasure(ConstraintLayout.java:1561) at android.view.View.measure(View.java:23466) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143) at android.view.View.measure(View.java:23466) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1565) at android.widget.LinearLayout.measureVertical(LinearLayout.java:847) at android.widget.LinearLayout.onMeasure(LinearLayout.java:726) at android.view.View.measure(View.java:23466) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at android.view.View.measure(View.java:23466) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1565) at android.widget.LinearLayout.measureVertical(LinearLayout.java:847) at android.widget.LinearLayout.onMeasure(LinearLayout.java:726) at android.view.View.measure(View.java:23466) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6834) at android.widget.FrameLayout.onMeasure(FrameLayout.java:185) at com.android.internal.policy.DecorView.onMeasure(DecorView.java:847) at android.view.View.measure(View.java:23466) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2954) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1753) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2041) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1636) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7946) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1092) at android.view.Choreographer.doCallbacks(Choreographer.java:893) at android.view.Choreographer.doFrame(Choreographer.java:812) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1078) at android.os.Handler.handleCallback(Handler.java:907) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:216) at android.app.ActivityThread.main(ActivityThread.java:7625) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)

    opened by dongbaoming123 7
  • 用到RecyclerView的时候 不能显示

    用到RecyclerView的时候 不能显示

    
    <com.scwang.smartrefresh.layout.SmartRefreshLayout
            android:id="@+id/refreshLayout"
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            >
    
            <android.support.v7.widget.RecyclerView
                android:id="@+id/recyclerview"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                />
    
        </com.scwang.smartrefresh.layout.SmartRefreshLayout>
    
    
    

    这种布局 我不管是注册到refreshLayout还是注册到recyclerView都是无法显示的。

    opened by 1izheng 7
  • java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

    java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

    我的是MainActivity,使用FrameLayout+RadioGroup的菜单。 我在BaseFragment中,封装LoadSir 具体代码: public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view=inflater.inflate(attachLayoutId(), container, false); ButterKnife.bind(this,view); llContent=(LinearLayout)view.findViewById(R.id.ll_content); if(llContent!=null){ mLoadService= LoadSir.getDefault().register(llContent, new Callback.OnReloadListener() { @Override public void onReload(View v) { onNetReload(v); } }); }else{ mLoadService=LoadSir.getDefault().register(view, new Callback.OnReloadListener() { @Override public void onReload(View v) { onNetReload(v); } }); } initView(view,savedInstanceState); mLoadService.showSuccess(); return mLoadService.getLoadLayout(); }

    MainActivity中四个菜单 第一个Fragment中有三个子fragment没问题,第二个Fragment有四个子Fragment也没问题,第三个只有一个Fragment的则报错。错误日志: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. at android.view.ViewGroup.addViewInner(ViewGroup.java:4454) at android.view.ViewGroup.addView(ViewGroup.java:4295) at android.view.ViewGroup.addView(ViewGroup.java:4235) at android.view.ViewGroup.addView(ViewGroup.java:4208) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1425) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1819) at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:797) at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2590) at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2377) at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2332) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2239) at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:700) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

    我把错误的Fragment的ll_content去掉,不报错,但是不显示加载信息。。。加上ll_content则报以上错误,希望有人帮忙解决一下

    opened by qq61821191 7
  • 关于Activity中Fragment空指针的问题

    关于Activity中Fragment空指针的问题

    使用版本:1.3.5

    ml8dy js 5jy f40zdo rav

    ViewPager用来切换两个Fragment 这两个Fragment的数据由于来自于一个接口,所以我在外层的Activity中进行网络请求 LoadService也是放在Actvity中监听的 请求完数据以后通过Fragment中的一个方法将值传入更新界面。 但是我发现用了LoadService以后,Fragment中的控件报空指针异常,getActivity和getContext方法也都为null。 这种情况应该如何解决呢?

    opened by lvyandev 7
  • a question about layout

    a question about layout

    CN @KingJA 你好, 我想问下为什么替换布局之后, 原来的View为什么不会报空指针, 也能设置数据, 加载成功后UI上的数据还能显示更改后的数据.

    En @KingJA Hi, I would like to know the old View why not throw a NullPointerException after replace layout, but also set the data, the UI after call showSuccess() can also display the changed data. (Why English is so awkward...)

    opened by sieml 7
  • Fragment中如果用到了ButterKnife, 会产生异常

    Fragment中如果用到了ButterKnife, 会产生异常

    @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = inflater.inflate(getLayoutId(), container, false); unbinder = ButterKnife.bind(this, rootView); loadService = LoadSir.getDefault().register(rootView, new Callback.OnReloadListener() { @Override public void onReload(View v) { // retry logic } }); return loadService.getLoadLayout(); }

    试下这段代码,然后在业务Fragment中通过@BindView(R.id.xxxx) View view1, 在调用view1的地方会产生空指针。

    opened by weizai 7
  • 有没有人遇到当数据很快获取到时,不能显示成功布局,还是加载布局的情况?

    有没有人遇到当数据很快获取到时,不能显示成功布局,还是加载布局的情况?

    当应用去请求网络数据加载时,数据获取到后,调用展示成功布局,这时是正常显示的。 当第二次去请求数据时,这时得到的是缓存数据,迅速返回,仍然是调用展示成功布局,但是会出现仍然是加载中布局的情况。然后需要再点击一下加载布局,才会展示成功布局。

    我现在的解决办法是增加一些延时,这样可以避免缓存数据立即返回。

    opened by jhwsx 6
  • 提一个建议,reload的click事件

    提一个建议,reload的click事件

    现在的reload的点击事件是设置在了整个的View上了(父布局的事件一直会被触发),建议在ids.xml中 添加 一个预先定义的id,用于设置reload的点击事件,可否这样: View reloadView = rootView.findViewById(R.id.reload_view); if (reloadView != null) { reloadView .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (onReloadEvent(context, rootView)) { return; } if (onReloadListener != null) { onReloadListener.onReload(v); } } }); }

    opened by lh1241698502 6
  • onReloadEvent 事件重写 点击特定view的事件 第一次无响应 ,第二次才触发 点击事件

    onReloadEvent 事件重写 点击特定view的事件 第一次无响应 ,第二次才触发 点击事件

    /** * @param onReloadListener 拿到重试的监听 * @return r */ @Override public Callback setCallback(Context context, OnReloadListener onReloadListener) { this.onReloadListener = onReloadListener; return super.setCallback(context, onReloadListener); }

    /**
     * @param context c
     * @param view    v
     * @return true or  false  返回true 则覆盖注册时的onReload,如果返回false则两者都执行,先执行onReloadEvent
     */
    @Override
    protected boolean onReloadEvent(Context context, View view) {
        Log.d("token-", "onReloadEvent: " + System.currentTimeMillis());
        (view.findViewById(R.id.tv_reload)).setOnClickListener(v -> {
            Log.d("token-2", "onReloadEvent: " + System.currentTimeMillis());
            onReloadListener.onReload(v);//去重试
        });
        return true;
    }
    

    第一次点击 log都出不来 点击第二次才触发点击事件

    opened by voynich-chen 2
  • DefaultCallback 调用时机有问题

    DefaultCallback 调用时机有问题

    在viewpager中出现几率很高,或者在网络请求返回特别快的时候,第一次callback是我手动触发的例如emptyCallback 或者 errorCallback,但是调用之后发现还是在loadingCallback的状态。 打断点发现我先是调用了自己的callback,然后紧接着默认callback在我调用之后才开始,就导致了我的界面一直是loading状态。 看一下是不是handler post的机制有问题

    opened by junchenChow 3
  • 实现点击Error视图中的某个控件来重试

    实现点击Error视图中的某个控件来重试

    将Callback接口中private OnReloadListener onReloadListener; 改为protected OnReloadListener onReloadListener; 理由:出现自定义布局界面时,只响应具体控件的点击事件,而不是全部的布局。

    虽然可以直接注册View或者onReloadEvent中获取某个空间的id再实现点击逻辑。但是他没有办法把重试的事件响应给业务层。 将 OnReloadListener onReloadListener 返回给Callback的子类就可以了。重新处理点击事件(包括拦截处理)。

    opened by AdamHLZhang 0
Releases(1.3.8)
  • 1.3.8(Mar 8, 2020)

    • [x] 适配Android X
    • [x] 支持ConstraintLayout的子View注册(详见Ps[1])
    • [x] 修复子view有margin,注册后出现双倍margin问题 Ps: [1]要注册RelativeLayout或ConstraintLayout的子View,如果该子View被其它子View约束,建议在子View外层再包一层布局,参考sample中acitivy_view.xm和activity_constraintlayout.xml
    Source code(tar.gz)
    Source code(zip)
  • 1.3.5(Jan 2, 2018)

    • [x] add API public Class<? extends Callback> getCurrentCallback()
    • [x] deprecated API public LinearLayout getTitleLoadLayout(Context context, ViewGroup rootView, View titleView)
    Source code(tar.gz)
    Source code(zip)
  • 1.3.2(Oct 21, 2017)

    • [x] add API public boolean getSuccessVisible() used for displaying callback above successView.
    • [x] fix layout fault when register in View.
    Source code(tar.gz)
    Source code(zip)
  • 1.3.0(Oct 13, 2017)

    • [x] in default, addView(SuccessfulView). Hide SuccessfulView instead of removeView(SuccessfulView).
    • [x] add default Callback ProgressCallback, HintCallback.
    Source code(tar.gz)
    Source code(zip)
  • 1.2.2(Sep 28, 2017)

  • 1.2.0(Sep 22, 2017)

Owner
KingJA
价值与影响
KingJA
VasSonic is a lightweight and high-performance Hybrid framework developed by tencent VAS team, which is intended to speed up the first screen of websites working on Android and iOS platform.

VasSonic: A Lightweight And High-performance Hybrid Framework VasSonic is a lightweight and high-performance Hybrid framework developed by tencent VAS

Tencent 11.6k Dec 30, 2022
LiteOrm is a fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line of code efficiently.

#LiteOrm:Android高性能数据库框架 A fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line

马天宇 1.5k Nov 19, 2022
UltimateAndroid is a rapid development framework for developing your apps

UltimateAndroid Version:0.10.2 UltimateAndroid is a rapid development framework for developing apps Master branch: Dev branch: V0.7.0 Ui Demo screensh

MarshalChen 2.1k Dec 26, 2022
A collection of hand-crafted extensions for your Kotlin projects.

Splitties Splitties is a collection of small Kotlin multiplatform libraries (with Android as first target). These libraries are intended to reduce the

Louis CAD 2.2k Dec 25, 2022
A Model-View-Presenter / Model-View-Intent library for modern Android apps

Mosby A Model-View-Presenter and Model-View-Intent library for Android apps. Dependency dependencies { compile 'com.hannesdorfmann.mosby3:mvi:3.1.1

Hannes Dorfmann 5.5k Dec 25, 2022
Nucleus is an Android library, which utilizes the Model-View-Presenter pattern to properly connect background tasks with visual parts of an application.

Nucleus Deprecation notice Nucleus is not under develpment anymore. It turns out that Redux architecture scales way better than MVP/MVI/MVVM/MVxxx and

Konstantin Mikheev 2k Nov 18, 2022
Moxy is MVP library for Android

Moxy This Moxy repository is deprecated and no longer supported. Please migrate to the actual version of the Moxy framework at Moxy communuty repo. De

Arello Mobile 1.6k Dec 28, 2022
Minimal UI library for Android inspired by React

Anvil - reactive views for Android Anvil is a small Java library for creating reactive user interfaces. Originally inspired by React, it suits well as

null 1.4k Dec 23, 2022
a MVP library for Android favoring a stateful Presenter

DEPRECATED - no longer actively maintained ThirtyInch - a MVP library for Android This library adds Presenters to Activities and Fragments. It favors

HCI @ gcx 1k Dec 15, 2022
A Mosby based VIPER library for Android

Moviper A Mosby based VIPER library for Android Why Moviper? You got tired because of fact that your Activities and Fragments were becoming god classe

Mateusz Koślacz 78 Nov 29, 2022
Android app built with MVP architectural approach and uses Marvel Comics API that allows developers everywhere to access information about Marvel's vast library of comics. :zap:

Villains & Heroes Android app built with MVP architectural approach and uses Marvel Comics API that allows developers everywhere to access information

André Mion 53 Jul 13, 2022
Crossword library for Android

Ararat Ararat is a crossword library for Android, written for and used by alphacross. It includes: Parsers for various formats CrosswordRenderer, whic

Akop Karapetyan 28 Oct 3, 2022
The most complete and powerful data-binding library and persistence infra for Kotlin 1.3, Android & Splitties Views DSL, JavaFX & TornadoFX, JSON, JDBC & SQLite, SharedPreferences.

Lychee (ex. reactive-properties) Lychee is a library to rule all the data. ToC Approach to declaring data Properties Other data-binding libraries Prop

Mike 112 Dec 9, 2022
Android part of the Android Studio(IntellijIDEA) OkHttp Profiler plugin

OkHttpProfiler Android Library Created by LocaleBro.com - Android Localization Platform The OkHttp Profiler plugin can show requests from the OkHttp l

Ievgenii 261 Dec 8, 2022
Android common lib, include ImageCache, HttpCache, DropDownListView, DownloadManager, Utils and so on

android-common-lib 关于我,欢迎关注 微博:Trinea 主页:trinea.cn 邮箱:trinea.cn#gmail.com 微信:codek2 主要包括:缓存(图片缓存、预取缓存、网络缓存)、公共View(下拉及底部加载更多ListView、底部加载更多ScrollView、

Trinea 5k Dec 30, 2022
dexposed enable 'god' mode for single android application.

What is it? Dexposed is a powerful yet non-invasive runtime AOP (Aspect-oriented Programming) framework for Android app development, based on the work

Alibaba 4.5k Dec 28, 2022
A small, yet full-featured framework that allows building View-based Android applications

Conductor A small, yet full-featured framework that allows building View-based Android applications. Conductor provides a light-weight wrapper around

BlueLine Labs 3.9k Jan 6, 2023
A Job Queue specifically written for Android to easily schedule jobs (tasks) that run in the background, improving UX and application stability.

This Project is Deprecated! Thanks to everybody who've used Android Priority JobQueue. It was designed in a world where there was no JobScheduler, RxJ

Yigit Boyar 3.4k Dec 31, 2022
🚀Plugin for Android Studio And IntelliJ Idea to generate Kotlin data class code from JSON text ( Json to Kotlin )

JsonToKotlinClass Hi, Welcome! This is a plugin to generate Kotlin data class from JSON string, in another word, a plugin that converts JSON string to

Seal 2.8k Jan 3, 2023