Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Can't add functionality that is based on scrolling changes - onScrollChanged doesn't get called #7

Open
AndroidDeveloperLB opened this issue Oct 2, 2013 · 0 comments

Comments

@AndroidDeveloperLB
Copy link

I wanted to add an effect like on this library:
https://github.com/ManuelPeinado/FadingActionBar
or this one:
https://github.com/ManuelPeinado/GlassActionBar

I've found out they just needs the scrolling changes , as the user scrolls, so I've made a class that extends MultiColumnListView and adds this functionality.

Sadly, when I use this class, it seems the onScrollChanged doesn't get called , so it won't work.

Here's the code:

public class PinterestListView extends MultiColumnListView {

private OnScrollChangedListener mOnScrollChangedListener;

public interface OnScrollChangedListener {
    void onScrollChanged(PinterestListView who, int l, int t, int oldl, int oldt);
}

public PinterestListView(final Context context) {
    super(context);
}

public PinterestListView(final Context context, final AttributeSet attrs) {
    super(context, attrs);
}

public PinterestListView(final Context context, final AttributeSet attrs, final int defStyle) {
    super(context, attrs, defStyle);
}

@Override
protected void onScrollChanged(final int l, final int t, final int oldl, final int oldt) {
    super.onScrollChanged(l, t, oldl, oldt);
    if (mOnScrollChangedListener != null) {
        mOnScrollChangedListener.onScrollChanged(this, l, t, oldl, oldt);
    }
}

public void setOnScrollChangedListener(final OnScrollChangedListener listener) {
    mOnScrollChangedListener = listener;
}
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant