1. Shoot accessibility pan to hit-actor instead of currently focused actor (done)
2. Added sound resources (done)
Play sound for focus, end of focus list
3. Added Get/SetEndcapFeedbackEnabled api to handle the feedback
In case of evas-plugin usage, need to disable endcap feedback since EFL will do.
4. TODO: support tap & hold event on focused actor (NEXT PATCH)
const char* FOCUS_BORDER_IMAGE_PATH = DALI_IMAGE_DIR "B16-8_TTS_focus.png";
const Vector4 FOCUS_BORDER_IMAGE_BORDER = Vector4(7.0f, 7.0f, 7.0f, 7.0f);
+const char* FOCUS_SOUND_FILE = DALI_SOUND_DIR "Focus.ogg";
+const char* FOCUS_CHAIN_END_SOUND_FILE = DALI_SOUND_DIR "End_of_List.ogg";
+
/**
* The function to be used in the hit-test algorithm to check whether the actor is hittable.
*/
FocusManager::FocusManager()
: mIsWrapped(false),
mIsFocusWithinGroup(false),
+ mIsEndcapFeedbackEnabled(true),
+ mIsEndcapFeedbackPlayed(false),
mCurrentFocusActor(FocusIDPair(0, 0)),
mFocusIndicatorActor(Actor()),
mRecursiveFocusMoveCounter(0),
if(mIsAccessibilityTtsEnabled)
{
+ Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get();
+ soundPlayer.PlaySound(FOCUS_SOUND_FILE);
+
// Play the accessibility attributes with the TTS player.
Dali::TtsPlayer player = Dali::TtsPlayer::Get(Dali::TtsPlayer::SCREEN_READER);
return mIsWrapped;
}
+void FocusManager::SetEndCapFeedbackEnabled(bool enabled)
+{
+ mIsEndcapFeedbackEnabled = enabled;
+}
+
+bool FocusManager::GetEndCapFeedbackEnabled() const
+{
+ return mIsEndcapFeedbackEnabled;
+}
+
void FocusManager::SetFocusIndicatorActor(Actor indicator)
{
mFocusIndicatorActor = indicator;
{
if(wrapped)
{
+ if(mIsEndcapFeedbackEnabled)
+ {
+ if(mIsEndcapFeedbackPlayed == false)
+ {
+ // play sound & skip to move once
+ Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get();
+ soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE);
+
+ mIsEndcapFeedbackPlayed = true;
+ return true;
+ }
+ mIsEndcapFeedbackPlayed = false;
+ }
+
if(forward)
{
focusIDIter = mFocusIDContainer.begin();
}
else
{
+ if(mIsEndcapFeedbackEnabled)
+ {
+ Dali::SoundPlayer soundPlayer = Dali::SoundPlayer::Get();
+ soundPlayer.PlaySound(FOCUS_CHAIN_END_SOUND_FILE);
+ }
+
DALI_LOG_INFO( gLogFilter, Debug::General, "[%s:%d] Overshot\n", __FUNCTION__, __LINE__);
// Send notification for handling overshooted situation
mFocusOvershotSignalV2.Emit(GetCurrentFocusActor(), forward ? Toolkit::FocusManager::OVERSHOT_NEXT : Toolkit::FocusManager::OVERSHOT_PREVIOUS);
{
bool handled = false;
- Actor currentGesturedActor = GetCurrentFocusActor();
+ if( panEvent.state == Gesture::Started )
+ {
+ // Find the focusable actor at the event position
+ Dali::HitTestAlgorithm::Results results;
+ AccessibilityManager manager = AccessibilityManager::Get();
+
+ Dali::HitTestAlgorithm::HitTest( Stage::GetCurrent(), panEvent.currentPosition, results, IsActorFocusableFunction );
+ mCurrentGesturedActor = results.actor;
+
+ if(!mCurrentGesturedActor)
+ {
+ DALI_LOG_ERROR("Gesture detected, but no hit actor");
+ }
+ }
+
Actor rootActor = Stage::GetCurrent().GetRootLayer();
Dali::PanGesture pan(panEvent.state);
pan.screenVelocity.y = pan.screenDisplacement.y / panEvent.timeDelta;
// Only handle the pan gesture when the current focused actor is scrollable or within a scrollable actor
- while(currentGesturedActor && currentGesturedActor != rootActor && !handled)
+ while(mCurrentGesturedActor && mCurrentGesturedActor != rootActor && !handled)
{
- Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(currentGesturedActor);
+ Dali::Toolkit::Control control = Dali::Toolkit::Control::DownCast(mCurrentGesturedActor);
if(control)
{
Vector2 localCurrent;
// If the gesture is not handled by the control, check its parent
if(!handled)
{
- currentGesturedActor = currentGesturedActor.GetParent();
+ mCurrentGesturedActor = mCurrentGesturedActor.GetParent();
+
+ if(!mCurrentGesturedActor)
+ {
+ DALI_LOG_ERROR("no more gestured actor");
+ }
}
else
{
bool GetWrapMode() const;
/**
+ * @copydoc Toolkit::FocusManager::SetEndCapFeedbackEnabled
+ */
+ void SetEndCapFeedbackEnabled(bool enabled);
+
+ /**
+ * @copydoc Toolkit::FocusManager::GetEndCapFeedbackEnabled
+ */
+ bool GetEndCapFeedbackEnabled() const;
+
+ /**
* @copydoc Toolkit::FocusManager::SetFocusIndicatorActor
*/
void SetFocusIndicatorActor(Actor indicator);
bool mIsWrapped; ///< Whether the focus movement is wrapped around or not
bool mIsFocusWithinGroup; ///< Whether the focus movement is limited to the current focus group or not
+ bool mIsEndcapFeedbackEnabled; ///< Whether the endcap feedback need to be played when the focus leaves the end or vice versa
+ bool mIsEndcapFeedbackPlayed; ///< Whether the endcap feedback was played or not
+
FocusIDContainer mFocusIDContainer; ///< The container to look up actor ID by focus order
IDAdditionalInfoContainer mIDAdditionalInfoContainer; ///< The container to look up additional information by actor ID
FocusIDPair mCurrentFocusActor; ///< The focus order and actor ID of current focused actor
+ Actor mCurrentGesturedActor; ///< The actor that will handle the gesture
Actor mFocusIndicatorActor; ///< The focus indicator actor shared by all the focusable actors for highlight
return GetImpl(*this).GetWrapMode();
}
+void FocusManager::SetEndCapFeedbackEnabled(bool enabled)
+{
+ GetImpl(*this).SetEndCapFeedbackEnabled(enabled);
+}
+
+bool FocusManager::GetEndCapFeedbackEnabled() const
+{
+ return GetImpl(*this).GetEndCapFeedbackEnabled();
+}
+
void FocusManager::SetFocusIndicatorActor(Actor indicator)
{
GetImpl(*this).SetFocusIndicatorActor(indicator);
--- /dev/null
+# Files to install here
+
+dali_toolkit_base_sound_files =\
+ $(toolkit_base_sounds_dir)/*.ogg
# Base files
toolkit_base_images_dir = ../../../base/dali-toolkit/images
+toolkit_base_sounds_dir = ../../../base/dali-toolkit/sounds
toolkit_base_src_dir = ../../../base/dali-toolkit/internal
public_api_base_src_dir = ../../../base/dali-toolkit/public-api
include ../../../base/dali-toolkit/images/file.list
+include ../../../base/dali-toolkit/sounds/file.list
include ../../../base/dali-toolkit/internal/file.list
include ../../../base/dali-toolkit/public-api/file.list
#resources_dir = ../../../resources
#daliimagedir = ${dataReadOnlyDir}/toolkit/images/
#daliimage_DATA = ${dali_toolkit_base_image_files}
+#dalisounddir = ${dataReadOnlyDir}/toolkit/sounds/
+#dalisound_DATA = ${dali_toolkit_base_sound_files}
# The Base library
lib_LTLIBRARIES = libdali-toolkit-base.la
libdali_toolkit_base_la_CXXFLAGS = -DDALI_COMPILATION \
-DDALI_IMAGE_DIR="\"${daliimagedir}\"" \
+ -DDALI_SOUND_DIR="\"${dalisounddir}\"" \
-Werror -Wall \
-I../../../base \
-I../../../capi \
# Base files
toolkit_base_images_dir = ../../../base/dali-toolkit/images
+toolkit_base_sounds_dir = ../../../base/dali-toolkit/sounds
toolkit_base_src_dir = ../../../base/dali-toolkit/internal
public_api_base_src_dir = ../../../base/dali-toolkit/public-api
include ../../../base/dali-toolkit/images/file.list
+include ../../../base/dali-toolkit/sounds/file.list
include ../../../base/dali-toolkit/internal/file.list
include ../../../base/dali-toolkit/public-api/file.list
daliimage_DATA = ${dali_toolkit_base_image_files} \
${dali_toolkit_optional_image_files}
+dalisounddir = ${dataReadOnlyDir}/toolkit/sounds/
+dalisound_DATA = ${dali_toolkit_base_sound_files}
+
# The Combined library
lib_LTLIBRARIES = libdali-toolkit.la
libdali_toolkit_la_CXXFLAGS = -DDALI_COMPILATION \
-DDALI_IMAGE_DIR="\"${daliimagedir}\"" \
+ -DDALI_SOUND_DIR="\"${dalisounddir}\"" \
-Werror -Wall \
-I../../../base \
-I../../../optional \
bool GetWrapMode() const;
/**
+ * @brief Set whether focus manager will play a feedback when the focus leaves the end or vice versa.
+ *
+ * If wrap mode is enabled, the feedback will be played once. In next time, focus will move continueously.
+ * Otherwise, feedback will be played with overshot signal
+ *
+ * @pre The FocusManager has been initialized.
+ * @param enabled Whether the endcap feedback is enabled or not
+ */
+ void SetEndCapFeedbackEnabled(bool enabled);
+
+ /**
+ * @brief Get whether the endcap feedback is enabled or not.
+ *
+ * @pre The FocusManager has been initialized.
+ * @return Whether the endcap feedback is enabled or not.
+ */
+ bool GetEndCapFeedbackEnabled() const;
+
+ /**
* @brief Set the focus indicator actor.
*
* This will replace the default focus indicator actor in
%define dali_data_rw_dir /opt/usr/share/dali/
%define dali_data_ro_dir /usr/share/dali/
%define dali_toolkit_image_files %{dali_data_ro_dir}/toolkit/images/
+%define dali_toolkit_sound_files %{dali_data_ro_dir}/toolkit/sounds/
%define dev_include_path %{_includedir}
##############################
%defattr(-,root,root,-)
%{_libdir}/lib%{name}.so*
%{dali_toolkit_image_files}/*
+%{dali_toolkit_sound_files}/*
%{_datadir}/license/%{name}
%files devel