[3.0] change adding focus indicator logic 55/112655/4
authorminho.sun <minho.sun@samsung.com>
Thu, 2 Feb 2017 06:21:44 +0000 (15:21 +0900)
committerminho.sun <minho.sun@samsung.com>
Fri, 3 Feb 2017 01:36:52 +0000 (10:36 +0900)
Make sure KeyboardFocusManager add focus indicator according to
mIsFocusIndicatorEnabled.

Change-Id: I036dbf4acf75214108d21dedce73cf604279669e
Signed-off-by: minho.sun <minho.sun@samsung.com>
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp
dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h

index e6ed691..001f2af 100644 (file)
@@ -111,16 +111,13 @@ KeyboardFocusManager::KeyboardFocusManager()
 : mCurrentFocusActor(0),
   mFocusIndicatorActor(),
   mFocusGroupLoopEnabled(false),
-  mIsKeyboardFocusEnabled(false),
   mIsFocusIndicatorEnabled(false),
   mIsWaitingKeyboardFocusChangeCommit(false),
   mSlotDelegate(this)
 {
-  OnPhysicalKeyboardStatusChanged(PhysicalKeyboard::Get());
-
+  // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorEnabled.
   Toolkit::KeyInputFocusManager::Get().UnhandledKeyEventSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
   Stage::GetCurrent().TouchSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch );
-  PhysicalKeyboard::Get().StatusChangedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnPhysicalKeyboardStatusChanged);
 }
 
 KeyboardFocusManager::~KeyboardFocusManager()
@@ -148,9 +145,8 @@ bool KeyboardFocusManager::DoSetCurrentFocusActor( const unsigned int actorID )
   // Check whether the actor is in the stage and is keyboard focusable.
   if( actor && actor.IsKeyboardFocusable() )
   {
-    mIsFocusIndicatorEnabled = true;
-    // Draw the focus indicator upon the focused actor when PhysicalKeyboard is attached
-    if( mIsKeyboardFocusEnabled )
+    // Draw the focus indicator upon the focused actor when Focus Indicator is enabled
+    if( mIsFocusIndicatorEnabled )
     {
       actor.Add( GetFocusIndicatorActor() );
     }
@@ -463,39 +459,8 @@ Actor KeyboardFocusManager::GetFocusIndicatorActor()
   return mFocusIndicatorActor;
 }
 
-void KeyboardFocusManager::OnPhysicalKeyboardStatusChanged(PhysicalKeyboard keyboard)
-{
-  mIsKeyboardFocusEnabled = keyboard.IsAttached();
-
-  if(mIsKeyboardFocusEnabled)
-  {
-    // Show indicator when keyboard focus turned on if there is focused actor.
-    Actor actor = GetCurrentFocusActor();
-    if(actor)
-    {
-      actor.Add( GetFocusIndicatorActor() );
-    }
-    mIsFocusIndicatorEnabled = true;
-  }
-  else
-  {
-    // Hide indicator when keyboard focus turned off
-    Actor actor = GetCurrentFocusActor();
-    if( actor && mFocusIndicatorActor )
-    {
-      actor.Remove( mFocusIndicatorActor );
-    }
-    mIsFocusIndicatorEnabled = false;
-  }
-}
-
 void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
 {
-  if(!mIsKeyboardFocusEnabled)
-  {
-    return;
-  }
-
   AccessibilityAdaptor accessibilityAdaptor = AccessibilityAdaptor::Get();
   bool isAccessibilityEnabled = accessibilityAdaptor.IsEnabled();
 
index 4eba5d3..1972b78 100644 (file)
@@ -19,8 +19,6 @@
  */
 
 // EXTERNAL INCLUDES
-#include <string>
-#include <dali/devel-api/adaptor-framework/physical-keyboard.h>
 #include <dali/public-api/object/base-object.h>
 
 // INTERNAL INCLUDES
@@ -220,12 +218,6 @@ private:
    */
   void OnTouch( const TouchData& touch );
 
-  /**
-   * Change the keyboard focus status when keyboard focus feature turned on or off.
-   * @return Whether the status is changed or not.
-   */
-  void OnPhysicalKeyboardStatusChanged(PhysicalKeyboard keyboard);
-
 private:
 
   // Undefined
@@ -246,8 +238,6 @@ private:
 
   bool mFocusGroupLoopEnabled:1; ///< Whether the focus movement is looped within the same focus group
 
-  bool mIsKeyboardFocusEnabled:1; ///< Whether keyboard focus feature turned on/off
-
   bool mIsFocusIndicatorEnabled:1; ///< Whether indicator should be shown / hidden. It could be enabled when keyboard focus feature enabled and navigation keys or 'Tab' key pressed.
 
   bool mIsWaitingKeyboardFocusChangeCommit:1; /// A flag to indicate PreFocusChangeSignal emitted but the proposed focus actor is not commited by the application yet.