blob: 5735241420ac4880928a36a807258291e55da5b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package cgeo.geocaching.test;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ScrollView;
public class BottomAwareScrollView extends ScrollView {
private boolean isAtBottom = true;
public BottomAwareScrollView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public BottomAwareScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public BottomAwareScrollView(Context context) {
super(context);
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
View lastChildView = getChildAt(getChildCount() - 1);
int diff = (lastChildView.getBottom() - (getHeight() + getScrollY()));
isAtBottom = diff <= 0;
super.onScrollChanged(l, t, oldl, oldt);
}
public boolean isAtBottom() {
return isAtBottom;
}
}
|