22 #include <AknIconUtils.h> |
22 #include <AknIconUtils.h> |
23 #include <AknIconArray.h> |
23 #include <AknIconArray.h> |
24 #include <aknstyluspopupmenu.h> |
24 #include <aknstyluspopupmenu.h> |
25 #include <AknQueryDialog.h> |
25 #include <AknQueryDialog.h> |
26 #include <StringLoader.h> |
26 #include <StringLoader.h> |
27 #include <tstaskswitcher.rsg> |
27 #include <taskswitcher.rsg> |
28 #include <aknlayoutscalable_apps.cdl.h> |
28 #include <aknlayoutscalable_apps.cdl.h> |
29 #include <layoutmetadata.cdl.h> |
29 #include <layoutmetadata.cdl.h> |
30 #include <aknlists.h> |
30 #include <aknlists.h> |
31 #include <touchfeedback.h> |
31 #include <touchfeedback.h> |
32 #include <akntransitionutils.h> |
32 #include <akntransitionutils.h> |
36 #include "tsapplogging.h" |
36 #include "tsapplogging.h" |
37 #include "tsfswclient.h" |
37 #include "tsfswclient.h" |
38 #include "tsappui.h" |
38 #include "tsappui.h" |
39 #include "tsdatachangeobserver.h" |
39 #include "tsdatachangeobserver.h" |
40 #include "tseventcontroler.h" |
40 #include "tseventcontroler.h" |
|
41 #include "tsappview.h" |
41 |
42 |
42 /** command ids for the fsw popup */ |
43 /** command ids for the fsw popup */ |
43 enum TPopupCommands |
44 enum TPopupCommands |
44 { |
45 { |
45 EFswCmdClose = 10000, |
46 EFswCmdClose = 10000, |
47 }; |
48 }; |
48 |
49 |
49 /** Number of closable applications, to show "close all" option. */ |
50 /** Number of closable applications, to show "close all" option. */ |
50 const TInt KTsMaxClosableApps = 2; |
51 const TInt KTsMaxClosableApps = 2; |
51 |
52 |
52 /** Interval until which no change in the fsw content is rendered |
|
53 after starting the closing of an application. */ |
|
54 const TInt KRefreshDelayAfterClose = 2; // seconds |
|
55 |
|
56 /** Uid of Active Idle application. |
53 /** Uid of Active Idle application. |
57 Used when movind Ai to specified position.*/ |
54 Used when movind Ai to specified position.*/ |
58 const TUid KAiUid = TUid::Uid( 0x102750F0 ); |
55 const TUid KAiUid = TUid::Uid( 0x102750F0 ); |
59 |
56 |
60 /** Position of Ai in fsw grid.*/ |
57 /** Position of Ai in fsw grid.*/ |
67 const TInt KAppKeyTypeLong = 2; |
64 const TInt KAppKeyTypeLong = 2; |
68 |
65 |
69 const TInt KLayoutItemCount = 4; |
66 const TInt KLayoutItemCount = 4; |
70 |
67 |
71 const TInt KRedrawTime = 250000; // 0.25 sec |
68 const TInt KRedrawTime = 250000; // 0.25 sec |
|
69 const TInt KRedrawTimeForLayoutSwitch = 700000; // 0.7 sec |
72 const TInt KHighlighActivationTime = 100000; // 100 ms |
70 const TInt KHighlighActivationTime = 100000; // 100 ms |
73 const TInt KUpdateGridTime = 1000000; // 1 s |
71 const TInt KUpdateGridTime = 1000000; // 1 s |
|
72 |
|
73 const TInt KMaxGranularity = 4; |
74 |
74 |
75 // ----------------------------------------------------------------------------- |
75 // ----------------------------------------------------------------------------- |
76 // CTsFastSwapArea::NewL |
76 // CTsFastSwapArea::NewL |
77 // ----------------------------------------------------------------------------- |
77 // ----------------------------------------------------------------------------- |
78 // |
78 // |
183 iGrid = NULL; |
183 iGrid = NULL; |
184 } |
184 } |
185 |
185 |
186 iGrid = new( ELeave ) CTsFastSwapGrid; |
186 iGrid = new( ELeave ) CTsFastSwapGrid; |
187 iGrid->ConstructL( this ); |
187 iGrid->ConstructL( this ); |
|
188 iGrid->DisableSingleClick(ETrue);//enables highlight on pointer |
188 iDeviceState.AddObserverL(*iGrid, MTsDeviceStateObserver::ESkin); |
189 iDeviceState.AddObserverL(*iGrid, MTsDeviceStateObserver::ESkin); |
189 |
190 |
190 AknListBoxLayouts::SetupStandardGrid( *iGrid ); |
191 AknListBoxLayouts::SetupStandardGrid( *iGrid ); |
191 |
192 |
192 RArray<TAknLayoutRect> rects; |
193 RArray<TAknLayoutRect> rects; |
199 TAknLayoutRect gridNextItem = rects[3]; |
200 TAknLayoutRect gridNextItem = rects[3]; |
200 CleanupStack::PopAndDestroy(&rects); |
201 CleanupStack::PopAndDestroy(&rects); |
201 |
202 |
202 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
203 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
203 iGrid->SetRect(gridAppPane.Rect()); |
204 iGrid->SetRect(gridAppPane.Rect()); |
204 iGrid->SetVisibleViewRect(gridAppPane.Rect()); |
|
205 TAknLayoutScalableParameterLimits gridParams = |
205 TAknLayoutScalableParameterLimits gridParams = |
206 AknLayoutScalable_Apps::cell_tport_appsw_pane_ParamLimits( variety ); |
206 AknLayoutScalable_Apps::cell_tport_appsw_pane_ParamLimits( variety ); |
207 TPoint empty( ELayoutEmpty, ELayoutEmpty ); |
207 TPoint empty( ELayoutEmpty, ELayoutEmpty ); |
208 |
208 |
209 AknListBoxLayouts::SetupFormGfxCell( *iGrid, iGrid->ItemDrawer(), 0, |
209 AknListBoxLayouts::SetupFormGfxCell( *iGrid, iGrid->ItemDrawer(), 0, |
351 } |
351 } |
352 HandleFswContentChanged(); |
352 HandleFswContentChanged(); |
353 iGrid->SetCurrentDataIndex(selIdx); |
353 iGrid->SetCurrentDataIndex(selIdx); |
354 UpdateGrid(ETrue, EFalse); |
354 UpdateGrid(ETrue, EFalse); |
355 DrawDeferred(); |
355 DrawDeferred(); |
356 } |
356 |
|
357 // Order full redraw after switch |
|
358 if(iRedrawTimer) |
|
359 { |
|
360 iRedrawTimer->Cancel(); |
|
361 iRedrawTimer->After(KRedrawTimeForLayoutSwitch); |
|
362 } |
|
363 } |
|
364 |
357 TSLOG_OUT(); |
365 TSLOG_OUT(); |
358 } |
366 } |
359 |
367 |
360 // ----------------------------------------------------------------------------- |
368 // ----------------------------------------------------------------------------- |
361 // CTsFastSwapArea::Draw |
369 // CTsFastSwapArea::Draw |
387 iFSClient->SwitchToApp( wgId ); |
395 iFSClient->SwitchToApp( wgId ); |
388 // We do not want to come back to ts if the activated app is closed. |
396 // We do not want to come back to ts if the activated app is closed. |
389 // Therefore ts must be moved to background. |
397 // Therefore ts must be moved to background. |
390 CTsAppUi* appui = |
398 CTsAppUi* appui = |
391 static_cast<CTsAppUi*>( iEikonEnv->AppUi() ); |
399 static_cast<CTsAppUi*>( iEikonEnv->AppUi() ); |
392 appui->MoveAppToBackground( AknTransEffect::EApplicationStartRect ); |
400 appui->MoveAppToBackground( CTsAppUi::EActivationTransition ); |
393 } |
401 } |
394 } |
402 } |
395 |
403 |
396 // -------------------------------------------------------------------------- |
404 // -------------------------------------------------------------------------- |
397 // CTsFastSwapArea::TryCloseAppL |
405 // CTsFastSwapArea::TryCloseAppL |
403 TSLOG_CONTEXT( TryCloseAppL, TSLOG_LOCAL ); |
411 TSLOG_CONTEXT( TryCloseAppL, TSLOG_LOCAL ); |
404 TSLOG2_IN( "%d %d", aIndex, aSuppressRendering ); |
412 TSLOG2_IN( "%d %d", aIndex, aSuppressRendering ); |
405 |
413 |
406 if ( aIndex >= 0 && aIndex < iArray.Count() && CanClose( aIndex ) ) |
414 if ( aIndex >= 0 && aIndex < iArray.Count() && CanClose( aIndex ) ) |
407 { |
415 { |
|
416 TInt selIdx = SelectedIndex(); |
|
417 if ( selIdx > aIndex && selIdx > 0 ) |
|
418 { |
|
419 selIdx--; |
|
420 } |
408 TInt wgId = iArray[aIndex]->WgId(); |
421 TInt wgId = iArray[aIndex]->WgId(); |
409 iFSClient->CloseApp( wgId ); |
422 iFSClient->CloseApp( wgId ); |
410 // The fsw content will change sooner or later |
423 // The fsw content will change sooner or later |
411 // but the updated content (without the closed app) will not |
424 // but the updated content (without the closed app) will not |
412 // come very fast. It looks better to the user if the item |
425 // come very fast. It looks better to the user if the item |
417 delete iArray[aIndex]; |
430 delete iArray[aIndex]; |
418 iArray.Remove( aIndex ); |
431 iArray.Remove( aIndex ); |
419 NotifyChange(); |
432 NotifyChange(); |
420 if ( !aSuppressRendering ) |
433 if ( !aSuppressRendering ) |
421 { |
434 { |
422 RenderContentL(); |
435 RenderContentL( ETrue ); |
423 } |
436 } |
424 // Update item selection on the screen if last item was deleted |
437 // Update item selection on the screen if last item was deleted |
425 TInt newItemCount = GridItemCount(); |
438 TInt newItemCount = GridItemCount(); |
426 if ( aIndex == newItemCount ) |
439 if ( aIndex == newItemCount ) |
427 { |
440 { |
428 newItemCount--; |
441 newItemCount--; |
429 iGrid->SetCurrentDataIndex(newItemCount); |
442 iGrid->SetCurrentDataIndex(newItemCount); |
430 } |
443 } |
431 iTimeOfLastClose.HomeTime(); |
444 else |
|
445 { |
|
446 DrawDeferred(); |
|
447 iGrid->SetCurrentDataIndex(selIdx); |
|
448 } |
432 } |
449 } |
433 |
450 |
434 TSLOG_OUT(); |
451 TSLOG_OUT(); |
435 } |
452 } |
436 |
453 |
516 void CTsFastSwapArea::HandleFswContentChangedL() |
533 void CTsFastSwapArea::HandleFswContentChangedL() |
517 { |
534 { |
518 TSLOG_CONTEXT( HandleFswContentChangedL, TSLOG_LOCAL ); |
535 TSLOG_CONTEXT( HandleFswContentChangedL, TSLOG_LOCAL ); |
519 TSLOG_IN(); |
536 TSLOG_IN(); |
520 |
537 |
521 // If there was an app close operation started during the last |
|
522 // few seconds then stop, to prevent flickering. |
|
523 TTime now; |
|
524 now.HomeTime(); |
|
525 TTimeIntervalSeconds iv; |
|
526 if ( now.SecondsFrom( iTimeOfLastClose, iv ) == KErrNone |
|
527 && iv.Int() <= KRefreshDelayAfterClose ) |
|
528 { |
|
529 TSLOG1_OUT( "difference since last close is only %d sec, stop", iv.Int() ); |
|
530 return; |
|
531 } |
|
532 |
|
533 // get current content from fastswap server |
538 // get current content from fastswap server |
534 iFSClient->GetContentL( iArray ); |
539 iFSClient->GetContentL( iArray ); |
535 SwapApplicationOrder( iArray ); |
540 SwapApplicationOrder( iArray ); |
536 |
541 |
537 #ifdef _DEBUG |
542 #ifdef _DEBUG |
554 |
559 |
555 // -------------------------------------------------------------------------- |
560 // -------------------------------------------------------------------------- |
556 // CTsFastSwapArea::RenderContentL |
561 // CTsFastSwapArea::RenderContentL |
557 // -------------------------------------------------------------------------- |
562 // -------------------------------------------------------------------------- |
558 // |
563 // |
559 void CTsFastSwapArea::RenderContentL() |
564 void CTsFastSwapArea::RenderContentL( TBool aSuppressAnimation ) |
560 { |
565 { |
561 TSLOG_CONTEXT( RenderContentL, TSLOG_LOCAL ); |
566 TSLOG_CONTEXT( RenderContentL, TSLOG_LOCAL ); |
562 TSLOG_IN(); |
567 TSLOG_IN(); |
563 |
568 |
564 _LIT(KSeparator, "\t"); |
569 _LIT(KSeparator, "\t"); |
565 |
570 |
566 CArrayPtr<CGulIcon>* iconArray = new ( ELeave ) CAknIconArray( iArray.Count() ); |
571 CArrayPtr<CGulIcon>* iconArray = new ( ELeave ) CAknIconArray( KMaxGranularity ); |
567 CleanupStack::PushL( iconArray ); |
572 CleanupStack::PushL( iconArray ); |
568 CDesCArrayFlat* textArray = new ( ELeave ) CDesCArrayFlat( iArray.Count() ); |
573 CDesCArrayFlat* textArray = new ( ELeave ) CDesCArrayFlat( KMaxGranularity ); |
569 CleanupStack::PushL( textArray ); |
574 CleanupStack::PushL( textArray ); |
570 RArray<TInt> closeItemArray; |
575 RArray<TInt> closeItemArray; |
571 CleanupClosePushL(closeItemArray); |
576 CleanupClosePushL(closeItemArray); |
572 |
577 |
573 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
578 TInt variety = Layout_Meta_Data::IsLandscapeOrientation() ? 1 : 0; |
575 CleanupClosePushL(rects); |
580 CleanupClosePushL(rects); |
576 rects.ReserveL(KLayoutItemCount); |
581 rects.ReserveL(KLayoutItemCount); |
577 GetFastSwapAreaRects(rects); |
582 GetFastSwapAreaRects(rects); |
578 TAknLayoutRect gridItem = rects[1]; |
583 TAknLayoutRect gridItem = rects[1]; |
579 CleanupStack::PopAndDestroy(&rects); |
584 CleanupStack::PopAndDestroy(&rects); |
580 if ( AknLayoutUtils::LayoutMirrored() ) |
585 if ( iArray.Count() ) |
581 { |
586 { |
582 iGrid->SetLayoutL( EFalse, EFalse, ETrue, iArray.Count(), 1, gridItem.Rect().Size(), iGridItemGap ); |
587 if ( AknLayoutUtils::LayoutMirrored() ) |
583 } |
588 { |
584 else |
589 iGrid->SetLayoutL( EFalse, EFalse, ETrue, iArray.Count(), 1, gridItem.Rect().Size(), iGridItemGap ); |
585 { |
590 } |
586 iGrid->SetLayoutL( EFalse, ETrue, ETrue, iArray.Count(), 1, gridItem.Rect().Size(), iGridItemGap ); |
591 else |
587 } |
592 { |
588 |
593 iGrid->SetLayoutL( EFalse, ETrue, ETrue, iArray.Count(), 1, gridItem.Rect().Size(), iGridItemGap ); |
|
594 } |
|
595 } |
|
596 |
589 for ( TInt i = 0, ie = iArray.Count(); i != ie; ++i ) |
597 for ( TInt i = 0, ie = iArray.Count(); i != ie; ++i ) |
590 { |
598 { |
591 const TDesC& appName( iArray[i]->AppName() ); |
599 const TDesC& appName( iArray[i]->AppName() ); |
592 const TInt formatLen = 3 + 2; |
600 const TInt formatLen = 3 + 2; |
593 RBuf formAppName; |
601 RBuf formAppName; |
647 // Cleanup |
655 // Cleanup |
648 CleanupStack::PopAndDestroy(&closeItemArray); |
656 CleanupStack::PopAndDestroy(&closeItemArray); |
649 CleanupStack::Pop(textArray); |
657 CleanupStack::Pop(textArray); |
650 CleanupStack::Pop(iconArray); |
658 CleanupStack::Pop(iconArray); |
651 |
659 |
652 iGrid->ScrollBarFrame()->SetScrollBarVisibilityL( |
660 if( iGrid->ScrollBarFrame() ) |
|
661 { |
|
662 iGrid->ScrollBarFrame()->SetScrollBarVisibilityL( |
653 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff); |
663 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff); |
|
664 } |
654 |
665 |
655 // refresh the items in the grid |
666 // refresh the items in the grid |
656 if(iPreviousNoOfItems < iArray.Count()) |
667 if(iPreviousNoOfItems < iArray.Count()) |
657 { |
668 { |
658 iGrid->HandleItemAdditionL(); |
669 iGrid->HandleItemAdditionL(); |
661 { |
672 { |
662 iGrid->HandleItemRemovalL(); |
673 iGrid->HandleItemRemovalL(); |
663 } |
674 } |
664 iPreviousNoOfItems = iArray.Count(); |
675 iPreviousNoOfItems = iArray.Count(); |
665 iEvtHandler.ReInitPhysicsL( GridWorldSize(), ViewSize(), ETrue ); |
676 iEvtHandler.ReInitPhysicsL( GridWorldSize(), ViewSize(), ETrue ); |
666 UpdateGrid( ETrue ); |
677 UpdateGrid( ETrue, !aSuppressAnimation ); |
667 |
678 |
668 TSLOG_OUT(); |
679 TSLOG_OUT(); |
669 } |
680 } |
670 |
681 |
671 // -------------------------------------------------------------------------- |
682 // -------------------------------------------------------------------------- |
750 { |
761 { |
751 iGrid->ShowHighlight(); |
762 iGrid->ShowHighlight(); |
752 } |
763 } |
753 |
764 |
754 RestoreSelectedIndex(); |
765 RestoreSelectedIndex(); |
755 UpdateGrid(ETrue, EFalse); |
766 UpdateGrid(EFalse, EFalse); |
756 |
767 |
757 iRedrawTimer->Cancel(); |
768 iRedrawTimer->Cancel(); |
758 iRedrawTimer->After(KRedrawTime); |
769 iRedrawTimer->After(KRedrawTime); |
759 |
770 |
760 // give feedback |
771 // give feedback |
782 else |
793 else |
783 { |
794 { |
784 // store the currently selected index if there is one |
795 // store the currently selected index if there is one |
785 SaveSelectedIndex(); |
796 SaveSelectedIndex(); |
786 } |
797 } |
787 iGrid->DrawDeferred(); |
|
788 } |
798 } |
789 |
799 |
790 // ----------------------------------------------------------------------------- |
800 // ----------------------------------------------------------------------------- |
791 // CTsFastSwapArea::OfferKeyEventL |
801 // CTsFastSwapArea::OfferKeyEventL |
792 // ----------------------------------------------------------------------------- |
802 // ----------------------------------------------------------------------------- |
863 { |
873 { |
864 if (!iGrid->IsHighlightVisible()) |
874 if (!iGrid->IsHighlightVisible()) |
865 { |
875 { |
866 if (aType == EEventKey) |
876 if (aType == EEventKey) |
867 { |
877 { |
868 ShowHighlight(); |
878 iGrid->ShowHighlight(); |
869 iConsumeEvent = ETrue; |
879 iConsumeEvent = ETrue; |
870 } |
880 } |
871 retVal = EKeyWasConsumed; |
881 retVal = EKeyWasConsumed; |
872 } |
882 } |
873 else if (iConsumeEvent) |
883 else if (iConsumeEvent) |
935 { |
945 { |
936 ++highlightItem; |
946 ++highlightItem; |
937 } |
947 } |
938 iSavedSelectedIndex = highlightItem - 1;//count from 0 |
948 iSavedSelectedIndex = highlightItem - 1;//count from 0 |
939 iGrid->SetCurrentDataIndex( iSavedSelectedIndex ); |
949 iGrid->SetCurrentDataIndex( iSavedSelectedIndex ); |
940 TBool forceRedraw(ETrue); |
|
941 UpdateGrid(forceRedraw); |
|
942 } |
950 } |
943 } |
951 } |
944 |
952 |
945 // ----------------------------------------------------------------------------- |
953 // ----------------------------------------------------------------------------- |
946 // CTsFastSwapArea::ProcessCommandL |
954 // CTsFastSwapArea::ProcessCommandL |
947 // Handle fsw popup commands |
955 // Handle fsw popup commands |
948 // ----------------------------------------------------------------------------- |
956 // ----------------------------------------------------------------------------- |
949 // |
957 // |
950 void CTsFastSwapArea::ProcessCommandL( TInt aCommandId ) |
958 void CTsFastSwapArea::ProcessCommandL( TInt aCommandId ) |
951 { |
959 { |
|
960 static_cast<CTsAppUi*>(iEikonEnv->AppUi())->DisablePopUpL(); |
952 switch ( aCommandId ) |
961 switch ( aCommandId ) |
953 { |
962 { |
954 case EFswCmdClose: |
963 case EFswCmdClose: |
955 TryCloseAppL( iAppIndexForPopup ); |
964 TryCloseAppL( iAppIndexForPopup ); |
956 break; |
965 break; |
1015 iTapEvent.iType = TPointerEvent::EButton1Up; |
1024 iTapEvent.iType = TPointerEvent::EButton1Up; |
1016 iGrid->HandlePointerEventL(iTapEvent); |
1025 iGrid->HandlePointerEventL(iTapEvent); |
1017 } |
1026 } |
1018 else if(aSource == iRedrawTimer) |
1027 else if(aSource == iRedrawTimer) |
1019 { |
1028 { |
1020 DrawNow(); |
1029 static_cast<CTsAppView*>(&iParent)->OrderFullWindowRedraw(); |
1021 } |
1030 } |
1022 else if( aSource == iUpdateGridTimer ) |
1031 else if( aSource == iUpdateGridTimer ) |
1023 { |
1032 { |
1024 UpdateGrid(ETrue, ETrue); |
1033 UpdateGrid(ETrue, ETrue); |
1025 } |
1034 } |
1061 iPopup->SetItemDimmed( EFswCmdCloseAll, !showPopupItem ); |
1070 iPopup->SetItemDimmed( EFswCmdCloseAll, !showPopupItem ); |
1062 showPopUp = showPopUp || showPopupItem; |
1071 showPopUp = showPopUp || showPopupItem; |
1063 |
1072 |
1064 if(showPopUp) |
1073 if(showPopUp) |
1065 { |
1074 { |
|
1075 static_cast<CTsAppUi*>(iEikonEnv->AppUi())->RequestPopUpL(); |
1066 // give feedback |
1076 // give feedback |
1067 LaunchPopupFeedback(); |
1077 LaunchPopupFeedback(); |
1068 // save index for later use & show popup |
1078 // save index for later use & show popup |
1069 iAppIndexForPopup = aIndex; |
1079 iAppIndexForPopup = aIndex; |
1070 iPopup->SetPosition( aPoint, CAknStylusPopUpMenu::EPositionTypeLeftBottom ); |
1080 iPopup->SetPosition( aPoint, CAknStylusPopUpMenu::EPositionTypeLeftBottom ); |
1162 { |
1172 { |
1163 switch ( aEventType ) |
1173 switch ( aEventType ) |
1164 { |
1174 { |
1165 case EEventEnterKeyPressed: |
1175 case EEventEnterKeyPressed: |
1166 case EEventItemClicked: |
1176 case EEventItemClicked: |
|
1177 case EEventItemSingleClicked: |
1167 { |
1178 { |
1168 SwitchToApp(SelectedIndex()); |
1179 SwitchToApp(SelectedIndex()); |
1169 } |
1180 } |
1170 break; |
1181 break; |
1171 case EEventPenDownOnItem: |
1182 case EEventPenDownOnItem: |
1223 } |
1234 } |
1224 iGrid->SetCurrentDataIndex(selectedItem); |
1235 iGrid->SetCurrentDataIndex(selectedItem); |
1225 UpdateGrid(forceRedraw, animate); |
1236 UpdateGrid(forceRedraw, animate); |
1226 } |
1237 } |
1227 |
1238 |
1228 // -------------------------------------------------------------------------- |
|
1229 // CTsFastSwapArea::ShowHiglight |
|
1230 // -------------------------------------------------------------------------- |
|
1231 // |
|
1232 void CTsFastSwapArea::ShowHighlight() |
|
1233 { |
|
1234 iGrid->ShowHighlight(); |
|
1235 UpdateGrid(ETrue, EFalse); |
|
1236 } |
|
1237 |
1239 |
1238 // -------------------------------------------------------------------------- |
1240 // -------------------------------------------------------------------------- |
1239 // CTsFastSwapArea::CenterItem |
1241 // CTsFastSwapArea::CenterItem |
1240 // -------------------------------------------------------------------------- |
1242 // -------------------------------------------------------------------------- |
1241 // |
1243 // |
1324 { |
1327 { |
1325 TSLOG_CONTEXT( CTsFastSwapArea::MoveOffset, TSLOG_LOCAL ); |
1328 TSLOG_CONTEXT( CTsFastSwapArea::MoveOffset, TSLOG_LOCAL ); |
1326 TSLOG2_IN("Old position x: %d, y:%d", ViewPos().iX, ViewPos().iY); |
1329 TSLOG2_IN("Old position x: %d, y:%d", ViewPos().iX, ViewPos().iY); |
1327 TSLOG2_IN("New position x: %d, y:%d", aPoint.iX, aPoint.iY); |
1330 TSLOG2_IN("New position x: %d, y:%d", aPoint.iX, aPoint.iY); |
1328 TSLOG_OUT(); |
1331 TSLOG_OUT(); |
|
1332 |
|
1333 //ignore case when drag occurs outside owned area |
|
1334 if( iIgnorePhysicsMove ) |
|
1335 { |
|
1336 return; |
|
1337 } |
|
1338 //postpone center item request in case of being moved |
|
1339 if(iUpdateGridTimer->IsActive()) |
|
1340 { |
|
1341 iUpdateGridTimer->Cancel(); |
|
1342 iUpdateGridTimer->After(KUpdateGridTime); |
|
1343 } |
1329 |
1344 |
1330 TInt currentXPos = aPoint.iX; |
1345 TInt currentXPos = aPoint.iX; |
1331 currentXPos -= Rect().Width() / 2; |
1346 currentXPos -= Rect().Width() / 2; |
1332 TRect gridViewRect = Rect(); |
1347 TRect gridViewRect = Rect(); |
1333 gridViewRect.iTl.iX = -currentXPos; |
1348 gridViewRect.iTl.iX = -currentXPos; |
1337 { |
1352 { |
1338 // Center view |
1353 // Center view |
1339 gridViewRect.iTl.iX += ( Rect().Width() - GridItemCount() * iGridItemWidth ) / 2; |
1354 gridViewRect.iTl.iX += ( Rect().Width() - GridItemCount() * iGridItemWidth ) / 2; |
1340 } |
1355 } |
1341 iGrid->SetRect( gridViewRect ); |
1356 iGrid->SetRect( gridViewRect ); |
1342 DrawNow(); |
1357 DrawDeferred(); |
1343 } |
1358 } |
1344 |
1359 |
1345 // -------------------------------------------------------------------------- |
1360 // -------------------------------------------------------------------------- |
1346 // CTsFastSwapArea::Tap |
1361 // CTsFastSwapArea::Tap |
1347 // -------------------------------------------------------------------------- |
1362 // -------------------------------------------------------------------------- |
1388 TapL(aPoint); |
1403 TapL(aPoint); |
1389 } |
1404 } |
1390 } |
1405 } |
1391 |
1406 |
1392 // -------------------------------------------------------------------------- |
1407 // -------------------------------------------------------------------------- |
1393 // CTsFastSwapArea::Drag |
1408 // CTsFastSwapArea::DragL |
1394 // -------------------------------------------------------------------------- |
1409 // -------------------------------------------------------------------------- |
1395 // |
1410 // |
1396 void CTsFastSwapArea::Drag( |
1411 void CTsFastSwapArea::DragL( |
1397 const MAknTouchGestureFwDragEvent& /*aEvent*/) |
1412 const MAknTouchGestureFwDragEvent& aEvent) |
1398 { |
1413 { |
|
1414 if( aEvent.State() == EAknTouchGestureFwStop) |
|
1415 { |
|
1416 CenterItem( KUpdateGridTime ); |
|
1417 } |
|
1418 if( !Rect().Contains(aEvent.CurrentPosition()) ) |
|
1419 { |
|
1420 iIgnorePhysicsMove = ETrue; |
|
1421 return; |
|
1422 } |
|
1423 else |
|
1424 { |
|
1425 iIgnorePhysicsMove = EFalse; |
|
1426 } |
|
1427 |
1399 iGrid->SetTactileFeedbackSupport(ETrue); |
1428 iGrid->SetTactileFeedbackSupport(ETrue); |
1400 iGrid->HideHighlight(); |
1429 iGrid->HideHighlight(); |
1401 CenterItem( KUpdateGridTime ); |
|
1402 DrawNow(); |
|
1403 } |
1430 } |
1404 |
1431 |
1405 // ----------------------------------------------------------------------------- |
1432 // ----------------------------------------------------------------------------- |
1406 // CTsFastSwapArea::ViewSize |
1433 // CTsFastSwapArea::ViewSize |
1407 // ----------------------------------------------------------------------------- |
1434 // ----------------------------------------------------------------------------- |