Commit 3e882d1a8dc3fbaa4f1f671e1d1da4d878ec04b6

Authored by adam.b
2 parents 762c7ea3 8b7d4ef5

[dali_1.2.8] Merge branch 'devel/master'

Change-Id: I826ef82f07f246258b07c9479f00aaf6200c8c7a
demo/dali-table-view.cpp
@@ -43,6 +43,14 @@ namespace @@ -43,6 +43,14 @@ namespace
43 const std::string LOGO_PATH( DEMO_IMAGE_DIR "Logo-for-demo.png" ); 43 const std::string LOGO_PATH( DEMO_IMAGE_DIR "Logo-for-demo.png" );
44 const std::string TILE_BACKGROUND(DEMO_IMAGE_DIR "item-background.9.png"); 44 const std::string TILE_BACKGROUND(DEMO_IMAGE_DIR "item-background.9.png");
45 const std::string TILE_BACKGROUND_ALPHA( DEMO_IMAGE_DIR "demo-tile-texture.9.png" ); 45 const std::string TILE_BACKGROUND_ALPHA( DEMO_IMAGE_DIR "demo-tile-texture.9.png" );
  46 +const std::string TILE_FOCUS( DEMO_IMAGE_DIR "tile-focus.9.png" );
  47 +
  48 +// Keyboard focus constants.
  49 +const float KEYBOARD_FOCUS_ANIMATION_DURATION = 1.0f; ///< The total duration of the keyboard focus animation
  50 +const float KEYBOARD_FOCUS_START_SCALE = 1.05f; ///< The starting scale of the focus highlight
  51 +const float KEYBOARD_FOCUS_END_SCALE = 1.18f; ///< The end scale of the focus highlight
  52 +const float KEYBOARD_FOCUS_END_ALPHA = 0.7f; ///< The end alpha of the focus highlight
  53 +const float KEYBOARD_FOCUS_INITIAL_FADE_PERCENTAGE = 0.16f; ///< The duration of the initial fade (from translucent to the end-alpha) as a percentage of the overal animation duration.
46 54
47 const float TILE_LABEL_PADDING = 8.0f; ///< Border between edge of tile and the example text 55 const float TILE_LABEL_PADDING = 8.0f; ///< Border between edge of tile and the example text
48 const float BUTTON_PRESS_ANIMATION_TIME = 0.35f; ///< Time to perform button scale effect. 56 const float BUTTON_PRESS_ANIMATION_TIME = 0.35f; ///< Time to perform button scale effect.
@@ -319,6 +327,61 @@ void DaliTableView::Initialize( Application&amp; application ) @@ -319,6 +327,61 @@ void DaliTableView::Initialize( Application&amp; application )
319 KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &DaliTableView::OnKeyboardPreFocusChange ); 327 KeyboardFocusManager::Get().PreFocusChangeSignal().Connect( this, &DaliTableView::OnKeyboardPreFocusChange );
320 KeyboardFocusManager::Get().FocusedActorEnterKeySignal().Connect( this, &DaliTableView::OnFocusedActorActivated ); 328 KeyboardFocusManager::Get().FocusedActorEnterKeySignal().Connect( this, &DaliTableView::OnFocusedActorActivated );
321 AccessibilityManager::Get().FocusedActorActivatedSignal().Connect( this, &DaliTableView::OnFocusedActorActivated ); 329 AccessibilityManager::Get().FocusedActorActivatedSignal().Connect( this, &DaliTableView::OnFocusedActorActivated );
  330 +
  331 + mFocusContainer = ImageView::New( TILE_FOCUS );
  332 + mFocusContainer.SetParentOrigin( ParentOrigin::CENTER );
  333 + mFocusContainer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  334 + mFocusContainer.SetInheritScale( false );
  335 + mFocusContainer.SetColorMode( USE_OWN_COLOR );
  336 + mFocusContainer.SetName( "focusActor" );
  337 + mFocusContainer.OnStageSignal().Connect( this, &DaliTableView::OnStageConnect );
  338 +
  339 + mFocusInner = ImageView::New( TILE_FOCUS );
  340 + mFocusInner.SetParentOrigin( ParentOrigin::CENTER );
  341 + mFocusInner.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  342 + mFocusInner.SetInheritScale( false );
  343 + mFocusInner.SetColorMode( USE_OWN_COLOR );
  344 + mFocusInner.SetName( "focusActor" );
  345 + mFocusInner.OnStageSignal().Connect( this, &DaliTableView::OnStageConnect );
  346 + mFocusContainer.Add( mFocusInner );
  347 +
  348 + // Setup the keyboard focus highlight.
  349 + Vector3 startScale( KEYBOARD_FOCUS_START_SCALE, KEYBOARD_FOCUS_START_SCALE, KEYBOARD_FOCUS_START_SCALE );
  350 + Vector3 endScale( KEYBOARD_FOCUS_END_SCALE, KEYBOARD_FOCUS_END_SCALE, KEYBOARD_FOCUS_END_SCALE );
  351 + mFocusAnimation = Animation::New( KEYBOARD_FOCUS_ANIMATION_DURATION );
  352 + mFocusAnimationInner = Animation::New( KEYBOARD_FOCUS_ANIMATION_DURATION );
  353 +
  354 + mFocusContainer.SetScale( startScale );
  355 + mFocusInner.SetScale( startScale );
  356 + mFocusContainer.SetOpacity( 0.0f );
  357 + mFocusInner.SetOpacity( 0.0f );
  358 + const float initialFadeDuration = KEYBOARD_FOCUS_ANIMATION_DURATION * KEYBOARD_FOCUS_INITIAL_FADE_PERCENTAGE;
  359 +
  360 + mFocusAnimation.AnimateTo( Property( mFocusContainer, Actor::Property::COLOR_ALPHA ), KEYBOARD_FOCUS_END_ALPHA, AlphaFunction::LINEAR, TimePeriod( 0.0f, initialFadeDuration ) );
  361 + mFocusAnimation.AnimateTo( Property( mFocusContainer, Actor::Property::SCALE ), endScale, AlphaFunction::LINEAR, TimePeriod( initialFadeDuration, KEYBOARD_FOCUS_ANIMATION_DURATION - initialFadeDuration ) );
  362 + mFocusAnimation.AnimateTo( Property( mFocusContainer, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunction::LINEAR, TimePeriod( initialFadeDuration, KEYBOARD_FOCUS_ANIMATION_DURATION - initialFadeDuration ) );
  363 +
  364 + mFocusAnimationInner.AnimateTo( Property( mFocusInner, Actor::Property::COLOR_ALPHA ), KEYBOARD_FOCUS_END_ALPHA, AlphaFunction::LINEAR, TimePeriod( 0.0f, initialFadeDuration ) );
  365 + mFocusAnimationInner.AnimateTo( Property( mFocusInner, Actor::Property::SCALE ), endScale, AlphaFunction::LINEAR, TimePeriod( initialFadeDuration, KEYBOARD_FOCUS_ANIMATION_DURATION - initialFadeDuration ) );
  366 + mFocusAnimationInner.AnimateTo( Property( mFocusInner, Actor::Property::COLOR_ALPHA ), 0.0f, AlphaFunction::LINEAR, TimePeriod( initialFadeDuration, KEYBOARD_FOCUS_ANIMATION_DURATION - initialFadeDuration ) );
  367 +
  368 + // Play the animation on the 1st glow object.
  369 + mFocusAnimation.SetLooping( true );
  370 + mFocusAnimation.Play();
  371 + // Stagger the animation on the 2st glow object half way through.
  372 + mFocusAnimationInner.SetLooping( true );
  373 + mFocusAnimationInner.PlayFrom( KEYBOARD_FOCUS_ANIMATION_DURATION / 2.0f );
  374 +
  375 + KeyboardFocusManager::Get().SetFocusIndicatorActor( mFocusContainer );
  376 +}
  377 +
  378 +void DaliTableView::OnStageConnect( Dali::Actor actor )
  379 +{
  380 + // If this is one of the keyboard focus actors, place it behind the object it is focusing.
  381 + if( actor.GetName() == "focusActor" )
  382 + {
  383 + actor.GetRendererAt( 0 ).SetProperty( Dali::Renderer::Property::DEPTH_INDEX, -40000 );
  384 + }
322 } 385 }
323 386
324 void DaliTableView::ApplyCubeEffectToPages() 387 void DaliTableView::ApplyCubeEffectToPages()
@@ -482,12 +545,12 @@ Actor DaliTableView::CreateTile( const std::string&amp; name, const std::string&amp; tit @@ -482,12 +545,12 @@ Actor DaliTableView::CreateTile( const std::string&amp; name, const std::string&amp; tit
482 content.Add( tileContent ); 545 content.Add( tileContent );
483 546
484 // Create an ImageView for the 9-patch border around the tile. 547 // Create an ImageView for the 9-patch border around the tile.
485 - ImageView image = ImageView::New( TILE_BACKGROUND );  
486 - image.SetAnchorPoint( AnchorPoint::CENTER );  
487 - image.SetParentOrigin( ParentOrigin::CENTER );  
488 - image.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );  
489 - image.SetOpacity( 0.8f );  
490 - tileContent.Add( image ); 548 + ImageView borderImage = ImageView::New( TILE_BACKGROUND );
  549 + borderImage.SetAnchorPoint( AnchorPoint::CENTER );
  550 + borderImage.SetParentOrigin( ParentOrigin::CENTER );
  551 + borderImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  552 + borderImage.SetOpacity( 0.8f );
  553 + tileContent.Add( borderImage );
491 554
492 TextLabel label = TextLabel::New(); 555 TextLabel label = TextLabel::New();
493 label.SetAnchorPoint( AnchorPoint::CENTER ); 556 label.SetAnchorPoint( AnchorPoint::CENTER );
@@ -504,7 +567,7 @@ Actor DaliTableView::CreateTile( const std::string&amp; name, const std::string&amp; tit @@ -504,7 +567,7 @@ Actor DaliTableView::CreateTile( const std::string&amp; name, const std::string&amp; tit
504 content.Add( label ); 567 content.Add( label );
505 568
506 // Set the tile to be keyboard focusable 569 // Set the tile to be keyboard focusable
507 - content.SetKeyboardFocusable(true); 570 + content.SetKeyboardFocusable( true );
508 571
509 // connect to the touch events 572 // connect to the touch events
510 content.TouchSignal().Connect( this, &DaliTableView::OnTilePressed ); 573 content.TouchSignal().Connect( this, &DaliTableView::OnTilePressed );
demo/dali-table-view.h
@@ -357,6 +357,12 @@ private: // Application callbacks &amp; implementation @@ -357,6 +357,12 @@ private: // Application callbacks &amp; implementation
357 void OnButtonsPageRelayout( const Dali::Actor& actor ); 357 void OnButtonsPageRelayout( const Dali::Actor& actor );
358 358
359 /** 359 /**
  360 + * @brief The is connected to the keyboard focus highlight actor, and called when it is placed on stage.
  361 + * @param[in] actor The actor that has been placed on stage.
  362 + */
  363 + void OnStageConnect( Dali::Actor actor );
  364 +
  365 + /**
360 * @brief Callback called to set up background actors 366 * @brief Callback called to set up background actors
361 * 367 *
362 * @param[in] actor The actor raising the callback 368 * @param[in] actor The actor raising the callback
@@ -378,6 +384,11 @@ private: @@ -378,6 +384,11 @@ private:
378 Dali::TapGestureDetector mLogoTapDetector; ///< To detect taps on the logo 384 Dali::TapGestureDetector mLogoTapDetector; ///< To detect taps on the logo
379 Dali::Toolkit::Popup mVersionPopup; ///< Displays DALi library version information 385 Dali::Toolkit::Popup mVersionPopup; ///< Displays DALi library version information
380 386
  387 + Dali::Toolkit::ImageView mFocusContainer; ///< The parent keyboard focus highlight actor
  388 + Dali::Toolkit::ImageView mFocusInner; ///< The child keyboard focus highlight actor
  389 + Dali::Animation mFocusAnimation; ///< The animation for the parent keyboard focus highlight actor
  390 + Dali::Animation mFocusAnimationInner; ///< The animation for the child keyboard focus highlight actor
  391 +
381 std::vector< Dali::Actor > mPages; ///< List of pages. 392 std::vector< Dali::Actor > mPages; ///< List of pages.
382 AnimationList mBackgroundAnimations; ///< List of background bubble animations 393 AnimationList mBackgroundAnimations; ///< List of background bubble animations
383 ExampleList mExampleList; ///< List of examples. 394 ExampleList mExampleList; ///< List of examples.
packaging/com.samsung.dali-demo.spec
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 2
3 Name: com.samsung.dali-demo 3 Name: com.samsung.dali-demo
4 Summary: The OpenGLES Canvas Core Demo 4 Summary: The OpenGLES Canvas Core Demo
5 -Version: 1.2.7 5 +Version: 1.2.8
6 Release: 1 6 Release: 1
7 Group: System/Libraries 7 Group: System/Libraries
8 License: Apache-2.0 8 License: Apache-2.0
resources/images/tile-focus.9.png 0 → 100644

2.29 KB