@Override protected InnerListView createRefreshableView(Context context, AttributeSet attrs) { lv = createListView(context, attrs); // Set it to this so it can be used in ListActivity/ListFragment lv.setId(android.R.id.list); // Set it to this so it can receive touch event instead of innerScroller -- Xavier-S lv.setReceiveView(this); return lv; }
/** ***************** Custom Methods ***************** */ @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { if (getState() == State.OVERSCROLLING) { setState(State.RESET); if (lv.getOuterScroller() != null) { lv.getOuterScroller().onInnerPullToRefreshScroll(0); } } super.onScrollChanged(l, t, oldl, oldt); if (this.onScrollChangeListener != null) { onScrollChangeListener.onScrollChanged(l, t, oldl, oldt); } if (t <= 0 && oldt <= 0) { informOuterScrollerThatImScrolling(t); } }
@Override public void setAdapter(ListAdapter adapter) { // Add the Footer View at the last possible moment if (null != mLvFooterLoadingFrame && !mAddedLvFooter) { // addFooterView(mLvFooterLoadingFrame, null, false); mAddedLvFooter = true; } super.setAdapter(adapter); }
@Override protected void dispatchDraw(Canvas canvas) { /** * This is a bit hacky, but Samsung's ListView has got a bug in it when using Header/Footer * Views and the list is empty. This masks the issue so that it doesn't cause an FC. See Issue * #66. */ try { super.dispatchDraw(canvas); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); } }
private void informOuterScrollerThatImScrolling(int t) { if (lv != null && lv.getOuterScroller() != null) { lv.getOuterScroller().onInnerPullToRefreshScroll(t); } }
@Override public void setEmptyViewInternal(View emptyView) { super.setEmptyView(emptyView); }