Java Code Examples for android.view.View#cancelLongPress()
The following examples show how to use
android.view.View#cancelLongPress() .
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: LaunchEnr File: CellLayout.java License: GNU General Public License v3.0 | 5 votes |
@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(); } }
Example 2
Source Project: LaunchEnr File: ShortcutAndWidgetContainer.java License: GNU General Public License v3.0 | 5 votes |
@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(); } }
Example 3
Source Project: LaunchEnr File: PagedView.java License: GNU General Public License v3.0 | 5 votes |
/** * {@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); }
Example 4
Source Project: LB-Launcher File: PagedViewWithDraggableItems.java License: Apache License 2.0 | 5 votes |
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(); } } } }
Example 5
Source Project: Trebuchet File: CellLayout.java License: GNU General Public License v3.0 | 5 votes |
@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(); } }
Example 6
Source Project: Trebuchet File: PagedView.java License: GNU General Public License v3.0 | 5 votes |
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(); } }
Example 7
Source Project: TurboLauncher File: PagedViewCellLayout.java License: Apache License 2.0 | 5 votes |
@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(); } }
Example 8
Source Project: TurboLauncher File: PagedViewCellLayoutChildren.java License: Apache License 2.0 | 5 votes |
@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(); } }
Example 9
Source Project: TurboLauncher File: CellLayout.java License: Apache License 2.0 | 5 votes |
@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(); } }
Example 10
Source Project: TurboLauncher File: ShortcutAndWidgetContainer.java License: Apache License 2.0 | 5 votes |
@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(); } }
Example 11
Source Project: TurboLauncher File: PagedViewWithDraggableItems.java License: Apache License 2.0 | 5 votes |
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(); } } } }
Example 12
Source Project: LB-Launcher File: CellLayout.java License: Apache License 2.0 | 5 votes |
@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(); } }
Example 13
Source Project: TurboLauncher File: PagedView.java License: Apache License 2.0 | 5 votes |
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(); } } }
Example 14
Source Project: freepager File: VerticalPager.java License: Apache License 2.0 | 5 votes |
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(); } } }
Example 15
Source Project: LB-Launcher File: PagedViewCellLayout.java License: Apache License 2.0 | 5 votes |
@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(); } }
Example 16
Source Project: android_9.0.0_r45 File: SearchView.java License: Apache License 2.0 | 4 votes |
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; }
Example 17
Source Project: CSipSimple File: SearchView.java License: GNU General Public License v3.0 | 4 votes |
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; }
Example 18
Source Project: Libraries-for-Android-Developers File: SearchView.java License: MIT License | 4 votes |
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; }
Example 19
Source Project: zhangshangwuda File: SearchView.java License: Apache License 2.0 | 4 votes |
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; }
Example 20
Source Project: zen4android File: SearchView.java License: MIT License | 4 votes |
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; }