@Override
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
- // Block request so we can still intercept the scrolling when QS is expanded.
- if (!mQsExpanded) {
- super.requestDisallowInterceptTouchEvent(disallowIntercept);
+ // Block request when interacting with the scroll view so we can still intercept the
+ // scrolling when QS is expanded.
+ if (mScrollView.isDispatchingTouchEvent()) {
+ return;
}
+ super.requestDisallowInterceptTouchEvent(disallowIntercept);
}
private void flingWithCurrentVelocity() {
import android.content.Context;
import android.util.AttributeSet;
+import android.view.MotionEvent;
import android.view.View;
import android.widget.ScrollView;
private Listener mListener;
private int mLastOverscrollAmount;
+ private boolean mDispatchingTouchEvent;
public ObservableScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
return getScrollY() == getMaxScrollY();
}
+ public boolean isDispatchingTouchEvent() {
+ return mDispatchingTouchEvent;
+ }
+
private int getMaxScrollY() {
int scrollRange = 0;
if (getChildCount() > 0) {
}
@Override
+ public boolean dispatchTouchEvent(MotionEvent ev) {
+ mDispatchingTouchEvent = true;
+ boolean result = super.dispatchTouchEvent(ev);
+ mDispatchingTouchEvent = false;
+ return result;
+ }
+
+ @Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if (mListener != null) {