// Path: pullrecyclerview/src/main/java/com/andfast/pullrecyclerview/layoutmanager/ILayoutManager.java
// public interface ILayoutManager {
// 
//     int getFirstVisibleItemPosition();
// 
//     int getLastVisibleItemPosition();
// 
//     RecyclerView.LayoutManager getLayoutManager();
// 
//     void setRecyclerAdapter(BaseRecyclerAdapter adapter);
// 
//     boolean isScrollToFooter(int itemCount);
// 
// }
// 
// Path: pullrecyclerview/src/main/java/com/andfast/pullrecyclerview/layoutmanager/XLinearLayoutManager.java
// public class XLinearLayoutManager extends LinearLayoutManager implements ILayoutManager {
// 
//     public XLinearLayoutManager(Context context) {
//         super(context);
//     }
// 
//     public XLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
//         super(context, orientation, reverseLayout);
//     }
// 
//     public XLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
//         super(context, attrs, defStyleAttr, defStyleRes);
//     }
// 
//     @Override
//     public int getFirstVisibleItemPosition() {
//         return this.findFirstVisibleItemPosition();
//     }
// 
//     @Override
//     public int getLastVisibleItemPosition() {
//         return this.findLastVisibleItemPosition();
//     }
// 
//     @Override
//     public RecyclerView.LayoutManager getLayoutManager() {
//         return this;
//     }
// 
//     @Override
//     public void setRecyclerAdapter(BaseRecyclerAdapter adapter) {
// 
//     }
// 
//     @Override
//     public boolean isScrollToFooter(int itemCount) {
//         int position = findLastVisibleItemPosition();
//         return position == itemCount - 1;
//     }
// }


import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import com.andfast.pullrecyclerview.layoutmanager.ILayoutManager;
import com.andfast.pullrecyclerview.layoutmanager.XLinearLayoutManager;
                    checkIfCanLoadMore();
                }
            }
        });
    }

    public void setScrollListener(OnScrollListener listener) {
        scrollListener = listener;
    }

    private boolean checkIfScrollToFooter() {
        return layoutManager.isScrollToFooter(adapter.getItemCount());
    }

    private void checkIfCanLoadMore() {
        if (isLoadMoreEnable && !adapter.isShowLoadMoreFooter()) {
            post(new Runnable() {
                @Override
                public void run() {
                    adapter.showLoadMoreFooter(true);
                }
            });
        }
    }

    public void setAdapter(Adapter adapter) {
        super.setAdapter(adapter);
        if (adapter instanceof BaseRecyclerAdapter) {
            this.adapter = (BaseRecyclerAdapter) adapter;
            if (layoutManager == null) {
// Path: pullrecyclerview/src/main/java/com/andfast/pullrecyclerview/layoutmanager/ILayoutManager.java
// public interface ILayoutManager {
// 
//     int getFirstVisibleItemPosition();
// 
//     int getLastVisibleItemPosition();
// 
//     RecyclerView.LayoutManager getLayoutManager();
// 
//     void setRecyclerAdapter(BaseRecyclerAdapter adapter);
// 
//     boolean isScrollToFooter(int itemCount);
// 
// }
// 
// Path: pullrecyclerview/src/main/java/com/andfast/pullrecyclerview/layoutmanager/XLinearLayoutManager.java
// public class XLinearLayoutManager extends LinearLayoutManager implements ILayoutManager {
// 
//     public XLinearLayoutManager(Context context) {
//         super(context);
//     }
// 
//     public XLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
//         super(context, orientation, reverseLayout);
//     }
// 
//     public XLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
//         super(context, attrs, defStyleAttr, defStyleRes);
//     }
// 
//     @Override
//     public int getFirstVisibleItemPosition() {
//         return this.findFirstVisibleItemPosition();
//     }
// 
//     @Override
//     public int getLastVisibleItemPosition() {
//         return this.findLastVisibleItemPosition();
//     }
// 
//     @Override
//     public RecyclerView.LayoutManager getLayoutManager() {
//         return this;
//     }
// 
//     @Override
//     public void setRecyclerAdapter(BaseRecyclerAdapter adapter) {
// 
//     }
// 
//     @Override
//     public boolean isScrollToFooter(int itemCount) {
//         int position = findLastVisibleItemPosition();
//         return position == itemCount - 1;
//     }
// }


// Path: pullrecyclerview/src/main/java/com/andfast/pullrecyclerview/LoadMoreRecyclerView.java
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import com.andfast.pullrecyclerview.layoutmanager.ILayoutManager;
import com.andfast.pullrecyclerview.layoutmanager.XLinearLayoutManager;

                    checkIfCanLoadMore();
                }
            }
        });
    }

    public void setScrollListener(OnScrollListener listener) {
        scrollListener = listener;
    }

    private boolean checkIfScrollToFooter() {
        return layoutManager.isScrollToFooter(adapter.getItemCount());
    }

    private void checkIfCanLoadMore() {
        if (isLoadMoreEnable && !adapter.isShowLoadMoreFooter()) {
            post(new Runnable() {
                @Override
                public void run() {
                    adapter.showLoadMoreFooter(true);
                }
            });
        }
    }

    public void setAdapter(Adapter adapter) {
        super.setAdapter(adapter);
        if (adapter instanceof BaseRecyclerAdapter) {
            this.adapter = (BaseRecyclerAdapter) adapter;
            if (layoutManager == null) {
                layoutManager = new XLinearLayoutManager(getContext());