Merge "Never drag scroll views with no children." into honeycomb

This commit is contained in:
Jeff Brown
2011-01-19 17:03:08 -08:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 6 deletions

View File

@@ -511,8 +511,10 @@ public class HorizontalScrollView extends FrameLayout {
switch (action & MotionEvent.ACTION_MASK) { switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN: { case MotionEvent.ACTION_DOWN: {
final float x = ev.getX(); mIsBeingDragged = getChildCount() != 0;
mIsBeingDragged = true; if (!mIsBeingDragged) {
return false;
}
/* /*
* If being flinged and user touches, stop the fling. isFinished * If being flinged and user touches, stop the fling. isFinished
@@ -523,7 +525,7 @@ public class HorizontalScrollView extends FrameLayout {
} }
// Remember where the motion event started // Remember where the motion event started
mLastMotionX = x; mLastMotionX = ev.getX();
mActivePointerId = ev.getPointerId(0); mActivePointerId = ev.getPointerId(0);
break; break;
} }

View File

@@ -521,8 +521,10 @@ public class ScrollView extends FrameLayout {
switch (action & MotionEvent.ACTION_MASK) { switch (action & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN: { case MotionEvent.ACTION_DOWN: {
final float y = ev.getY(); mIsBeingDragged = getChildCount() != 0;
mIsBeingDragged = true; if (!mIsBeingDragged) {
return false;
}
/* /*
* If being flinged and user touches, stop the fling. isFinished * If being flinged and user touches, stop the fling. isFinished
@@ -537,7 +539,7 @@ public class ScrollView extends FrameLayout {
} }
// Remember where the motion event started // Remember where the motion event started
mLastMotionY = y; mLastMotionY = ev.getY();
mActivePointerId = ev.getPointerId(0); mActivePointerId = ev.getPointerId(0);
break; break;
} }