本文整理匯總了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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
示例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;
}
}
示例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);
}