當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewParent.requestDisallowInterceptTouchEvent方法代碼示例

本文整理匯總了Java中android.view.ViewParent.requestDisallowInterceptTouchEvent方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewParent.requestDisallowInterceptTouchEvent方法的具體用法?Java ViewParent.requestDisallowInterceptTouchEvent怎麽用?Java ViewParent.requestDisallowInterceptTouchEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.ViewParent的用法示例。


在下文中一共展示了ViewParent.requestDisallowInterceptTouchEvent方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onStopTrackingTouch

import android.view.ViewParent; //導入方法依賴的package包/類
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    Log.i(TAG, "bottomProgress onStopTrackingTouch [" + this.hashCode() + "] ");
    onEvent(JCUserAction.ON_SEEK_POSITION);
    startProgressTimer();
    ViewParent vpup = getParent();
    while (vpup != null) {
        vpup.requestDisallowInterceptTouchEvent(false);
        vpup = vpup.getParent();
    }
    if (currentState != CURRENT_STATE_PLAYING &&
            currentState != CURRENT_STATE_PAUSE) return;
    int time = seekBar.getProgress() * getDuration() / 100;
    JCMediaManager.instance().mediaPlayer.seekTo(time);
    Log.i(TAG, "seekTo " + time + " [" + this.hashCode() + "] ");
}
 
開發者ID:Wilshion,項目名稱:HeadlineNews,代碼行數:17,代碼來源:JCVideoPlayer.java

示例2: onDrag

import android.view.ViewParent; //導入方法依賴的package包/類
@Override
public void onDrag(float dx, float dy) {
    if (mScaleDragDetector.isScaling()) {
        return; // Do not drag if we are already scaling
    }

    if (DEBUG) {
        LogManager.getLogger().d(LOG_TAG,
                String.format("onDrag: dx: %.2f. dy: %.2f", dx, dy));
    }

    ImageView imageView = getImageView();
    mSuppMatrix.postTranslate(dx, dy);
    checkAndDisplayMatrix();

    /**
     * Here we decide whether to let the ImageView's parent to start taking
     * over the touch event.
     *
     * First we check whether this function is enabled. We never want the
     * parent to take over if we're scaling. We then check the edge we're
     * on, and the direction of the scroll (i.e. if we're pulling against
     * the edge, aka 'overscrolling', let the parent take over).
     */
    ViewParent parent = imageView.getParent();
    if (mAllowParentInterceptOnEdge && !mScaleDragDetector.isScaling() && !mBlockParentIntercept) {
        if (mScrollEdge == EDGE_BOTH
                || (mScrollEdge == EDGE_LEFT && dx >= 1f)
                || (mScrollEdge == EDGE_RIGHT && dx <= -1f)) {
            if (null != parent) {
                parent.requestDisallowInterceptTouchEvent(false);
            }
        }
    } else {
        if (null != parent) {
            parent.requestDisallowInterceptTouchEvent(true);
        }
    }
}
 
開發者ID:wuhighway,項目名稱:DailyStudy,代碼行數:40,代碼來源:PhotoViewAttacher.java

示例3: startScrubbing

import android.view.ViewParent; //導入方法依賴的package包/類
private void startScrubbing() {
    scrubbing = true;
    setPressed(true);
    ViewParent parent = getParent();
    if (parent != null) {
        parent.requestDisallowInterceptTouchEvent(true);
    }
    for (OnScrubListener listener : listeners) {
        listener.onScrubStart(this, getScrubberPosition());
    }
}
 
開發者ID:rubensousa,項目名稱:PreviewSeekBar,代碼行數:12,代碼來源:CustomTimeBar.java

示例4: onTouchEvent

import android.view.ViewParent; //導入方法依賴的package包/類
@Override
public boolean onTouchEvent(MotionEvent event) {

    switch (event.getAction()) {
        // onDown is handled in GestureDetector
        case MotionEvent.ACTION_UP:
            // re-enable scrolling for parent scrollview
            ViewParent view = this.getParent();
            view.requestDisallowInterceptTouchEvent(false);
    }

    boolean result = mDetector.onTouchEvent(event);
    // <-- if result is false (event not detected) then add custom detection code here
    return result;
}
 
開發者ID:suragch,項目名稱:mongol-library,代碼行數:16,代碼來源:MongolEditText.java

示例5: requestParentDisallowInterceptTouchEvent

import android.view.ViewParent; //導入方法依賴的package包/類
private void requestParentDisallowInterceptTouchEvent(boolean disallowIntercept) {
    Log.i(LOG_TAG, "requestParentDisallowInterceptTouchEvent");
    final ViewParent parent = getParent();
    if (parent != null) {
        parent.requestDisallowInterceptTouchEvent(disallowIntercept);
    }
}
 
開發者ID:GaoGersy,項目名稱:MultiSelecter,代碼行數:8,代碼來源:SuperSwipeRefreshLayout.java

示例6: onStopTrackingTouch

import android.view.ViewParent; //導入方法依賴的package包/類
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
    startProgressTimer();
    ViewParent vpup = getParent();
    while (vpup != null) {
        vpup.requestDisallowInterceptTouchEvent(false);
        vpup = vpup.getParent();
    }
    if (currentState != CURRENT_STATE_PLAYING &&
            currentState != CURRENT_STATE_PAUSE) return;
    int time = seekBar.getProgress() * getDuration() / 100;
    MediaManager.instance().mediaPlayer.seekTo(time);
    Log.i(TAG, "seekTo " + time + " [" + this.hashCode() + "] ");
}
 
開發者ID:qq1210514049,項目名稱:ListVideoPlayer,代碼行數:15,代碼來源:ListVideoPlayer.java

示例7: markAsWillDragged

import android.view.ViewParent; //導入方法依賴的package包/類
protected void markAsWillDragged(boolean disallowParentTouch) {
    if (disallowParentTouch) {
        ViewParent parent = getParent();
        if (parent != null) {
            parent.requestDisallowInterceptTouchEvent(true);
        }
    }
    setScrollState(SCROLL_STATE_DRAGGING);
}
 
開發者ID:rexyren,項目名稱:PageScrollView,代碼行數:10,代碼來源:BaseViewGroup.java

示例8: onTouch

import android.view.ViewParent; //導入方法依賴的package包/類
public boolean onTouch(View v, MotionEvent ev) {
    boolean handled = false;
    if (!this.mZoomEnabled || !hasDrawable((ImageView) v)) {
        return false;
    }
    ViewParent parent = v.getParent();
    switch (ev.getAction()) {
        case 0:
            if (parent != null) {
                parent.requestDisallowInterceptTouchEvent(true);
            } else {
                Log.i(LOG_TAG, "onTouch getParent() returned null");
            }
            cancelFling();
            break;
        case 1:
        case 3:
            if (getScale() < this.mMinScale) {
                RectF rect = getDisplayRect();
                if (rect != null) {
                    v.post(new AnimatedZoomRunnable(this, getScale(), this.mMinScale, rect.centerX(), rect.centerY()));
                    handled = true;
                    break;
                }
            }
            break;
    }
    if (this.mScaleDragDetector != null && this.mScaleDragDetector.onTouchEvent(ev)) {
        handled = true;
    }
    if (this.mGestureDetector == null || !this.mGestureDetector.onTouchEvent(ev)) {
        return handled;
    }
    return true;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:36,代碼來源:PhotoViewAttacher.java

示例9: requestDisallowInterceptTouchEvent

import android.view.ViewParent; //導入方法依賴的package包/類
/**
 * 是否請求當前view的父view不要攔截事件
 *
 * @param view
 * @param disallowIntercept true-請求父view不要攔截,false-父view可以攔截
 */
public static void requestDisallowInterceptTouchEvent(View view, boolean disallowIntercept)
{
    ViewParent parent = view.getParent();
    if (parent == null)
    {
        return;
    }
    parent.requestDisallowInterceptTouchEvent(disallowIntercept);
}
 
開發者ID:zj565061763,項目名稱:windowmanager,代碼行數:16,代碼來源:SDTouchHelper.java

示例10: catchView

import android.view.ViewParent; //導入方法依賴的package包/類
private void catchView() {
    ViewParent parent = getParent();
    if (parent != null) {
        parent.requestDisallowInterceptTouchEvent(true);
    }
}
 
開發者ID:LanguidSheep,項目名稱:sealtalk-android-master,代碼行數:7,代碼來源:SwitchButton.java

示例11: onTouch

import android.view.ViewParent; //導入方法依賴的package包/類
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View v, MotionEvent ev) {
    boolean handled = false;

    if (mZoomEnabled && hasDrawable((ImageView) v)) {
        ViewParent parent = v.getParent();
        switch (ev.getAction()) {
            case ACTION_DOWN:
                // First, disable the Parent from intercepting the touch
                // event
                if (null != parent) {
                    parent.requestDisallowInterceptTouchEvent(true);
                } else {
                    LogManager.getLogger().i(LOG_TAG, "onTouch getParent() returned null");
                }

                // If we're flinging, and the user presses down, cancel
                // fling
                cancelFling();
                break;

            case ACTION_CANCEL:
            case ACTION_UP:
                // If the user has zoomed less than min scale, zoom back
                // to min scale
                if (getScale() < mMinScale) {
                    RectF rect = getDisplayRect();
                    if (null != rect) {
                        v.post(new AnimatedZoomRunnable(getScale(), mMinScale,
                                rect.centerX(), rect.centerY()));
                        handled = true;
                    }
                }
                break;
        }

        // Try the Scale/Drag detector
        if (null != mScaleDragDetector) {
            boolean wasScaling = mScaleDragDetector.isScaling();
            boolean wasDragging = mScaleDragDetector.isDragging();

            handled = mScaleDragDetector.onTouchEvent(ev);

            boolean didntScale = !wasScaling && !mScaleDragDetector.isScaling();
            boolean didntDrag = !wasDragging && !mScaleDragDetector.isDragging();

            mBlockParentIntercept = didntScale && didntDrag;
        }

        // Check to see if the user double tapped
        if (null != mGestureDetector && mGestureDetector.onTouchEvent(ev)) {
            handled = true;
        }

    }

    return handled;
}
 
開發者ID:joelan,項目名稱:ClouldReader,代碼行數:60,代碼來源:PhotoViewAttacher.java

示例12: onInterceptTouchEvent

import android.view.ViewParent; //導入方法依賴的package包/類
public boolean onInterceptTouchEvent(MotionEvent ev) {
    boolean z = false;
    int action = ev.getAction();
    if (action == 2 && this.mIsBeingDragged) {
        return true;
    }
    int y;
    switch (action & 255) {
        case 0:
            y = (int) ev.getY();
            if (!inChild((int) ev.getX(), y)) {
                this.mIsBeingDragged = false;
                recycleVelocityTracker();
                break;
            }
            this.mLastMotionY = y;
            this.mActivePointerId = MotionEventCompat.getPointerId(ev, 0);
            initOrResetVelocityTracker();
            this.mVelocityTracker.addMovement(ev);
            this.mScroller.computeScrollOffset();
            if (!this.mScroller.isFinished()) {
                z = true;
            }
            this.mIsBeingDragged = z;
            startNestedScroll(2);
            break;
        case 1:
        case 3:
            this.mIsBeingDragged = false;
            this.mActivePointerId = -1;
            recycleVelocityTracker();
            if (this.mScroller.springBack(getScrollX(), getScrollY(), 0, 0, 0, getScrollRange())) {
                ViewCompat.postInvalidateOnAnimation(this);
            }
            stopNestedScroll();
            break;
        case 2:
            int activePointerId = this.mActivePointerId;
            if (activePointerId != -1) {
                int pointerIndex = MotionEventCompat.findPointerIndex(ev, activePointerId);
                if (pointerIndex != -1) {
                    y = (int) MotionEventCompat.getY(ev, pointerIndex);
                    if (Math.abs(y - this.mLastMotionY) > this.mTouchSlop && (getNestedScrollAxes() & 2) == 0) {
                        this.mIsBeingDragged = true;
                        this.mLastMotionY = y;
                        initVelocityTrackerIfNotExists();
                        this.mVelocityTracker.addMovement(ev);
                        this.mNestedYOffset = 0;
                        ViewParent parent = getParent();
                        if (parent != null) {
                            parent.requestDisallowInterceptTouchEvent(true);
                            break;
                        }
                    }
                }
                Log.e(TAG, "Invalid pointerId=" + activePointerId + " in onInterceptTouchEvent");
                break;
            }
            break;
        case 6:
            onSecondaryPointerUp(ev);
            break;
    }
    return this.mIsBeingDragged;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:66,代碼來源:NestedScrollView.java

示例13: disableScroll

import android.view.ViewParent; //導入方法依賴的package包/類
/**
 * disables intercept touchevents
 */
public void disableScroll() {
    ViewParent parent = getParent();
    if (parent != null)
        parent.requestDisallowInterceptTouchEvent(true);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:Chart.java

示例14: onInterceptTouchEvent

import android.view.ViewParent; //導入方法依賴的package包/類
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    if (!isSwipeEnabled()) {
        return false;
    }
    if (mClickToClose && getOpenStatus() == Status.Open && isTouchOnSurface(ev)) {
        return true;
    }
    for (SwipeDenier denier : mSwipeDeniers) {
        if (denier != null && denier.shouldDenySwipe(ev)) {
            return false;
        }
    }

    switch (ev.getAction()) {
        case MotionEvent.ACTION_DOWN:
            mDragHelper.processTouchEvent(ev);
            mIsBeingDragged = false;
            sX = ev.getRawX();
            sY = ev.getRawY();
            //if the swipe is in middle state(scrolling), should intercept the touch
            if (getOpenStatus() == Status.Middle) {
                mIsBeingDragged = true;
            }
            break;
        case MotionEvent.ACTION_MOVE:
            boolean beforeCheck = mIsBeingDragged;
            checkCanDrag(ev);
            if (mIsBeingDragged) {
                ViewParent parent = getParent();
                if (parent != null) {
                    parent.requestDisallowInterceptTouchEvent(true);
                }
            }
            if (!beforeCheck && mIsBeingDragged) {
                //let children has one chance to catch the touch, and request the swipe not intercept
                //useful when swipeLayout wrap a swipeLayout or other gestural layout
                return false;
            }
            break;

        case MotionEvent.ACTION_CANCEL:
        case MotionEvent.ACTION_UP:
            mIsBeingDragged = false;
            mDragHelper.processTouchEvent(ev);
            break;
        default://handle other action, such as ACTION_POINTER_DOWN/UP
            mDragHelper.processTouchEvent(ev);
    }
    return mIsBeingDragged;
}
 
開發者ID:xieyangxuejun,項目名稱:Views,代碼行數:52,代碼來源:SwipeLayout.java

示例15: requestParentDisallowInterceptTouchEvent

import android.view.ViewParent; //導入方法依賴的package包/類
private void requestParentDisallowInterceptTouchEvent(boolean disallowIntercept) {
    final ViewParent parent = getParent();
    if (parent != null) {
        parent.requestDisallowInterceptTouchEvent(disallowIntercept);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:7,代碼來源:DirectionalViewpager.java


注:本文中的android.view.ViewParent.requestDisallowInterceptTouchEvent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。