[TIMOB-2000] Android: Module name collision between Ti.UI.Android and Ti.Android
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:57:47.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.5.0 M01 |
Components | Android |
Labels | android, defect |
Reporter | Bill Dawson |
Assignee | Bill Dawson |
Created | 2011-04-15T03:07:46.000+0000 |
Updated | 2011-04-17T01:57:47.000+0000 |
Description
If you run this app.js:
/*global Ti, Titanium, alert, JSON */
Titanium.UI.setBackgroundColor('#000');
Ti.API.info('Ti.UI.Android.SOFT_INPUT_ADJUST_PAN = ' + Ti.UI.Android.SOFT_INPUT_ADJUST_PAN);
Ti.API.info('Ti.Android.ACTION_ALL_APPS = ' + Ti.Android.ACTION_ALL_APPS);
The result should be:
I/TiAPI ( 1127): (kroll$1) [1,147] Ti.UI.Android.SOFT_INPUT_ADJUST_PAN = 32
I/TiAPI ( 1127): (kroll$1) [0,169] Ti.Android.ACTION_ALL_APPS = android.intent.action.ALL_APPS
But the actual result is:
I/TiAPI ( 1127): (kroll$1) [1,147] Ti.UI.Android.SOFT_INPUT_ADJUST_PAN = 32
I/TiAPI ( 1127): (kroll$1) [0,169] Ti.Android.ACTION_ALL_APPS = null
The second one fails because KrollObject.get() grabs the cached module named Android, which comes from Ti.UI.Android since it was called first.
Comments
- Bill Dawson 2011-04-15
(from [3f1d49ee52fb480288b9ef8ddedbed18b94a4f65]) [#2000 state:fixed-in-qa] Caching of modules now uses their full qualified class names as keys to avoid collisions between Ti.Android and Ti.UI.Android http://github.com/appcelerator/titanium_mobile/commit/3f1d49ee52fb480288b9ef8ddedbed18b94a4f65"> http://github.com/appcelerator/titanium_mobile/commit/3f1d49ee52fb4...
- Thomas Huelbert 2011-04-15
Hey Bill, I am seeing :
I/TiAPI ( 299): (kroll$3) [99,29737] Ti.UI.Android.SOFT_INPUT_ADJUST_PAN = 32
I/TiAPI ( 299): (kroll$3) [2,29739] Ti.Android.ACTION_ALL_APPS = undefinedin Titanium SDK version: 1.5.0d02c264
- Marshall Culpepper 2011-04-15
Adding Don's comment from the duplicate #2142:
Ti.UI.Android and Ti.Android are not detected as separate namespaces. If both modules are included in boot, and Ti.UI.Android is added last, calling Ti.Android.createActivity throws an exception because it's looking in the Ti.UI.Android module - Bill Dawson 2011-04-15
(from [b42c84f0441aca59872f3c2bec07abb02afb2965]) [#2000 state:fixed-in-qa] third-level modules should not be included in Application.java (and thus not in app_modules collection in android.py). They are bound lazily at runtime. https://github.com/appcelerator/titanium_mobile/commit/b42c84f0441aca59872f3c2bec07abb02afb2965"> https://github.com/appcelerator/titanium_mobile/commit/b42c84f0441a...
- Bill Dawson 2011-04-15
- Matt Schmulen 2011-04-15
Titanium SDK version: 1.5.0 (12/01/10 09:30 ac7cfd8), drillbit, Android 1.6/2.1