Created
June 24, 2015 16:52
-
-
Save lenamuit/b84e6847c49ca2a41e29 to your computer and use it in GitHub Desktop.
ScrollViewExt with reach bottom callback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ScrollViewExt extends ScrollView { | |
private ScrollViewListener scrollViewListener; | |
public ScrollViewExt(Context context) { | |
super(context); | |
} | |
public ScrollViewExt(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
} | |
public ScrollViewExt(Context context, AttributeSet attrs, int defStyleAttr) { | |
super(context, attrs, defStyleAttr); | |
} | |
public void setScrollViewListener(ScrollViewListener scrollViewListener) { | |
this.scrollViewListener = scrollViewListener; | |
} | |
@Override | |
protected void onScrollChanged(int l, int t, int oldl, int oldt) { | |
super.onScrollChanged(l, t, oldl, oldt); | |
if (scrollViewListener != null) { | |
scrollViewListener.onScrollChanged(this, l, t, oldl, oldt); | |
} | |
} | |
public interface ScrollViewListener { | |
void onScrollChanged(ScrollViewExt scrollView, | |
int x, int y, int oldx, int oldy); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment