[TIMOB-952] View click event listeners not being invoked on "empty" view space
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:54:46.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.5.0 |
Components | Android |
Labels | android, defect |
Reporter | Bill Dawson |
Assignee | Don Thorp |
Created | 2011-04-15T02:40:01.000+0000 |
Updated | 2011-04-17T01:54:46.000+0000 |
Description
Fail case: http://gist.github.com/403933">http://gist.github.com/403933 - the click event only fires if you click into the text field. If you click on an uninhabited portion of the view, you don't get it.
This occurs because of the special background handling and TiBackgroundDrawable. In other words, it fails on simple backgrounds.
Adding this simple usecase, as discussed with Don.
http://gist.github.com/585768">http://gist.github.com/585768
Just swap the last two lines to see that the view1 (red) event listener never fires.
His explanation was thus:
"the problem is that when a complex background is added setClickable() in Android is called with true. For a simple background it's not. As a temporary working around give it corners or a background image and your click will work."
Just to note, you can add a label to the simple view, and this will allow the view1 event listener to fire, but only when you click the text of the label. For any other area of the simple background, the complex view positioned beneath or over it will fire instead. Here is an example:
http://gist.github.com/585819">http://gist.github.com/585819
hehe - sorry, Don!
I have just noticed that whenever I post an update, it automatically defaults the "who's responsible" option back to Marshall.
Assigning back to you...
btw, as a temporary workaround, you can set borderRadius:0 and the click events work correctly
See #1625 as well
(from [7b6449b75f82462bd18c1c4776ef67f014e18829]) [#952 state:fixed-in-qa][#1625 state:fixed-in-qa] refactored click handling and removed special cases that weren't needed. Note if a view doesn't handle a click Android search up through all components under the touch/click point to find one that will. If you want to stop other views from getting a click (e.g. full screen loading view) just set an no-op click handler on the topmost view http://github.com/appcelerator/titanium_mobile/commit/7b6449b75f82462bd18c1c4776ef67f014e18829"> http://github.com/appcelerator/titanium_mobile/commit/7b6449b75f824...
1.4.2.5935b3 g1 (1.6) simulator 2.2, iOS 4.1