680 TInt CAknBitmapAnimation::AnimationStartedCallback(TAny* aPtr) |
680 TInt CAknBitmapAnimation::AnimationStartedCallback(TAny* aPtr) |
681 { |
681 { |
682 CAknBitmapAnimation* ptr = (CAknBitmapAnimation*)aPtr; |
682 CAknBitmapAnimation* ptr = (CAknBitmapAnimation*)aPtr; |
683 return ptr->AnimationHasStarted(ETrue); |
683 return ptr->AnimationHasStarted(ETrue); |
684 } |
684 } |
|
685 |
|
686 EXPORT_C void CAknBitmapAnimation::StartAnimationL( TBool aKeepLastFrame ) |
|
687 { |
|
688 #ifdef _DEBUG |
|
689 RDebug::Print(_L("CAknBitmapAnimation::StartAnimationL instance:%x"),this); |
|
690 #endif //_DEBUG |
|
691 |
|
692 if ( iFlags & EAnimationSingleFrame ) |
|
693 { |
|
694 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
|
695 iFlags &= ~EWaitingForUiEffect; |
|
696 #endif |
|
697 iFlags |= EAnimationStarted; |
|
698 DrawDeferred(); |
|
699 return; |
|
700 } |
|
701 |
|
702 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
|
703 TInt redirectstatus = 0; |
|
704 RProperty::Get(KPSUidAvkonDomain, KAknTfxServerRedirectionStatus, redirectstatus ); |
|
705 TBool isredirected = (redirectstatus & ETfxScreenRedirected); |
|
706 |
|
707 // this is executed as long as transition is running, then the aknbitmapanimation |
|
708 // switches to "normal" mode and WaitForUiEffect callback isn't called anymore |
|
709 if( CAknTransitionUtils::GetData(EDontAnimateBitmaps) || isredirected ) |
|
710 { |
|
711 if( !(iFlags & EAnimationTimerStarted) && !( iFlags & EWaitingForUiEffect ) ) |
|
712 { |
|
713 iFlags |= EWaitingForUiEffect; |
|
714 TCallBack callback(WaitForUiEffect, this); |
|
715 iTimer->Cancel(); |
|
716 iTimer->Start(KWaitForUiEffectDelay, KWaitForUiEffectDelay, callback); |
|
717 } |
|
718 } |
|
719 else |
|
720 { |
|
721 iFlags &= ~EWaitingForUiEffect; |
|
722 #endif |
|
723 if (!IsInitialisationCompleted()) |
|
724 { |
|
725 CompleteAnimationInitialisationL(); |
|
726 } |
|
727 else |
|
728 { |
|
729 // Otherwise, update animation data since it may have changed |
|
730 iAnimation.SetBitmapAnimDataL(*iBitmapAnimData); |
|
731 // This call updates the cached background frame content for the animation. |
|
732 // It is also very important to call this function only after calling |
|
733 // iAnimation.SetBitmapAnimDataL() |
|
734 iAnimation.SetPositionL(iPosition); |
|
735 } |
|
736 if( aKeepLastFrame ) |
|
737 { |
|
738 iAnimation.StartAndKeepLastFrameL(); |
|
739 } |
|
740 else |
|
741 { |
|
742 iAnimation.StartL(); |
|
743 } |
|
744 |
|
745 if (!(iFlags & EAnimationTimerStarted)) |
|
746 { // if animation timer has not started, start timer |
|
747 TCallBack callback(AnimationStartedCallback, this); |
|
748 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
|
749 iTimer->Cancel(); //when popup animations are enabled the timer might already be started |
|
750 #endif //RD_UI_TRANSITION_EFFECTS_POPUPS |
|
751 iTimer->Start(iBitmapAnimData->DurationInMilliSeconds()*KConversionFromMillisecondsToMicroseconds/2, 1/*just the once*/, callback); // a delay of half the animation time |
|
752 iFlags |= EAnimationTimerStarted; |
|
753 } |
|
754 #ifdef RD_UI_TRANSITION_EFFECTS_POPUPS |
|
755 } |
|
756 #endif |
|
757 } |