87 CAlfLayoutSwitchEffectCoordinator::~CAlfLayoutSwitchEffectCoordinator() |
112 CAlfLayoutSwitchEffectCoordinator::~CAlfLayoutSwitchEffectCoordinator() |
88 { |
113 { |
89 } |
114 } |
90 |
115 |
91 // --------------------------------------------------------- |
116 // --------------------------------------------------------- |
92 // CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack |
117 // CAlfLayoutSwitchEffectCoordinator::Blank |
93 // |
118 // --------------------------------------------------------- |
94 // This method is callback which gets called when layout |
119 // |
95 // switch effect has ended. |
120 void CAlfLayoutSwitchEffectCoordinator::Blank(TBool aEnabled) |
96 // --------------------------------------------------------- |
121 { |
97 // |
122 __ALFLOGSTRING1("CAlfLayoutSwitchEffectCoordinator::Blank %d", aEnabled); |
98 void CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack( TInt aHandle ) |
123 iBlankEnabled = aEnabled; |
99 { |
124 Event( aEnabled ? EEventBlankOn : EEventBlankOff ); |
100 //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack")); |
125 } |
101 if (iLayoutSwitchEffectContext == aHandle) |
126 |
102 { |
127 // --------------------------------------------------------- |
103 AknTransEffect::TContext nextContext = NextLayoutSwitchContext(); |
128 // CAlfLayoutSwitchEffectCoordinator::LowMemoryEvent |
104 |
129 // --------------------------------------------------------- |
105 // Unfreeze visible content. This reveals real roster content (in new orientation). |
130 // |
106 if (nextContext == AknTransEffect::ELayoutSwitchExit) |
131 void CAlfLayoutSwitchEffectCoordinator::LowMemoryEvent() |
107 { |
132 { |
108 #ifdef HUI_DEBUG_TRACK_DRAWING |
133 __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::LowMemory"); |
109 RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack unfreezing roster content")); |
134 Event( EEventLowMemory ); |
110 #endif |
135 } |
111 iBridge.iHuiEnv->Display(0).SetDirty(); |
136 |
112 TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(EFalse)); |
|
113 iBridge.SetVisualTreeVisibilityChanged(ETrue); |
|
114 } |
|
115 |
|
116 // Set next effect |
|
117 SetLayoutSwitchEffect(nextContext); |
|
118 |
|
119 if (nextContext == AknTransEffect::ENone) |
|
120 { |
|
121 // Restore normal priority |
|
122 RThread me = RThread(); |
|
123 me.SetPriority(iOriginalPriority); |
|
124 me.Close(); |
|
125 |
|
126 // Just in case refresh everything |
|
127 iBridge.iHuiEnv->Display(0).SetDirty(); |
|
128 } |
|
129 } |
|
130 else |
|
131 { |
|
132 //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack - got different handle (normal, dont worry...) - %i"), aHandle); |
|
133 } |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------- |
|
137 // CAlfLayoutSwitchEffectCoordinator::Cancel |
|
138 // --------------------------------------------------------- |
|
139 // |
|
140 void CAlfLayoutSwitchEffectCoordinator::Cancel() |
|
141 { |
|
142 // Disable effect |
|
143 SetLayoutSwitchEffect( AknTransEffect::ENone ); |
|
144 |
|
145 // Unfreeze visible content |
|
146 if ( iRosterFreezeEndTimer ) |
|
147 { |
|
148 iRosterFreezeEndTimer->Cancel(); |
|
149 } |
|
150 |
|
151 iBridge.iHuiEnv->Display(0).SetDirty(); |
|
152 TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(EFalse)); |
|
153 iBridge.SetVisualTreeVisibilityChanged(ETrue); |
|
154 |
|
155 // Restore normal priority |
|
156 RThread me = RThread(); |
|
157 me.SetPriority(iOriginalPriority); |
|
158 me.Close(); |
|
159 } |
|
160 |
|
161 // --------------------------------------------------------- |
137 // --------------------------------------------------------- |
162 // CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch |
138 // CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch |
163 // |
|
164 // This method starts the layout switch effect procedure. |
|
165 // --------------------------------------------------------- |
139 // --------------------------------------------------------- |
166 // |
140 // |
167 void CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch() |
141 void CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch() |
168 { |
142 { |
169 // Hm. what to do if earlier is already in progress ? |
143 __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch"); |
170 //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch")); |
144 Event( EEventLayoutSwitch ); |
171 if ( iBridge.iHuiEnv->MemoryLevel() <= EHuiMemoryLevelLowest ) |
145 } |
172 { |
146 |
173 // No effects in low memory mode |
147 // --------------------------------------------------------- |
174 return; |
148 // CAlfLayoutSwitchEffectCoordinator::Event |
175 } |
149 // --------------------------------------------------------- |
176 |
150 // |
177 if (!iLayoutSwitchEffectContext) |
151 void CAlfLayoutSwitchEffectCoordinator::Event(TEvent aEvent) |
178 { |
152 { |
179 TBool tfxOn = CAknTransitionUtils::TransitionsEnabled(AknTransEffect::ELayoutswitchTransitionsOff ); |
153 // States: |
180 TBool tfxExists = LayoutSwitchEffectsExist(); |
154 // - EStateIdle - No layout switch effect ongoing |
181 if (tfxOn && tfxExists) |
155 // - EStateFreezeFx - Roster frozen, periodic fullscreen completeness checking |
182 { |
156 // - EStateBlankFx - Roster frozen, expecting client to say when ready to unfreeze |
183 // Boost priority so that we are able to draw more frames for the effect |
157 // - EStateThemeFx - Theme effect in use |
184 RThread me = RThread(); |
158 |
185 me.SetPriority(EPriorityAbsoluteHigh); |
159 // Events: |
186 me.Close(); |
160 // - EEventBlankOn - Client requested blank on |
|
161 // - EEventBlankOff - Client requested blank off |
|
162 // - EEventLayoutSwitch - Layout switch noticed |
|
163 // - EEventLowMemory - Low memory indication |
|
164 // and implicit Finish - Effect finished |
|
165 |
|
166 // Transitions: |
|
167 // From EStateIdle: |
|
168 // - EEventBlankOn: EStateBlankFx |
|
169 // - EEventLayoutSwitch: If effect available, EStateThemeFx. Otherwise EStateFreezeFx. |
|
170 // |
|
171 // From EStateFreezeFx: |
|
172 // - EEventBlankOn: EStateBlankFx |
|
173 // - implicit Finish - EStateIdle |
|
174 // |
|
175 // From EStateBlankFx: |
|
176 // - EEventBlankOff: EStateFreezeFx (we use freeze to ensure that result is ok) |
|
177 // - EEventLayoutSwitch: If effect available, EStateThemeFx. |
|
178 // |
|
179 // From EStateThemeFx: |
|
180 // - EEventLowMemory: If blank still on, EStateBlankFx. Otherwise EStateFreezeFx. |
|
181 // - implicit Finish - EStateIdle |
|
182 |
|
183 TState nextState = EStateIdle; |
|
184 |
|
185 switch ( iCurrentState ) |
|
186 { |
|
187 case EStateFreezeFx: |
|
188 nextState = NextFreezeState(aEvent); |
|
189 break; |
|
190 |
|
191 case EStateBlankFx: |
|
192 nextState = NextBlankState(aEvent); |
|
193 break; |
|
194 |
|
195 case EStateThemeFx: |
|
196 nextState = NextThemeState(aEvent); |
|
197 break; |
|
198 |
|
199 case EStateIdle: |
|
200 default: |
|
201 nextState = NextIdleState(aEvent); |
|
202 break; |
|
203 } |
|
204 |
|
205 if ( nextState != iCurrentState ) |
|
206 { |
|
207 Transition( nextState, iCurrentState ); |
|
208 } |
|
209 } |
|
210 |
|
211 // --------------------------------------------------------- |
|
212 // CAlfLayoutSwitchEffectCoordinator::Transition |
|
213 // --------------------------------------------------------- |
|
214 // |
|
215 void CAlfLayoutSwitchEffectCoordinator::Transition( |
|
216 TState aNewState, TState aPreviousState) |
|
217 { |
|
218 __ALFLOGSTRING2("CAlfLayoutSwitchEffectCoordinator::Transition from: %d to: %d", aNewState, aPreviousState); |
|
219 iCurrentState = aNewState; |
|
220 |
|
221 // Undo previous state - don't unfreeze roster. |
|
222 switch ( aPreviousState ) |
|
223 { |
|
224 case EStateFreezeFx: |
|
225 if ( iRosterFreezeEndTimer ) |
|
226 { |
|
227 iRosterFreezeEndTimer->Cancel(); |
|
228 } |
|
229 break; |
|
230 |
|
231 case EStateBlankFx: |
|
232 iBridge.iHuiEnv->iPauseDrawing = EFalse; |
|
233 break; |
|
234 |
|
235 case EStateThemeFx: |
|
236 { |
|
237 RThread me = RThread(); |
|
238 me.SetPriority(iOriginalPriority); |
|
239 me.Close(); |
|
240 |
|
241 if ( iRosterFreezeEndTimer ) |
|
242 { |
|
243 iRosterFreezeEndTimer->Cancel(); |
|
244 } |
|
245 |
|
246 SetLayoutSwitchEffect( AknTransEffect::ENone ); |
|
247 } |
|
248 break; |
|
249 |
|
250 case EStateIdle: |
|
251 default: |
|
252 break; |
|
253 } |
|
254 |
|
255 // Do next state actions |
|
256 switch ( iCurrentState ) |
|
257 { |
|
258 case EStateFreezeFx: |
|
259 { |
|
260 if (!iRosterFreezeEndTimer) |
|
261 { |
|
262 TRAP_IGNORE(iRosterFreezeEndTimer = CAlfRosterFreezeEndTimer::NewL(iBridge)); |
|
263 } |
187 |
264 |
188 // Freeze visual content |
265 if (iRosterFreezeEndTimer) |
189 //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch freezing roster content")); |
266 { |
190 iBridge.iHuiEnv->Display(0).SetDirty(); |
267 iRosterFreezeEndTimer->Cancel(); |
191 TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(ETrue)); |
|
192 |
268 |
|
269 FreezeRoster(ETrue); |
|
270 |
193 // Remove all other effects |
271 // Remove all other effects |
194 iBridge.HandleGfxStopEvent( EFalse ); |
272 iBridge.HandleGfxStopEvent( EFalse ); |
195 iBridge.RemoveAllTemporaryPresenterVisuals(); |
273 iBridge.RemoveAllTemporaryPresenterVisuals(); |
|
274 |
|
275 // Set remove freeze timer |
|
276 __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::Transition - Freeze timer started"); |
|
277 iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000, TCallBack(DoFreezeFinished, this)); |
|
278 } |
|
279 } |
|
280 break; |
|
281 |
|
282 case EStateBlankFx: |
|
283 { |
|
284 // Start blanker |
|
285 iBridge.iHuiEnv->iPauseDrawing = ETrue; |
|
286 FreezeRoster(ETrue); |
|
287 } |
|
288 break; |
|
289 |
|
290 case EStateThemeFx: |
|
291 { |
|
292 // Boost priority so that we are able to draw more frames for the effect |
|
293 RThread me = RThread(); |
|
294 me.SetPriority(EPriorityAbsoluteHigh); |
|
295 me.Close(); |
196 |
296 |
197 // Set first layout switch effect |
297 // Freeze visual content |
198 SetLayoutSwitchEffect(AknTransEffect::ELayoutSwitchStart); |
298 iBridge.iHuiEnv->Display(0).SetDirty(); |
|
299 FreezeRoster(ETrue); |
|
300 |
|
301 // Remove all other effects |
|
302 iBridge.HandleGfxStopEvent( EFalse ); |
|
303 iBridge.RemoveAllTemporaryPresenterVisuals(); |
|
304 |
|
305 // Set first layout switch effect |
|
306 SetLayoutSwitchEffect(AknTransEffect::ELayoutSwitchStart); |
|
307 } |
|
308 break; |
|
309 |
|
310 case EStateIdle: |
|
311 default: |
|
312 { |
|
313 // Undo everything to be sure |
|
314 RThread me = RThread(); |
|
315 me.SetPriority(iOriginalPriority); |
|
316 me.Close(); |
|
317 |
|
318 SetLayoutSwitchEffect( AknTransEffect::ENone ); |
|
319 if ( iRosterFreezeEndTimer ) |
|
320 { |
|
321 iRosterFreezeEndTimer->Cancel(); |
|
322 } |
|
323 |
|
324 iBridge.iHuiEnv->iPauseDrawing = EFalse; |
|
325 FreezeRoster(EFalse); |
|
326 iBridge.iHuiEnv->Display(0).SetDirty(); |
|
327 iBridge.SetVisualTreeVisibilityChanged(ETrue); |
|
328 } |
|
329 break; |
|
330 } |
|
331 |
|
332 // Inform bridge about layout switch actions |
|
333 if ( aNewState != EStateIdle && aPreviousState == EStateIdle ) |
|
334 { |
|
335 iLayoutSwitchNotCompleted = ETrue; |
|
336 iBridge.LayoutSwitchStart(); |
|
337 } |
|
338 if ( aNewState == EStateIdle && iLayoutSwitchNotCompleted ) |
|
339 { |
|
340 iLayoutSwitchNotCompleted = EFalse; |
|
341 iBridge.LayoutSwitchComplete(); |
|
342 } |
|
343 |
|
344 __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::Transition end"); |
|
345 } |
|
346 |
|
347 |
|
348 |
|
349 // --------------------------------------------------------- |
|
350 // CAlfLayoutSwitchEffectCoordinator::NextIdleState |
|
351 // --------------------------------------------------------- |
|
352 // |
|
353 CAlfLayoutSwitchEffectCoordinator::TState |
|
354 CAlfLayoutSwitchEffectCoordinator::NextIdleState( |
|
355 TEvent aEvent) |
|
356 { |
|
357 TState state = EStateIdle; |
|
358 |
|
359 switch ( aEvent ) |
|
360 { |
|
361 case EEventLayoutSwitch: |
|
362 if ( IsThemeEffectEnabled() ) |
|
363 { |
|
364 state = EStateThemeFx; |
199 } |
365 } |
200 else |
366 else |
201 { |
367 { |
202 if (!iRosterFreezeEndTimer) |
368 state = EStateFreezeFx; |
203 { |
369 } |
204 TRAP_IGNORE(iRosterFreezeEndTimer = CAlfRosterFreezeEndTimer::NewL(iBridge)); |
370 break; |
205 } |
371 |
|
372 case EEventBlankOn: |
|
373 state = EStateBlankFx; |
|
374 break; |
|
375 |
|
376 case EEventBlankOff: |
|
377 case EEventLowMemory: |
|
378 default: |
|
379 break; |
|
380 } |
|
381 |
|
382 return state; |
|
383 } |
|
384 |
|
385 // --------------------------------------------------------- |
|
386 // CAlfLayoutSwitchEffectCoordinator::NextFreezeState |
|
387 // --------------------------------------------------------- |
|
388 // |
|
389 CAlfLayoutSwitchEffectCoordinator::TState |
|
390 CAlfLayoutSwitchEffectCoordinator::NextFreezeState( |
|
391 TEvent aEvent) |
|
392 { |
|
393 TState state = EStateFreezeFx; |
|
394 |
|
395 switch ( aEvent ) |
|
396 { |
|
397 case EEventBlankOn: |
|
398 state = EStateBlankFx; |
|
399 break; |
|
400 |
|
401 case EEventLayoutSwitch: |
|
402 case EEventBlankOff: |
|
403 case EEventLowMemory: |
|
404 default: |
|
405 break; |
|
406 } |
|
407 |
|
408 return state; |
|
409 } |
|
410 |
|
411 // --------------------------------------------------------- |
|
412 // CAlfLayoutSwitchEffectCoordinator::NextBlankState |
|
413 // --------------------------------------------------------- |
|
414 // |
|
415 CAlfLayoutSwitchEffectCoordinator::TState |
|
416 CAlfLayoutSwitchEffectCoordinator::NextBlankState( |
|
417 TEvent aEvent) |
|
418 { |
|
419 TState state = EStateBlankFx; |
|
420 |
|
421 switch ( aEvent ) |
|
422 { |
|
423 case EEventLayoutSwitch: |
|
424 if ( IsThemeEffectEnabled() ) |
|
425 { |
|
426 state = EStateThemeFx; |
|
427 } |
|
428 break; |
|
429 |
|
430 case EEventBlankOff: |
|
431 state = EStateFreezeFx; |
|
432 break; |
|
433 |
|
434 case EEventBlankOn: |
|
435 case EEventLowMemory: |
|
436 default: |
|
437 break; |
|
438 } |
|
439 |
|
440 return state; |
|
441 } |
|
442 |
|
443 // --------------------------------------------------------- |
|
444 // CAlfLayoutSwitchEffectCoordinator::NextThemeState |
|
445 // --------------------------------------------------------- |
|
446 // |
|
447 CAlfLayoutSwitchEffectCoordinator::TState |
|
448 CAlfLayoutSwitchEffectCoordinator::NextThemeState( |
|
449 TEvent aEvent) |
|
450 { |
|
451 TState state = EStateThemeFx; |
|
452 |
|
453 switch ( aEvent ) |
|
454 { |
|
455 case EEventLowMemory: |
|
456 state = iBlankEnabled ? EStateBlankFx : EStateFreezeFx; |
|
457 break; |
206 |
458 |
207 if (iRosterFreezeEndTimer) |
459 case EEventLayoutSwitch: |
208 { |
460 case EEventBlankOn: |
209 iBridge.iHuiEnv->Display(0).SetDirty(); |
461 case EEventBlankOff: |
210 TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(ETrue)); |
462 default: |
211 |
463 break; |
212 // Remove all other effects |
464 } |
213 iBridge.HandleGfxStopEvent( EFalse ); |
465 |
214 iBridge.RemoveAllTemporaryPresenterVisuals(); |
466 return state; |
215 |
467 } |
216 // Set remove freeze timer |
468 |
217 iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000); |
469 // --------------------------------------------------------- |
218 } |
470 // CAlfLayoutSwitchEffectCoordinator::FreezeFinished |
219 //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch - tfx are set OFF -> I am not starting effect.")); |
471 // --------------------------------------------------------- |
220 } |
472 // |
221 } |
473 void CAlfLayoutSwitchEffectCoordinator::FreezeFinished() |
222 else |
474 { |
223 { |
475 Transition(EStateIdle, iCurrentState); |
224 //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch - old effect exists - %i"), iLayoutSwitchEffectContext); |
|
225 } |
|
226 } |
|
227 |
|
228 // --------------------------------------------------------- |
|
229 // CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext |
|
230 // |
|
231 // This method automatically selects the next context in the |
|
232 // layout switch procedure. |
|
233 // |
|
234 // Contextes change in the following order during layout switch: |
|
235 // |
|
236 // 1. AknTransEffect::ENone |
|
237 // 2. AknTransEffect::ELayoutSwitchStart |
|
238 // 3. AknTransEffect::ELayoutSwitchExit |
|
239 // 4. AknTransEffect::ENone |
|
240 // |
|
241 // After new context is selected, appropriate effect is set |
|
242 // (and/or removed) from the roster. |
|
243 // |
|
244 // --------------------------------------------------------- |
|
245 // |
|
246 AknTransEffect::TContext CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext() |
|
247 { |
|
248 // Resolve next context based on current context |
|
249 AknTransEffect::TContext newContext = AknTransEffect::ENone; |
|
250 switch (iLayoutSwitchEffectContext) |
|
251 { |
|
252 case AknTransEffect::ENone: |
|
253 { |
|
254 newContext = AknTransEffect::ELayoutSwitchStart; |
|
255 break; |
|
256 } |
|
257 case AknTransEffect::ELayoutSwitchStart: |
|
258 { |
|
259 newContext = AknTransEffect::ELayoutSwitchExit; |
|
260 break; |
|
261 } |
|
262 case AknTransEffect::ELayoutSwitchExit: // fallthrough |
|
263 default: |
|
264 { |
|
265 newContext = AknTransEffect::ENone; |
|
266 break; |
|
267 } |
|
268 } |
|
269 |
|
270 //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchEffectL old ctx = %i, new ctx = %i"), iLayoutSwitchEffectContext, newContext); |
|
271 return newContext; |
|
272 } |
476 } |
273 |
477 |
274 // --------------------------------------------------------- |
478 // --------------------------------------------------------- |
275 // CAlfLayoutSwitchEffectCoordinator::SetLayoutSwitchEffectL |
479 // CAlfLayoutSwitchEffectCoordinator::SetLayoutSwitchEffectL |
276 // |
480 // |
312 } |
516 } |
313 } |
517 } |
314 } |
518 } |
315 } |
519 } |
316 |
520 |
317 TBool CAlfLayoutSwitchEffectCoordinator::LayoutSwitchEffectsExist() |
521 // --------------------------------------------------------- |
|
522 // CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack |
|
523 // |
|
524 // This method is callback which gets called when layout |
|
525 // switch effect has ended. |
|
526 // --------------------------------------------------------- |
|
527 // |
|
528 void CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack( TInt aHandle ) |
|
529 { |
|
530 //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack")); |
|
531 // KErrNotFound indicates callback from DoNextLayoutSwitchContext |
|
532 if (iLayoutSwitchEffectContext == aHandle || aHandle == KErrNotFound) |
|
533 { |
|
534 AknTransEffect::TContext nextContext = NextLayoutSwitchContext(); |
|
535 |
|
536 // Unfreeze visible content. This reveals real roster content (in new orientation). |
|
537 if (nextContext == AknTransEffect::ELayoutSwitchExit) |
|
538 { |
|
539 #ifdef HUI_DEBUG_TRACK_DRAWING |
|
540 RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack unfreezing roster content")); |
|
541 #endif |
|
542 iBridge.iHuiEnv->Display(0).SetDirty(); |
|
543 FreezeRoster(EFalse); |
|
544 iBridge.SetVisualTreeVisibilityChanged(ETrue); |
|
545 if ( iLayoutSwitchNotCompleted ) |
|
546 { |
|
547 iLayoutSwitchNotCompleted = EFalse; |
|
548 iBridge.LayoutSwitchComplete(); |
|
549 } |
|
550 } |
|
551 |
|
552 // Set next effect |
|
553 SetLayoutSwitchEffect(nextContext); |
|
554 |
|
555 if (nextContext == AknTransEffect::ENone) |
|
556 { |
|
557 // Restore normal priority |
|
558 if ( iCurrentState == EStateThemeFx ) |
|
559 { |
|
560 Transition(EStateIdle, iCurrentState); |
|
561 } |
|
562 |
|
563 RThread me = RThread(); |
|
564 me.SetPriority(iOriginalPriority); |
|
565 me.Close(); |
|
566 |
|
567 // Just in case refresh everything |
|
568 iBridge.iHuiEnv->Display(0).SetDirty(); |
|
569 } |
|
570 } |
|
571 else |
|
572 { |
|
573 //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack - got different handle (normal, dont worry...) - %i"), aHandle); |
|
574 } |
|
575 } |
|
576 |
|
577 // --------------------------------------------------------- |
|
578 // CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext |
|
579 // |
|
580 // This method automatically selects the next context in the |
|
581 // layout switch procedure. |
|
582 // |
|
583 // Contextes change in the following order during layout switch: |
|
584 // |
|
585 // 1. AknTransEffect::ENone |
|
586 // 2. AknTransEffect::ELayoutSwitchStart |
|
587 // 3. AknTransEffect::ELayoutSwitchExit |
|
588 // 4. AknTransEffect::ENone |
|
589 // |
|
590 // After new context is selected, appropriate effect is set |
|
591 // (and/or removed) from the roster. |
|
592 // |
|
593 // --------------------------------------------------------- |
|
594 // |
|
595 // todo: rename |
|
596 TInt DoNextLayoutSwitchContext(TAny* aLayoutSwitchCoordinator) |
|
597 { |
|
598 CAlfLayoutSwitchEffectCoordinator* coordinator = (CAlfLayoutSwitchEffectCoordinator*)aLayoutSwitchCoordinator; |
|
599 coordinator->AlfGfxEffectEndCallBack(KErrNotFound); |
|
600 return 0; |
|
601 } |
|
602 |
|
603 // --------------------------------------------------------- |
|
604 // CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext |
|
605 // --------------------------------------------------------- |
|
606 // |
|
607 AknTransEffect::TContext CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext() |
|
608 { |
|
609 // Resolve next context based on current context |
|
610 AknTransEffect::TContext newContext = AknTransEffect::ENone; |
|
611 switch (iLayoutSwitchEffectContext) |
|
612 { |
|
613 case AknTransEffect::ENone: |
|
614 { |
|
615 newContext = AknTransEffect::ELayoutSwitchStart; |
|
616 break; |
|
617 } |
|
618 case AknTransEffect::ELayoutSwitchStart: |
|
619 { |
|
620 newContext = AknTransEffect::ELayoutSwitch; |
|
621 if (!iRosterFreezeEndTimer) |
|
622 { |
|
623 TRAP_IGNORE(iRosterFreezeEndTimer = CAlfRosterFreezeEndTimer::NewL(iBridge)); |
|
624 } |
|
625 if (iRosterFreezeEndTimer) |
|
626 { |
|
627 iRosterFreezeEndTimer->Cancel(); |
|
628 iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000, TCallBack(DoNextLayoutSwitchContext, this)); |
|
629 } |
|
630 else |
|
631 { |
|
632 newContext = AknTransEffect::ELayoutSwitchExit; |
|
633 } |
|
634 break; |
|
635 } |
|
636 case AknTransEffect::ELayoutSwitch: |
|
637 { |
|
638 newContext = AknTransEffect::ELayoutSwitchExit; |
|
639 break; |
|
640 } |
|
641 case AknTransEffect::ELayoutSwitchExit: // fallthrough |
|
642 default: |
|
643 { |
|
644 newContext = AknTransEffect::ENone; |
|
645 break; |
|
646 } |
|
647 } |
|
648 |
|
649 //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchEffectL old ctx = %i, new ctx = %i"), iLayoutSwitchEffectContext, newContext); |
|
650 return newContext; |
|
651 } |
|
652 |
|
653 // --------------------------------------------------------- |
|
654 // CAlfLayoutSwitchEffectCoordinator::IsThemeEffectEnabled() |
|
655 // Returns true if layout switch theme effect may be used |
|
656 // --------------------------------------------------------- |
|
657 // |
|
658 TBool CAlfLayoutSwitchEffectCoordinator::IsThemeEffectEnabled() const |
|
659 { |
|
660 TBool memoryOk = !( iBridge.iHuiEnv->MemoryLevel() <= EHuiMemoryLevelLowest ); |
|
661 TBool tfxOn = CAknTransitionUtils::TransitionsEnabled(AknTransEffect::ELayoutswitchTransitionsOff ); |
|
662 TBool tfxExists = LayoutSwitchEffectsExist(); |
|
663 |
|
664 return |
|
665 memoryOk && tfxOn && tfxExists; |
|
666 } |
|
667 |
|
668 // --------------------------------------------------------- |
|
669 // CAlfLayoutSwitchEffectCoordinator::LayoutSwitchEffectsExist() |
|
670 // Returns true if layout switch effect exists |
|
671 // --------------------------------------------------------- |
|
672 // |
|
673 TBool CAlfLayoutSwitchEffectCoordinator::LayoutSwitchEffectsExist() const |
318 { |
674 { |
319 TBool appearExists = EFalse; |
675 TBool appearExists = EFalse; |
320 TBool disAppearExists = EFalse; |
676 TBool disAppearExists = EFalse; |
321 |
677 |
322 for ( TInt i = 0; i<iBridge.iAlfRegisteredEffects.Count(); i++ ) |
678 for ( TInt i = 0; i<iBridge.iAlfRegisteredEffects.Count(); i++ ) |