uifw/AvKon/src/AknBitmapAnimation.cpp
branchRCL_3
changeset 56 d48ab3b357f1
parent 55 aecbbf00d063
child 72 a5e7a4f63858
--- a/uifw/AvKon/src/AknBitmapAnimation.cpp	Tue Aug 31 15:28:30 2010 +0300
+++ b/uifw/AvKon/src/AknBitmapAnimation.cpp	Wed Sep 01 12:16:19 2010 +0100
@@ -557,7 +557,7 @@
 LOCAL_C TInt WaitForUiEffect(TAny* aArg)
 	{
 	CAknBitmapAnimation* self = (CAknBitmapAnimation*)aArg;
-	self->StartAnimationL();
+	TRAP_IGNORE(self->StartAnimationL());
 	return EFalse;
 	}
 #endif
@@ -682,3 +682,76 @@
 	CAknBitmapAnimation* ptr = (CAknBitmapAnimation*)aPtr;
 	return ptr->AnimationHasStarted(ETrue);
 	}
+
+EXPORT_C void CAknBitmapAnimation::StartAnimationL( TBool aKeepLastFrame )
+    {
+#ifdef _DEBUG
+        RDebug::Print(_L("CAknBitmapAnimation::StartAnimationL instance:%x"),this);
+#endif //_DEBUG
+        
+    if ( iFlags & EAnimationSingleFrame )
+        {
+#ifdef RD_UI_TRANSITION_EFFECTS_POPUPS  
+        iFlags &= ~EWaitingForUiEffect;
+#endif        
+        iFlags |= EAnimationStarted;       
+        DrawDeferred();
+        return;
+        }
+
+#ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
+    TInt redirectstatus = 0;
+    RProperty::Get(KPSUidAvkonDomain, KAknTfxServerRedirectionStatus, redirectstatus );
+    TBool isredirected = (redirectstatus & ETfxScreenRedirected);
+    
+    // this is executed as long as transition is running, then the aknbitmapanimation
+    // switches to "normal" mode and WaitForUiEffect callback isn't called anymore
+    if(  CAknTransitionUtils::GetData(EDontAnimateBitmaps) || isredirected )
+        {
+        if( !(iFlags & EAnimationTimerStarted) && !( iFlags & EWaitingForUiEffect ) )
+            {
+            iFlags |= EWaitingForUiEffect;
+            TCallBack callback(WaitForUiEffect, this);
+            iTimer->Cancel();
+            iTimer->Start(KWaitForUiEffectDelay, KWaitForUiEffectDelay, callback); 
+            }
+        }
+    else
+        {
+        iFlags &= ~EWaitingForUiEffect;
+#endif
+        if (!IsInitialisationCompleted())
+            {
+            CompleteAnimationInitialisationL();
+            }
+        else
+            {
+            // Otherwise, update animation data since it may have changed
+            iAnimation.SetBitmapAnimDataL(*iBitmapAnimData);
+                // This call updates the cached background frame content for the animation.
+                // It is also very important to call this function only after calling
+                // iAnimation.SetBitmapAnimDataL()
+                iAnimation.SetPositionL(iPosition);
+            }
+        if( aKeepLastFrame )
+            {
+            iAnimation.StartAndKeepLastFrameL();
+            }
+        else
+            {
+            iAnimation.StartL();
+            }
+        
+        if (!(iFlags & EAnimationTimerStarted))
+            { // if animation timer has not started, start timer
+            TCallBack callback(AnimationStartedCallback, this);
+#ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
+            iTimer->Cancel(); //when popup animations are enabled the timer might already be started
+#endif //RD_UI_TRANSITION_EFFECTS_POPUPS
+            iTimer->Start(iBitmapAnimData->DurationInMilliSeconds()*KConversionFromMillisecondsToMicroseconds/2, 1/*just the once*/, callback); // a delay of half the animation time
+            iFlags |= EAnimationTimerStarted;
+            }
+#ifdef RD_UI_TRANSITION_EFFECTS_POPUPS
+        }
+#endif
+    }