Fixed Coding Idioms Violations
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_Indicator.cpp
index a1ad07f..c6da460 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,40 @@ using namespace Tizen::Graphics;
 using namespace Tizen::Ui;
 using namespace Tizen::Ui::Animations;
 
-namespace Tizen { namespace Ui { namespace Controls
+namespace
 {
+const char* pPortraitSvcName = "elm_indicator_portrait";
+const char* pLandScapeSvcName = "elm_indicator_landscape";
+const char* pPortPublicKey = "__Plug_Ecore_Evas_Port";
+const char* pLandPublicKey = "__Plug_Ecore_Evas_Land";
+const char* pIndicatorKey = "Inidcator_Manager_Object";
+const int CONNECTION_INTERVAL = 1000;
+const int ANIMATION_INTERVAL = 3000;
+const int ANIMATION_DURATION = 200;
+
+const int MSG_DOMAIN_CONTROL_INDICATOR = 0x10001;
+const int MSG_ID_INDICATOR_REPEAT_EVENT = 0x10002;
+const int MSG_ID_INDICATOR_ROTATION = 0x10003;
+const int MSG_ID_INDICATOR_OPACITY = 0X1004;
+const int MSG_ID_INDICATOR_TYPE = 0X1005;
+const int MSG_ID_INDICATOR_START_ANIMATION = 0X10006;
+}
 
-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;
+namespace Tizen { namespace Ui { namespace Controls
+{
 
-#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
+struct _IndicatorDataAnimation
+{
+   Ecore_X_Window xwin;
+   double duration;
+};
 
-typedef enum
+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 +105,7 @@ _Indicator::_Indicator(void)
        : __pPortraitIndicatorEvasObject(null)
        , __pLandscapeIndicatorEvasObject(null)
        , __pConnectionTimer(null)
+       , __pAnimationTimer(null)
        , __pPortraitVisualElement(null)
        , __pLandscapeVisualElement(null)
        , __pCurrentVisualElement(null)
@@ -98,6 +115,10 @@ _Indicator::_Indicator(void)
        , __landscapeautohide(false)
        , __opacity(_INDICATOR_OPACITY_OPAQUE)
        , __orientation(_CONTROL_ORIENTATION_PORTRAIT)
+       , __startTouchPoint(0.0f, 0.0f)
+       , __animationing(false)
+       , __touchPressed(false)
+       , __quickpanelOpened(false)
 {
 }
 
@@ -109,6 +130,15 @@ _Indicator::~_Indicator(void)
                delete __pConnectionTimer;
                __pConnectionTimer = null;
        }
+
+       if (__pAnimationTimer != null)
+       {
+               __pAnimationTimer->Cancel();
+               delete __pAnimationTimer;
+               __pAnimationTimer = null;
+       }
+
+       _UiEventManager::GetInstance()->RemoveTouchEventListener(*this);
 }
 
 result
@@ -119,10 +149,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 +185,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 +209,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 +308,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 +337,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.");
 
@@ -339,9 +387,9 @@ _Indicator::AddIndicatorObject(_Control* pControl, _Window* pWindow)
                r = ChangeCurrentVisualElement(__pLandscapeVisualElement);
        }
 
-       Ecore_Evas *pPortraitEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
+       Ecore_EvaspPortraitEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
        SysTryReturn(NID_UI_CTRL, pPortraitEe, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
-       Ecore_Evas *pLandscapeEe = ecore_evas_object_ecore_evas_get(__pLandscapeIndicatorEvasObject);
+       Ecore_EvaspLandscapeEe = ecore_evas_object_ecore_evas_get(__pLandscapeIndicatorEvasObject);
        SysTryReturn(NID_UI_CTRL, pLandscapeEe, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
 
        ecore_evas_data_set(pPortraitEe, pPortPublicKey, __pPortraitIndicatorEvasObject);
@@ -354,6 +402,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;
 }
 
@@ -380,6 +430,21 @@ _Indicator::DeleteIndicatorObject(void)
                }
        }
 
+       Ecore_Evas* pPortraitEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
+       Ecore_Evas* pLandscapeEe = ecore_evas_object_ecore_evas_get(__pLandscapeIndicatorEvasObject);
+
+       if (pPortraitEe)
+       {
+               ecore_evas_callback_delete_request_set(pPortraitEe, null);
+               ecore_evas_callback_msg_handle_set(pPortraitEe, null);
+       }
+
+       if (pLandscapeEe)
+       {
+               ecore_evas_callback_delete_request_set(pLandscapeEe, null);
+               ecore_evas_callback_msg_handle_set(pLandscapeEe, null);
+       }
+
        __pPortraitIndicatorEvasObject = null;
        __pLandscapeIndicatorEvasObject = null;
        __pPortraitVisualElement = null;
@@ -410,6 +475,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 +499,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 +527,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,30 +563,40 @@ _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;
        }
 }
 
 void
-_Indicator::OnDisconnected(Ecore_Evas *pEe)
+_Indicator::OnDisconnected(Ecore_EvaspEe)
 {
        _Indicator* pIndicator = (_Indicator*)ecore_evas_data_get(pEe, pIndicatorKey);
        SysTryReturnVoidResult(NID_UI_CTRL, pIndicator, E_SYSTEM, "[E_SYSTEM] Unable to get Indicator Object");
@@ -572,13 +674,16 @@ _Indicator::IsNotificationTrayOpenEnabled(void) const
 }
 
 void
-_Indicator::OnMessageHandle(Ecore_Evas *pEe, int msgDomain, int msgId, void *data, int size)
+_Indicator::OnMessageHandle(Ecore_EvaspEe, int msgDomain, int msgId, void *data, int size)
 {
        if (!data)
        {
                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);
 
@@ -586,7 +691,7 @@ _Indicator::OnMessageHandle(Ecore_Evas *pEe, int msgDomain, int msgId, void *dat
        {
                if (msgId == MSG_ID_INDICATOR_REPEAT_EVENT)
                {
-                       int *repeat = (int*)data;
+                       intrepeat = (int*)data;
                        if (1 == *repeat)
                        {
                                if (pPortraitIndicatorEvasObject)
@@ -610,6 +715,35 @@ _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)
+                       {
+                               if (pIndicator->__orientation == _CONTROL_ORIENTATION_PORTRAIT)
+                               {
+                                       if (pIndicator->__portraitautohide)
+                                       {
+                                               pIndicator->ShowIndicatorEffect(true, pData->duration);
+                                       }
+                               }
+                               else
+                               {
+                                       if (pIndicator->__landscapeautohide)
+                                       {
+                                               pIndicator->ShowIndicatorEffect(true, pData->duration);
+                                       }
+                               }
+                       }
+               }
+
        }
 }
 
@@ -626,55 +760,472 @@ _Indicator::OnHitTest(const Tizen::Graphics::FloatPoint& point)
                return HIT_TEST_NOWHERE;
        }
 
-       Evas_Object* pImageObject = null;
-       if (this->__pCurrentVisualElement)
+       if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
+       {
+               if (__portraitautohide)
+               {
+                       return HIT_TEST_NOWHERE;
+               }
+               else
+               {
+                       return HIT_TEST_MATCH;
+               }
+       }
+       else
+       {
+               if (__landscapeautohide)
+               {
+                       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)
+                       {
+                               __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;
+       }
+
+       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
+       {
+               return false;
+       }
+       if (touchPosition.y < indicatorHeight)
+       {
+               if (__animationing)
+               {
+                       return true;
+               }
+               else
+               {
+                       __startTouchPoint = touchPosition;
+                       __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 false;
+       }
+}
+
+bool
+_Indicator::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
+{
+       if (IsVisible() ==false)
        {
-               _VisualElementImpl* pImpl = _VisualElementImpl::GetInstance(*this->__pCurrentVisualElement);
-               if (pImpl)
+               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)
                {
-                       _EflNode* pNativeNode = dynamic_cast< _EflNode* >(pImpl->GetNativeNode());
-                       if (pNativeNode)
+                       if (__animationing)
                        {
-                               VisualElementSurface* pPortraitSurface = pNativeNode->GetSurface();
-                               if (pPortraitSurface)
+                               return true;
+                       }
+               }
+
+               if (pTouchManager->IsListenerOnly(touchinfo.GetPointId()) == true)
+               {
+                       _TouchManager* pTouchManager = _TouchManager::GetInstance();
+                       if (pTouchManager)
+                       {
+                               if(pTouchManager->GetTouchControlSource() == &source)
                                {
-                                       _EflVisualElementSurfaceImpl* pSurface = dynamic_cast<_EflVisualElementSurfaceImpl*>(_VisualElementSurfaceImpl::GetInstance(*pPortraitSurface));
-                                       if (pSurface)
-                                       {
-                                               pImageObject = (Evas_Object*)pSurface->GetNativeHandle();
-                                       }
+                                       SysLog(NID_UI, "VisibleState changed false, Call SetTouchCanceled");
+                                       pTouchManager->SetTouchCanceled(null);
                                }
                        }
+                       return true;
+               }
+               else
+               {
+                       return false;
                }
        }
+       else if (__quickpanelOpened == true)
+       {
+               OnChangeLayout(__orientation);
+               __quickpanelOpened = 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 (pImageObject)
+       if (__touchPressed)
        {
-               if (!evas_object_repeat_events_get(pImageObject))
+               FloatPoint touchPoint = source.ConvertToScreenPosition(touchinfo.GetCurrentPosition());
+               float gap = touchPoint.y - __startTouchPoint.y;
+
+               int touchGap = 0;
+               if (__pWindow)
                {
-                       return HIT_TEST_MATCH;
+                       GET_SHAPE_CONFIG(FORM::INDICATOR_TOUCH_GAP, __pWindow->GetOrientation(), touchGap);
                }
                else
                {
-                       return HIT_TEST_NOWHERE;
+                       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
        {
-               return HIT_TEST_NOWHERE;
+               if (__pAnimationTimer)
+               {
+                       __pAnimationTimer->Cancel();
+               }
+               __quickpanelOpened = true;
+               __animationing = false;
+               r = false;
        }
+       return r;
+}
+
+bool
+_Indicator::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
+{
+       return false;
 }
 
 void
-_Indicator::SetIndicatorOrientation(Tizen::Ui::_ControlOrientation orientation)
+_Indicator::OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target)
 {
-       __orientation = orientation;
+       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;
+                       }
+               }
+
+               if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
+               {
+                       if (__portraitautohide)
+                       {
+                               __pAnimationTimer->Start(ANIMATION_INTERVAL);
+                               __animationing = true;
+                       }
+               }
+               else
+               {
+                       if (__landscapeautohide)
+                       {
+                               __pAnimationTimer->Start(ANIMATION_INTERVAL);
+                               __animationing = true;
+                       }
+               }
+       }
 }
 
 void
-_Indicator::SetWindow(_Window* pWindow)
+_Indicator::OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount)
 {
-       __pWindow = pWindow;
+
+}
+
+void
+_Indicator::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
+{
+       const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
+       const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
+
+       String* pUserData = (String*) animation.GetUserData();
+
+       if ((pUserData != null) && (*pUserData == String(L"UpAnimation")))
+       {
+               Color bgColor(0x00000000);
+
+               int indicatorHeight = 0;
+               GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorHeight);
+
+               if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
+               {
+                       if (__portraitautohide)
+                       {
+                               SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
+                               if (__pPortraitVisualElement && __portraitautohide)
+                               {
+                                       __pPortraitVisualElement->SetShowState(false);
+                               }
+                       }
+                       SetBounds(FloatRectangle(0.0f, 0.0f, portraitSize.width, indicatorHeight));
+               }
+               else
+               {
+                       if (__landscapeautohide)
+                       {
+                               SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
+                               if (__pLandscapeVisualElement && __landscapeautohide)
+                               {
+                                       __pLandscapeVisualElement->SetShowState(false);
+                               }
+                       }
+                       SetBounds(FloatRectangle(0.0f, 0.0f, landscapeSize.width, indicatorHeight));
+               }
+               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