Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMOB-11845-Capture longpress using dispatchTouchEvent in native MapView #3871

Merged
merged 3 commits into from Feb 21, 2013

Conversation

salachi
Copy link
Contributor

@salachi salachi commented Feb 14, 2013

TIMOB-11845-Implemented the logic to detect LongPress based on touch.

@@ -125,6 +133,54 @@ public boolean dispatchTouchEvent(MotionEvent ev)
if (!scrollEnabled && ev.getAction() == MotionEvent.ACTION_MOVE) {
return true;
}
int actionType = ev.getAction();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems it's more appropriate to put this implementation in onTouchEvent() instead of dispatchTouchEvent() since it's trying to handle events.

@ghost ghost assigned pingwang2011 Feb 19, 2013
@arthurevans
Copy link
Contributor

Should include a doc update if we're adding support on a new platform. Here are the changes that need to be made in apidoc/Titanium/Map/View.yml

  1. Remove 'longpress' from this list:
excludes: {
    events: [ 'singletap', 'doubletap', 'dblclick', 'longclick', 'longpress', 'pinch',
    'swipe', 'touchstart', 'touchend', 'touchcancel', 'touchmove', 'twofingertap' ]
}
  1. Add "longpress" into the events: list between "loading" and "pinchangeddragstate".
  - name: longpress
    since: { android: 3.1.0 }

That's all you need--the remaining docs will be inherited from View.longpress.

float yhigh = longClickYCoordinate + Y_TOLERANCE;
if ((xup > xlow && xup < xhigh) && (yup > ylow && yup < yhigh)) {
// Treat it as a long press
if (proxy.hierarchyHasListener(TiC.EVENT_LONGPRESS)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can move this check to the top. If there is no listener for longpress, we don't need to do such calculation.

@pingwang2011
Copy link
Contributor

Code reviewed. Looks good. Only one minor comment.
Functionally tested. Ran the test case in TIMOB-11845 and KS->mapview and TIMOB-10009 and TIMOB-10289. All passed.
Please also address Arthur's comments.

@pingwang2011
Copy link
Contributor

Code reviewed and functionally tested. Also ran docgen.py and it passed. Request Accepted

pingwang2011 added a commit that referenced this pull request Feb 21, 2013
TIMOB-11845-Capture longpress using dispatchTouchEvent in native MapView
@pingwang2011 pingwang2011 merged commit a850c18 into tidev:master Feb 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants