cancelLongPress ( )源码实例Demo

android.view.View#cancelLongPress ( )源码实例Demo

下面列出了android.view.View#cancelLongPress ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: LaunchEnr   文件: CellLayout.java
@Override
public void cancelLongPress() {
    super.cancelLongPress();

    // Cancel long press for all children
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        child.cancelLongPress();
    }
}
 
源代码2 项目: LaunchEnr   文件: ShortcutAndWidgetContainer.java
@Override
public void cancelLongPress() {
    super.cancelLongPress();

    // Cancel long press for all children
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        child.cancelLongPress();
    }
}
 
源代码3 项目: LaunchEnr   文件: PagedView.java
/**
 * {@inheritDoc}
 */
@Override
public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
    if (disallowIntercept) {
        // We need to make sure to cancel our long press if
        // a scrollable widget takes over touch events
        final View currentPage = getPageAt(mCurrentPage);
        currentPage.cancelLongPress();
    }
    super.requestDisallowInterceptTouchEvent(disallowIntercept);
}
 
源代码4 项目: LB-Launcher   文件: PagedViewWithDraggableItems.java
protected void determineDraggingStart(MotionEvent ev) {
    /*
     * Locally do absolute value. mLastMotionX is set to the y value
     * of the down event.
     */
    final int pointerIndex = ev.findPointerIndex(mActivePointerId);
    final float x = ev.getX(pointerIndex);
    final float y = ev.getY(pointerIndex);
    final int xDiff = (int) Math.abs(x - mLastMotionX);
    final int yDiff = (int) Math.abs(y - mLastMotionY);

    final int touchSlop = mTouchSlop;
    boolean yMoved = yDiff > touchSlop;
    boolean isUpwardMotion = (yDiff / (float) xDiff) > mDragSlopeThreshold;

    if (isUpwardMotion && yMoved && mLastTouchedItem != null) {
        // Drag if the user moved far enough along the Y axis
        beginDragging(mLastTouchedItem);

        // Cancel any pending long press
        if (mAllowLongPress) {
            mAllowLongPress = false;
            // Try canceling the long press. It could also have been scheduled
            // by a distant descendant, so use the mAllowLongPress flag to block
            // everything
            final View currentPage = getPageAt(mCurrentPage);
            if (currentPage != null) {
                currentPage.cancelLongPress();
            }
        }
    }
}
 
源代码5 项目: Trebuchet   文件: CellLayout.java
@Override
public void cancelLongPress() {
    super.cancelLongPress();

    // Cancel long press for all children
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        child.cancelLongPress();
    }
}
 
源代码6 项目: Trebuchet   文件: PagedView.java
protected void cancelCurrentPageLongPress() {
    // Try canceling the long press. It could also have been scheduled
    // by a distant descendant, so use the mAllowLongPress flag to block
    // everything
    final View currentPage = getPageAt(mCurrentPage);
    if (currentPage != null) {
        currentPage.cancelLongPress();
    }
}
 
源代码7 项目: TurboLauncher   文件: PagedViewCellLayout.java
@Override
public void cancelLongPress() {
    super.cancelLongPress();

    // Cancel long press for all children
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        child.cancelLongPress();
    }
}
 
@Override
public void cancelLongPress() {
    super.cancelLongPress();

    // Cancel long press for all children
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        child.cancelLongPress();
    }
}
 
源代码9 项目: TurboLauncher   文件: CellLayout.java
@Override
public void cancelLongPress() {
    super.cancelLongPress();

    // Cancel long press for all children
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        child.cancelLongPress();
    }
}
 
源代码10 项目: TurboLauncher   文件: ShortcutAndWidgetContainer.java
@Override
public void cancelLongPress() {
    super.cancelLongPress();

    // Cancel long press for all children
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        child.cancelLongPress();
    }
}
 
protected void determineDraggingStart(MotionEvent ev) {
   
    final int pointerIndex = ev.findPointerIndex(mActivePointerId);
    final float x = ev.getX(pointerIndex);
    final float y = ev.getY(pointerIndex);
    final int xDiff = (int) Math.abs(x - mLastMotionX);
    final int yDiff = (int) Math.abs(y - mLastMotionY);

    final int touchSlop = mTouchSlop;
    boolean yMoved = yDiff > touchSlop;
    boolean isUpwardMotion = (yDiff / (float) xDiff) > mDragSlopeThreshold;

    if (isUpwardMotion && yMoved && mLastTouchedItem != null) {
        // Drag if the user moved far enough along the Y axis
        beginDragging(mLastTouchedItem);

        // Cancel any pending long press
        if (mAllowLongPress) {
            mAllowLongPress = false;
            // Try canceling the long press. It could also have been scheduled
            // by a distant descendant, so use the mAllowLongPress flag to block
            // everything
            final View currentPage = getPageAt(mCurrentPage);
            if (currentPage != null) {
                currentPage.cancelLongPress();
            }
        }
    }
}
 
源代码12 项目: LB-Launcher   文件: CellLayout.java
@Override
public void cancelLongPress() {
    super.cancelLongPress();

    // Cancel long press for all children
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        child.cancelLongPress();
    }
}
 
源代码13 项目: TurboLauncher   文件: PagedView.java
protected void cancelCurrentPageLongPress() {
    if (mAllowLongPress) {
        //mAllowLongPress = false;
        // Try canceling the long press. It could also have been scheduled
        // by a distant descendant, so use the mAllowLongPress flag to block
        // everything
        final View currentPage = getPageAt(mCurrentPage);
        if (currentPage != null) {
            currentPage.cancelLongPress();
        }
    }
}
 
源代码14 项目: freepager   文件: VerticalPager.java
private void checkStartScroll(float x, float y) {
	/*
	 * Locally do absolute value. mLastMotionX is set to the y value of the
	 * down event.
	 */
	final int xDiff = (int) Math.abs(x - mLastMotionX);
	final int yDiff = (int) Math.abs(y - mLastMotionY);

	boolean xMoved = xDiff > mTouchSlop;
	boolean yMoved = yDiff > mTouchSlop;

	if (xMoved || yMoved) {

		if (yMoved) {
			// Scroll if the user moved far enough along the X axis
			mTouchState = TOUCH_STATE_SCROLLING;
			enableChildrenCache();
		}
		// Either way, cancel any pending longpress
		if (mAllowLongPress) {
			mAllowLongPress = false;
			// Try canceling the long press. It could also have been
			// scheduled
			// by a distant descendant, so use the mAllowLongPress flag to
			// block
			// everything
			final View currentScreen = getChildAt(mCurrentPage);
			currentScreen.cancelLongPress();
		}
	}
}
 
源代码15 项目: LB-Launcher   文件: PagedViewCellLayout.java
@Override
public void cancelLongPress() {
    super.cancelLongPress();

    // Cancel long press for all children
    final int count = getChildCount();
    for (int i = 0; i < count; i++) {
        final View child = getChildAt(i);
        child.cancelLongPress();
    }
}
 
源代码16 项目: android_9.0.0_r45   文件: SearchView.java
public boolean onKey(View v, int keyCode, KeyEvent event) {
    // guard against possible race conditions
    if (mSearchable == null) {
        return false;
    }

    if (DBG) {
        Log.d(LOG_TAG, "mTextListener.onKey(" + keyCode + "," + event + "), selection: "
                + mSearchSrcTextView.getListSelection());
    }

    // If a suggestion is selected, handle enter, search key, and action keys
    // as presses on the selected suggestion
    if (mSearchSrcTextView.isPopupShowing()
            && mSearchSrcTextView.getListSelection() != ListView.INVALID_POSITION) {
        return onSuggestionsKey(v, keyCode, event);
    }

    // If there is text in the query box, handle enter, and action keys
    // The search key is handled by the dialog's onKeyDown().
    if (!mSearchSrcTextView.isEmpty() && event.hasNoModifiers()) {
        if (event.getAction() == KeyEvent.ACTION_UP) {
            if (keyCode == KeyEvent.KEYCODE_ENTER) {
                v.cancelLongPress();

                // Launch as a regular search.
                launchQuerySearch(KeyEvent.KEYCODE_UNKNOWN, null, mSearchSrcTextView.getText()
                        .toString());
                return true;
            }
        }
        if (event.getAction() == KeyEvent.ACTION_DOWN) {
            SearchableInfo.ActionKeyInfo actionKey = mSearchable.findActionKey(keyCode);
            if ((actionKey != null) && (actionKey.getQueryActionMsg() != null)) {
                launchQuerySearch(keyCode, actionKey.getQueryActionMsg(), mSearchSrcTextView
                        .getText().toString());
                return true;
            }
        }
    }
    return false;
}
 
源代码17 项目: CSipSimple   文件: SearchView.java
public boolean onKey(View v, int keyCode, KeyEvent event) {
    // guard against possible race conditions
    if (mSearchable == null) {
        return false;
    }

    if (DBG) {
        Log.d(LOG_TAG, "mTextListener.onKey(" + keyCode + "," + event + "), selection: "
                + mQueryTextView.getListSelection());
    }

    // If a suggestion is selected, handle enter, search key, and action keys
    // as presses on the selected suggestion
    if (mQueryTextView.isPopupShowing()
            && mQueryTextView.getListSelection() != ListView.INVALID_POSITION) {
        return onSuggestionsKey(v, keyCode, event);
    }

    // If there is text in the query box, handle enter, and action keys
    // The search key is handled by the dialog's onKeyDown().
    if (!mQueryTextView.isEmpty() && KeyEventCompat.hasNoModifiers(event)) {
        if (event.getAction() == KeyEvent.ACTION_UP) {
            if (keyCode == KeyEvent.KEYCODE_ENTER) {
                v.cancelLongPress();

                // Launch as a regular search.
                launchQuerySearch(KeyEvent.KEYCODE_UNKNOWN, null, mQueryTextView.getText()
                        .toString());
                return true;
            }
        }
        if (event.getAction() == KeyEvent.ACTION_DOWN) {
            // TODO SearchableInfo.ActionKeyInfo actionKey = mSearchable.findActionKey(keyCode);
            // TODO if ((actionKey != null) && (actionKey.getQueryActionMsg() != null)) {
            // TODO     launchQuerySearch(keyCode, actionKey.getQueryActionMsg(), mQueryTextView
            // TODO             .getText().toString());
            // TODO     return true;
            // TODO }
        }
    }
    return false;
}
 
public boolean onKey(View v, int keyCode, KeyEvent event) {
    // guard against possible race conditions
    if (mSearchable == null) {
        return false;
    }

    if (DBG) {
        Log.d(LOG_TAG, "mTextListener.onKey(" + keyCode + "," + event + "), selection: "
                + mQueryTextView.getListSelection());
    }

    // If a suggestion is selected, handle enter, search key, and action keys
    // as presses on the selected suggestion
    if (mQueryTextView.isPopupShowing()
            && mQueryTextView.getListSelection() != ListView.INVALID_POSITION) {
        return onSuggestionsKey(v, keyCode, event);
    }

    // If there is text in the query box, handle enter, and action keys
    // The search key is handled by the dialog's onKeyDown().
    if (!mQueryTextView.isEmpty() && KeyEventCompat.hasNoModifiers(event)) {
        if (event.getAction() == KeyEvent.ACTION_UP) {
            if (keyCode == KeyEvent.KEYCODE_ENTER) {
                v.cancelLongPress();

                // Launch as a regular search.
                launchQuerySearch(KeyEvent.KEYCODE_UNKNOWN, null, mQueryTextView.getText()
                        .toString());
                return true;
            }
        }
        if (event.getAction() == KeyEvent.ACTION_DOWN) {
            // TODO SearchableInfo.ActionKeyInfo actionKey = mSearchable.findActionKey(keyCode);
            // TODO if ((actionKey != null) && (actionKey.getQueryActionMsg() != null)) {
            // TODO     launchQuerySearch(keyCode, actionKey.getQueryActionMsg(), mQueryTextView
            // TODO             .getText().toString());
            // TODO     return true;
            // TODO }
        }
    }
    return false;
}
 
源代码19 项目: zhangshangwuda   文件: SearchView.java
public boolean onKey(View v, int keyCode, KeyEvent event) {
    // guard against possible race conditions
    if (mSearchable == null) {
        return false;
    }

    if (DBG) {
        Log.d(LOG_TAG, "mTextListener.onKey(" + keyCode + "," + event + "), selection: "
                + mQueryTextView.getListSelection());
    }

    // If a suggestion is selected, handle enter, search key, and action keys
    // as presses on the selected suggestion
    if (mQueryTextView.isPopupShowing()
            && mQueryTextView.getListSelection() != ListView.INVALID_POSITION) {
        return onSuggestionsKey(v, keyCode, event);
    }

    // If there is text in the query box, handle enter, and action keys
    // The search key is handled by the dialog's onKeyDown().
    if (!mQueryTextView.isEmpty() && KeyEventCompat.hasNoModifiers(event)) {
        if (event.getAction() == KeyEvent.ACTION_UP) {
            if (keyCode == KeyEvent.KEYCODE_ENTER) {
                v.cancelLongPress();

                // Launch as a regular search.
                launchQuerySearch(KeyEvent.KEYCODE_UNKNOWN, null, mQueryTextView.getText()
                        .toString());
                return true;
            }
        }
        if (event.getAction() == KeyEvent.ACTION_DOWN) {
            // TODO SearchableInfo.ActionKeyInfo actionKey = mSearchable.findActionKey(keyCode);
            // TODO if ((actionKey != null) && (actionKey.getQueryActionMsg() != null)) {
            // TODO     launchQuerySearch(keyCode, actionKey.getQueryActionMsg(), mQueryTextView
            // TODO             .getText().toString());
            // TODO     return true;
            // TODO }
        }
    }
    return false;
}
 
源代码20 项目: zen4android   文件: SearchView.java
public boolean onKey(View v, int keyCode, KeyEvent event) {
    // guard against possible race conditions
    if (mSearchable == null) {
        return false;
    }

    if (DBG) {
        Log.d(LOG_TAG, "mTextListener.onKey(" + keyCode + "," + event + "), selection: "
                + mQueryTextView.getListSelection());
    }

    // If a suggestion is selected, handle enter, search key, and action keys
    // as presses on the selected suggestion
    if (mQueryTextView.isPopupShowing()
            && mQueryTextView.getListSelection() != ListView.INVALID_POSITION) {
        return onSuggestionsKey(v, keyCode, event);
    }

    // If there is text in the query box, handle enter, and action keys
    // The search key is handled by the dialog's onKeyDown().
    if (!mQueryTextView.isEmpty() && KeyEventCompat.hasNoModifiers(event)) {
        if (event.getAction() == KeyEvent.ACTION_UP) {
            if (keyCode == KeyEvent.KEYCODE_ENTER) {
                v.cancelLongPress();

                // Launch as a regular search.
                launchQuerySearch(KeyEvent.KEYCODE_UNKNOWN, null, mQueryTextView.getText()
                        .toString());
                return true;
            }
        }
        if (event.getAction() == KeyEvent.ACTION_DOWN) {
            // TODO SearchableInfo.ActionKeyInfo actionKey = mSearchable.findActionKey(keyCode);
            // TODO if ((actionKey != null) && (actionKey.getQueryActionMsg() != null)) {
            // TODO     launchQuerySearch(keyCode, actionKey.getQueryActionMsg(), mQueryTextView
            // TODO             .getText().toString());
            // TODO     return true;
            // TODO }
        }
    }
    return false;
}
 
源代码评论
动弹
沙发等你来抢
 方法所在类
 同类方法