Fixed operation of Indiactor.
authorKeuckdo Bang <keuckdo.bang@samsung.net>
Thu, 29 Aug 2013 07:09:29 +0000 (16:09 +0900)
committerKeuckdo Bang <keuckdo.bang@samsung.net>
Thu, 29 Aug 2013 07:55:31 +0000 (16:55 +0900)
Change-Id: Ieddc01a4eba09ab84f5c25733dac6dc64e2e0edb

src/ui/controls/FUiCtrl_Form.cpp
src/ui/controls/FUiCtrl_Frame.cpp
src/ui/controls/FUiCtrl_Indicator.cpp
src/ui/controls/FUiCtrl_Keypad.cpp
src/ui/controls/FUiCtrl_Popup.cpp
src/ui/inc/FUiCtrl_Form.h
src/ui/inc/FUiCtrl_Frame.h
src/ui/inc/FUiCtrl_Indicator.h
src/ui/inc/FUiCtrl_Keypad.h
src/ui/inc/FUi_ResourceFormConfig.h
src/ui/resource/FUi_ResourceFormConfig.cpp

index 9bf6ea1..f33910c 100644 (file)
@@ -3492,6 +3492,11 @@ _Form::OnVisibleStateChanged(void)
                                }
                        }
                }
+               ActivateIndicator();
+       }
+       else
+       {
+               DeactivateIndicator();
        }
        AdjustClientBounds();
 }
@@ -3531,8 +3536,26 @@ _Form::OnFormActivated(void)
 }
 
 void
-_Form::OnFormDeactivated(void)
+_Form::ActivateIndicator(void)
+{
+       if (__pIndicator)
+       {
+               __pIndicator->Activate();
+       }
+
+       return;
+}
+
+void
+_Form::DeactivateIndicator(void)
 {
+       if (__pIndicator)
+       {
+               __pIndicator->Deactivate();
+       }
+
+       return;
 }
 
+
 }}} // Tizen::Ui::Controls
index 6b727e9..2baea8f 100644 (file)
@@ -187,6 +187,7 @@ _Frame::OnActivated(void)
        }
 
        pCurrentForm->AddIndicatorObject();
+       pCurrentForm->ActivateIndicator();
 
        SetFocusWindowActivationChecked(true);
        _Control* pFocusControl = pCurrentForm->GetFocusControl();
@@ -202,6 +203,25 @@ _Frame::OnActivated(void)
        _AccessibilityManager::GetInstance()->RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM);
 }
 
+
+void
+_Frame::OnDeactivated(void)
+{
+       SysLog(NID_UI, "deactivated(%d)", __activated);
+
+       _Window::OnDeactivated();
+
+       _Form* pCurrentForm = GetCurrentForm();
+       if (pCurrentForm == null)
+       {
+               return;
+       }
+
+       pCurrentForm->DeactivateIndicator();
+
+}
+
+
 bool
 _Frame::OnNotifiedN(const _Control& source, IList* pArgs)
 {
index a1ad07f..b9327de 100644 (file)
@@ -20,6 +20,8 @@
  */
 
 #include <FGrpRectangle.h>
+#include <FUiAnimAnimationTransaction.h>
+#include <FUiAnimVisualElementPropertyAnimation.h>
 #include <FGrp_CoordinateSystem.h>
 #include <FUiAnim_VisualElementSurfaceImpl.h>
 #include "FUiAnim_VisualElement.h"
@@ -29,7 +31,9 @@
 #include "FUi_EcoreEvas.h"
 #include "FUi_ResourceManager.h"
 #include "FUi_CoordinateSystemUtils.h"
+#include "FUi_UiEventManager.h"
 #include "FUi_Window.h"
+#include "FUi_TouchManager.h"
 #include "FUiCtrl_Form.h"
 #include "FUiCtrl_Indicator.h"
 #include "FUiCtrl_IndicatorManager.h"
@@ -40,28 +44,37 @@ using namespace Tizen::Graphics;
 using namespace Tizen::Ui;
 using namespace Tizen::Ui::Animations;
 
-namespace Tizen { namespace Ui { namespace Controls
-{
-
 static const char* pPortraitSvcName = "elm_indicator_portrait";
 static const char* pLandScapeSvcName = "elm_indicator_landscape";
 static const char* pPortPublicKey = "__Plug_Ecore_Evas_Port";
 static const char* pLandPublicKey = "__Plug_Ecore_Evas_Land";
 static const char* pIndicatorKey = "Inidcator_Manager_Object";
 static const int CONNECTION_INTERVAL = 1000;
+static const int ANIMATION_INTERVAL = 3000;
+static const int ANIMATION_DURATION = 300;
 
-#define MSG_DOMAIN_CONTROL_INDICATOR 0x10001
-#define MSG_ID_INDICATOR_REPEAT_EVENT 0x10002
-#define MSG_ID_INDICATOR_ROTATION 0x10003
-#define MSG_ID_INDICATOR_OPACITY 0X1004
-#define MSG_ID_INDICATOR_TYPE 0X1005
+static const int MSG_DOMAIN_CONTROL_INDICATOR = 0x10001;
+static const int MSG_ID_INDICATOR_REPEAT_EVENT = 0x10002;
+static const int MSG_ID_INDICATOR_ROTATION = 0x10003;
+static const int MSG_ID_INDICATOR_OPACITY = 0X1004;
+static const int MSG_ID_INDICATOR_TYPE = 0X1005;
+static const int MSG_ID_INDICATOR_START_ANIMATION = 0X10006;
+
+namespace Tizen { namespace Ui { namespace Controls
+{
 
-typedef enum
+struct _IndicatorDataAnimation
+{
+   Ecore_X_Window xwin;
+   double duration;
+};
+
+enum
 {
    _INDICATOR_TYPE_UNKNOWN, /**< Unknown indicator type mode */
    _INDICATOR_TYPE_1, /**< Type 0 the the indicator */
    _INDICATOR_TYPE_2, /**< Type 1 the indicator */
-} _IndicatorTypeMode;
+} _IndicatorType;
 
 _Indicator*
 _Indicator::CreateIndicator(void)
@@ -89,6 +102,7 @@ _Indicator::_Indicator(void)
        : __pPortraitIndicatorEvasObject(null)
        , __pLandscapeIndicatorEvasObject(null)
        , __pConnectionTimer(null)
+       , __pAnimationTimer(null)
        , __pPortraitVisualElement(null)
        , __pLandscapeVisualElement(null)
        , __pCurrentVisualElement(null)
@@ -98,6 +112,9 @@ _Indicator::_Indicator(void)
        , __landscapeautohide(false)
        , __opacity(_INDICATOR_OPACITY_OPAQUE)
        , __orientation(_CONTROL_ORIENTATION_PORTRAIT)
+       , __startTouchPoint(0.0f, 0.0f)
+       , __animationing(false)
+       , __touchPressed(false)
 {
 }
 
@@ -109,6 +126,15 @@ _Indicator::~_Indicator(void)
                delete __pConnectionTimer;
                __pConnectionTimer = null;
        }
+
+       if (__pAnimationTimer != null)
+       {
+               __pAnimationTimer->Cancel();
+               delete __pAnimationTimer;
+               __pAnimationTimer = null;
+       }
+
+       _UiEventManager::GetInstance()->RemoveTouchEventListener(*this);
 }
 
 result
@@ -119,10 +145,13 @@ _Indicator::SetIndicatorShowState(bool state)
        _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
        SysTryReturnResult(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] Unable to get evas");
 
+       Ecore_X_Window win = 0;
+
        if (__pWindow)
        {
                r = pEcoreEvas->SetIndicatorShowState(*__pWindow, state);
                SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+               win = (Ecore_X_Window)__pWindow->GetNativeHandle();
        }
 
        __showstate = state;
@@ -152,12 +181,22 @@ _Indicator::SetIndicatorAutoHide(bool portrait, bool landscape)
                {
                        Color bgColor(0x00000000);
                        SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
+                       if (__pPortraitVisualElement)
+                       {
+                               __pPortraitVisualElement->SetShowState(false);
+                       }
                        ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
+                       ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
                }
                else
                {
                        SetIndicatorOpacity(__opacity);
+                       if (__pPortraitVisualElement)
+                       {
+                               __pPortraitVisualElement->SetShowState(true);
+                       }
                        ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
+                       ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
                }
        }
        else
@@ -166,12 +205,22 @@ _Indicator::SetIndicatorAutoHide(bool portrait, bool landscape)
                {
                        Color bgColor(0x00000000);
                        SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
+                       if (__pLandscapeVisualElement)
+                       {
+                               __pLandscapeVisualElement->SetShowState(false);
+                       }
                        ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
+                       ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
                }
                else
                {
                        SetIndicatorOpacity(__opacity);
+                       if (__pLandscapeVisualElement)
+                       {
+                               __pLandscapeVisualElement->SetShowState(true);
+                       }
                        ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
+                       ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
                }
        }
        __portraitautohide = portrait;
@@ -255,20 +304,17 @@ _Indicator::GetIndicatorBounds(void) const
        const Dimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSize();
        const Dimension landscapeSize = Dimension(portraitSize.height, portraitSize.width);
 
-       _ControlOrientation orientation = __pWindow->GetOrientation();
-
        Rectangle indicatorbounds(0, 0, 0, 0);
 
-       if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
+       if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
        {
                indicatorbounds.width = portraitSize.width;
-               GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
        }
        else
        {
                indicatorbounds.width = landscapeSize.width;
-               GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
        }
+       GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
 
        _CoordinateSystem* pCoordSystem = _CoordinateSystem::GetInstance();
        SysTryReturn(NID_UI_CTRL, pCoordSystem, Rectangle(-1, -1, -1, -1), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
@@ -287,21 +333,19 @@ _Indicator::GetIndicatorBoundsF(void) const
        const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
        const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
 
-       _ControlOrientation orientation = __pWindow->GetOrientation();
-
        FloatRectangle indicatorbounds(0.0f, 0.0f, 0.0f, 0.0f);
 
-       if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
+       if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
        {
                indicatorbounds.width = portraitSize.width;
-               GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
        }
        else
        {
                indicatorbounds.width = landscapeSize.width;
-               GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
        }
 
+       GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
+
        _CoordinateSystem* pCoordSystem = _CoordinateSystem::GetInstance();
        SysTryReturn(NID_UI_CTRL, pCoordSystem, FloatRectangle(-1.0, -1.0, -1.0, -1.0), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
 
@@ -354,6 +398,8 @@ _Indicator::AddIndicatorObject(_Control* pControl, _Window* pWindow)
        ecore_evas_callback_msg_handle_set(pPortraitEe, _Indicator::OnMessageHandle);
        ecore_evas_callback_msg_handle_set(pLandscapeEe, _Indicator::OnMessageHandle);
 
+       Activate();
+
        return r;
 }
 
@@ -410,6 +456,13 @@ _Indicator::ChangeCurrentVisualElement(Tizen::Ui::Animations::_VisualElement* pV
 void
 _Indicator::OnChangeLayout(_ControlOrientation orientation)
 {
+       RemoveIndicatorAnimations();
+       if (__pAnimationTimer != null)
+       {
+               __pAnimationTimer->Cancel();
+               __animationing = false;
+       }
+
        Ecore_X_Window win = 0;
        if (__pWindow)
        {
@@ -427,12 +480,22 @@ _Indicator::OnChangeLayout(_ControlOrientation orientation)
                {
                        Color bgColor(0x00000000);
                        SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
+                       if (__pPortraitVisualElement)
+                       {
+                               __pPortraitVisualElement->SetShowState(false);
+                       }
                        ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
+                       ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
                }
                else
                {
                        SetIndicatorOpacity(__opacity);
+                       if (__pPortraitVisualElement)
+                       {
+                               __pPortraitVisualElement->SetShowState(true);
+                       }
                        ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
+                       ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
                }
 
        }
@@ -445,12 +508,22 @@ _Indicator::OnChangeLayout(_ControlOrientation orientation)
                {
                        Color bgColor(0x00000000);
                        SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
+                       if (__pLandscapeVisualElement)
+                       {
+                               __pLandscapeVisualElement->SetShowState(false);
+                       }
                        ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
+                       ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
                }
                else
                {
                        SetIndicatorOpacity(__opacity);
+                       if (__pLandscapeVisualElement)
+                       {
+                               __pLandscapeVisualElement->SetShowState(true);
+                       }
                        ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
+                       ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
                }
        }
 }
@@ -471,25 +544,35 @@ _Indicator::OnAttachedToMainTree(void)
 void
 _Indicator::OnTimerExpired(Timer& timer)
 {
-       Eina_Bool result = EINA_TRUE;
-
-       _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
-       if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
+       if (__pConnectionTimer == &timer)
        {
-               result = ecore_evas_extn_plug_connect(__pPortraitIndicatorEvasObject, pPortraitSvcName, 0, EINA_FALSE);
+               Eina_Bool result = EINA_TRUE;
+
+               _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
+               if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
+               {
+                       result = ecore_evas_extn_plug_connect(__pPortraitIndicatorEvasObject, pPortraitSvcName, 0, EINA_FALSE);
+               }
+               else
+               {
+                       result = ecore_evas_extn_plug_connect(__pLandscapeIndicatorEvasObject, pLandScapeSvcName, 0, EINA_FALSE);
+               }
+
+               if (result == EINA_TRUE)
+               {
+                       timer.Cancel();
+               }
+               else
+               {
+                       timer.Start(CONNECTION_INTERVAL);
+               }
        }
-       else
+       else if(__pAnimationTimer == &timer)
        {
-               result = ecore_evas_extn_plug_connect(__pLandscapeIndicatorEvasObject, pLandScapeSvcName, 0, EINA_FALSE);
-       }
+               ShowIndicatorEffect(false, ANIMATION_DURATION);
 
-       if (result == EINA_TRUE)
-       {
                timer.Cancel();
-       }
-       else
-       {
-               timer.Start(CONNECTION_INTERVAL);
+               __animationing = false;
        }
 }
 
@@ -579,6 +662,9 @@ _Indicator::OnMessageHandle(Ecore_Evas *pEe, int msgDomain, int msgId, void *dat
                return;
        }
 
+       _Indicator* pIndicator = (_Indicator*)ecore_evas_data_get(pEe, pIndicatorKey);
+       SysTryReturnVoidResult(NID_UI_CTRL, pIndicator, E_SYSTEM, "[E_SYSTEM] Unable to get Indicator Object");
+
        Evas_Object* pPortraitIndicatorEvasObject = (Evas_Object*)ecore_evas_data_get(pEe, pPortPublicKey);
        Evas_Object* pLandscapeIndicatorEvasObject = (Evas_Object*)ecore_evas_data_get(pEe, pLandPublicKey);
 
@@ -610,6 +696,22 @@ _Indicator::OnMessageHandle(Ecore_Evas *pEe, int msgDomain, int msgId, void *dat
                                }
                        }
                }
+               else if (msgId == MSG_ID_INDICATOR_START_ANIMATION)
+               {
+                       _IndicatorDataAnimation* pData = (_IndicatorDataAnimation*)data;
+                       Ecore_X_Window win = 0;
+                       _Window* pWindow = pIndicator->__pWindow;
+                       if (pWindow)
+                       {
+                                       win = (Ecore_X_Window)pWindow->GetNativeHandle();
+                       }
+
+                       if (pData->xwin == win)
+                       {
+                               pIndicator->ShowIndicatorEffect(true, pData->duration);
+                       }
+               }
+
        }
 }
 
@@ -626,55 +728,428 @@ _Indicator::OnHitTest(const Tizen::Graphics::FloatPoint& point)
                return HIT_TEST_NOWHERE;
        }
 
-       Evas_Object* pImageObject = null;
-       if (this->__pCurrentVisualElement)
+       if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
        {
-               _VisualElementImpl* pImpl = _VisualElementImpl::GetInstance(*this->__pCurrentVisualElement);
-               if (pImpl)
+               if (__portraitautohide)
+               {
+                       return HIT_TEST_NOWHERE;
+               }
+               else
+               {
+                       return HIT_TEST_MATCH;
+               }
+       }
+       else
+       {
+               if (__landscapeautohide)
                {
-                       _EflNode* pNativeNode = dynamic_cast< _EflNode* >(pImpl->GetNativeNode());
-                       if (pNativeNode)
+                       return HIT_TEST_NOWHERE;
+               }
+               else
+               {
+                       return HIT_TEST_MATCH;
+               }
+       }
+
+}
+
+void
+_Indicator::SetIndicatorOrientation(Tizen::Ui::_ControlOrientation orientation)
+{
+       __orientation = orientation;
+}
+
+void
+_Indicator::SetWindow(_Window* pWindow)
+{
+       __pWindow = pWindow;
+}
+
+result
+_Indicator::ShowIndicatorEffect(bool down, int duration)
+{
+       Ecore_X_Window win = 0;
+       if (__pWindow)
+       {
+               win = (Ecore_X_Window)__pWindow->GetNativeHandle();
+       }
+
+       VisualElementPropertyAnimation* pSlideAnimation = new (std::nothrow) VisualElementPropertyAnimation();
+       SysTryReturnResult(NID_UI_CTRL, pSlideAnimation, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+
+       pSlideAnimation->SetDuration(duration);
+       pSlideAnimation->SetPropertyName( L"bounds.position");
+       pSlideAnimation->SetVisualElementAnimationStatusEventListener(this);
+
+       float indicatorHeight = 0.0f;
+       GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __orientation, indicatorHeight);
+
+       String* pUserData = null;
+       if (down)
+       {
+               Color bgColor(0xff1e1e1e);
+               SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
+
+               if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
+               {
+                       if (__pPortraitVisualElement)
                        {
-                               VisualElementSurface* pPortraitSurface = pNativeNode->GetSurface();
-                               if (pPortraitSurface)
-                               {
-                                       _EflVisualElementSurfaceImpl* pSurface = dynamic_cast<_EflVisualElementSurfaceImpl*>(_VisualElementSurfaceImpl::GetInstance(*pPortraitSurface));
-                                       if (pSurface)
-                                       {
-                                               pImageObject = (Evas_Object*)pSurface->GetNativeHandle();
-                                       }
-                               }
+                               __pPortraitVisualElement->SetShowState(true);
                        }
                }
+               else
+               {
+                       if (__pLandscapeVisualElement)
+                       {
+                               __pLandscapeVisualElement->SetShowState(true);
+                       }
+               }
+
+               pSlideAnimation->SetStartValue(Variant(FloatPoint(0.0f, -indicatorHeight)));
+               pSlideAnimation->SetEndValue(Variant(FloatPoint(0.0f, 0.0f)));
+               ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
+               pUserData = new (std::nothrow) String(L"DownAnimation");
+               SysTryReturnResult(NID_UI_CTRL, pUserData, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       }
+       else
+       {
+               pSlideAnimation->SetStartValue(Variant(FloatPoint(0.0f, 0.0f)));
+               pSlideAnimation->SetEndValue(Variant(FloatPoint(0.0f, -indicatorHeight)));
+               ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
+               pUserData = new (std::nothrow) String(L"UpAnimation");
+               SysTryReturnResult(NID_UI_CTRL, pUserData, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
+       }
+       pSlideAnimation->SetUserData((void*)(pUserData));
+       AddAnimation( L"bounds.position", *pSlideAnimation);
+
+       delete pSlideAnimation;
+
+       return E_SUCCESS;
+}
+
+void
+_Indicator::RemoveIndicatorAnimations(void)
+{
+       if (__pAnimationTimer)
+       {
+               __pAnimationTimer->Cancel();
+       }
+       RemoveAllAnimations();
+}
+
+bool
+_Indicator::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
+{
+       bool r = false;
+       if (IsVisible() ==false)
+       {
+               return false;
        }
 
-       if (pImageObject)
+       int pointId = touchinfo.GetPointId();
+       _TouchManager* pTouchManager = _TouchManager::GetInstance();
+
+       FloatPoint touchPosition = source.ConvertToScreenPosition(touchinfo.GetCurrentPosition());
+       int indicatorHeight = 0;
+       if (__pWindow)
+       {
+               GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorHeight);
+       }
+       else
        {
-               if (!evas_object_repeat_events_get(pImageObject))
+               return false;
+       }
+       if (touchPosition.y < indicatorHeight)
+       {
+               if (__animationing)
                {
-                       return HIT_TEST_MATCH;
+                       return true;
                }
                else
                {
-                       return HIT_TEST_NOWHERE;
+                       __startTouchPoint = touchinfo.GetCurrentPosition();
+                       __touchPressed = true;
+                       __pointId = pointId;
+               }
+
+               if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
+               {
+                       if (__portraitautohide)
+                       {
+                               return false;
+                       }
+                       else
+                       {
+                               return true;
+                       }
+               }
+               else
+               {
+                       if (__landscapeautohide)
+                       {
+                               return false;
+                       }
+                       else
+                       {
+                               return true;
+                       }
                }
        }
+
+       if (pTouchManager->IsListenerOnly(pointId) == true )
+       {
+               return true;
+       }
        else
        {
-               return HIT_TEST_NOWHERE;
+               return false;
+       }
+}
+
+bool
+_Indicator::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
+{
+       if (IsVisible() ==false)
+       {
+               return false;
+       }
+
+       _TouchManager* pTouchManager = _TouchManager::GetInstance();
+
+       if (__touchPressed)
+       {
+               if (touchinfo.GetPointId() == __pointId)
+               {
+                       __touchPressed = false;
+               }
+
+               FloatPoint touchPosition = source.ConvertToScreenPosition(touchinfo.GetCurrentPosition());
+               int indicatorHeight = 0;
+               if (__pWindow)
+               {
+                       GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorHeight);
+               }
+               else
+               {
+                       return false;
+               }
+               if (touchPosition.y < indicatorHeight)
+               {
+                       if (__animationing)
+                       {
+                               return true;
+                       }
+               }
+
+               if (pTouchManager->IsListenerOnly(touchinfo.GetPointId()) == true)
+               {
+                       return true;
+               }
+               else
+               {
+                       return false;
+               }
+       }
+       return false;
+}
+
+bool
+_Indicator::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
+{
+       bool r = false;
+
+       if (IsVisible() ==false)
+       {
+               return false;
+       }
+
+       int pointId = touchinfo.GetPointId();
+       _TouchManager* pTouchManager = _TouchManager::GetInstance();
+
+       if (__touchPressed)
+       {
+               FloatPoint touchPoint = touchinfo.GetCurrentPosition();
+               float gap = touchPoint.y - __startTouchPoint.y;
+
+               int touchGap = 0;
+               if (__pWindow)
+               {
+                       GET_SHAPE_CONFIG(FORM::INDICATOR_TOUCH_GAP, __pWindow->GetOrientation(), touchGap);
+               }
+               else
+               {
+                       return false;
+               }
+
+               if (gap < touchGap || __animationing)
+               {
+               }
+               else
+               {
+                       if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
+                       {
+                               if (__portraitautohide)
+                               {
+                                       ShowIndicatorEffect(true, ANIMATION_DURATION);
+                               }
+                       }
+                       else
+                       {
+                               if (__landscapeautohide)
+                               {
+                                       ShowIndicatorEffect(true, ANIMATION_DURATION);
+                               }
+                       }
+               }
+               
+               if (pTouchManager->IsListenerOnly(pointId) == true)
+               {
+                       r = true;
+               }
+               else
+               {
+                       r = false;
+               }
+       }
+       else
+       {
+               r = false;
+       }
+       return r;
+}
+
+bool
+_Indicator::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
+{
+       return false;
+}
+
+void
+_Indicator::OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target)
+{
+       String* pUserData = (String*) animation.GetUserData();
+
+       if ((pUserData != null) && (*pUserData == String(L"DownAnimation")))
+       {
+               if (__pAnimationTimer == null)
+               {
+                       __pAnimationTimer = new (std::nothrow) Timer;
+                       if (__pAnimationTimer == null)
+                       {
+                               return;
+                       }
+
+                       result r = __pAnimationTimer->Construct(*this);
+                       if (r != E_SUCCESS)
+                       {
+                               delete __pAnimationTimer;
+                               __pAnimationTimer = null;
+
+                               return;
+                       }
+               }
+
+               __pAnimationTimer->Start(ANIMATION_INTERVAL);
+
+               __animationing = true;
        }
 }
 
 void
-_Indicator::SetIndicatorOrientation(Tizen::Ui::_ControlOrientation orientation)
+_Indicator::OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount)
 {
-       __orientation = orientation;
+
 }
 
 void
-_Indicator::SetWindow(_Window* pWindow)
+_Indicator::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
 {
-       __pWindow = pWindow;
+       String* pUserData = (String*) animation.GetUserData();
+
+       if ((pUserData != null) && (*pUserData == String(L"UpAnimation")))
+       {
+               Color bgColor(0x00000000);
+               SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
+
+               int indicatorHeight = 0;
+               GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorHeight);
+               SetBounds(FloatRectangle(0.0f, 0.0f, GetIndicatorBoundsF().width, indicatorHeight));
+
+               if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
+               {
+                       if (__pPortraitVisualElement)
+                       {
+                               __pPortraitVisualElement->SetShowState(false);
+                       }
+               }
+               else
+               {
+                       if (__pLandscapeVisualElement)
+                       {
+                               __pLandscapeVisualElement->SetShowState(false);
+                       }
+               }
+               delete pUserData;
+       }
+}
+
+void
+_Indicator::Activate(void)
+{
+       _UiEventManager::GetInstance()->AddTouchEventListener(*this);
+
+       return;
+}
+
+void
+_Indicator::Deactivate(void)
+{
+       _UiEventManager::GetInstance()->RemoveTouchEventListener(*this);
+
+       if (__pAnimationTimer)
+       {
+               __pAnimationTimer->Cancel();
+       }
+       RemoveAllAnimations();
+
+       Ecore_X_Window win = 0;
+       if (__pWindow)
+       {
+               win = (Ecore_X_Window)__pWindow->GetNativeHandle();
+       }
+
+       if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
+       {
+               if (__portraitautohide)
+               {
+                       Color bgColor(0x00000000);
+                       SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
+
+                       if (__pPortraitVisualElement)
+                       {
+                               __pPortraitVisualElement->SetShowState(false);
+                               ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
+                       }
+                       __animationing = false;
+               }
+       }
+       else
+       {
+               if (__landscapeautohide)
+               {
+                       Color bgColor(0x00000000);
+                       SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
+
+                       if (__pLandscapeVisualElement)
+                       {
+                               __pLandscapeVisualElement->SetShowState(false);
+                               ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
+                       }
+                       __animationing = false;
+               }
+       }
+
+       return;
 }
 
 }}} // Tizen::Ui::Controls
index 03934ef..fd7e432 100755 (executable)
@@ -878,4 +878,26 @@ _Keypad::IsLayoutChangable(void) const
        return true;
 }
 
+void
+_Keypad::OnActivated(void)
+{
+       _Window::OnActivated();
+
+       if (__pIndicator)
+       {
+               __pIndicator->Activate();
+       }
+}
+
+void
+_Keypad::OnDeactivated(void)
+{
+       _Window::OnDeactivated();
+
+       if (__pIndicator)
+       {
+               __pIndicator->Deactivate();
+       }
+}
+
 } } } // Tizen::Ui::Controls
index a675a36..e66c61d 100644 (file)
@@ -618,6 +618,8 @@ _Popup::OnActivated(void)
                                __pIndicator->SetIndicatorAutoHide(false, false);
                        }
                }
+
+               __pIndicator->Activate();
        }
 
        _Window::OnActivated();
@@ -634,6 +636,11 @@ _Popup::OnDeactivated(void)
 
        ReleaseTouchCapture();
 
+       if (__pIndicator)
+       {
+               __pIndicator->Deactivate();
+       }
+
        _Window::OnDeactivated();
 }
 
@@ -830,6 +837,7 @@ _Popup::OnChangeLayout(_ControlOrientation orientation)
                        }
                        else
                        {
+                               __pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, landscapeSize.width, indicatorheight));
                                if (FORM_STYLE_LANDSCAPE_INDICATOR_AUTO_HIDE & pForm->GetFormStyle())
                                {
                                        __pIndicator->SetIndicatorShowState(true);
index eb240e3..c7e652b 100644 (file)
@@ -217,6 +217,9 @@ public:
        void SetFormOrientationStatusEventListener(Tizen::Ui::Controls::_IFormOrientationStatusEventListener* pFormOrientationstatusEventListener);
        Tizen::Ui::OrientationStatus GetFormOrientationStatus(void) const;
 
+       void ActivateIndicator(void);
+       void DeactivateIndicator(void);
+
 //callback
        virtual void OnDraw(void);
        virtual void OnActionPerformed(const Tizen::Ui::_Control& source, int actionId);
index 5f11fd1..1bd7bb9 100644 (file)
@@ -54,6 +54,7 @@ public:
 // Callbacks
        virtual void OnDraw(void);
        virtual void OnActivated(void);
+       virtual void OnDeactivated(void);
        virtual void OnChildAttached(const Tizen::Ui::_Control& child);
        virtual void OnChildDetached(const Tizen::Ui::_Control& child);
        virtual bool OnNotifiedN(const Tizen::Ui::_Control& source, Tizen::Base::Collection::IList* pArgs);
index 4890b65..e8562f2 100644 (file)
 #define _FUI_CTRL_INTERNAL_INDICATOR_H_
 
 #include <FBaseRtTimer.h>
+#include <FUiAnimIVisualElementAnimationStatusEventListener.h>
 #include "FUi_Control.h"
 #include "FUi_EcoreEvas.h"
 #include "FUiAnim_ControlVisualElement.h"
+#include "FUi_ITouchEventListener.h"
 
 namespace Tizen { namespace Ui { namespace Animations
 {
@@ -44,6 +46,8 @@ namespace Tizen { namespace Ui { namespace Controls
 class _Indicator
        : public Tizen::Ui::Animations::_ControlVisualElement
        , public Tizen::Base::Runtime::ITimerEventListener
+       , public Tizen::Ui::_ITouchEventListener
+       , public Tizen::Ui::Animations::IVisualElementAnimationStatusEventListener
 {
 public:
                _Indicator(void);
@@ -70,6 +74,12 @@ public:
                void SetIndicatorOrientation(Tizen::Ui::_ControlOrientation orientation);
                void SetWindow(Tizen::Ui::_Window* pWindow);
 
+               result ShowIndicatorEffect(bool down, int duration);
+               void RemoveIndicatorAnimations(void);
+
+               void Activate(void);
+               void Deactivate(void);
+
                void OnChangeLayout(_ControlOrientation orientation);
                result OnAttachedToMainTree(void);
                virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
@@ -78,6 +88,15 @@ public:
 
                virtual Animations::HitTestResult OnHitTest(const Tizen::Graphics::FloatPoint& point);
 
+               virtual bool OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
+               virtual bool OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo);
+               virtual bool OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo);
+               virtual bool OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo);
+
+               virtual void OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target);
+               virtual void OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount);
+               virtual void OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally);
+
 private:
                _Indicator(const _Indicator& value);
                _Indicator& operator =(const _Indicator& value);
@@ -86,6 +105,7 @@ private:
                Evas_Object* __pPortraitIndicatorEvasObject;
                Evas_Object* __pLandscapeIndicatorEvasObject;
                Tizen::Base::Runtime::Timer* __pConnectionTimer;
+               Tizen::Base::Runtime::Timer* __pAnimationTimer;
                Tizen::Ui::Animations::_VisualElement* __pPortraitVisualElement;
                Tizen::Ui::Animations::_VisualElement* __pLandscapeVisualElement;
                Tizen::Ui::Animations::_VisualElement* __pCurrentVisualElement;
@@ -95,7 +115,10 @@ private:
                bool __landscapeautohide;
                _IndicatorOpacity __opacity;
                Tizen::Ui::_ControlOrientation __orientation;
-
+               Tizen::Graphics::FloatPoint __startTouchPoint;
+               bool __animationing;
+               bool __touchPressed;
+               int __pointId;
 }; // _Indicator
 
 }}} // Tizen::Ui::Controls
index 41ddf22..658330a 100644 (file)
@@ -112,6 +112,9 @@ public:
 
        virtual bool IsLayoutChangable(void) const;
 
+       virtual void OnActivated(void);
+       virtual void OnDeactivated(void);
+
 private:
        _Keypad(void);
        _Keypad(const _Keypad&);
index d575c84..b67ca4b 100644 (file)
@@ -30,6 +30,7 @@ DECLARE_UI_CONFIG(FORM);
        DECLARE_SHAPE_CONFIG(INDICATOR_HEIGHT, 2)
        DECLARE_SHAPE_CONFIG(INDICATOR_MINIMIZE_WIDTH, 3)
        DECLARE_SHAPE_CONFIG(INDICATOR_MINIMIZE_HEIGHT, 4)
+       DECLARE_SHAPE_CONFIG(INDICATOR_TOUCH_GAP, 5)
 DECLARE_END_UI_CONFIG(FORM);
 
 #endif //_FUI_RESOURCE_FORM_CONFIG_H_
\ No newline at end of file
index 97d9af3..b7b5d9f 100644 (file)
@@ -39,11 +39,13 @@ START_UI_CONFIG(FORM);
        START_UI_CONFIG_MODE(720x1280);
                ADD_SHAPE_CONFIG(INDICATOR_WIDTH, 720);
                ADD_SHAPE_CONFIG(INDICATOR_HEIGHT, 60);
+               ADD_SHAPE_CONFIG(INDICATOR_TOUCH_GAP, 40);
        END_UI_CONFIG_MODE(720x1280);
 
        START_UI_CONFIG_MODE(1280x720);
                ADD_SHAPE_CONFIG(INDICATOR_WIDTH, _SCREEN_HEIGHT_);
                ADD_SHAPE_CONFIG(INDICATOR_HEIGHT, 60);
+               ADD_SHAPE_CONFIG(INDICATOR_TOUCH_GAP, 40);
        END_UI_CONFIG_MODE(1280x720);
 
        START_UI_CONFIG_MODE(1280x720);