Modified focus ui behavior for DateTimePicker
authorBhavya Kumili <bhavya.k@samsung.com>
Thu, 11 Jul 2013 11:56:09 +0000 (17:26 +0530)
committerBhavya Kumili <bhavya.k@samsung.com>
Thu, 11 Jul 2013 12:34:14 +0000 (18:04 +0530)
Change-Id: I4f6d3a8c2238ccbe73f62511fff72d1bad3ab734

src/ui/controls/FUiCtrl_DateTimePresenter.cpp

index c00d339..513a5b1 100644 (file)
@@ -729,8 +729,6 @@ _DateTimePresenter::OnActionPerformed(const _Control& source, int actionId)
 bool
 _DateTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
 {
-       int boxId = 0;
-
        if (!__keypadEnabled)
        {
                return false;
@@ -738,17 +736,6 @@ _DateTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo
 
        _KeyCode keyCode = keyInfo.GetKeyCode();
 
-       if (__focusedBoxIndex < __outputBoxMaxCount)
-       {
-               boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
-
-               if ((keyCode != _KEY_RIGHT) && (keyCode != _KEY_LEFT) && (keyCode != _KEY_TAB) && (boxId == DATETIME_ID_MONTH))
-               {
-                       //month can be changed only with touch on input pad
-                       return true;
-               }
-       }
-
        switch (keyCode)
        {
                case _KEY_RIGHT:
@@ -944,11 +931,39 @@ _DateTimePresenter::HandleInputPadValueChange(int inputPadReturnValue)
        else if (boxId == DATETIME_ID_MONTH)
        {
                PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_SIP, __pView);
-               newNumber = inputPadReturnValue;
-               __inputComposing = DATETIME_INPUT_BEGIN;
+
+               if (__inputComposing == DATETIME_INPUT_BEGIN && __keypadEnabled)
+               {
+                       currentNumber = GetNumberInBox(boxId);
+                       newNumber = currentNumber * 10 + inputPadReturnValue;
+
+                       if (newNumber > 12)
+                       {
+                               newNumber = 12;
+                       }
+                       else if (newNumber < 1)
+                       {
+                               newNumber = 1;
+                       }
+
+                       ChangeFocusBox();
+               }
+               else
+               {
+                       if (inputPadReturnValue == 0)
+                       {
+                               return;
+                       }
+                       newNumber = inputPadReturnValue;
+                       __inputComposing = DATETIME_INPUT_BEGIN;
+
+                       if (!__keypadEnabled || newNumber > 1)
+                       {
+                               ChangeFocusBox();
+                       }
+               }
 
                SetNumberInBox(boxId, newNumber);
-               ChangeFocusBox();
        }
        else
        {