Quantcast
Viewing all articles
Browse latest Browse all 8068

custom Navigation bar problems with Android

Hi.

I'm encountering a strange behavior while using a custom Navbar in Android. All seems to be right until I close a window directly (by code) in the custom navBar. The secont time I open another window with the navBar, the old objects (label, buttons, etc.) are still there.

I post an example:

First, from a main window I call the AddForm in the NavBar:

var ui = require('navigation');
var nav = ui.createNavigatorGroup();
 
Alloy.Globals.navBar = nav;
 
nav.open(winAddPill, {animated: true});
Image may be NSFW.
Clik here to view.
img1

When user press ADD button (you can't see, is in bottom), I autoclose the window in the nav, after save the data, with this code:

Alloy.Globals.navBar.close($.win);

If I do that, when now I call another window, e.g., show info (which has a DELETE button in right), the title label is mixed with previous window:

Alloy.Globals.navBar.open(winPill, {animated: true});

Image may be NSFW.
Clik here to view.
img2

As you can see, all is mixed, this is what must be shown instead:

Image may be NSFW.
Clik here to view.
img2

If I continue to open new windows, all is still mixing. But if I simply click on the ANDROID back system button, then all is reset and the next navBar open works fine.

Any help to avoid this behavior?

Finally, the custom navBar for Android that I'm using:

exports.createNavigatorGroup = function() {
 
    var me = {};
 
        var navViews = []; // A stack of navigation bars
        var navView;
 
        function pushNavBar() {
            navView = Ti.UI.createView({
                top: 0,
                height: 44,
                backgroundColor: '#BBB'
            });
            navViews.push(navView);
        };
 
        function popNavBar() {
            navViews.pop();
            navView = navViews[navViews.length - 1];
        };
 
        // Make sure we always have a navView available to prepare
        pushNavBar();
 
        me.open = function(win) {
            navView.add(Ti.UI.createLabel({
                text: win.title,
                color: 'black'
            }));
 
            navView.win = win;
            win.add(navView);
 
            win.navBarHidden = true;
            win.open();
 
        // Prepare for the next window
            pushNavBar();
        };
 
        me.close = function(win) {
            if (navViews.length > 1) {
                // Close the window on this nav
                popNavBar();
                win.close();
            }
        };
    return me;
};

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>