PDA

View Full Version : Browser to be closed automatically when changing the orientation on IPod !!!



pm.sreejith
30 Dec 2011, 1:05 AM
Hi All,

I have developed an application using ST pr2 in MVC architecture. Now the application runs on all webkit browsers in desktop, IPad, IPod etc..

But I have seen while working on IPod and we tried to change the orientation while loading the application, the browser getting closed....

Please have a look on the code given below:


init: function() {

this.callParent(arguments);

localStorage.setItem('defaltfontsize',18);
localStorage.setItem('titlefontsize',21);

//For getting news id selected while switching from Portrait view to Landscape view

var scope = {
obj : this
}

this.getLandscapeViewView().create();
this.getPortraitViewView().create();
this.getMobilePviewView().create();
this.getMobileLviewView().create();
this.getMobileDetailView().create();
this.getEditableSheetView().create();

if(Ext.os.deviceType.toLowerCase()=='phone') {

if(!this.getMobileLview()) {
this.getMobileLviewView().create();
}

if(!this.getMobilePview()) {
this.getMobilePviewView().create();
}

this.getMobileLview().hide();
this.getMobilePview().show();

this.getMobileLatestNewsNow();
this.getMobileNewsCategoryWise();

var obj=this;
setTimeout(function(){
obj.getMobilePview().hide();
obj.getMobilePview().show();
},8000);

/* if (Ext.Viewport.getOrientation()!="landscape")
{
this.getMobileLview().hide();
this.getMobilePview().show();
}
else
{
this.getMobilePview().hide();
this.getMobileLview().show();
}
Ext.Viewport.on('resize', this.doChangeOrientationMobile, scope);
var obj=this;
setTimeout(function()
{
if (Ext.Viewport.getOrientation()!="landscape")

{
obj.getMobilePview().hide();
obj.getMobilePview().show();
}
else
{
obj.getMobileLview().hide();
obj.getMobileLview().show();
}

},8000);
*/

}

if(Ext.os.deviceType.toLowerCase()=='tablet' || Ext.os.deviceType.toLowerCase()=='desktop' )
{
if(!this.getLandscapeView()) {
this.getLandscapeViewView().create();
}
this.getNewsCategoryWise();


if(!this.getPortraitView())
{
this.getPortraitViewView().create();
}
this.getNewsCategoryWisePortrait();


Ext.Viewport.on('resize', this.doChangeOrientation, scope);
//this.getNewsCategoryWise();
//this.wwwaaa();
var obj=this;
if (Ext.Viewport.getOrientation()!="landscape")
{
if(!this.getPortraitView())
{
this.getPortraitViewView().create();
}


this.getPortraitView().show();
setTimeout(function()
{
obj.getPortraitView().hide();
obj.getPortraitView().show();
},8000);
}
else
{
if(!this.getLandscapeView()) {
this.getLandscapeViewView().create();
}

this.getLandscapeView().show();
setTimeout(function()
{
obj.getLandscapeView().hide();
obj.getLandscapeView().show();
},8000);
}

this.getLatestNewsNow();
}
else if(Ext.os.deviceType.toLowerCase()=='phone')
{
//alert(Ext.os.deviceType.toLowerCase());
}

},
doChangeOrientation:function(){
this.obj.changeOrientation();

},
doChangeOrientationMobile:function(){
if (Ext.Viewport.getOrientation()!="landscape")
{
this.obj.getMobileLview().hide();
this.obj.getMobilePview().show();
}
else
{
this.obj.getMobilePview().hide();
this.obj.getMobileLview().show();
}

},
changeOrientation:function(){

if (Ext.Viewport.getOrientation()!="landscape"){
if(!this.getPortraitView())
{
this.getPortraitViewView().create();
}
this.getLandscapeView().hide();
this.getPortraitView().show();

if(this.getEditableSheet()) {
this.getEditableSheet().hide();
}

}
else{
if(!this.getLandscapeView()) {
this.getLandscapeViewView().create();
}

var iNIdLS = 0;
iNIdLS = localStorage.getItem('newsidselected');
var iNewsId = iNIdLS;

if(iNewsId > 0){
var q = Ext.DomQuery;
var selected = "", n = "";

if(this.currentSelected==" "){
selected='div#each_'+iNewsId;
n=q.selectNode(selected);
n.className = 'divNewsItemSel';
//n.style.border="4px solid #7A7979";
this.currentSelected=selected;
}
else{
n=q.selectNode(this.currentSelected);
//n.style.border="4px double #b1b1b1";
n.className = 'divNewsItem';
selected='div#each_'+iNewsId;
n=q.selectNode(selected);
//n.style.border="4px solid #7A7979";
n.className = 'divNewsItemSel';
this.currentSelected=selected;
}

this.getNewsDetails(iNewsId);
}

this.getPortraitView().hide();
this.getLandscapeView().show();
if(this.getPortraitnewsSheet()) {
this.getPortraitnewsSheet().hide();
}
}
},



I'm using ST2.0 Pr2 with MVC architecture. Anybody know why it is happens...

Thanks in advance...

estesbubba
30 Dec 2011, 6:52 AM
First thing you should go to PR3. Second I would power off the device having problems and try it again.