[TIMOB-10293] Android: Transition all event names to lower case designs
| GitHub Issue | n/a |
|---|---|
| Type | Sub-task |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2012-08-17T15:26:48.000+0000 |
| Affected Version/s | Release 3.0.0 |
| Fix Version/s | Sprint 2012-17 API, Release 3.0.0 |
| Components | Android |
| Labels | api, look1 |
| Reporter | Blain Hamon |
| Assignee | Ping Wang |
| Created | 2012-08-01T16:00:25.000+0000 |
| Updated | 2017-03-20T17:07:12.000+0000 |
Description
In the aug 1 architectural meeting, it was resolved that events should use only lowercase letters 'a'-'z', for reasons of consistency, aligning with W3C and for making life easy for Alloy. For example:
* android:back should be androidback
* durationAvailable should be durationavailable
To transition, lowercase versions of the events should be made, deprecating but still using the camelCase and namespaced events. Document as such. Then eventually drop the non-lowercase events.
Steps for functional test: 1. Run the test code below. See the alert "addedtotab fired". 2. Click tab1. Click BACK, SEARCH, VOLUME, CAMERA hard keys to fire events. 3. Click tab2. Scroll the scrollable view to fire events. 4. Click tab3. See the alert "durationabailable fired".
var tabGroup = Ti.UI.createTabGroup(); // // Test events: addedtotab, androidback, androidcamera, androidsearch, androidvoldown, androidvolup // var win1 = Ti.UI.createWindow({ backgroundColor : "orange" }); var text1 = Ti.UI.createTextArea({ top: 10, editable: false, value: "Please click the BACK, SEARCH, VOLUME, CAMERA key to fire events." }); win1.add(text1); win1.addEventListener("addedtotab", function(){ alert("addedtotab fired"); }); win1.addEventListener("androidback", function(){ Ti.API.info("*************** androidback fired"); alert("androidback fired"); }); win1.addEventListener("androidcamera", function(){ Ti.API.info("*************** androidcamera fired"); alert("androidcamera fired"); }); win1.addEventListener("androidsearch", function(){ Ti.API.info("*************** androidsearch fired"); alert("androidsearch fired"); }); win1.addEventListener("androidvoldown", function(){ Ti.API.info("*************** androidvoldown fired"); alert("androidvoldown fired"); }); win1.addEventListener("androidvolup", function(){ Ti.API.info("*************** androidvolup fired"); alert("androidvolup fired"); }); // // Test events: dragend, scrollend // var win2 = Ti.UI.createWindow({ backgroundColor : "lime" }); var text2 = Ti.UI.createTextArea({ top: 10, editable: false, value: "Please scroll the view to fire events." }); win2.add(text2); var view1 = Ti.UI.createView({ backgroundColor : '#123' }); var view2 = Ti.UI.createView({ backgroundColor : '#246' }); var view3 = Ti.UI.createView({ backgroundColor : '#48b' }); var scrollableView = Ti.UI.createScrollableView({ top: 100, views : [view1, view2, view3], showPagingControl : true }); scrollableView.addEventListener("dragend", function(e){ Ti.API.info('**************** dragend fired: current index = ' + e.currentPage + ', current view = ' + e.view); alert("dragend fired"); }); scrollableView.addEventListener("scrollend", function(e){ Ti.API.info('**************** scrollend fired: current index = ' + e.currentPage + ', current view = ' + e.view); alert("scrollend fired"); }); win2.add(scrollableView); // // Test events: durationavailable // var win3 = Titanium.UI.createWindow(); var activeMovie = Titanium.Media.createVideoPlayer({url: 'movie.mp4'}); activeMovie.addEventListener('durationavailable', function(e) { Ti.API.info('**************** durationavailable fired: ' + e.duration + ' ms'); alert("durationavailable fired"); }); win3.add(activeMovie); var tab1 = Ti.UI.createTab({ title: "tab1", window : win1 }); var tab2 = Ti.UI.createTab({ title: "tab2", window : win2 }); var tab3 = Ti.UI.createTab({ title: "tab3", window : win3 }); tabGroup.addTab(tab1); tabGroup.addTab(tab2); tabGroup.addTab(tab3); tabGroup.open();PR https://github.com/appcelerator/titanium_mobile/pull/2767
Closing ticket as fixed.