equal
deleted
inserted
replaced
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, |
39 /** window group's priority */ |
37 /** window group's priority */ |
40 const TInt KAknLongTapWindowPosition = 11; // window group's priority |
38 const TInt KAknLongTapWindowPosition = 11; // window group's priority |
41 |
39 |
42 /** Window`s Position when hiding the animation which does not own Window Group */ |
40 /** Window`s Position when hiding the animation which does not own Window Group */ |
43 const TInt KAknAnimationNotOwnWindowGroupWindowPosition = -10; // never at front |
41 const TInt KAknAnimationNotOwnWindowGroupWindowPosition = -10; // never at front |
|
42 |
|
43 /** animation's position offset */ |
|
44 const TInt KVerticalOffset = -75; |
44 |
45 |
45 /** window group's name */ |
46 /** window group's name */ |
46 _LIT( KAknLongTapWgName, "LongTapAnim" ); // window groups name |
47 _LIT( KAknLongTapWgName, "LongTapAnim" ); // window groups name |
47 |
48 |
48 |
49 |
163 layoutRect.LayoutRect( layoutRect.Rect(), |
164 layoutRect.LayoutRect( layoutRect.Rect(), |
164 AknLayoutScalable_Avkon::cursor_press_pane_g1() ); |
165 AknLayoutScalable_Avkon::cursor_press_pane_g1() ); |
165 |
166 |
166 SetRect( TRect( TPoint(aX, aY), layoutRect.Rect().Size() )); |
167 SetRect( TRect( TPoint(aX, aY), layoutRect.Rect().Size() )); |
167 |
168 |
168 // Position window so that it will be directly on top of |
169 // position window |
169 // the location that was clicked. |
|
170 TPoint point( aX - Rect().Width() / 2, aY - Rect().Height() / 2 ); |
170 TPoint point( aX - Rect().Width() / 2, aY - Rect().Height() / 2 ); |
|
171 point.iY += KVerticalOffset; |
|
172 point.iY = Max( 0, point.iY ); |
|
173 |
171 Window().SetPosition( point ); |
174 Window().SetPosition( point ); |
172 |
175 |
173 iAnim->SetSize( layoutRect.Rect().Size() ); |
176 iAnim->SetSize( layoutRect.Rect().Size() ); |
174 |
177 |
175 iAnim->SetPosition( Rect().iTl ); |
178 iAnim->SetPosition( Rect().iTl ); |
188 ActivateL(); |
191 ActivateL(); |
189 |
192 |
190 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
193 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
191 if ( feedback ) |
194 if ( feedback ) |
192 { |
195 { |
193 CBitmapAnimClientData* animData = iAnim->BitmapAnimData(); |
196 feedback->InstantFeedback( |
194 TInt interval = animData->FrameIntervalInMilliSeconds() |
197 this, ETouchFeedbackLongTap, |
195 * KConversionFromMillisecondsToMicroseconds; |
198 ETouchFeedbackVibra, TPointerEvent() ); |
196 TInt frameCount = animData->FrameArray().Count(); |
|
197 |
|
198 // timeout should be greater than normal animation time |
|
199 // so that timeout does not interfere into normal operation |
|
200 TInt timeout = interval * (frameCount+1); |
|
201 feedback->StartFeedback( this, ETouchContinuousSmooth, NULL, KStartIntensity, timeout ); |
|
202 } |
199 } |
203 StartAnimation(); |
200 StartAnimation(); |
204 } |
201 } |
205 |
202 |
206 |
203 |
391 iExtension->iIndex++; |
388 iExtension->iIndex++; |
392 if (iExtension->iIndex == frameCount) |
389 if (iExtension->iIndex == frameCount) |
393 { |
390 { |
394 iExtension->iIndex = frameCount - 1; |
391 iExtension->iIndex = frameCount - 1; |
395 } |
392 } |
396 MTouchFeedback* feedback = MTouchFeedback::Instance(); |
|
397 if ( feedback ) |
|
398 { |
|
399 // intensity should go from 0 to 100 |
|
400 TInt intensity = KEndIntensity |
|
401 * (iExtension->iIndex+1) / frameCount; |
|
402 feedback->ModifyFeedback( this, intensity ); |
|
403 } |
|
404 DrawNow(); |
393 DrawNow(); |
405 } |
394 } |
406 |
395 |
407 |
396 |
408 // --------------------------------------------------------- |
397 // --------------------------------------------------------- |