Skip to content
Browse files

Fix issue

  • Loading branch information...
1 parent ed00189 commit 18037bf2f447193ef40f1a996b0673e87f8c5584 @TangKe committed Aug 19, 2012
Showing with 15 additions and 14 deletions.
  1. +1 −1 Aretha/src/com/aretha/widget/WaveLayout.java
  2. +14 −13 Aretha/src/com/aretha/widget/Workspace.java
View
2 Aretha/src/com/aretha/widget/WaveLayout.java
@@ -210,7 +210,7 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
mPressedX = ev.getX();
mPressedY = ev.getY();
}
- return true;
+ return super.onInterceptTouchEvent(ev);
}
@Override
View
27 Aretha/src/com/aretha/widget/Workspace.java
@@ -62,6 +62,7 @@
private int mTouchSlop;
private boolean mTouchedInIngnoreChild;
+ private boolean mIsShowInitializeItem;
public Workspace(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
@@ -127,7 +128,10 @@ protected void onLayout(boolean changed, int l, int t, int r, int b) {
+ childMeasureHeight / 2);
layoutedChildWidth += childMeasureWidth;
}
- scrollToPage(mCurrentChildIndex, false);
+ if (!mIsShowInitializeItem) {
+ scrollToPage(mCurrentChildIndex, false);
+ mIsShowInitializeItem = true;
+ }
}
@Override
@@ -156,11 +160,14 @@ public void computeScroll() {
public boolean onInterceptTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
+ if (!mScroller.isFinished()) {
+ mScroller.abortAnimation();
+ }
mTouchDownX = mLastMotionX = ev.getX();
break;
case MotionEvent.ACTION_MOVE:
if (Math.abs(mTouchDownX - ev.getX()) > mTouchSlop) {
- return !mTouchedInIngnoreChild;
+ return true;
}
break;
}
@@ -172,18 +179,15 @@ public boolean onInterceptTouchEvent(MotionEvent ev) {
public boolean onTouchEvent(MotionEvent event) {
final int x = (int) event.getX();
final int y = (int) event.getY();
+ final boolean superResult = super.onTouchEvent(event);
if (getChildCount() <= 0)
- return super.onTouchEvent(event);
+ return superResult;
acquireVelocityTrackerAndAddMovement(event);
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
- if (!mScroller.isFinished()) {
- mScroller.abortAnimation();
- }
-
/**
* If user touch down in the View with id R.id.workspace_ignore,
* this view will not response to the touch event.
@@ -210,10 +214,6 @@ public boolean onTouchEvent(MotionEvent event) {
case MotionEvent.ACTION_MOVE:
float scroll = event.getX() - mLastMotionX;
- if (Math.abs(mTouchDownX - x) < mTouchSlop) {
- return super.onTouchEvent(event);
- }
-
/**
* Bounce scroll
*/
@@ -252,7 +252,7 @@ public boolean onTouchEvent(MotionEvent event) {
requestDisallowInterceptTouchEvent(false);
break;
}
- return true;
+ return superResult;
}
@Override
@@ -265,7 +265,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
for (int index = 0; index < childCount; index++) {
View child = getChildAt(index);
measuredWidth += child.getMeasuredWidth();
- measuredHeight = Math.max(measuredHeight, child.getMeasuredHeight());
+ measuredHeight = Math
+ .max(measuredHeight, child.getMeasuredHeight());
}
mContentWidth = measuredWidth;
measuredWidth += getPaddingLeft() + getPaddingRight();

0 comments on commit 18037bf

Please sign in to comment.
Something went wrong with that request. Please try again.