fix check defect and toolbar longpress disable
authorMyung Jin Kim <critical.kim@samsung.com>
Mon, 29 Apr 2013 15:03:50 +0000 (00:03 +0900)
committerMyung Jin Kim <critical.kim@samsung.com>
Mon, 29 Apr 2013 15:03:50 +0000 (00:03 +0900)
Change-Id: I61b30f56a070ac88621eaa230e18bf219a9141be

src/ui/controls/FUiCtrl_CheckButton.cpp
src/ui/controls/FUiCtrl_CheckButtonPresenter.cpp
src/ui/controls/FUiCtrl_ToolbarPresenter.cpp
src/ui/inc/FUiCtrl_CheckButtonPresenter.h

index c93b5d1..a632b3f 100644 (file)
@@ -655,6 +655,7 @@ _CheckButton::SetPropertySelected(const Variant& selected)
        if (__checkButtonStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING || __checkButtonStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
        {
                __pCheckButtonPresenter->CalculateButtonBounds();
+               __pCheckButtonPresenter->InitOnOffHandlerMoved();
                __pCheckButtonPresenter->AdjustHandlerPosition();
        }
 
index d0915e9..d4fca48 100644 (file)
@@ -1404,6 +1404,14 @@ _CheckButtonPresenter::OnTouchReleased(const _Control& source, const _TouchInfo&
 
        if (status == _CHECK_BUTTON_STATUS_NORMAL && __onOffHandlerPressed == false)
        {
+               if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING || checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
+               {
+                       AdjustHandlerPosition();
+
+                       __onOffHandlerPressed = false;
+                       __onOffHandlerMoved = false;
+               }
+
                return true;
        }
 
@@ -1506,6 +1514,14 @@ _CheckButtonPresenter::OnTouchReleased(const _Control& source, const _TouchInfo&
 }
 
 result
+_CheckButtonPresenter::InitOnOffHandlerMoved(void)
+{
+       __onOffHandlerMoved = false;
+
+       return E_SUCCESS;
+}
+
+result
 _CheckButtonPresenter::AdjustHandlerPosition(void)
 {
        float handlerWidth = 0.0f;
@@ -1591,6 +1607,7 @@ _CheckButtonPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& to
 
        FloatRectangle bounds = __pCheckButton->GetClientBoundsF();
        bool isInCheckButtonArea = bounds.Contains(touchPoint);
+       bool isInOnOffHandlerArea = __onOffSlidingButtonBounds.Contains(touchPoint);
 
        if (__onOffHandlerPressed == true)
        {
@@ -1598,7 +1615,7 @@ _CheckButtonPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& to
        }
        else
        {
-               if (isInCheckButtonArea == true && (__touchMoveHandled != true))
+               if (isInCheckButtonArea == true && __touchMoveHandled == false && isInOnOffHandlerArea == false )
                {
                        __pCheckButton->SetCheckButtonStatus(_CHECK_BUTTON_STATUS_PRESSED);
                }
@@ -1612,9 +1629,7 @@ _CheckButtonPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& to
 
        if (checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING || checkStyle == CHECK_BUTTON_STYLE_ONOFF_SLIDING_WITH_DIVIDER)
        {
-               bool isInOnOffHandlerArea = __onOffSlidingButtonBounds.Contains(touchPoint);
-
-               if (isInOnOffHandlerArea == true)
+               if (isInOnOffHandlerArea == true && __onOffHandlerPressed == true)
                {
                        __onOffHandlerPosition = touchPoint.x;
 
@@ -1624,7 +1639,14 @@ _CheckButtonPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& to
 
        __pCheckButton->Invalidate();
 
-       return false;
+       if (__onOffHandlerMoved == true)
+       {
+               return true;
+       }
+       else
+       {
+               return false;
+       }
 }
 
 void
index b6de7ba..f94765f 100644 (file)
@@ -1306,6 +1306,8 @@ _ToolbarPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& tou
                                        }
                                }
 
+                               __pToolbar->Invalidate(true);
+
                                return true;
                        }
                }
@@ -1417,17 +1419,17 @@ _ToolbarPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchi
        }
        else
        {
-               if (__initialPressesItemStatus == _BUTTON_STATUS_DISABLED)
-               {
-                       return false;
-               }
-
                if (__tabMoved)
                {
                        pCurrentButton->SetButtonStatus(__initialPressesItemStatus, false);
                }
                else
                {
+                       if (__initialPressesItemStatus == _BUTTON_STATUS_DISABLED)
+                       {
+                               return false;
+                       }
+
                        if (itemBounds.Contains(touchPoint))
                        {
                                pCurrentButton->SetButtonStatus(_BUTTON_STATUS_PRESSED);
@@ -1593,14 +1595,18 @@ _ToolbarPresenter::OnLongPressGestureDetected(void)
                        return false;
                }
 
-               __editItemIndex = longPressedItemIndex;
-
-               __beingEdited = true;
-
                _Button* pButton = null;
-               pButton = __pToolbar->GetItem(__editItemIndex);
+               pButton = __pToolbar->GetItem(longPressedItemIndex);
                SysTryReturn(NID_UI_CTRL, pButton, true, E_INVALID_STATE, "[E_INVALID_STATE] Unable to retrieve a button");
 
+               if (pButton->GetButtonStatus() == _BUTTON_STATUS_DISABLED)
+               {
+                       return false;
+               }
+
+               __editItemIndex = longPressedItemIndex;
+               __beingEdited = true;
+
                pButton->SetButtonStatus(_BUTTON_STATUS_NORMAL);
 
                FloatRectangle itemBounds = pButton->GetBoundsF();
index 31dec6c..213084c 100644 (file)
@@ -84,6 +84,7 @@ public:
 
        result AdjustHandlerPosition(void);
        result CalculateButtonBounds(void);
+       result InitOnOffHandlerMoved(void);
 protected:
        result SetModel(const _CheckButtonModel& checkButtonModel);