hansemannn / titanium-googlemaps

🗺 Use the Google Maps SDK in Titanium

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Opening a new View or window on top of the window

kid-yume opened this issue · comments

What if i want to open a window over top of the map. i am unable to add a window to the screen or anything

I don't think anything would prevent from doing that. You're issue is not in the module.

Im not saying its the module per say maybe its the way the module works and interacts with windows. For example I cannot add the map to a view. It can only be added to a window. When i add it to a view it does not work. If i add a secondary window in the app.js it will not work. however, if i fire an app event inside the postlayout listener the window opens with no issues. If i try to add any "views" to that window it will not work. I did not start having these kind of issues until i added the module. Does that make sense?

/*

  • Single Window Application Template:
  • A basic starting point for your application. Mostly a blank canvas.
  • In app.js, we generally take care of a few things:
    • Bootstrap the application with any data we need
    • Check for dependencies like device type, platform version or network connection
    • Require and open our top-level UI component

*/
Ti.App.currentHeight ="0";
Ti.App.currentWidth = "0";
//bootstrap and check dependencies
if (Ti.version < 1.8) {
alert('Sorry - this application template requires Titanium Mobile SDK 1.8 or later');
}

// This is a single context application with multiple windows in a stack
(function() {
//render appropriate components based on the platform and form factor
var osname = Ti.Platform.osname,
version = Ti.Platform.version,
height = Ti.Platform.displayCaps.platformHeight,
width = Ti.Platform.displayCaps.platformWidth;

//considering tablets to have width over 720px and height over 600px - you can define your own
function checkTablet() {
var platform = Ti.Platform.osname;

switch (platform) {
  case 'ipad':
    return true;
  case 'android':
    var psc = Ti.Platform.Android.physicalSizeCategory;
    var tiAndroid = Ti.Platform.Android;
    return psc === tiAndroid.PHYSICAL_SIZE_CATEGORY_LARGE || psc === tiAndroid.PHYSICAL_SIZE_CATEGORY_XLARGE;
  default:
    return Math.min(
      Ti.Platform.displayCaps.platformHeight,
      Ti.Platform.displayCaps.platformWidth
    ) >= 400
}

}

var isTablet = checkTablet();
console.log(isTablet);

var Window,Window2;
if (isTablet) {
Window = require('ui/tablet/ApplicationWindow');
} else {
// Android uses platform-specific properties to create windows.
// All other platforms follow a similar UI pattern.
if (osname === 'android') {
Window = require('ui/handheld/android/ApplicationWindow');
} else {
Window = require('ui/handheld/ApplicationWindow');
}
}

Window2 = require('ui/handheld/TableViewWindow');

new Window().open();
// new Window2().open(); Will not work this way

Ti.App.addEventListener('done',function(e){
Ti.API.info(e);
new Window2().open(); // now will open howver now views show inside.

});

})();

I mean "no views will show inside the 2nd window now."

Nevermind. Weirdest thing started a whole new project and it started working again!