--- a/taskswitcher/taskswitcherui/taskswitcherapp/src/tsfastswaparea.cpp Wed Mar 31 21:17:19 2010 +0300
+++ b/taskswitcher/taskswitcherui/taskswitcherapp/src/tsfastswaparea.cpp Wed Apr 14 15:47:59 2010 +0300
@@ -115,6 +115,7 @@
CTsFastSwapArea::~CTsFastSwapArea()
{
iArray.ResetAndDestroy();
+ iIsClosing.Close();
delete iGrid;
delete iFSClient;
delete iPopup;
@@ -134,7 +135,7 @@
SetRect( aRect );
- // setup ganes grid
+ // setup grid
ReCreateGridL();
// create stylus popup instance
@@ -188,6 +189,44 @@
AknListBoxLayouts::SetupStandardGrid( *iGrid );
+ // Setup layout
+ LayoutGridL();
+
+ if( wasHighlight )
+ {
+ iGrid->ShowHighlight();
+ }
+ else
+ {
+ iGrid->HideHighlight();
+ }
+
+ // Setup empty text
+ HBufC* text = StringLoader::LoadLC( R_TS_FSW_NO_APPS );
+ iGrid->SetEmptyGridTextL( *text );
+ CleanupStack::PopAndDestroy( text );
+
+ // Setup grid observers
+ if ( obs )
+ {
+ iGrid->SetObserver( obs );
+ }
+ iGrid->SetListBoxObserver(this);
+ iGrid->SetFastSwapGridObserver(this);
+ iGrid->SetContainerWindowL(*this);
+
+ // Make sure that there is an ActivateL call even when we are not
+ // called from ConstructL. (in order to have the grid's parent ptr set properly)
+ ActivateL();
+ }
+
+
+// --------------------------------------------------------------------------
+// CTsFastSwapArea::LayoutGridL
+// --------------------------------------------------------------------------
+//
+void CTsFastSwapArea::LayoutGridL()
+ {
RArray<TAknLayoutRect> rects;
CleanupClosePushL(rects);
rects.ReserveL(KLayoutItemCount);
@@ -222,22 +261,13 @@
AknsUtils::GetCachedColor( AknsUtils::SkinInstance(), highlightTextColor,
KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG11 );
CFormattedCellListBoxData::TColors colors;
- colors.iText = textColor;
+ colors.iText = textColor;
colors.iBack = iGrid->ItemDrawer()->BackColor();
colors.iHighlightedText = highlightTextColor;
colors.iHighlightedBack = iGrid->ItemDrawer()->HighlightedBackColor();
iGrid->ItemDrawer()->FormattedCellData()->SetSubCellColorsL(1, colors);
iGrid->SetStrokeColors(textColor, highlightTextColor);
- // Setup grid observers
- if ( obs )
- {
- iGrid->SetObserver( obs );
- }
- iGrid->SetListBoxObserver(this);
- iGrid->SetFastSwapGridObserver(this);
- iGrid->SetContainerWindowL(*this);
-
if ( AknLayoutUtils::LayoutMirrored() )
{
iGridItemGap = gridItem.Rect().iTl.iX - gridNextItem.Rect().iBr.iX;
@@ -258,24 +288,11 @@
}
iGridItemWidth = gridItem.Rect().Width();
+ // Update item drawer
+ iGrid->UpdateItemDrawerLayoutDataL();
+
// Update state
HandleDeviceStateChanged( EDeviceType );
- if( wasHighlight )
- {
- iGrid->ShowHighlight();
- }
- else
- {
- iGrid->HideHighlight();
- }
-
- HBufC* text = StringLoader::LoadLC( R_TS_FSW_NO_APPS );
- iGrid->SetEmptyGridTextL( *text );
- CleanupStack::PopAndDestroy( text );
-
- // Make sure that there is an ActivateL call even when we are not
- // called from ConstructL. (in order to have the grid's parent ptr set properly)
- ActivateL();
}
@@ -333,11 +350,11 @@
// data with new layout values
TInt selIdx = SelectedIndex();
TRAPD(err,
- ReCreateGridL();
- /*iEvtHandler.ReInitPhysicsL(GridWorldSize(), ViewSize(), ETrue);*/);
+ /*ReCreateGridL()*/
+ LayoutGridL() );
if ( err != KErrNone )
{
- TSLOG1( TSLOG_INFO, "ReCreateGridL leaves with %d", err );
+ TSLOG1( TSLOG_INFO, "LayoutGridL leaves with %d", err );
}
HandleFswContentChanged();
iGrid->SetCurrentDataIndex(selIdx);
@@ -380,6 +397,7 @@
if ( aIndex >= 0 && aIndex < iArray.Count() )
{
TInt wgId = iArray[aIndex]->WgId();
+ TUid appUid = iArray[aIndex]->AppUid();
// Move other app to foreground and then move ourselves to background.
// Order is important and cannot be reversed.
iFSClient->SwitchToApp( wgId );
@@ -389,7 +407,7 @@
iIgnoreLayoutSwitch = ETrue;
CTsAppUi* appui =
static_cast<CTsAppUi*>( iEikonEnv->AppUi() );
- appui->MoveAppToBackground( CTsAppUi::EActivationTransition );
+ appui->MoveAppToBackground( CTsAppUi::EActivationTransition, appUid, wgId );
iIgnoreLayoutSwitch = EFalse;
// Orientation update
@@ -418,6 +436,7 @@
}
TInt wgId = iArray[aIndex]->WgId();
iFSClient->CloseApp( wgId );
+ iIsClosing.Append(wgId);
// The fsw content will change sooner or later
// but the updated content (without the closed app) will not
// come very fast. It looks better to the user if the item
@@ -689,9 +708,9 @@
}
// refresh the items in the grid
- iGrid->HandleItemAdditionL();
iEvtHandler.ReInitPhysicsL( GridWorldSize(), ViewSize(), ETrue );
UpdateGrid( ETrue, !aSuppressAnimation );
+ iGrid->HandleItemAdditionL();
TSLOG_OUT();
}
@@ -753,6 +772,11 @@
{
// stop listening for changes in fsw content
iFSClient->CancelSubscribe();
+ // Hide highlight
+ if ( iGrid->GridBehaviour() == CTsFastSwapGrid::ETouchOnly )
+ {
+ iGrid->HideHighlight();
+ }
}
// -----------------------------------------------------------------------------
@@ -764,8 +788,20 @@
TSLOG_CONTEXT( CTsFastSwapArea::HandleSwitchToForegroundEvent, TSLOG_LOCAL );
TSLOG_IN();
+ iIsClosing.Reset();
+
+ CTsGridItemDrawer* itemDrawer =
+ static_cast<CTsGridItemDrawer*>( iGrid->ItemDrawer() );
+ itemDrawer->SetRedrawBackground(ETrue);
+
+ // Update Layout
+ CTsAppUi* appUi = static_cast<CTsAppUi*>(iEikonEnv->AppUi());
+ if ( appUi && appUi->EffectsEnabled() )
+ {
+ TRAP_IGNORE( LayoutGridL() );
+ }
+
// Reset grid
- TRAP_IGNORE( ReCreateGridL() );
if ( iDeviceState.DeviceType() == CTsDeviceState::EFullTouch )
{
iGrid->HideHighlight();
@@ -786,6 +822,8 @@
iRedrawTimer->Cancel();
iRedrawTimer->After(KRedrawTime);
+ itemDrawer->SetRedrawBackground(EFalse);
+
// give feedback
LaunchPopupFeedback();
@@ -923,6 +961,9 @@
if(aPointerEvent.iType == TPointerEvent::EButton1Down)
{
iTapEvent = aPointerEvent;
+ iGrid->EnableAknEventHandling(EFalse);
+ iGrid->HandlePointerEventL(aPointerEvent);
+ iGrid->EnableAknEventHandling(ETrue);
}
}
@@ -1669,4 +1710,24 @@
return availableRect.iPixelSize.iWidth > availableRect.iPixelSize.iHeight;
}
+
+// -----------------------------------------------------------------------------
+// CTsFastSwapArea::IsAppClosing
+// -----------------------------------------------------------------------------
+//
+TBool CTsFastSwapArea::IsAppClosing( TInt aWgId )
+ {
+ TBool retVal(EFalse);
+ if ( iIsClosing.Count() )
+ {
+ TInt idx = iIsClosing.Find(aWgId);
+ retVal = idx != KErrNotFound;
+ if ( retVal )
+ {
+ iIsClosing.Remove(idx);
+ }
+ }
+ return retVal;
+ }
+
// End of file