tidev / titanium-sdk

🚀 Native iOS and Android Apps with JavaScript
https://titaniumsdk.com/
Other
2.76k stars 1.21k forks source link

fix(android): set correct title after titleAttributes update #13957

Closed m1ga closed 10 months ago

m1ga commented 11 months ago

Fixes an issue that came with https://github.com/tidev/titanium-sdk/pull/13954 and window titles. Title where not shown in all (sub)windows:

Test 1:

var win = Titanium.UI.createWindow({
    barColor: "pink",
    backgroundColor: "white",
    title: 'Autos',
    titleAttributes: {
        top: 0,
        color: "blue",
    },
});

win.addEventListener("click", function() {
    win.titleAttributes = {
        color: "yellow"
    }
})
win.open();

open and click

Test 2:

var win = Titanium.UI.createWindow({
    barColor: "pink",
    backgroundColor: "white",
    title: 'Autos',
    titleAttributes: {
        top: 0,
        color: "blue",
    },
});

var navWin = Titanium.UI.createNavigationWindow({
    window: win,
});

win.addEventListener("click", function() {
    win.titleAttributes = {
        color: "yellow"
    }
    win.title = "new"

    var w2 = Ti.UI.createWindow({
        barColor: "black",
        backgroundColor: "white",
        title: 'subwindow',
        titleAttributes: {
            top: 0,
            color: "green",
        },
    })
    navWin.openWindow(w2);
    setTimeout(function() {
        w2.title = "subwindow 2";
    }, 2000);
})
navWin.open();

open and click, wait, close window after title changed.