equal
deleted
inserted
replaced
58 const TInt KMemoryRequestAmountInBytes = 524288; |
58 const TInt KMemoryRequestAmountInBytes = 524288; |
59 const TInt KMinMemoryAmountInBytes = 524288; |
59 const TInt KMinMemoryAmountInBytes = 524288; |
60 |
60 |
61 // time to wait before sending the task to background |
61 // time to wait before sending the task to background |
62 // (must give time to animation) |
62 // (must give time to animation) |
63 const TInt KWaitBeforeGoingToBackground = 100000; |
63 const TInt KWaitBeforeGoingToBackground = 175000; |
64 |
64 |
65 // ----------------------------------------------------------------------------- |
65 // ----------------------------------------------------------------------------- |
66 // CTsAppUi::ConstructL() |
66 // CTsAppUi::ConstructL() |
67 // ConstructL is called by the application framework |
67 // ConstructL is called by the application framework |
68 // ----------------------------------------------------------------------------- |
68 // ----------------------------------------------------------------------------- |
142 iApplicationTask.SetWgId( iWg.Identifier() ); |
142 iApplicationTask.SetWgId( iWg.Identifier() ); |
143 |
143 |
144 // And finally, go to background. |
144 // And finally, go to background. |
145 MoveAppToBackground( ENoneTransition ); |
145 MoveAppToBackground( ENoneTransition ); |
146 |
146 |
147 iEikonEnv->RootWin().SetOrdinalPosition(-1); |
147 iEikonEnv->RootWin().SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront); |
148 iEikonEnv->RootWin().EnableReceiptOfFocus(EFalse); |
148 iEikonEnv->RootWin().EnableReceiptOfFocus(EFalse); |
149 |
149 |
150 iIsPopUpShown = EFalse; |
150 iIsPopUpShown = EFalse; |
|
151 iUiStarted = EFalse; |
|
152 iDisableAppKeyHandling = EFalse; |
151 |
153 |
152 TSLOG_OUT(); |
154 TSLOG_OUT(); |
153 } |
155 } |
154 |
156 |
155 // ----------------------------------------------------------------------------- |
157 // ----------------------------------------------------------------------------- |
334 // These calls may be redundant but the functions will do nothing if the |
336 // These calls may be redundant but the functions will do nothing if the |
335 // state has already been changed. |
337 // state has already been changed. |
336 // Both this function and the 'manual' MoveAppTo functions must fire the events |
338 // Both this function and the 'manual' MoveAppTo functions must fire the events |
337 // because in some cases only one of them will run (e.g. when bringing to foreground |
339 // because in some cases only one of them will run (e.g. when bringing to foreground |
338 // not with the hw key but by other means etc.) |
340 // not with the hw key but by other means etc.) |
|
341 iDisableAppKeyHandling = EFalse; |
|
342 if ( !iUiStarted ) |
|
343 { |
|
344 // Ignore foreground events if UI is starting |
|
345 return; |
|
346 } |
339 if ( aForeground ) |
347 if ( aForeground ) |
340 { |
348 { |
341 HandleSwitchToForegroundEvent(); |
349 HandleSwitchToForegroundEvent(); |
342 } |
350 } |
343 // exclude cases with dialogs like power menu, memory card |
351 // exclude cases with dialogs like power menu, memory card |
344 else if( !IsFaded()) |
352 else |
345 { |
353 { |
346 HandleSwitchToBackgroundEvent(); |
354 if( !IsFaded() ) |
|
355 { |
|
356 HandleSwitchToBackgroundEvent(); |
|
357 } |
|
358 else |
|
359 { |
|
360 iDisableAppKeyHandling = ETrue; |
|
361 } |
347 } |
362 } |
348 |
363 |
349 // Call Base class method |
364 // Call Base class method |
350 CAknAppUi::HandleForegroundEventL( aForeground ); |
365 CAknAppUi::HandleForegroundEventL( aForeground ); |
351 |
366 |
379 { |
394 { |
380 if(!iForeground) |
395 if(!iForeground) |
381 { |
396 { |
382 MoveAppToBackground( EBackgroundTransition ); |
397 MoveAppToBackground( EBackgroundTransition ); |
383 } |
398 } |
384 else |
399 else if( !iDisableAppKeyHandling ) |
385 { |
400 { |
386 iAppView->HandleAppKey(KAppKeyTypeLong); |
401 iAppView->HandleAppKey(KAppKeyTypeLong); |
387 } |
402 } |
388 } |
403 } |
389 else if( value & KTaskswitcherShortAppKeyPressed ) |
404 else if( value & KTaskswitcherShortAppKeyPressed && !iDisableAppKeyHandling ) |
390 { |
405 { |
391 iAppView->HandleAppKey(KAppKeyTypeShort); |
406 iAppView->HandleAppKey(KAppKeyTypeShort); |
392 } |
407 } |
393 } |
408 } |
394 } |
409 } |
411 TSLOG_CONTEXT( CTsAppUi::HandleResourceChangeL, TSLOG_LOCAL ); |
426 TSLOG_CONTEXT( CTsAppUi::HandleResourceChangeL, TSLOG_LOCAL ); |
412 TSLOG_IN(); |
427 TSLOG_IN(); |
413 // Must call base class implementation first, |
428 // Must call base class implementation first, |
414 // sizes from LayoutMetricsRect etc. will only be correct after this. |
429 // sizes from LayoutMetricsRect etc. will only be correct after this. |
415 CAknAppUi::HandleResourceChangeL( aType ); |
430 CAknAppUi::HandleResourceChangeL( aType ); |
416 if( aType == KEikDynamicLayoutVariantSwitch && iAppView ) |
431 if( aType == KEikDynamicLayoutVariantSwitch && iAppView && !LayoutChangeAllowed() ) |
417 { |
432 { |
418 // Check if layout switch is necessary |
433 // Keep displayed orientation |
419 TSizeMode mode = iEikonEnv->ScreenDevice()->GetCurrentScreenModeAttributes(); |
434 return; |
420 TBool isLandscape = mode.iScreenSize.iWidth > mode.iScreenSize.iHeight; |
|
421 TRect appRect = ApplicationRect(); |
|
422 TBool isAppLandscape = appRect.Width() > appRect.Height(); |
|
423 if(isLandscape != isAppLandscape) |
|
424 { |
|
425 // Keep displayed orientation |
|
426 return; |
|
427 } |
|
428 } |
435 } |
429 // forward event |
436 // forward event |
430 iDeviceState->HandleResourceChange( aType ); |
437 iDeviceState->HandleResourceChange( aType ); |
431 if ( iAppView ) |
438 if ( iAppView ) |
432 { |
439 { |
498 void CTsAppUi::MoveAppToForeground( TUint /*aTransitionType*/ ) |
505 void CTsAppUi::MoveAppToForeground( TUint /*aTransitionType*/ ) |
499 { |
506 { |
500 TSLOG_CONTEXT( MoveAppToForeground, TSLOG_LOCAL ); |
507 TSLOG_CONTEXT( MoveAppToForeground, TSLOG_LOCAL ); |
501 TSLOG_IN(); |
508 TSLOG_IN(); |
502 |
509 |
|
510 iUiStarted = ETrue; |
|
511 |
503 // Request window server to bring our application |
512 // Request window server to bring our application |
504 // to foreground |
513 // to foreground |
505 iApplicationTask.BringToForeground(); |
514 iApplicationTask.BringToForeground(); |
506 |
515 |
507 // Notify |
516 // Notify |
527 iForeground = EFalse; |
536 iForeground = EFalse; |
528 SetTaskswitcherStateProperty( KTaskswitcherBackgroundValue ); |
537 SetTaskswitcherStateProperty( KTaskswitcherBackgroundValue ); |
529 |
538 |
530 // notify view |
539 // notify view |
531 iAppView->HandleSwitchToBackgroundEvent(); |
540 iAppView->HandleSwitchToBackgroundEvent(); |
|
541 |
|
542 iWg.SetOrdinalPosition(-1, ECoeWinPriorityNormal); |
532 } |
543 } |
533 |
544 |
534 TSLOG_OUT(); |
545 TSLOG_OUT(); |
535 } |
546 } |
536 |
547 |
556 iForeground = ETrue; |
567 iForeground = ETrue; |
557 SetTaskswitcherStateProperty( KTaskswitcherForegroundValue ); |
568 SetTaskswitcherStateProperty( KTaskswitcherForegroundValue ); |
558 |
569 |
559 // notify view |
570 // notify view |
560 iAppView->HandleSwitchToForegroundEvent(); |
571 iAppView->HandleSwitchToForegroundEvent(); |
|
572 |
|
573 iWg.SetOrdinalPosition(iWg.OrdinalPosition(), ECoeWinPriorityAlwaysAtFront); |
561 } |
574 } |
562 |
575 |
563 TSLOG_OUT(); |
576 TSLOG_OUT(); |
564 } |
577 } |
565 |
578 |
659 SetFullScreenApp(EFalse); |
672 SetFullScreenApp(EFalse); |
660 } |
673 } |
661 TSLOG_OUT(); |
674 TSLOG_OUT(); |
662 } |
675 } |
663 |
676 |
|
677 |
|
678 // ----------------------------------------------------------------------------- |
|
679 // CTsAppUi::LayoutCanBeChanged |
|
680 // ----------------------------------------------------------------------------- |
|
681 // |
|
682 TBool CTsAppUi::LayoutChangeAllowed() |
|
683 { |
|
684 // Check if layout switch is necessary |
|
685 TSizeMode mode = iEikonEnv->ScreenDevice()->GetCurrentScreenModeAttributes(); |
|
686 TBool isLandscape = mode.iScreenSize.iWidth > mode.iScreenSize.iHeight; |
|
687 TRect appRect = ApplicationRect(); |
|
688 TBool isAppLandscape = appRect.Width() > appRect.Height(); |
|
689 TBool retVal; |
|
690 if(isLandscape != isAppLandscape) |
|
691 { |
|
692 retVal = EFalse; |
|
693 } |
|
694 else |
|
695 { |
|
696 retVal = ETrue; |
|
697 } |
|
698 return retVal; |
|
699 } |
|
700 |
664 // End of file |
701 // End of file |