If you think the Android project StreamHub-Android-Reviews-App listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package livefyre.fadingactionbar;
//www.java2s.comimport android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.ScrollView;
/**
* @author Cyril Mottier with modifications from Manuel Peinado
*/publicclass ObservableScrollView extends ScrollView implements ObservableScrollable {
// Edge-effects don't mix well with the translucent action bar in Android 2.X
privateboolean mDisableEdgeEffects = true;
private OnScrollChangedCallback mOnScrollChangedListener;
public ObservableScrollView(Context context) {
super(context);
}
public ObservableScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ObservableScrollView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
protectedvoid onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if (mOnScrollChangedListener != null) {
mOnScrollChangedListener.onScroll(l, t);
}
}
@Override
protectedfloat getTopFadingEdgeStrength() {
// http://stackoverflow.com/a/6894270/244576
if (mDisableEdgeEffects && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
return 0.0f;
}
return super.getTopFadingEdgeStrength();
}
@Override
protectedfloat getBottomFadingEdgeStrength() {
// http://stackoverflow.com/a/6894270/244576
if (mDisableEdgeEffects && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
return 0.0f;
}
return super.getBottomFadingEdgeStrength();
}
@Override
publicvoid setOnScrollChangedCallback(OnScrollChangedCallback callback) {
mOnScrollChangedListener = callback;
}
}