/** 
 * @company: JOE工作室 
 * @Copyright: Copyright © 2013 - 2016 joe.All Rights Reserved.
 * @Filename: MyScrollView.java
 * @Description: TODO(用一句话描述该文件做什么) 
 * @Author: JOE
 * @Date: 2016-1-23 上午1:29:14 
 **/
package com.gingersoft.gsa.cloud.base.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;


public class ObservableScrollView extends ScrollView {
	private ScrollViewListener scrollViewListener = null;

	public interface ScrollViewListener {
		void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx,
                             int oldy);
	}
 
	public ObservableScrollView(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}

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


	public void setScrollViewListener(ScrollViewListener scrollViewListener) {
		this.scrollViewListener = scrollViewListener;
	}

	@Override
	protected void onScrollChanged(int x, int y, int oldx, int oldy) {
		super.onScrollChanged(x, y, oldx, oldy);
		if (scrollViewListener != null) {
			scrollViewListener.onScrollChanged(this, x, y, oldx, oldy);
		}
	}

}
