当前位置: 首页>>代码示例>>Java>>正文


Java MotionEvent.getEdgeFlags方法代码示例

本文整理汇总了Java中android.view.MotionEvent.getEdgeFlags方法的典型用法代码示例。如果您正苦于以下问题:Java MotionEvent.getEdgeFlags方法的具体用法?Java MotionEvent.getEdgeFlags怎么用?Java MotionEvent.getEdgeFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.MotionEvent的用法示例。


在下文中一共展示了MotionEvent.getEdgeFlags方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onTouchEvent

import android.view.MotionEvent; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
    if (mVirtualCount == 0 || !isEnabled()) {
        return super.onTouchEvent(event);
    }
    if (event.getAction() == MotionEvent.ACTION_DOWN && event.getEdgeFlags() != 0) {
        return false;
    }
    if (mVelocityTracker == null) {
        mVelocityTracker = VelocityTracker.obtain();
    }
    mVelocityTracker.addMovement(event);
    final int action = event.getAction() & MotionEventCompat.ACTION_MASK;
    if (action == MotionEvent.ACTION_MOVE) {
        handleTouchActionMove(event);
    } else {
        if (action == MotionEvent.ACTION_DOWN) {
            handleTouchActionDown(event);
        }
        if (action == MotionEvent.ACTION_CANCEL || action == MotionEvent.ACTION_UP) {
            handleTouchActionUp(event);
        }
    }
    return true;
}
 
开发者ID:rexyren,项目名称:PageScrollView,代码行数:26,代码来源:PageScrollView.java

示例2: onTouchEvent

import android.view.MotionEvent; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent event) {
    if (!isZoomEnable) {
        return false;
    }

    if (event.getEdgeFlags() != 0 && event.getAction() == MotionEvent.ACTION_DOWN) {
        return false;
    }
    return performTouchAction(event);
}
 
开发者ID:yangchong211,项目名称:YCEventConflict,代码行数:12,代码来源:PullToZoomBaseView.java

示例3: onInterceptTouchEvent

import android.view.MotionEvent; //导入方法依赖的package包/类
/*********************************************************
 * Touch processing
 *********************************************************/

@Override
public boolean onInterceptTouchEvent(MotionEvent event)
{
    final int action = MotionEventCompat.getActionMasked(event);
    if (action == MotionEvent.ACTION_DOWN && event.getEdgeFlags() != 0)
    {
        // Don't handle edge touches immediately -- they may actually belong to one of our
        // descendants.
        return false;
    }
    onTouchEvent(event);
    return mGestureListener.isMoved;
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:18,代码来源:TwoDScrollView.java

示例4: onTouchEvent

import android.view.MotionEvent; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(MotionEvent ev) {
    if (mItemsCanFocus && ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {
        // Don't handle edge touches immediately -- they may actually belong to one of our
        // descendants.
        return false;
    }
    return super.onTouchEvent(ev);
}
 
开发者ID:Shmilyz,项目名称:Swap,代码行数:10,代码来源:PLA_ListView.java

示例5: onTouchEvent

import android.view.MotionEvent; //导入方法依赖的package包/类
@Override
public boolean onTouchEvent(@NonNull MotionEvent event) {
    if (!isPullToZoomEnabled() || isHideHeader()) {
        return false;
    }

    if (event.getAction() == MotionEvent.ACTION_DOWN && event.getEdgeFlags() != 0) {
        return false;
    }

    switch (event.getAction()) {
        case MotionEvent.ACTION_MOVE: {
            if (mIsBeingDragged) {
                mLastMotionY = event.getY();
                mLastMotionX = event.getX();
                pullEvent();
                isZooming = true;
                return true;
            }
            break;
        }

        case MotionEvent.ACTION_DOWN: {
            if (isReadyForPullStart()) {
                mLastMotionY = mInitialMotionY = event.getY();
                mLastMotionX = mInitialMotionX = event.getX();
                return true;
            }
            break;
        }

        case MotionEvent.ACTION_CANCEL:
        case MotionEvent.ACTION_UP: {
            if (mIsBeingDragged) {
                mIsBeingDragged = false;
                // If we're already refreshing, just scroll back to the top
                if (isZooming()) {
                    smoothScrollToTop();
                    if (onPullZoomListener != null) {
                        onPullZoomListener.onPullZoomEnd();
                    }
                    isZooming = false;
                    return true;
                }
                return true;
            }
            break;
        }
    }
    return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:52,代码来源:PullToZoomBase.java

示例6: onTouchEvent

import android.view.MotionEvent; //导入方法依赖的package包/类
@Override
public final boolean onTouchEvent(MotionEvent event) {

	if (!isPullToRefreshEnabled()) {
		return false;
	}

	// If we're refreshing, and the flag is set. Eat the event
	if (!mScrollingWhileRefreshingEnabled && isRefreshing()) {
		return true;
	}

	if (event.getAction() == MotionEvent.ACTION_DOWN && event.getEdgeFlags() != 0) {
		return false;
	}

	switch (event.getAction()) {
		case MotionEvent.ACTION_MOVE: {
			if (mIsBeingDragged) {
				mLastMotionY = event.getY();
				mLastMotionX = event.getX();
				pullEvent();
				return true;
			}
			break;
		}

		case MotionEvent.ACTION_DOWN: {
			if (isReadyForPull()) {
				mLastMotionY = mInitialMotionY = event.getY();
				mLastMotionX = mInitialMotionX = event.getX();
				return true;
			}
			break;
		}

		case MotionEvent.ACTION_CANCEL:
		case MotionEvent.ACTION_UP: {
			if (mIsBeingDragged) {
				mIsBeingDragged = false;

				if (mState == State.RELEASE_TO_REFRESH
						&& (null != mOnRefreshListener || null != mOnRefreshListener2)) {
					setState(State.REFRESHING, true);
					return true;
				}

				// If we're already refreshing, just scroll back to the top
				if (isRefreshing()) {
					smoothScrollTo(0);
					return true;
				}

				// If we haven't returned by here, then we're not in a state
				// to pull, so just reset
				setState(State.RESET);

				return true;
			}
			break;
		}
	}

	return false;
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:66,代码来源:PullToRefreshBase.java

示例7: onTouchEvent

import android.view.MotionEvent; //导入方法依赖的package包/类
@Override
	public final boolean onTouchEvent(MotionEvent event) {
		
//		handlerSteepListener(event);

		if (!isPullToRefreshEnabled()) {
			return false;
		}

		// If we're refreshing, and the flag is set. Eat the event
		if (!mScrollingWhileRefreshingEnabled && isRefreshing()) {
			return true;
		}

		if (event.getAction() == MotionEvent.ACTION_DOWN && event.getEdgeFlags() != 0) {
			return false;
		}

		switch (event.getAction()) {
			case MotionEvent.ACTION_MOVE: {
				if (mIsBeingDragged) {
					mLastMotionY = event.getY();
					mLastMotionX = event.getX();
					pullEvent();
					return true;
				}
				break;
			}

			case MotionEvent.ACTION_DOWN: {
				if (isReadyForPull()) {
					mLastMotionY = mInitialMotionY = event.getY();
					mLastMotionX = mInitialMotionX = event.getX();
					return true;
				}
				break;
			}

			case MotionEvent.ACTION_CANCEL:
			case MotionEvent.ACTION_UP: {
				if (mIsBeingDragged) {
					mIsBeingDragged = false;

					if (mState == State.RELEASE_TO_REFRESH
							&& (null != mOnRefreshListener || null != mOnRefreshListener2)) {
						setState(State.REFRESHING, true);
						return true;
					}

					// If we're already refreshing, just scroll back to the top
					if (isRefreshing()) {
						smoothScrollTo(0);
						return true;
					}

					// If we haven't returned by here, then we're not in a state
					// to pull, so just reset
					setState(State.RESET);

					return true;
				}
				break;
			}
		}

		return false;
	}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:68,代码来源:PullToRefreshBase.java

示例8: onTouchEvent

import android.view.MotionEvent; //导入方法依赖的package包/类
public final boolean onTouchEvent(MotionEvent event) {
    if (!isPullToRefreshEnabled()) {
        return false;
    }
    if (!this.mScrollingWhileRefreshingEnabled && isRefreshing()) {
        return true;
    }
    if (event.getAction() == 0 && event.getEdgeFlags() != 0) {
        return false;
    }
    switch (event.getAction()) {
        case 0:
            if (!isReadyForPull()) {
                return false;
            }
            float y = event.getY();
            this.mInitialMotionY = y;
            this.mLastMotionY = y;
            y = event.getX();
            this.mInitialMotionX = y;
            this.mLastMotionX = y;
            return true;
        case 1:
        case 3:
            if (!this.mIsBeingDragged) {
                return false;
            }
            this.mIsBeingDragged = false;
            if (this.mState == State.RELEASE_TO_REFRESH && (this.mOnRefreshListener != null || this.mOnRefreshListener2 != null)) {
                setState(State.REFRESHING, true);
                return true;
            } else if (isRefreshing()) {
                smoothScrollTo(0);
                return true;
            } else {
                setState(State.RESET, new boolean[0]);
                return true;
            }
        case 2:
            if (!this.mIsBeingDragged) {
                return false;
            }
            this.mLastMotionY = event.getY();
            this.mLastMotionX = event.getX();
            pullEvent();
            return true;
        default:
            return false;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:51,代码来源:PullToRefreshBase.java

示例9: onTouchEvent

import android.view.MotionEvent; //导入方法依赖的package包/类
public boolean onTouchEvent(MotionEvent event) {
    if (!isPullToZoomEnabled() || isHideHeader()) {
        return false;
    }
    if (event.getAction() == 0 && event.getEdgeFlags() != 0) {
        return false;
    }
    switch (event.getAction()) {
        case 0:
            if (!isReadyForPullStart()) {
                return false;
            }
            float y = event.getY();
            this.mInitialMotionY = y;
            this.mLastMotionY = y;
            y = event.getX();
            this.mInitialMotionX = y;
            this.mLastMotionX = y;
            return true;
        case 1:
        case 3:
            if (!this.mIsBeingDragged && !this.mIsForcedragged) {
                return false;
            }
            this.mIsBeingDragged = false;
            this.mIsForcedragged = false;
            if (!isZooming()) {
                return true;
            }
            smoothScrollToTop();
            if (this.onPullZoomListener != null) {
                this.onPullZoomListener.onPullZoomEnd();
            }
            this.isZooming = false;
            return true;
        case 2:
            if (!this.mIsBeingDragged && !this.mIsForcedragged) {
                return false;
            }
            this.mLastMotionY = event.getY();
            this.mLastMotionX = event.getX();
            pullEvent();
            this.isZooming = true;
            return true;
        default:
            return false;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:49,代码来源:PullToZoomBase.java

示例10: onTouchEvent

import android.view.MotionEvent; //导入方法依赖的package包/类
public final boolean onTouchEvent(MotionEvent event) {
    if (!this.mIsPullToRefreshEnabled) {
        return false;
    }
    if (isRefreshing() && this.mDisableScrollingWhileRefreshing) {
        return true;
    }
    if (event.getAction() == 0 && event.getEdgeFlags() != 0) {
        return false;
    }
    switch (event.getAction()) {
        case 0:
            if (!isReadyForPull()) {
                return false;
            }
            float y = event.getY();
            this.mInitialMotionY = y;
            this.mLastMotionY = y;
            return true;
        case 1:
        case 3:
            if (!this.mIsBeingDragged) {
                return false;
            }
            this.mIsBeingDragged = false;
            if (this.mState != 1 || this.mOnRefreshListener == null) {
                this.mHeaderLayout.reset3();
                smoothScrollTo(0);
            } else {
                setRefreshingInternal(true);
            }
            return true;
        case 2:
            if (!(this.mHeaderLayout == null || this.mHeaderLayout.refreshFlag)) {
                this.mHeaderLayout.refreshFlag = true;
            }
            if (!this.mIsBeingDragged) {
                return false;
            }
            this.mLastMotionY = event.getY();
            pullEvent();
            return true;
        default:
            return false;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:47,代码来源:PullToRefreshBase.java

示例11: onTouchEvent

import android.view.MotionEvent; //导入方法依赖的package包/类
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent ev) {
    if (ev.getAction() == MotionEvent.ACTION_DOWN && ev.getEdgeFlags() != 0) {
        // Don't handle edge touches immediately -- they may actually belong to one of our
        // descendants.
        return false;
    }

    if (getAdapter() == null || getAdapter().getItemCount() == 0) {
        // Nothing to present or scroll; nothing to touch.
        return false;
    }

    final int action = ev.getAction();

    switch (action & MotionEvent.ACTION_MASK) {
        case MotionEvent.ACTION_DOWN: {
            // Remember where the motion event started
            mLastMotionX = mInitialMotionX = ev.getX();
            mLastMotionY = mInitialMotionY = ev.getY();
            mActivePointerId = ev.getPointerId(0);
            break;
        }
        case MotionEvent.ACTION_MOVE:
            if (!mIsBeingDragged) {
                final int pointerIndex = ev.findPointerIndex(mActivePointerId);
                if (pointerIndex == -1) {
                    // A child has consumed some touch events and put us into an inconsistent
                    // state.
                    resetTouch();
                    break;
                }
                final float x = ev.getX(pointerIndex);
                final float xDiff = Math.abs(x - mLastMotionX);
                final float y = ev.getY(pointerIndex);
                final float yDiff = Math.abs(y - mLastMotionY);
                if (xDiff > mTouchSlop && xDiff > yDiff) {
                    mIsBeingDragged = true;
                    requestParentDisallowInterceptTouchEvent(true);
                    mLastMotionX = x - mInitialMotionX > 0 ? mInitialMotionX + mTouchSlop :
                            mInitialMotionX - mTouchSlop;
                    mLastMotionY = y;
                    mScrollState = SCROLL_STATE_DRAGGING;

                    // Disallow Parent Intercept, just in case
                    ViewParent parent = getParent();
                    if (parent != null) {
                        parent.requestDisallowInterceptTouchEvent(true);
                    }
                }
            }
            break;
        case MotionEvent.ACTION_UP:
            if (mIsBeingDragged) {
                resetTouch();
            }
            break;
        case MotionEvent.ACTION_CANCEL:
            if (mIsBeingDragged) {
                resetTouch();
            }
            break;
        case MotionEvent.ACTION_POINTER_DOWN: {
            final int index = ev.getActionIndex();
            mLastMotionX = ev.getX(index);
            mActivePointerId = ev.getPointerId(index);
            break;
        }
        case MotionEvent.ACTION_POINTER_UP:
            onSecondaryPointerUp(ev);
            mLastMotionX = ev.getX(ev.findPointerIndex(mActivePointerId));
            break;
    }
    return super.onTouchEvent(ev);
}
 
开发者ID:thaihuynhxyz,项目名称:recycler-view-pager,代码行数:77,代码来源:RecyclerViewPager.java

示例12: onTouchEvent

import android.view.MotionEvent; //导入方法依赖的package包/类
public final boolean onTouchEvent(MotionEvent event) {
    if (!isPullToRefreshEnabled()) {
        return false;
    }
    if (!this.mScrollingWhileRefreshingEnabled && isRefreshing()) {
        return true;
    }
    if (event.getAction() == 0 && event.getEdgeFlags() != 0) {
        return false;
    }
    switch (event.getAction()) {
        case 0:
            if (!isReadyForPull()) {
                return false;
            }
            float y = event.getY();
            this.mInitialMotionY = y;
            this.mLastMotionY = y;
            y = event.getX();
            this.mInitialMotionX = y;
            this.mLastMotionX = y;
            return true;
        case 1:
        case 3:
            if (!this.mIsBeingDragged) {
                return false;
            }
            this.mIsBeingDragged = false;
            if (this.mState == State.RELEASE_TO_REFRESH && (this.mOnRefreshListener != null
                    || this.mOnRefreshListener2 != null)) {
                setState(State.REFRESHING, true);
                return true;
            } else if (isRefreshing()) {
                smoothScrollTo(0);
                return true;
            } else {
                setState(State.RESET, new boolean[0]);
                return true;
            }
        case 2:
            if (!this.mIsBeingDragged) {
                return false;
            }
            this.mLastMotionY = event.getY();
            this.mLastMotionX = event.getX();
            pullEvent();
            return true;
        default:
            return false;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:52,代码来源:PullToRefreshBase.java

示例13: onTouchEvent

import android.view.MotionEvent; //导入方法依赖的package包/类
public boolean onTouchEvent(MotionEvent ev) {
    if (this.mItemsCanFocus && ev.getAction() == 0 && ev.getEdgeFlags() != 0) {
        return false;
    }
    return super.onTouchEvent(ev);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:7,代码来源:PLA_ListView.java


注:本文中的android.view.MotionEvent.getEdgeFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。