Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11845] Android: support the 'longpress' event on MapView

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-03-30T00:41:56.000+0000
Affected Version/sRelease 2.1.4, Release 3.0.0
Fix Version/sRelease 3.1.0, 2013 Sprint 04 API, 2013 Sprint 04, 2013 Sprint 07 Core
ComponentsAndroid
Labelsexalture, module_map, parity, qe-testadded, triage
ReporterCarlo Hermus
AssigneeAllen Yeung
Created2012-11-21T16:03:54.000+0000
Updated2013-03-30T18:33:05.000+0000

Description

*Actual Result* No results. The event is only fired the first time you touch the screen when window is opened. It states in version 1.8.0.1 this feature was available. But in version 2.1.3, 2.1.4 and the new 3.0 SDK this feature is not available. *Expected Result* Being able to detect longpress event on a mapview and return the appropriate parameters. *Notes* When you run this on a iOS device it works. *Test case*
var mapView = Ti.Map.createView({
	mapType : Ti.Map.STANDARD_TYPE,
	animate : true,
	regionFit : true,
	region : {
		latitudeDelta : 0.02,
		longitudeDelta : 0.02,
	},
	userLocation : true,
	width : '100%',
	height : '100%',
	top : 0,
});

// open a single window
var window = Ti.UI.createWindow({
	backgroundColor : 'white'
});

mapView.addEventListener('longpress', function(e) {
	alert(e);
});

window.add(mapView);
window.open();

Attachments

FileDateSize
.log2012-11-21T16:04:03.000+0000153460
diagnostic3006535850083081922.log2012-11-21T16:04:13.000+00001743

Comments

  1. Daniel Sefton 2012-11-21

    Tested and confirmed on Samsung Galaxy S2 2.3.6 device and Android emulator 2.3.3 on both 2.1.4 GA and latest 3.0.0 build.
  2. Carlo Hermus 2012-11-25

    Any ETA on this?
  3. Carlo Hermus 2012-12-16

    Any ETA on this?
  4. Ben Scofield 2012-12-22

    Hi. Also wondering if there was an movement on this. Thanks.
  5. Ben Scofield 2013-02-07

    Hi Vivekr, I was wondering if you could tell me if, included in the scope of this ticket, is the issue that the "longpress" event is fired on a quick tap. Thanks.
  6. Carlo Hermus 2013-02-13

    Can you please give us an ETA? My android launch is depending on this and so is my paycheque
  7. Ben Scofield 2013-02-13

    x2
  8. Sunila 2013-02-14

    Since the TIUIView touch handlers get the event only once, I implemented this in the native MapView by handling touch. I have returned false for 'allowRegisterForTouch' so that TIView handlers don't get registered and we don't get duplicate event fired at the first time.
  9. Ping Wang 2013-02-15

    The 'longpress' event is never supported on MapView on Android. This event is not documented either. Change the ticket to New Feature.
  10. Michael Pauley 2013-02-15

    If I remember correctly this was a feature in 1.8
  11. Carlo Hermus 2013-02-20

    Dear Ping, Please change it back to bug. We are waiting for 3 months until it was picked up and after a few weeks in review it is now a feature?? And this "feature" was available in 1.8 versions and also documented. Even so it is working in iPhone. This is a bug and not a new feature request. Besides there is also a pull request from november.
  12. Arthur Evans 2013-02-20

    On testing, the Android behavior on 1.8 is identical to the current behavior, so this is not a regression. The 1.8 doc is wrong. So we have a documentation issue here as well as a parity issue. When we transitioned to a new doc format in 1.8, a number of spurious events were introduced by the new documentation inheritance mechanism. Between 1.8 and 2.0, we spent a lot of time testing controls and correcting the doc for events etc., that were not actually supported. In this case, it appears that we were overzealous and removed the doc for the "longpress" event, although it appears to be supported on iOS. I'll open a doc ticket to correct the event support info.
  13. Ping Wang 2013-02-20

    PR: https://github.com/appcelerator/titanium_mobile/pull/3871
  14. Ben Scofield 2013-02-21

    Can someone help me out with this? I'm having trouble keeping up. Will this be added in 3.1 or will documentation be updated to reflect that it is not available for Android? Thanks.
  15. Ping Wang 2013-02-21

    Hi Ben, this feature will be in 3.1 and the doc will show that it is added on Android since 3.1.
  16. Ben Scofield 2013-02-21

    Thanks, Ping.
  17. Carlo Hermus 2013-02-28

    Thanks Ping. I tested and the longpress works... I have only 2 questions or requests. The longpress is activated after 4 seconds pressing and then releasing. On the iPhone it is activated after 2 seconds and still pressing on the map. Is it possible to implement this as the iPhone so give it only 2 seconds (because it is hard not to move the map while pressing for 4 seconds). And is it possible to implement this as the iPhone that the event is triggered when still pressing and not on the up event. TIA, Carlo
  18. Arthur Evans 2013-03-06

    I agree the longpress ought to be fired while the user is still pressing. This allows the app to update the UI and cue the user that something has happened. Otherwise, the user doesn't know they've pressed long enough until they lift their finger.
  19. Ben Scofield 2013-03-06

    Agreed. Also, I've never encountered an app where a longpress takes 4 seconds. I'm not sure that a user could be convinced to press for that long.
  20. Shyam Bhadauria 2013-03-12

    Closing it as it has been implemented.Test case added.
  21. Arthur Evans 2013-03-13

    Carlo, if you have test code handy, could you open a bug for the parity differences between Android and iOS?
  22. Ben Scofield 2013-03-28

    Hi. Can we get an update on what this additional activity is for? Is the release going to stay the same and has the timing been addressed or is it still 4 seconds? Thanks.
  23. Allen Yeung 2013-03-28

    PR: https://github.com/appcelerator/titanium_mobile/pull/4054 The long press event does not take 4 seconds to activate, it's most likely masked by the fact that you need to lift your finger to trigger the event. I've changed it so the long press event activates even when the user does not perform and action up event.
  24. Eric Merriman 2013-03-30

    Ok, verified the feature has been implemented as follows: Longpress fires after approx 2 seconds while finger down, without "up" event. Verified on the following with the sample code above: Mac OS 10.8.3 SDK: 3.1.0.v20130329175112 Titanium Studio, build: 3.1.0.201303261815 CLI 3.0.25-alpha node-appc 1.0.29-alpha Nexus 4 OS 4.2.1

JSON Source