本文整理汇总了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() + "] ");
}
示例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);
}
}
}
示例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());
}
}
示例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;
}
示例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);
}
}
示例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() + "] ");
}
示例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);
}
示例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;
}
示例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);
}
示例10: catchView
import android.view.ViewParent; //导入方法依赖的package包/类
private void catchView() {
ViewParent parent = getParent();
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(true);
}
}
示例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;
}
示例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;
}
示例13: disableScroll
import android.view.ViewParent; //导入方法依赖的package包/类
/**
* disables intercept touchevents
*/
public void disableScroll() {
ViewParent parent = getParent();
if (parent != null)
parent.requestDisallowInterceptTouchEvent(true);
}
示例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;
}
示例15: requestParentDisallowInterceptTouchEvent
import android.view.ViewParent; //导入方法依赖的package包/类
private void requestParentDisallowInterceptTouchEvent(boolean disallowIntercept) {
final ViewParent parent = getParent();
if (parent != null) {
parent.requestDisallowInterceptTouchEvent(disallowIntercept);
}
}