Github user sospartan commented on a diff in the pull request:

    https://github.com/apache/incubator-weex/pull/35#discussion_r104340501
  
    --- Diff: 
android/sdk/src/main/java/com/taobao/weex/ui/view/listview/adapter/WXRecyclerViewOnScrollListener.java
 ---
    @@ -266,46 +276,49 @@ public void onScrolled(RecyclerView recyclerView, int 
dx, int dy) {
         super.onScrolled(recyclerView, dx, dy);
         RecyclerView.LayoutManager layoutManager = 
recyclerView.getLayoutManager();
         IOnLoadMoreListener l;
    -    if((l = listener.get()) != null){
    -      l.onBeforeScroll(dx,dy);
    +    if ((l = listener.get()) != null) {
    +      l.onBeforeScroll(dx, dy);
         }
     
         //  int lastVisibleItemPosition = -1;
    -    if (layoutManagerType == null) {
    -      if (layoutManager instanceof LinearLayoutManager) {
    -        layoutManagerType = LAYOUT_MANAGER_TYPE.LINEAR;
    -      } else if (layoutManager instanceof GridLayoutManager) {
    -        layoutManagerType = LAYOUT_MANAGER_TYPE.GRID;
    -      } else if (layoutManager instanceof StaggeredGridLayoutManager) {
    -        layoutManagerType = LAYOUT_MANAGER_TYPE.STAGGERED_GRID;
    -      } else {
    -        throw new RuntimeException(
    -            "Unsupported LayoutManager used. Valid ones are 
LinearLayoutManager, GridLayoutManager and StaggeredGridLayoutManager");
    -      }
    -    }
    +    if (layoutManager instanceof LinearLayoutManager) {
    +      layoutManagerType = LAYOUT_MANAGER_TYPE.LINEAR;
    +      mLastVisibleItemPosition = ((LinearLayoutManager) 
layoutManager).findLastVisibleItemPosition();
    +      listener.get().notifyAppearStateChange(((LinearLayoutManager) 
layoutManager).findFirstVisibleItemPosition()
    --- End diff --
    
    1. listener can be null
    2.`listener.get().notifyAppearStateChange(` is same in other branch, put 
this call out of 'if', code would be more readable.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to