appcelerator/titanium_mobile — pull request #5055 by farfromrefug (2013-12-03 18:53:03+00:00)
Title: View from template java side

This is kind of a big PR with great consequences. The original idea was for this example to work
```
var win = Ti.UI.createWindow({
backgroundColor : 'white',
orientationModes : [Ti.UI.UPSIDE_PORTRAIT, Ti.UI.PORTRAIT, Ti.UI.LANDSCAPE_RIGHT, Ti.UI.LANDSCAPE_LEFT]
});
var btnHolder = Ti.UI.createView({
left: 0,
layout: 'vertical',
height: Ti.UI.SIZE,
width: Ti.UI.SIZE,
backgroundColor: 'green'
});
btnHolder.add([
{type:'Ti.UI.Button', left:0, bid:0,title: 'start'},
{type:'Ti.UI.Button', right:0, bid:1,title: 'pause'},
{type:'Ti.UI.Button', left:0, bid:2,title: 'resume'},
{type:'Ti.UI.Button', right:0, bid:3,title: 'playpause'},
{type:'Ti.UI.Button', left:0, bid:4,title: 'stop'},
{type:'Ti.UI.Button', right:0, bid:5,title: 'reverse'},
{type:'Ti.UI.Button', left:0, bid:6,title: 'autoreverse'},
{type:'Ti.UI.Button', right:0, bid:7,title: 'transition'}
]);
btnHolder.addEventListener('singletap', function(e) {
Ti.API.info(JSON.stringify(e));
alert("we tapped on the button with bid: " + e.source.bid);
});
win.add(btnHolder);
win.open();
```
[jira ticket|https://jira.appcelerator.org/browse/TC-3364]

Now about the PR:
- The "APIMap" can obviously be changed as i didnt really now how to name it.
- You can see that i modified almost all the android projects. Why? The trick behind that PR is to add a class to kroll.common. But that class can only be created in the ant target "update.apis". This means that when developing the SDK for android in eclipse you would not get the correct jar file. (currently you get the one from the kroll.common project under bin).
With that PR, every project will use the one from dist/android, which has been modified by "update.apis"
- As mentioned in the ticket, this PR allows to create any proxy on the java's side using templates. Consequently it will allow to fix [this one|https://jira.appcelerator.org/browse/TIMOB-15268]
- About the native side. Why did i add the "nativeUpdateProperties" method? Without it the sample wouldn't work. Especially you wouldn't be able to read the "bid" property from the "singletap" event. This is because "bid" is not a "compiled" accessor, and so we need to tell the krollobject to store that value (knowing that you won't be able to change it in the future if there is no bindId).

Once again i am willing to give any amount of work to get this one to go through.