{"action":"created","issue":{"url":"https://api.github.com/repos/CymChad/BaseRecyclerViewAdapterHelper/issues/462","repository_url":"https://api.github.com/repos/CymChad/BaseRecyclerViewAdapterHelper","labels_url":"https://api.github.com/repos/CymChad/BaseRecyclerViewAdapterHelper/issues/462/labels{/name}","comments_url":"https://api.github.com/repos/CymChad/BaseRecyclerViewAdapterHelper/issues/462/comments","events_url":"https://api.github.com/repos/CymChad/BaseRecyclerViewAdapterHelper/issues/462/events","html_url":"https://github.com/CymChad/BaseRecyclerViewAdapterHelper/issues/462","id":186538638,"number":462,"title":"setEmptyView() 与 addFooterView() 初始化配置","user":{"login":"hongtaoStudio","id":17540498,"avatar_url":"https://avatars.githubusercontent.com/u/17540498?v=3","gravatar_id":"","url":"https://api.github.com/users/hongtaoStudio","html_url":"https://github.com/hongtaoStudio","followers_url":"https://api.github.com/users/hongtaoStudio/followers","following_url":"https://api.github.com/users/hongtaoStudio/following{/other_user}","gists_url":"https://api.github.com/users/hongtaoStudio/gists{/gist_id}","starred_url":"https://api.github.com/users/hongtaoStudio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hongtaoStudio/subscriptions","organizations_url":"https://api.github.com/users/hongtaoStudio/orgs","repos_url":"https://api.github.com/users/hongtaoStudio/repos","events_url":"https://api.github.com/users/hongtaoStudio/events{/privacy}","received_events_url":"https://api.github.com/users/hongtaoStudio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-11-01T13:51:39Z","updated_at":"2016-11-03T04:28:37Z","closed_at":null,"body":"`setEmptyView()` 被调用后，在 `adapter` 初始化完成时（没有数据），会显示 `EmptyView`，但此时正处于获取数据的状态，`EmptyView` 不应该被隐藏吗？为了在第一次获取数据的时候不显示 `EmptyView` 我只能在获得数据后做处理，逻辑如下：\r\n``` java\r\nprotected <T> void setData(List<T> datas, BaseQuickAdapter adapter) {\r\n    if (mIsRefresh) {\r\n        adapter.setNewData(datas);\r\n        if (datas.size() == 0 && adapter.getEmptyView() == null) {\r\n            adapter.setEmptyView(mEmptyView);\r\n        } else if (datas.size() < ApiConstants.ParamValue.PAGE_SIZE) {\r\n            adapter.loadComplete();\r\n            adapter.addFooterView(mNoMoreView);\r\n        }\r\n    } else {\r\n        if (datas.size() == 0) {\r\n            adapter.loadComplete();\r\n            adapter.addFooterView(mNoMoreView);\r\n        } else adapter.addData(datas);\r\n    }\r\n}\r\n```\r\n这部分代码位于父类中，可以看到，逻辑比较繁琐，最理想的使用应该是在 `Adapter` 初始化时做配置，而不是在获得数据后写一堆的逻辑判断。\r\n\r\n可能是我还没有理解这个库的使用方法，就我目前看来，只能使用如上的办法，希望能有更好的办法处理这方面的逻辑。\r\n\r\n最后建议增加 `setErrorView()`。\r\n\r\nthx\r\n"},"comment":{"url":"https://api.github.com/repos/CymChad/BaseRecyclerViewAdapterHelper/issues/comments/258062484","html_url":"https://github.com/CymChad/BaseRecyclerViewAdapterHelper/issues/462#issuecomment-258062484","issue_url":"https://api.github.com/repos/CymChad/BaseRecyclerViewAdapterHelper/issues/462","id":258062484,"user":{"login":"CymChad","id":7698209,"avatar_url":"https://avatars.githubusercontent.com/u/7698209?v=3","gravatar_id":"","url":"https://api.github.com/users/CymChad","html_url":"https://github.com/CymChad","followers_url":"https://api.github.com/users/CymChad/followers","following_url":"https://api.github.com/users/CymChad/following{/other_user}","gists_url":"https://api.github.com/users/CymChad/gists{/gist_id}","starred_url":"https://api.github.com/users/CymChad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CymChad/subscriptions","organizations_url":"https://api.github.com/users/CymChad/orgs","repos_url":"https://api.github.com/users/CymChad/repos","events_url":"https://api.github.com/users/CymChad/events{/privacy}","received_events_url":"https://api.github.com/users/CymChad/received_events","type":"User","site_admin":false},"created_at":"2016-11-03T04:28:37Z","updated_at":"2016-11-03T04:28:37Z","body":"这个可以的，那我修改一下。"}}
{"actor":{"display_login":"CymChad"}}