[TIMOB-24190] Android: Adding getLocationOnScreen() to retrieve location after translation
| GitHub Issue | n/a | 
|---|---|
| Type | New Feature | 
| Priority | Critical | 
| Status | Closed | 
| Resolution | Invalid | 
| Resolution Date | 2017-03-06T13:31:26.000+0000 | 
| Affected Version/s | n/a | 
| Fix Version/s | n/a | 
| Components | Android | 
| Labels | android, community, notable, position | 
| Reporter | Michael Gangolf | 
| Assignee | Frankie Merzadyan | 
| Created | 2016-12-01T19:15:36.000+0000 | 
| Updated | 2017-03-06T13:31:26.000+0000 | 
Description
	Animating a view using transform and a 2DMatrix will return the left coordinate and not the new position. The new method 
getLocationOnScreen() will return the actual x/y value.
Example
var win = Ti.UI.createWindow({
    backgroundColor: "#fff"
});
var v = Ti.UI.createView({
    left: 0,
    top: 0,
    width: 100,
    height: 100,
    backgroundColor: "#f00"
});
var dpi = Ti.Platform.displayCaps.logicalDensityFactor;
win.addEventListener("open", function() {
    v.animate({
        left: 200,
        duration: 1000
    }, function() {
        console.log("Animate left:");
        console.log("left: " + v.left);
        console.log("rect.x: " + v.rect.x);
        console.log("locationOnScreen: " + v.getLocationOnScreen().x);
        console.log("------------------------");
        var matrix = Ti.UI.create2DMatrix()
        matrix = matrix.translate(-200*dpi, 0);
        v.animate({
            transform: matrix,
            duration: 1000
        }, function() {
            console.log("Animate transform:");
            console.log("left: " + v.left);
            console.log("rect.x: " + v.rect.x);
            console.log("locationOnScreen: " + v.getLocationOnScreen().x);
            console.log("------------------------");
        });
    });
})
win.add(v);
win.open();
Danke Michael! [~fmerzadyan], can you do the CR & FT for this? Thx! *EDIT*: The community PR was revoked, so pulling it out of 6.1.0