uifw/AvKon/src/aknlongtapanimation.cpp
branchRCL_3
changeset 10 3d340a0166ff
parent 3 8ca85d2f0db7
child 13 a8834a2e9a96
equal deleted inserted replaced
9:0aa5fbdfbc30 10:3d340a0166ff
    22 #include <apgwgnam.h>
    22 #include <apgwgnam.h>
    23 #include <aknlayoutscalable_avkon.cdl.h>
    23 #include <aknlayoutscalable_avkon.cdl.h>
    24 
    24 
    25 #include <AknTasHook.h> // for testability hooks
    25 #include <AknTasHook.h> // for testability hooks
    26 #include <touchfeedback.h>
    26 #include <touchfeedback.h>
    27 const TInt KStartIntensity = 1;
       
    28 const TInt KEndIntensity = 100;
       
    29 #include "aknlongtapanimation.h"
    27 #include "aknlongtapanimation.h"
    30 
    28 
    31 enum TInternalFlags
    29 enum TInternalFlags
    32 	{
    30 	{
    33 	EAnimationStarted			     =	0x0001,
    31 	EAnimationStarted			     =	0x0001,
   193     ActivateL();
   191     ActivateL();
   194 
   192 
   195     MTouchFeedback* feedback = MTouchFeedback::Instance();
   193     MTouchFeedback* feedback = MTouchFeedback::Instance();
   196     if ( feedback )
   194     if ( feedback )
   197         {
   195         {
   198         CBitmapAnimClientData* animData = iAnim->BitmapAnimData();	
   196         feedback->InstantFeedback( 
   199 		TInt interval = animData->FrameIntervalInMilliSeconds()
   197                 this, ETouchFeedbackLongTap,
   200 		             * KConversionFromMillisecondsToMicroseconds;
   198                 ETouchFeedbackVibra, TPointerEvent() );
   201         TInt frameCount = animData->FrameArray().Count();
       
   202 
       
   203         // timeout should be greater than normal animation time 
       
   204         // so that timeout does not interfere into normal operation
       
   205         TInt timeout = interval * (frameCount+1); 
       
   206         feedback->StartFeedback( this, ETouchContinuousSmooth, NULL, KStartIntensity, timeout );
       
   207         }
   199         }
   208 	StartAnimation();
   200 	StartAnimation();
   209     }
   201     }
   210 
   202 
   211 
   203 
   373 	{
   365 	{
   374     if (iExtension->iFlags & EAnimationStarted)
   366     if (iExtension->iFlags & EAnimationStarted)
   375 		{
   367 		{
   376 		iExtension->iTimer->Cancel();
   368 		iExtension->iTimer->Cancel();
   377 		iExtension->iFlags &= ~EAnimationStarted;
   369 		iExtension->iFlags &= ~EAnimationStarted;
   378         MTouchFeedback* feedback = MTouchFeedback::Instance();
       
   379         if ( feedback )
       
   380             {
       
   381             feedback->StopFeedback( this );
       
   382             }
       
   383 		}
   370 		}
   384 	}
   371 	}
   385 
   372 
   386 
   373 
   387 // ---------------------------------------------------------
   374 // ---------------------------------------------------------
   396 	iExtension->iIndex++;
   383 	iExtension->iIndex++;
   397 	if (iExtension->iIndex == frameCount)
   384 	if (iExtension->iIndex == frameCount)
   398 	{
   385 	{
   399 		iExtension->iIndex = frameCount - 1;
   386 		iExtension->iIndex = frameCount - 1;
   400 	}
   387 	}
   401     MTouchFeedback* feedback = MTouchFeedback::Instance();
       
   402     if ( feedback )
       
   403         {
       
   404         // intensity should go from 0 to 100
       
   405         TInt intensity = KEndIntensity
       
   406                        * (iExtension->iIndex+1) / frameCount;
       
   407         feedback->ModifyFeedback( this, intensity );
       
   408         }
       
   409 	DrawNow();
   388 	DrawNow();
   410 	}
   389 	}
   411 
   390 
   412 
   391 
   413 // ---------------------------------------------------------
   392 // ---------------------------------------------------------