Code Monkey home page Code Monkey logo

Comments (5)

lindroy avatar lindroy commented on July 25, 2024

已经提交了Pull Request。

from multiplestatusview.

qyxxjd avatar qyxxjd commented on July 25, 2024

感谢!周一去公司了发个新版本,家里网太差。

from multiplestatusview.

lindroy avatar lindroy commented on July 25, 2024

非常感谢你的采纳!但是我后来想想觉得只返回切换后的状态视图不太完善,所以再次增加了一个切换前的状态视图,方便开发者对比使用。主要代码如下:

    /**
     * 视图状态改变接口
     */
    public interface OnViewStatusChangeListener {
        /**
         * @param formerViewStatus 切换前的视图状态
         * @param newViewStatus    切换后的视图状态
         */
        void onChange(int formerViewStatus, int newViewStatus);
    }

    /**
     * 设置视图状态改变监听事件
     *
     * @param onViewStatusChangeListener 视图状态改变监听事件
     */
    public void setOnViewStatusChangeListener(OnViewStatusChangeListener onViewStatusChangeListener) {
        this.mViewStatusListener = onViewStatusChangeListener;
    }

    /**
     * 修复状态视图的值
     *
     * @param viewStatus 当前的视图状态
     */
    private void changeViewStatus(int viewStatus) {
        if (null != mViewStatusListener) {
            mViewStatusListener.onChange(mViewStatus, viewStatus);
        }
        mViewStatus = viewStatus;
    }

另外,我还发现了一个问题,在此一并提出:

    @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        clear(mEmptyView, mLoadingView, mErrorView, mNoNetworkView);
        if (null != mOtherIds) {
            mOtherIds.clear();
        }
       ……
        }
    }

由于mOtherIds在创建时已经初始化了,所以这里不会为null,应该改为判断集合是否为空:

 if (!mOtherIds.isEmpty()) {
            mOtherIds.clear();
 }

但是在我的pull request中没有改到这里,你可以参考一下,谢谢了。

from multiplestatusview.

qyxxjd avatar qyxxjd commented on July 25, 2024

好的

from multiplestatusview.

qyxxjd avatar qyxxjd commented on July 25, 2024

查看 v1.6

from multiplestatusview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.