X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Faccessibility-manager%2Faccessibility-manager-impl.cpp;h=e67cb27f5776d2879bb8460957f1c3aa47c9d990;hp=aee1bc0ff176bd0e7f902c97f14a669f7c0ebdd8;hb=70162c49a1387daf074414b7c6223417fce53419;hpb=87a9019904ab49c42f1e32e7ebb6a1512b0dc28c diff --git a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp index aee1bc0..e67cb27 100644 --- a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp +++ b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,10 +25,10 @@ #include #include #include -#include #include // INTERNAL INCLUDES +#include #include #include #include @@ -58,10 +58,10 @@ Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_FOC const char* const ACTOR_FOCUSABLE("focusable"); const char* const IS_FOCUS_GROUP("isFocusGroup"); -const char* FOCUS_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "B16-8_TTS_focus.9.png"; +const char* FOCUS_BORDER_IMAGE_FILE_NAME = "B16-8_TTS_focus.9.png"; -const char* FOCUS_SOUND_FILE = DALI_SOUND_DIR "Focus.ogg"; -const char* FOCUS_CHAIN_END_SOUND_FILE = DALI_SOUND_DIR "End_of_List.ogg"; +const char* FOCUS_SOUND_FILE_NAME = "Focus.ogg"; +const char* FOCUS_CHAIN_END_SOUND_FILE_NAME = "End_of_List.ogg"; /** * The function to be used in the hit-test algorithm to check whether the actor is hittable. @@ -75,8 +75,8 @@ bool IsActorFocusableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType case Dali::HitTestAlgorithm::CHECK_ACTOR: { // Check whether the actor is visible and not fully transparent. - if( actor.IsVisible() - && actor.GetCurrentWorldColor().a > 0.01f) // not FULLY_TRANSPARENT + if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) + && actor.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ).a > 0.01f) // not FULLY_TRANSPARENT { // Check whether the actor is focusable Property::Index propertyActorFocusable = actor.GetPropertyIndex(ACTOR_FOCUSABLE); @@ -89,7 +89,7 @@ bool IsActorFocusableFunction(Actor actor, Dali::HitTestAlgorithm::TraverseType } case Dali::HitTestAlgorithm::DESCEND_ACTOR_TREE: { - if( actor.IsVisible() ) // Actor is visible, if not visible then none of its children are visible. + if( actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ) ) // Actor is visible, if not visible then none of its children are visible. { hittable = true; } @@ -112,6 +112,8 @@ AccessibilityManager::AccessibilityManager() mFocusIndicatorActor(), mPreviousPosition( 0.0f, 0.0f ), mRecursiveFocusMoveCounter(0), + mFocusSoundFilePath(), + mFocusChainEndSoundFilePath(), mIsWrapped(false), mIsFocusWithinGroup(false), mIsEndcapFeedbackEnabled(false), @@ -119,7 +121,9 @@ AccessibilityManager::AccessibilityManager() mIsAccessibilityTtsEnabled(false), mTtsCreated(false), mIsFocusIndicatorEnabled(false), - mContinuousPlayMode(false) + mContinuousPlayMode(false), + mIsFocusSoundFilePathSet(false), + mIsFocusChainEndSoundFilePathSet(false) { } @@ -160,7 +164,7 @@ void AccessibilityManager::SetAccessibilityAttribute(Actor actor, Toolkit::Acces { if(actor) { - unsigned int actorID = actor.GetId(); + unsigned int actorID = actor.GetProperty< int >( Actor::Property::ID ); ActorAdditionalInfo info = GetActorAdditionalInfo(actorID); info.mAccessibilityAttributes[type] = text; @@ -176,7 +180,7 @@ std::string AccessibilityManager::GetAccessibilityAttribute(Actor actor, Toolkit if(actor) { - ActorAdditionalInfo data = GetActorAdditionalInfo(actor.GetId()); + ActorAdditionalInfo data = GetActorAdditionalInfo(actor.GetProperty< int >( Actor::Property::ID )); text = data.mAccessibilityAttributes[type]; } @@ -238,11 +242,11 @@ void AccessibilityManager::SetFocusOrder(Actor actor, const unsigned int order) actor.SetProperty(propertyActorFocusable, true); // Now we insert the actor into the focus chain with the specified focus order - mFocusIDContainer.insert(FocusIDPair(order, actor.GetId())); + mFocusIDContainer.insert(FocusIDPair(order, actor.GetProperty< int >( Actor::Property::ID ))); } // Update the actor's focus order in its additional data - SynchronizeActorAdditionalInfo(actor.GetId(), order); + SynchronizeActorAdditionalInfo(actor.GetProperty< int >( Actor::Property::ID ), order); } } @@ -252,7 +256,7 @@ unsigned int AccessibilityManager::GetFocusOrder(Actor actor) const if(actor) { - ActorAdditionalInfo data = GetActorAdditionalInfo(actor.GetId()); + ActorAdditionalInfo data = GetActorAdditionalInfo(actor.GetProperty< int >( Actor::Property::ID )); focusOrder = data.mFocusOrder; } @@ -290,7 +294,7 @@ bool AccessibilityManager::SetCurrentFocusActor(Actor actor) { if(actor) { - return DoSetCurrentFocusActor(actor.GetId()); + return DoSetCurrentFocusActor(actor.GetProperty< int >( Actor::Property::ID )); } return false; @@ -326,16 +330,16 @@ bool AccessibilityManager::DoSetCurrentFocusActor(const unsigned int actorID) } // Go through the actor's hierarchy to check whether the actor is visible - bool actorVisible = actor.IsVisible(); + bool actorVisible = actor.GetCurrentProperty< bool >( Actor::Property::VISIBLE ); Actor parent = actor.GetParent(); while (actorVisible && parent && parent != rootActor) { - actorVisible = parent.IsVisible(); + actorVisible = parent.GetCurrentProperty< bool >( Actor::Property::VISIBLE ); parent = parent.GetParent(); } // Check whether the actor is fully transparent - bool actorOpaque = actor.GetCurrentWorldColor().a > 0.01f; + bool actorOpaque = actor.GetCurrentProperty< Vector4 >( Actor::Property::WORLD_COLOR ).a > 0.01f; // Set the focus only when the actor is focusable and visible and not fully transparent if(actorVisible && actorFocusable && actorOpaque) @@ -357,7 +361,13 @@ bool AccessibilityManager::DoSetCurrentFocusActor(const unsigned int actorID) Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get(); if(soundPlayer) { - soundPlayer.PlaySound(FOCUS_SOUND_FILE); + if (!mIsFocusSoundFilePathSet) + { + const std::string soundDirPath = AssetManager::GetDaliSoundPath(); + mFocusSoundFilePath = soundDirPath + FOCUS_SOUND_FILE_NAME; + mIsFocusSoundFilePathSet = true; + } + soundPlayer.PlaySound(mFocusSoundFilePath); } // Play the accessibility attributes with the TTS player. @@ -595,9 +605,12 @@ Actor AccessibilityManager::GetFocusIndicatorActor() if( ! mFocusIndicatorActor ) { // Create the default if it hasn't been set and one that's shared by all the keyboard focusable actors - mFocusIndicatorActor = Toolkit::ImageView::New( FOCUS_BORDER_IMAGE_PATH ); - mFocusIndicatorActor.SetParentOrigin( ParentOrigin::CENTER ); - mFocusIndicatorActor.SetZ( 1.0f ); + const std::string imageDirPath = AssetManager::GetDaliImagePath(); + const std::string focusBorderImagePath = imageDirPath + FOCUS_BORDER_IMAGE_FILE_NAME; + + mFocusIndicatorActor = Toolkit::ImageView::New(focusBorderImagePath); + mFocusIndicatorActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + mFocusIndicatorActor.SetProperty( Actor::Property::POSITION_Z, 1.0f ); // Apply size constraint to the focus indicator mFocusIndicatorActor.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); @@ -622,7 +635,13 @@ bool AccessibilityManager::DoMoveFocus(FocusIDIter focusIDIter, bool forward, bo Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get(); if(soundPlayer) { - soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE); + if (!mIsFocusChainEndSoundFilePathSet) + { + const std::string soundDirPath = AssetManager::GetDaliSoundPath(); + mFocusChainEndSoundFilePath = soundDirPath + FOCUS_CHAIN_END_SOUND_FILE_NAME; + mIsFocusChainEndSoundFilePathSet = true; + } + soundPlayer.PlaySound(mFocusChainEndSoundFilePath); } mIsEndcapFeedbackPlayed = true; @@ -944,12 +963,12 @@ bool AccessibilityManager::ClearAccessibilityFocus() } } -bool AccessibilityManager::AccessibilityActionScroll( Dali::TouchEvent& touchEvent ) +bool AccessibilityManager::AccessibilityActionScroll( Dali::TouchData& touchData ) { Dali::Toolkit::AccessibilityManager handle( this ); if( !mActionScrollSignal.Empty() ) { - mActionScrollSignal.Emit( handle, touchEvent ); + mActionScrollSignal.Emit( handle, touchData ); } return true; @@ -1283,7 +1302,7 @@ bool AccessibilityManager::AccessibilityActionStartStop() return mIsAccessibilityTtsEnabled; } -bool AccessibilityManager::AccessibilityActionTouch(const TouchEvent& touchEvent) +bool AccessibilityManager::AccessibilityActionTouch(const TouchData& touchData) { bool handled = false; @@ -1292,17 +1311,17 @@ bool AccessibilityManager::AccessibilityActionTouch(const TouchEvent& touchEvent Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(GetCurrentFocusActor()); if(control) { - handled = GetImplementation( control ).OnAccessibilityTouch(touchEvent); + handled = GetImplementation( control ).OnAccessibilityTouch(touchData); } return handled; } -bool AccessibilityManager::HandlePanGesture(const Integration::PanGestureEvent& panEvent) +bool AccessibilityManager::HandlePanGesture(const AccessibilityGestureEvent& panEvent) { bool handled = false; - if( panEvent.state == Gesture::Started ) + if( panEvent.state == AccessibilityGestureEvent::Started ) { // Find the focusable actor at the event position Dali::HitTestAlgorithm::Results results; @@ -1319,7 +1338,7 @@ bool AccessibilityManager::HandlePanGesture(const Integration::PanGestureEvent& // Gesture::Finished (Up) events are delivered with previous (Motion) event position // Use the real previous position; otherwise we may incorrectly get a ZERO velocity - if ( Gesture::Finished != panEvent.state ) + if ( AccessibilityGestureEvent::Finished != panEvent.state ) { // Store the previous position for next Gesture::Finished iteration. mPreviousPosition = panEvent.previousPosition; @@ -1327,7 +1346,8 @@ bool AccessibilityManager::HandlePanGesture(const Integration::PanGestureEvent& Actor rootActor = Stage::GetCurrent().GetRootLayer(); - Dali::PanGesture pan(panEvent.state); + Dali::PanGesture pan( static_cast(panEvent.state) ); + pan.time = panEvent.time; pan.numberOfTouches = panEvent.numberOfTouches; pan.screenPosition = panEvent.currentPosition;