Merging EditDateTime & DateTimePicker Changes from RSA-master to RSA-tizen2.1
authorSreedeep Moulik <sreedeep.m@samsung.com>
Mon, 20 May 2013 09:51:22 +0000 (15:21 +0530)
committerSreedeep Moulik <sreedeep.m@samsung.com>
Mon, 20 May 2013 09:51:22 +0000 (15:21 +0530)
Change-Id: I7010e9d6c4807c874e34769638855000ef26dbf9
Signed-off-by: Sreedeep Moulik <sreedeep.m@samsung.com>
21 files changed:
src/ui/controls/FUiCtrl_DateTimeBar.cpp
src/ui/controls/FUiCtrl_DateTimeBarPresenter.cpp
src/ui/controls/FUiCtrl_DateTimeDisplayBox.cpp
src/ui/controls/FUiCtrl_DateTimePicker.cpp
src/ui/controls/FUiCtrl_DateTimePresenter.cpp
src/ui/controls/FUiCtrl_DateTimeUtils.cpp
src/ui/controls/FUiCtrl_EditDate.cpp
src/ui/controls/FUiCtrl_EditDatePresenter.cpp
src/ui/controls/FUiCtrl_EditTime.cpp
src/ui/controls/FUiCtrl_EditTimePresenter.cpp
src/ui/controls/FUiCtrl_InputPadPresenter.cpp
src/ui/inc/FUiCtrl_DateTimeBar.h
src/ui/inc/FUiCtrl_DateTimeBarPresenter.h
src/ui/inc/FUiCtrl_DateTimeDefine.h
src/ui/inc/FUiCtrl_DateTimePicker.h
src/ui/inc/FUiCtrl_DateTimePresenter.h
src/ui/inc/FUiCtrl_DateTimeUtils.h
src/ui/inc/FUiCtrl_EditDate.h
src/ui/inc/FUiCtrl_EditDatePresenter.h
src/ui/inc/FUiCtrl_EditTime.h
src/ui/inc/FUiCtrl_EditTimePresenter.h

index 2f9e913..95da538 100644 (file)
@@ -651,6 +651,33 @@ _DateTimeBar::RefreshItems(void)
 }
 
 bool
+_DateTimeBar::OnFocusGained(const _Control& control)
+{
+       return true;
+}
+
+bool
+_DateTimeBar::OnFocusLost(const _Control& control)
+{
+       __pDateTimeBarPresenter->SetItemFocused(false);
+       return true;
+}
+
+void
+_DateTimeBar::OnDrawFocus(void)
+{
+       __pDateTimeBarPresenter->SetItemFocused(true);
+       __pDateTimeBarPresenter->DrawFocus();
+       return;
+}
+
+bool
+_DateTimeBar::OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo)
+{
+       return __pDateTimeBarPresenter->OnKeyPressed(source,keyInfo);
+}
+
+bool
 _DateTimeBar::OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element)
 {
        return __pDateTimeBarPresenter->OnAccessibilityFocusMovedNext(control, element);
@@ -714,7 +741,7 @@ _DateTimeBar::OnAccessibilityFocusIn(const _AccessibilityContainer& control, con
        }
        else if (__accessibilityFocusOutIndex > focusInIndex)
        {
-               if(pFocusInAccessibilityElement != null && pFocusInAccessibilityElement->GetBounds().x < 0)
+               if (pFocusInAccessibilityElement != null && pFocusInAccessibilityElement->GetBounds().x < 0)
                {
                        __pDateTimeBarPresenter->MovePrevious();
                }
index c417e11..dea9773 100644 (file)
@@ -35,8 +35,6 @@ using namespace Tizen::Base;
 using namespace Tizen::Base::Runtime;
 using namespace Tizen::Graphics::_Text;
 
-const int UPDATE_ITEM_COUNT = 3;
-
 namespace Tizen { namespace Ui { namespace Controls
 {
 
@@ -56,10 +54,14 @@ _DateTimeBarPresenter::_DateTimeBarPresenter(_DateTimeBar* pDateTimeBar)
        , __arrowAreaBounds(FloatRectangle())
        , __windowAreaBounds(FloatRectangle())
        , __pBgColorReplacementBitmap(null)
+       , __pFocusBitmap(null)
        , __pArrowColorReplacementBitmap(null)
        , __isInitialAnimation(false)
        , __initialAnimationValue(0.0f)
        , __pFont(null)
+       , __isFocused(false)
+       , __focusedIndex(-1)
+       , __focusBounds(FloatRectangle())
 {
 }
 
@@ -71,6 +73,9 @@ _DateTimeBarPresenter::~_DateTimeBarPresenter(void)
        delete __pBgColorReplacementBitmap;
        __pBgColorReplacementBitmap = null;
 
+       delete __pFocusBitmap;
+       __pFocusBitmap = null;
+
        delete __pArrowColorReplacementBitmap;
        __pArrowColorReplacementBitmap = null;
 
@@ -135,6 +140,9 @@ _DateTimeBarPresenter::LoadResource(void)
        SysTryCatch(NID_UI_CTRL, __pBgColorReplacementBitmap != null, r = GetLastResult(), GetLastResult(), "[%s] Propagating.",
                    GetErrorMessage(GetLastResult()));
 
+       r = GET_BITMAP_CONFIG_N(FOCUSUI::FOCUS, BITMAP_PIXEL_FORMAT_ARGB8888, __pFocusBitmap);
+       SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
        r = LoadArrowBitmap();
        SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to load resources.", GetErrorMessage(r));
 
@@ -153,6 +161,9 @@ CATCH:
        delete __pBgColorReplacementBitmap;
        __pBgColorReplacementBitmap = null;
 
+       delete __pFocusBitmap;
+       __pFocusBitmap = null;
+
        return r;
 }
 
@@ -225,14 +236,55 @@ _DateTimeBarPresenter::Draw(void)
        r = DrawArrow(*pCanvas);
        SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
+       if (__isFocused)
+       {
+               DrawFocus();
+       }
+
+CATCH:
        delete pCanvas;
        return r;
+}
 
+result
+_DateTimeBarPresenter::DrawFocus()
+{
+       Canvas* pCanvas = __pDateTimeBar->GetCanvasN();
+       SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create canvas.");
+
+       result r = E_SUCCESS;
+
+       if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pFocusBitmap))
+       {
+               r = pCanvas->DrawNinePatchedBitmap(__focusBounds, *__pFocusBitmap);
+               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+       else
+       {
+               r = pCanvas->DrawBitmap(__focusBounds, *__pFocusBitmap);
+               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+       }
 CATCH:
+
        delete pCanvas;
        return r;
 }
 
+void
+_DateTimeBarPresenter::SetItemFocused(bool isFocused)
+{
+       if (!__isFocused)
+       {
+               __focusedIndex = (GetSelectedItemIndex() - 1);
+               _DateTimeBarItem* pItem = null;
+               pItem = GetItemAt(__focusedIndex);
+
+               __focusBounds = pItem->GetBounds();
+       }
+       __isFocused = isFocused;
+       return;
+}
+
 result
 _DateTimeBarPresenter::DrawItem(Canvas& canvas)
 {
@@ -961,6 +1013,92 @@ _DateTimeBarPresenter::GetWindowBounds(void) const
 }
 
 bool
+_DateTimeBarPresenter::OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo)
+{
+       if (!__isFocused)
+       {
+               return false;
+       }
+
+       _KeyCode keyCode = keyInfo.GetKeyCode();
+
+       switch (keyCode)
+       {
+               case KEY_RIGHT:
+               {
+                       if ((__focusBounds.x + __focusBounds.width) > (GetWindowBounds().width - __focusBounds.width))
+                       {
+                               MoveNext();
+                       }
+                       else
+                       {
+                               __focusBounds.x = __focusBounds.x + __focusBounds.width + GetItemMargin();
+                               __pDateTimeBar->Invalidate();
+
+                       }
+                       __focusedIndex = GetItemIndexFromPosition(FloatPoint(__focusBounds.x, __focusBounds.y));
+
+                       break;
+               }
+
+               case KEY_LEFT:
+               {
+                       if ((__focusBounds.x - __focusBounds.width) < 0)
+                       {
+                               MovePrevious();
+                       }
+                       else
+                       {
+                               __focusBounds.x = __focusBounds.x - __focusBounds.width - GetItemMargin();
+                               __pDateTimeBar->Invalidate();
+                       }
+                       __focusedIndex = GetItemIndexFromPosition(FloatPoint(__focusBounds.x, __focusBounds.y));
+
+                       break;
+               }
+
+               case KEY_ENTER:
+               {
+                       _DateTimeBarItem* pItem = null;
+
+                       SetItemSelected(__focusedIndex);
+                       __pDateTimeBarModel->SetFirstDrawnItemIndex((__focusedIndex));
+
+                       if (__focusedIndex >= 0)
+                       {
+                               pItem = GetItemAt(__focusedIndex);
+                       }
+
+                       if (pItem != null)
+                       {
+                               __pDateTimeBar->SetVisibleState(false);
+                               __pDateTimeBar->Close();
+
+                               __pDateTimeBar->FireActionEvent(pItem->GetActionId());
+
+                               if (__pDateTimeBar->GetSelectedBoxId() >= DATETIME_ID_YEAR && __pDateTimeBar->GetSelectedBoxId() <= DATETIME_ID_DAY)
+                               {
+                                       __pDateTimeBar->FireDateTimeChangeEvent(DATE_INTERNAL_CHANGE_SAVED);
+                               }
+                               else if (__pDateTimeBar->GetSelectedBoxId() >= DATETIME_ID_HOUR && __pDateTimeBar->GetSelectedBoxId() <= DATETIME_ID_MINUTE)
+                               {
+                                       __pDateTimeBar->FireDateTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
+                               }
+                       }
+                       __isFocused = false;
+                       break;
+               }
+
+               default:
+               {
+                       return false;
+               }
+       }
+
+       return true;
+}
+
+bool
 _DateTimeBarPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
 {
        if (&source != __pDateTimeBar)
index 8dfcfa0..98c30a6 100644 (file)
@@ -56,7 +56,7 @@ _DateTimeDisplayBox::_DateTimeDisplayBox(const FloatRectangle& bounds, int boxId
 
        GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_NORMAL, __textColor[DATETIME_STATUS_NORMAL]);
        GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_HIGHLIGHTED, __textColor[DATETIME_STATUS_HIGHLIGHTED]);
-       GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_PRESSED, __textColor[DATETIME_STATUS_PRESSED]);
+       GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_PRESSED, __textColor[DATETIME_STATUS_SELECTED]);
        GET_COLOR_CONFIG(DATETIMEPICKER::TEXT_DISABLED, __textColor[DATETIME_STATUS_DISABLED]);
 }
 
@@ -190,14 +190,14 @@ _DateTimeDisplayBox::DrawBackground(Canvas& canvas, DateTimePickerStatus status)
        if (__boxId == DATETIME_ID_AMPM)
        {
                isCustomBitmap[DATETIME_STATUS_NORMAL] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_NORMAL);
-               isCustomBitmap[DATETIME_STATUS_PRESSED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_PRESSED);
+               isCustomBitmap[DATETIME_STATUS_SELECTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_PRESSED);
                isCustomBitmap[DATETIME_STATUS_HIGHLIGHTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_HIGHLIGHTED);
                isCustomBitmap[DATETIME_STATUS_DISABLED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_DISABLED);
        }
        else
        {
                isCustomBitmap[DATETIME_STATUS_NORMAL] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_NORMAL);
-               isCustomBitmap[DATETIME_STATUS_PRESSED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_PRESSED);
+               isCustomBitmap[DATETIME_STATUS_SELECTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_PRESSED);
                isCustomBitmap[DATETIME_STATUS_HIGHLIGHTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_HIGHLIGHTED);
                isCustomBitmap[DATETIME_STATUS_DISABLED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_DISABLED);
        }
@@ -251,7 +251,7 @@ void
 _DateTimeDisplayBox::SetBackgroundBitmap(Bitmap **pBackgroundNormalBitmap, Bitmap **pBackgroundEffectBitmap)
 {
        GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_TEXT_NORMAL, __textColor[DATETIME_STATUS_NORMAL]);
-       GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_TEXT_PRESSED, __textColor[DATETIME_STATUS_PRESSED]);
+       GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_TEXT_PRESSED, __textColor[DATETIME_STATUS_SELECTED]);
        GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_TEXT_HIGHLIGHTED, __textColor[DATETIME_STATUS_HIGHLIGHTED]);
        GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_TEXT_DISABLED, __textColor[DATETIME_STATUS_DISABLED]);
 
index 0889d37..6ff4c4f 100644 (file)
@@ -24,6 +24,7 @@
 #include <FBaseColIEnumeratorT.h>
 #include <FBaseSysLog.h>
 #include <FGrp_BitmapImpl.h>
+#include <FSysSettingInfo.h>
 
 #include "FUiCtrl_DateTimePicker.h"
 #include "FUiAnim_VisualElement.h"
@@ -49,6 +50,7 @@ using namespace Tizen::Base::Collection;
 using namespace Tizen::Graphics;
 using namespace Tizen::Ui;
 using namespace Tizen::Ui::Animations;
+using namespace Tizen::System;
 
 namespace Tizen { namespace Ui { namespace Controls
 {
@@ -67,6 +69,8 @@ _DateTimePicker::_DateTimePicker(_DateTimePresenter* pPresenter, const String& t
 
 _DateTimePicker::~_DateTimePicker(void)
 {
+       SettingInfo::RemoveSettingEventListener(*this);
+
        if (__pDateTimeChangeEvent != null)
        {
                delete __pDateTimeChangeEvent;
@@ -151,6 +155,9 @@ _DateTimePicker::CreateDateTimePickerN(int style, const String& title)
                pView->GetAccessibilityContainer()->Activate(true);
        }
 
+       r = SettingInfo::AddSettingEventListener(*pView);
+       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
        return pView;
 
 CATCH:
@@ -1090,6 +1097,64 @@ _DateTimePicker::OnFontInfoRequested(unsigned long& style, float& size)
        return;
 }
 
+bool
+_DateTimePicker::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+       if (&source != this)
+       {
+               return false;
+       }
+
+       return __pPresenter->OnKeyPressed(source, keyInfo);
+}
+
+bool
+_DateTimePicker::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+       if (&source != this)
+       {
+               return false;
+       }
+
+       return __pPresenter->OnKeyReleased(source, keyInfo);
+}
+
+void
+_DateTimePicker::OnDrawFocus(void)
+{
+       __pPresenter->DrawFocus();
+       return;
+}
+
+bool
+_DateTimePicker::OnFocusGained(const _Control& source)
+{
+       return _Control::OnFocusGained(source);
+}
+
+bool
+_DateTimePicker::OnFocusLost(const _Control& source)
+{
+       result r = __pPresenter->ReleaseFocus();
+       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, false, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       _Control::OnFocusLost(source);
+       return true;
+}
+
+void
+_DateTimePicker::OnSettingChanged(Tizen::Base::String& key)
+{
+        if (key.Equals(L"http://tizen.org/setting/locale.date.format", false)
+                        || key.Equals(L"http://tizen.org/setting/locale.time.format.24hour", false))
+        {
+                __pPresenter->UpdateLocaleDateTimeFormat();
+                Invalidate();
+        }
+
+        return;
+}
+
 Font*
 _DateTimePicker::GetDateTimeFont(void)
 {
index 0f57b3a..f96fd7d 100644 (file)
@@ -20,7 +20,7 @@
  * @brief              This is the implementation file for the _DateTimePresenter class.
  */
 
-#include <vconf.h>
+#include <FSysSettingInfo.h>
 #include <FBaseErrorDefine.h>
 #include <FBaseSysLog.h>
 #include <FGrp_TextTextObject.h>
@@ -43,6 +43,7 @@ using namespace Tizen::Base;
 using namespace Tizen::Graphics;
 using namespace Tizen::Graphics::_Text;
 using namespace Tizen::Ui::Animations;
+using namespace Tizen::System;
 
 namespace Tizen { namespace Ui { namespace Controls
 {
@@ -51,7 +52,7 @@ const int DATETIME_DISPLAY_STRING_MAX_LENGTH = 10;
 _DateTimePresenter::_DateTimePresenter(int pickerStyle, const String& title)
        : __pView(null)
        , __pModel(null)
-       , __selectedBoxIndex(-1)
+       , __selectedBoxIndex(0)
        , __focusedBoxIndex(0)
        , __pInputPad(null)
        , __inputPadType(INPUTPAD_STYLE_NORMAL)
@@ -64,6 +65,7 @@ _DateTimePresenter::_DateTimePresenter(int pickerStyle, const String& title)
        , __hour(0)
        , __minute(0)
        , __is24HourNotation(false)
+       , __dtp24HourSet(false)
        , __isPm(false)
        , __isPmButtonPressed(false)
        , __isFocusBoxChanged(false)
@@ -76,6 +78,7 @@ _DateTimePresenter::_DateTimePresenter(int pickerStyle, const String& title)
        , __pBgEffectBitmap(null)
        , __pFont(null)
        , __pPmBox(null)
+       , __keypadEnabled(false)
 {
        for (int i = 0; i < DATETIME_ID_MAX; i++)
        {
@@ -180,6 +183,7 @@ _DateTimePresenter::Construct(_DateTimePicker& view)
        SysTryReturnResult(NID_UI_CTRL, (__pModel != null), E_OUT_OF_MEMORY, "Memory allocation failed.");
 
        // Load display data for sync with model data
+       UpdateTimeFormat();
        LoadPickerData();
 
        if (__inputPadEnabled == true)
@@ -205,7 +209,12 @@ _DateTimePresenter::Construct(_DateTimePicker& view)
 
                __pInputPad->SetFont(__pFont);
 
-               _DateTimeDisplayBox* pDisplayBox = __pDisplayBox[__focusedBoxIndex];
+               if (__pInputPad->IsFocusable() == true)
+               {
+                       __pInputPad->SetFocusable(false);
+               }
+
+               _DateTimeDisplayBox* pDisplayBox = __pDisplayBox[__selectedBoxIndex];
                SysTryCatch(NID_UI_CTRL, (pDisplayBox != null), , E_SYSTEM,
                                        "[E_SYSTEM] A system error has occurred. Failed to get Display box.");
 
@@ -349,6 +358,7 @@ void
 _DateTimePresenter::Set24HourNotationEnabled(bool enable)
 {
        __is24HourNotation = enable;
+       __dtp24HourSet = true;
 
        UpdateDateTimeOutputConfig();
 }
@@ -399,7 +409,6 @@ _DateTimePresenter::SetFocusBoxId(int boxId)
                if (boxId == displayBoxId)
                {
                        SetFocusBox(i);
-                       ChangeInputPadStyle(boxId);
                        return;
                }
        }
@@ -516,6 +525,35 @@ _DateTimePresenter::SetFont(Font* pFont)
 }
 
 void
+_DateTimePresenter::UpdateLocaleDateTimeFormat(void)
+{
+       UpdateTimeFormat();
+
+       UpdateDateTimeOutputConfig();
+
+       LoadPickerData();
+
+       for (int i = 0; i < __outputBoxMaxCount; i++)
+       {
+               AdjustDisplayValue(i);
+       }
+
+       return;
+}
+
+void
+_DateTimePresenter::UpdateTimeFormat(void)
+{
+       if (!__dtp24HourSet)
+       {
+               String key(L"http://tizen.org/setting/locale.time.format.24hour");
+               SettingInfo::GetValue(key , __is24HourNotation);
+       }
+
+       return;
+}
+
+void
 _DateTimePresenter::OnChangeLayout(_ControlOrientation orientation)
 {
        result r = E_SUCCESS;
@@ -550,15 +588,18 @@ _DateTimePresenter::OnTouchPressed(const _Control& source, const _TouchInfo& tou
 
        int touchedAreaId = CalculateTouchArea(touchinfo.GetCurrentPosition().x, touchinfo.GetCurrentPosition().y);
 
+       if (touchedAreaId != DATETIME_AREA_INPUT)
+       {
+               __keypadEnabled = false;
+       }
+
        if (touchedAreaId == DATETIME_AREA_OUTPUT_AMPM)
        {
                __isPmButtonPressed = true;
-               __pView->Draw();
+               __pView->Invalidate(true);
                return true;
        }
 
-       __selectedBoxIndex = CalculateTouchOutputArea(touchinfo.GetCurrentPosition().x, touchinfo.GetCurrentPosition().y);
-
        return true;
 }
 
@@ -585,6 +626,11 @@ _DateTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
 
        int touchedAreaId = CalculateTouchArea(touchinfo.GetCurrentPosition().x, touchinfo.GetCurrentPosition().y);
 
+       if (touchedAreaId != DATETIME_AREA_INPUT)
+       {
+               __keypadEnabled = false;
+       }
+
        if (__isPmButtonPressed == true)
        {
                if (touchedAreaId == DATETIME_AREA_OUTPUT_AMPM)
@@ -596,7 +642,7 @@ _DateTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
                __inputComposing = DATETIME_INPUT_END;
                __changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
                __isPmButtonPressed = false;
-               __pView->Draw();
+               __pView->Invalidate(true);
 
                return true;
        }
@@ -604,9 +650,8 @@ _DateTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
        if ((touchedAreaId == DATETIME_AREA_NONE) || (touchedAreaId == DATETIME_AREA_INPUT) ||
                (touchedAreaId == DATETIME_AREA_OUTPUT_AMPM))
        {
-               __selectedBoxIndex = -1;
                __isPmButtonPressed = false;
-               __pView->Draw();
+               __pView->Invalidate(true);
 
                return true;
        }
@@ -616,11 +661,9 @@ _DateTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
        if (touchedAreaId == DATETIME_AREA_OUTPUT)
        {
                newOutputFocusedIndex = CalculateTouchOutputArea(touchinfo.GetCurrentPosition().x, touchinfo.GetCurrentPosition().y);
-               if ((newOutputFocusedIndex == (-1)) || (newOutputFocusedIndex == __focusedBoxIndex))
-               {
-                       __selectedBoxIndex = -1;
-                       __pView->Draw();
 
+               if (newOutputFocusedIndex == (-1))
+               {
                        return true;
                }
 
@@ -630,8 +673,10 @@ _DateTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
                        {
                                AdjustDisplayValue(i);
                        }
-
-                       SetFocusBox(newOutputFocusedIndex);
+               }
+               else
+               {
+                       __selectedBoxIndex = newOutputFocusedIndex;
                }
 
                _VisualElement* pVisualElement = null;
@@ -645,18 +690,17 @@ _DateTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
                r = GetLastResult();
                SysTryReturn(NID_UI_CTRL, (pCanvas != null), false, r, "[%s] Propagating.", GetErrorMessage(r));
 
-               DrawDateTimeDisplayBox(*pCanvas, __focusedBoxIndex);
+               DrawDateTimeDisplayBox(*pCanvas, __selectedBoxIndex);
 
                delete pCanvas;
 
-               __selectedBoxIndex = -1;
                __inputComposing = DATETIME_INPUT_END;
                __changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
 
-               int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
+               int boxId = __pDisplayBox[__selectedBoxIndex]->GetDisplayBoxId();
                ChangeInputPadStyle(boxId);
 
-               __pView->Draw();
+               __pView->Invalidate(true);
 
                return true;
        }
@@ -672,12 +716,11 @@ _DateTimePresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& to
                return false;
        }
 
-       __selectedBoxIndex = -1;
        __isPmButtonPressed = false;
        __inputComposing = DATETIME_INPUT_END;
        __changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
 
-       __pView->Draw();
+       __pView->Invalidate(true);
 
        return true;
 }
@@ -685,12 +728,175 @@ _DateTimePresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& to
 void
 _DateTimePresenter::OnInputPadValueChanged(const _Control& source, int inputPadReturnValue)
 {
+       HandleInputPadValueChange(inputPadReturnValue);
+}
+
+void
+_DateTimePresenter::OnActionPerformed(const _Control& source, int actionId)
+{
+       HandleSaveCancelAction(actionId);
+}
+
+bool
+_DateTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+       int boxId = 0;
+       __keypadEnabled = true;
+
+       _KeyCode keyCode = keyInfo.GetKeyCode();
+
+       if (__focusedBoxIndex < __outputBoxMaxCount)
+       {
+               boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
+
+               if ((keyCode != _KEY_RIGHT) && (keyCode != _KEY_LEFT) && (boxId == DATETIME_ID_MONTH))
+               {
+                       //month can be changed only with touch on input pad
+                       return true;
+               }
+       }
+
+       switch (keyCode)
+       {
+               case _KEY_RIGHT:
+               {
+                       if (__pickerStyle != DATETIME_OUTPUT_STYLE_DATE && __focusedBoxIndex < __outputBoxMaxCount)
+                       {
+                               __focusedBoxIndex++;
+                               SetFocusBox(__focusedBoxIndex);
+                       }
+                       else if (__pickerStyle == DATETIME_OUTPUT_STYLE_DATE && __focusedBoxIndex < __outputBoxMaxCount-1)
+                       {
+                               __focusedBoxIndex++;
+                               SetFocusBox(__focusedBoxIndex);
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+               break;
+               case _KEY_LEFT:
+               {
+                       if (__focusedBoxIndex  > 0)
+                       {
+                               __focusedBoxIndex--;
+                               SetFocusBox(__focusedBoxIndex);
+                       }
+                       else
+                       {
+                               return false;
+                       }
+               }
+               break;
+               case _KEY_ENTER:
+               {
+                       if (__focusedBoxIndex == __outputBoxMaxCount)
+                       {
+                               __isPmButtonPressed = true;
+                       }
+               }
+               break;
+               case _KEY_0:
+               case _KEY_NUMPAD_0:
+                       HandleInputPadValueChange(0);
+                       break;
+               case _KEY_1:
+               case _KEY_NUMPAD_1:
+                       HandleInputPadValueChange(1);
+                       break;
+               case _KEY_2:
+               case _KEY_NUMPAD_2:
+                       HandleInputPadValueChange(2);
+                       break;
+               case _KEY_3:
+               case _KEY_NUMPAD_3:
+                       HandleInputPadValueChange(3);
+                       break;
+               case _KEY_4:
+               case _KEY_NUMPAD_4:
+                       HandleInputPadValueChange(4);
+                       break;
+               case _KEY_5:
+               case _KEY_NUMPAD_5:
+                       HandleInputPadValueChange(5);
+                       break;
+               case _KEY_6:
+               case _KEY_NUMPAD_6:
+                       HandleInputPadValueChange(6);
+                       break;
+               case _KEY_7:
+               case _KEY_NUMPAD_7:
+                       HandleInputPadValueChange(7);
+                       break;
+               case _KEY_8:
+               case _KEY_NUMPAD_8:
+                       HandleInputPadValueChange(8);
+                       break;
+               case _KEY_9:
+               case _KEY_NUMPAD_9:
+                       HandleInputPadValueChange(9);
+                       break;
+               default:
+                       return false;
+       }
+
+       __pView->Invalidate(true);
+       return true;
+}
+
+bool
+_DateTimePresenter::OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo)
+{
+       _KeyCode keyCode = keyInfo.GetKeyCode();
+       if (__isPmButtonPressed == true && keyCode == _KEY_ENTER)
+       {
+               __isPm = (!__isPm);
+               __isPmButtonPressed = false;
+               __pView->Invalidate(true);
+       }
+
+       return true;
+}
+
+result
+_DateTimePresenter::DrawFocus(void)
+{
+       result r = E_SUCCESS;
+       __keypadEnabled = true;
+       __focusedBoxIndex = __selectedBoxIndex;
+
+       __pView->Invalidate(true);
+       return r;
+}
+
+result
+_DateTimePresenter::ReleaseFocus(void)
+{
+       result r = E_SUCCESS;
+       __keypadEnabled = false;
+       __focusedBoxIndex = 0;
+       __selectedBoxIndex = 0;
+
+       __pView->Invalidate(true);
+       return r;
+}
+
+void
+_DateTimePresenter::HandleInputPadValueChange(int inputPadReturnValue)
+{
        if ((__inputPadEnabled == false) || (inputPadReturnValue == -1))
        {
                return;
        }
 
-       int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
+       if ((__keypadEnabled == true) && (__pickerStyle != DATETIME_OUTPUT_STYLE_DATE) && (__focusedBoxIndex == __outputBoxMaxCount))
+       {
+               //in case of Am/Pm if keypad enabled, inputpad values need not be handled though in focus
+               return;
+       }
+
+       int boxId = __pDisplayBox[__selectedBoxIndex]->GetDisplayBoxId();
        int currentNumber = GetNumberInBox(boxId);
        int newNumber = 0;
 
@@ -756,11 +962,11 @@ _DateTimePresenter::OnInputPadValueChanged(const _Control& source, int inputPadR
                }
        }
 
-       __pView->Draw();
+       __pView->Invalidate(true);
 }
 
 void
-_DateTimePresenter::OnActionPerformed(const _Control& source, int actionId)
+_DateTimePresenter::HandleSaveCancelAction(int actionId)
 {
        result r = E_SUCCESS;
 
@@ -779,8 +985,9 @@ _DateTimePresenter::OnActionPerformed(const _Control& source, int actionId)
        __inputComposing = DATETIME_INPUT_END;
        __changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
        __focusedBoxIndex = 0;
+       __selectedBoxIndex = 0;
 
-       int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
+       int boxId = __pDisplayBox[__selectedBoxIndex]->GetDisplayBoxId();
 
        SetFocusBoxId(boxId);
        __pView->Close();
@@ -956,7 +1163,10 @@ _DateTimePresenter::UpdateDateTimeOutputConfig(void)
                float leftMargin = 0.0f;
                GET_SHAPE_CONFIG(DATETIMEPICKER::DATETIME_OUTPUT_LEFT_MARGIN, orientation, leftMargin);
 
-               switch (GetLocaleDateFormat())
+               _DateTimeUtils dateTimeUtils;
+               int localeDateFormat = dateTimeUtils.GetLocaleDateFormat();
+
+               switch (localeDateFormat)
                {
                case DATE_FORMAT_DDMMYYYY:
                        {
@@ -1157,7 +1367,7 @@ _DateTimePresenter::LoadResource(void)
        }
 
        GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_BG_NORMAL, backgroundColor[DATETIME_STATUS_NORMAL]);
-       GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_BG_PRESSED, backgroundColor[DATETIME_STATUS_PRESSED]);
+       GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_BG_PRESSED, backgroundColor[DATETIME_STATUS_SELECTED]);
        GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_BG_HIGHLIGHTED, backgroundColor[DATETIME_STATUS_HIGHLIGHTED]);
        GET_COLOR_CONFIG(DATETIMEPICKER::AMPM_BG_DISABLED, backgroundColor[DATETIME_STATUS_DISABLED]);
 
@@ -1189,7 +1399,7 @@ _DateTimePresenter::LoadResource(void)
        r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pDisplayBoxNormalBitmap[DATETIME_STATUS_NORMAL]);
        SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
 
-       r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pDisplayBoxNormalBitmap[DATETIME_STATUS_PRESSED]);
+       r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pDisplayBoxNormalBitmap[DATETIME_STATUS_SELECTED]);
        SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, pDisplayBoxNormalBitmap[DATETIME_STATUS_HIGHLIGHTED]);
@@ -1202,7 +1412,7 @@ _DateTimePresenter::LoadResource(void)
        r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pAmPmNormalBitmap[DATETIME_STATUS_NORMAL]);
        SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
 
-       r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pAmPmNormalBitmap[DATETIME_STATUS_PRESSED]);
+       r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pAmPmNormalBitmap[DATETIME_STATUS_SELECTED]);
        SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, pAmPmNormalBitmap[DATETIME_STATUS_HIGHLIGHTED]);
@@ -1212,12 +1422,12 @@ _DateTimePresenter::LoadResource(void)
        SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
 
        isDisplayBoxCustomBitmap[DATETIME_STATUS_NORMAL] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_NORMAL);
-       isDisplayBoxCustomBitmap[DATETIME_STATUS_PRESSED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_PRESSED);
+       isDisplayBoxCustomBitmap[DATETIME_STATUS_SELECTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_PRESSED);
        isDisplayBoxCustomBitmap[DATETIME_STATUS_HIGHLIGHTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_HIGHLIGHTED);
        isDisplayBoxCustomBitmap[DATETIME_STATUS_DISABLED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::CONTENT_BG_DISABLED);
 
        isAmPmCustomBitmap[DATETIME_STATUS_NORMAL] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_NORMAL);
-       isAmPmCustomBitmap[DATETIME_STATUS_PRESSED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_PRESSED);
+       isAmPmCustomBitmap[DATETIME_STATUS_SELECTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_PRESSED);
        isAmPmCustomBitmap[DATETIME_STATUS_HIGHLIGHTED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_HIGHLIGHTED);
        isAmPmCustomBitmap[DATETIME_STATUS_DISABLED] = IS_CUSTOM_BITMAP(DATETIMEPICKER::AMPM_BG_DISABLED);
 
@@ -1241,15 +1451,15 @@ _DateTimePresenter::LoadResource(void)
                SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
        }
 
-       if (!isDisplayBoxCustomBitmap[DATETIME_STATUS_PRESSED])
+       if (!isDisplayBoxCustomBitmap[DATETIME_STATUS_SELECTED])
        {
-               r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDisplayBoxEffectBitmap[DATETIME_STATUS_PRESSED]);
+               r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDisplayBoxEffectBitmap[DATETIME_STATUS_SELECTED]);
                SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
        }
 
        if (!isDisplayBoxCustomBitmap[DATETIME_STATUS_HIGHLIGHTED])
        {
-               r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDisplayBoxEffectBitmap[DATETIME_STATUS_HIGHLIGHTED]);
+               r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::CONTENT_BG_EFFECT_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, __pDisplayBoxEffectBitmap[DATETIME_STATUS_HIGHLIGHTED]);
                SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
        }
 
@@ -1280,9 +1490,9 @@ _DateTimePresenter::LoadResource(void)
                SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
        }
 
-       if (!isAmPmCustomBitmap[DATETIME_STATUS_PRESSED])
+       if (!isAmPmCustomBitmap[DATETIME_STATUS_SELECTED])
        {
-               r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmEffectBitmap[DATETIME_STATUS_PRESSED]);
+               r = GET_BITMAP_CONFIG_N(DATETIMEPICKER::AMPM_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pAmPmEffectBitmap[DATETIME_STATUS_SELECTED]);
                SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
        }
 
@@ -1408,18 +1618,28 @@ _DateTimePresenter::DrawDateTimeDisplayBox(Canvas& canvas, int index)
        {
                status = DATETIME_STATUS_DISABLED;
        }
-       else if (index == __selectedBoxIndex)
-       {
-               status = DATETIME_STATUS_PRESSED;
-       }
-       else if (index == __focusedBoxIndex)
+       else
        {
-               status = DATETIME_STATUS_HIGHLIGHTED;
+               if (__keypadEnabled)
+               {
+                       if (index == __focusedBoxIndex)
+                       {
+                               status = DATETIME_STATUS_HIGHLIGHTED;
+                       }
+               }
+               else
+               {
+                       if (index == __selectedBoxIndex)
+                       {
+                               status = DATETIME_STATUS_SELECTED;
+                       }
+               }
        }
 
        if (boxId == DATETIME_ID_YEAR)
        {
-               if ((__inputComposing == DATETIME_INPUT_BEGIN) && (status == DATETIME_STATUS_HIGHLIGHTED))
+               if ((__inputComposing == DATETIME_INPUT_BEGIN) && ((__keypadEnabled && status == DATETIME_STATUS_HIGHLIGHTED)
+                               || (!__keypadEnabled && status == DATETIME_STATUS_SELECTED)))
                {
                        String length = L"%0d";
 
@@ -1451,7 +1671,8 @@ _DateTimePresenter::DrawDateTimeDisplayBox(Canvas& canvas, int index)
        }
        else
        {
-               if ((__inputComposing == DATETIME_INPUT_BEGIN) && (status == DATETIME_STATUS_HIGHLIGHTED))
+               if ((__inputComposing == DATETIME_INPUT_BEGIN) && ((__keypadEnabled && status == DATETIME_STATUS_HIGHLIGHTED)
+                               || (!__keypadEnabled && status == DATETIME_STATUS_SELECTED)))
                {
                        r = text.Format(DATETIME_DISPLAY_STRING_MAX_LENGTH, L"%d", number);
                        SysTryReturnVoidResult(NID_UI_CTRL, (r == E_SUCCESS), r, "[%s] Propagating.", GetErrorMessage(r));
@@ -1481,8 +1702,6 @@ _DateTimePresenter::DrawPm(Canvas& canvas)
 
        _DateTimeUtils dateTimeUtils;
 
-
-
        if (__isPm == false)
        {
                dateTimeUtils.GetAmPm(text, AM_TYPE);
@@ -1500,11 +1719,18 @@ _DateTimePresenter::DrawPm(Canvas& canvas)
        }
        else if (__isPmButtonPressed == true)
        {
-               __pPmBox->DrawDisplayBox(canvas, DATETIME_STATUS_PRESSED);
+               __pPmBox->DrawDisplayBox(canvas, DATETIME_STATUS_SELECTED);
        }
        else
        {
-               __pPmBox->DrawDisplayBox(canvas, DATETIME_STATUS_NORMAL);
+               if (__keypadEnabled && __focusedBoxIndex == __outputBoxMaxCount)
+               {
+                       __pPmBox->DrawDisplayBox(canvas, DATETIME_STATUS_HIGHLIGHTED);
+               }
+               else
+               {
+                       __pPmBox->DrawDisplayBox(canvas, DATETIME_STATUS_NORMAL);
+               }
        }
 }
 
@@ -1977,13 +2203,30 @@ _DateTimePresenter::GetNumberInBox(int boxId) const
 void
 _DateTimePresenter::SetFocusBox(int index)
 {
-       __focusedBoxIndex = index;
+       if (__keypadEnabled)
+       {
+               __focusedBoxIndex = index;
+
+               if (__focusedBoxIndex < __outputBoxMaxCount)
+               {
+                       __selectedBoxIndex = __focusedBoxIndex;
+               }
+       }
+
        __isFocusBoxChanged = true;
+       __inputComposing = DATETIME_INPUT_END;
+       __changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
+
+       int boxId = __pDisplayBox[__selectedBoxIndex]->GetDisplayBoxId();
+
+       ChangeInputPadStyle(boxId);
 }
 
 void
 _DateTimePresenter::LoadPickerData(void)
 {
+       _DateTimeUtils dateTimeUtils;
+
        __year = GetYear();
        __month = GetMonth();
        __day = GetDay();
@@ -2017,6 +2260,7 @@ _DateTimePresenter::LoadPickerData(void)
                        __isPm = false;
                }
        }
+
        __minute = GetMinute();
 }
 
@@ -2170,7 +2414,7 @@ _DateTimePresenter::AdjustDisplayValue(int index)
                {
                        maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
 
-                       if(__hour == DATETIME_HOUR_MIN)
+                       if (__hour == DATETIME_HOUR_MIN)
                        {
                                minValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
                        }
@@ -2192,12 +2436,27 @@ _DateTimePresenter::AdjustDisplayValue(int index)
 void
 _DateTimePresenter::ChangeFocusBox(void)
 {
-       if (__focusedBoxIndex < (__outputBoxMaxCount - 1))
+       if (__keypadEnabled)
        {
-               __focusedBoxIndex++;
-               int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
-               ChangeInputPadStyle(boxId);
-               __isFocusBoxChanged = true;
+               if (__focusedBoxIndex < __outputBoxMaxCount - 1)
+               {
+                       __focusedBoxIndex++;
+                       __selectedBoxIndex = __focusedBoxIndex;
+                       int boxId = __pDisplayBox[__focusedBoxIndex]->GetDisplayBoxId();
+                       ChangeInputPadStyle(boxId);
+                       __isFocusBoxChanged = true;
+               }
+       }
+       else
+       {
+               if (__selectedBoxIndex < (__outputBoxMaxCount - 1))
+               {
+                       __selectedBoxIndex++;
+                       __focusedBoxIndex = __selectedBoxIndex;
+                       int boxId = __pDisplayBox[__selectedBoxIndex]->GetDisplayBoxId();
+                       ChangeInputPadStyle(boxId);
+                       __isFocusBoxChanged = true;
+               }
        }
 
        for (int i = 0; i < __outputBoxMaxCount; i++)
@@ -2209,19 +2468,6 @@ _DateTimePresenter::ChangeFocusBox(void)
        __changeFocusCounter = DATE_TIME_CHANGE_FOCUS_COUNTER_MIN;
 }
 
-int
-_DateTimePresenter::GetLocaleDateFormat(void) const
-{
-       int localeDateFormat = -1;
-       int error = vconf_get_int(VCONFKEY_SETAPPL_DATE_FORMAT_INT, &localeDateFormat);
-       if (error == -1)
-       {
-               localeDateFormat = SETTING_DATE_FORMAT_DD_MM_YYYY;
-       }
-
-       return localeDateFormat;
-}
-
 void
 _DateTimePresenter::SetAccessibilityElementText(void)
 {
index 912de49..66dfd09 100644 (file)
 
 #include <FBaseDateTime.h>
 #include <FLclDateTimeSymbols.h>
+#include <FLclLocaleManager.h>
+#include <FLclDateTimeFormatter.h>
+#include <FSysSettingInfo.h>
 #include "FUiCtrl_DateTimeUtils.h"
+#include "FUiCtrl_DateTimeDefine.h"
 #include "FUi_ResourceManager.h"
 
 using namespace Tizen::Base;
 using namespace Tizen::Locales;
 using namespace Tizen::Base::Collection;
+using namespace Tizen::System;
 
 namespace Tizen { namespace Ui { namespace Controls
 {
@@ -50,7 +55,7 @@ _DateTimeUtils::GetMonthString(int month) const
        dateSymbols.Construct(CALENDAR_GREGORIAN);
 
        const IList* pListOfShortMonths = dateSymbols.GetShortMonths();
-       SysTryReturn(NID_LCL, (pListOfShortMonths != null), text, E_SYSTEM, "[E_SYSTEM] A system error has occurred. pListOfShortMonths is null.");
+       SysTryReturn(NID_UI_CTRL, (pListOfShortMonths != null), text, E_SYSTEM, "[E_SYSTEM] A system error has occurred. pListOfShortMonths is null.");
 
        String* pObj = null;
        pObj = static_cast<String*>(const_cast<Object*>(pListOfShortMonths->GetAt(month - 1)));
@@ -116,7 +121,7 @@ _DateTimeUtils::GetAmPm(String& timeFormat, _AmPmType amPmType) const
        dateSymbols.Construct(CALENDAR_GREGORIAN);
 
        const IList* pListOfAmPm = dateSymbols.GetAmPm();
-       SysTryReturnVoidResult(NID_LCL, (pListOfAmPm != null), E_SYSTEM, "[E_SYSTEM] A system error has occurred. pListOfAmPm is null.");
+       SysTryReturnVoidResult(NID_UI_CTRL, (pListOfAmPm != null), E_SYSTEM, "[E_SYSTEM] A system error has occurred. pListOfAmPm is null.");
 
        String* pObj = null;
        pObj = static_cast<String*>(const_cast<Object*>(pListOfAmPm->GetAt(amPmType)));
@@ -151,4 +156,76 @@ _DateTimeUtils::GetFullMonthString(int month) const
 
        return text;
 }
+
+int
+_DateTimeUtils::GetLocaleDateFormat(void) const
+{
+       result r = E_SUCCESS;
+
+       LocaleManager localeManager;
+       int localeDateFormat = 0;
+
+       r = localeManager.Construct();
+       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, localeDateFormat, E_SYSTEM, "[E_SYSTEM] A system error has occurred.");
+
+       Locale systemLocale = localeManager.GetSystemLocale();
+
+       DateTimeFormatter* pDateFormatter = DateTimeFormatter::CreateDateFormatterN(systemLocale, DATE_TIME_STYLE_LONG);
+       r = GetLastResult();
+       SysTryReturn(NID_UI_CTRL, pDateFormatter != null, localeDateFormat, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       String formatString = pDateFormatter->GetPattern();
+       formatString.ToLowerCase();
+
+       delete pDateFormatter;
+       pDateFormatter = null;
+
+       int stringLength = formatString.GetLength();
+       String parsedString = L"";
+
+       for (int i = 0; i < stringLength; i++)
+       {
+               wchar_t ch = '\0';
+               r = formatString.GetCharAt(i, ch);
+               SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, localeDateFormat, r, "[%s] Propagating.", GetErrorMessage(r));
+
+               if (ch == 'd' && !parsedString.Contains(L"DD"))
+               {
+                       parsedString.Append(L"DD");
+               }
+               else if (ch == 'm' && !parsedString.Contains(L"MM"))
+               {
+                       parsedString.Append(L"MM");
+               }
+               else if (ch == 'y' && !parsedString.Contains(L"YYYY"))
+               {
+                       parsedString.Append(L"YYYY");
+               }
+
+               if (parsedString.GetLength() == LOCALE_DATE_FORMAT_STRING_LENGTH)
+               {
+                       break;
+               }
+       }
+
+       if (parsedString.Equals(L"DDMMYYYY", false))
+       {
+               localeDateFormat = DATE_FORMAT_DDMMYYYY;
+       }
+       else if (parsedString.Equals(L"MMDDYYYY", false))
+       {
+               localeDateFormat = DATE_FORMAT_MMDDYYYY;
+       }
+       else if (parsedString.Equals(L"YYYYMMDD", false))
+       {
+               localeDateFormat = DATE_FORMAT_YYYYMMDD;
+       }
+       else if (parsedString.Equals(L"YYYYDDMM", false))
+       {
+               localeDateFormat = DATE_FORMAT_YYYYDDMM;
+       }
+
+       return localeDateFormat;
+}
+
 }}} // Tizen::Ui::Controls
index ac5fe30..e447c6c 100644 (file)
@@ -20,7 +20,6 @@
  * @brief              This is the implementation file for the _EditDate class.
  */
 
-#include <vconf.h>
 #include <FSysSettingInfo.h>
 #include "FUi_AccessibilityContainer.h"
 #include "FUi_AccessibilityElement.h"
@@ -716,24 +715,27 @@ _EditDate::CreateAccessibilityElement(void)
                __pAccessibilityDayElement->SetTrait(ACCESSIBILITY_TRAITS_DAY);
                __pAccessibilityDayElement->SetHint(hintText);
 
-               switch (__pEditDatePresenter->GetLocaleDateFormat())
+               _DateTimeUtils dateTimeUtils;
+               int localeDateFormat =  dateTimeUtils.GetLocaleDateFormat();
+
+               switch (localeDateFormat)
                {
-               case SETTING_DATE_FORMAT_DD_MM_YYYY:
+               case DATE_FORMAT_DDMMYYYY:
                        pContainer->AddElement(*__pAccessibilityDayElement);
                        pContainer->AddElement(*__pAccessibilityMonthElement);
                        pContainer->AddElement(*__pAccessibilityYearElement);
                        break;
-               case SETTING_DATE_FORMAT_MM_DD_YYYY:
+               case DATE_FORMAT_MMDDYYYY:
                        pContainer->AddElement(*__pAccessibilityMonthElement);
                        pContainer->AddElement(*__pAccessibilityDayElement);
                        pContainer->AddElement(*__pAccessibilityYearElement);
                        break;
-               case SETTING_DATE_FORMAT_YYYY_MM_DD:
+               case DATE_FORMAT_YYYYMMDD:
                        pContainer->AddElement(*__pAccessibilityYearElement);
                        pContainer->AddElement(*__pAccessibilityMonthElement);
                        pContainer->AddElement(*__pAccessibilityDayElement);
                        break;
-               case SETTING_DATE_FORMAT_YYYY_DD_MM:
+               case DATE_FORMAT_YYYYDDMM:
                        pContainer->AddElement(*__pAccessibilityYearElement);
                        pContainer->AddElement(*__pAccessibilityDayElement);
                        pContainer->AddElement(*__pAccessibilityMonthElement);
@@ -805,8 +807,6 @@ _EditDate::OnChangeLayout(_ControlOrientation orientation)
 bool
 _EditDate::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
 {
-       SetFocused(true);
-
        FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
 
        if (absoluteBounds.y != __absoluteBounds.y || absoluteBounds.height != __absoluteBounds.height)
@@ -958,6 +958,54 @@ _EditDate::OnSettingChanged(String& key)
        return;
 }
 
+bool
+_EditDate::OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo)
+{
+       _KeyCode keyCode = keyInfo.GetKeyCode();
+
+       switch (keyCode)
+       {
+               case _KEY_ENTER:
+               {
+
+                       FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
+
+                       if (absoluteBounds.y != __absoluteBounds.y || absoluteBounds.height != __absoluteBounds.height)
+                       {
+                               CalculateDateTimeBarPosition();
+                       }
+                       break;
+               }
+               default:
+                       break;
+
+       }
+
+       return __pEditDatePresenter->OnKeyPressed(source, keyInfo);
+}
+
+bool
+_EditDate::OnFocusGained(const _Control &source)
+{
+       __pEditDatePresenter->SetFocusedElement();
+       return true;
+}
+
+bool
+_EditDate::OnFocusLost(const _Control &source)
+{
+       __pEditDatePresenter->OnFocusLost(source);
+       return true;
+}
+
+void
+_EditDate::OnDrawFocus(void)
+{
+       __pEditDatePresenter->SetFocusState(true);
+       __pEditDatePresenter->DrawFocus();
+       return;
+}
+
 FloatRectangle
 _EditDate::GetParentWindowBounds(void) const
 {
@@ -1023,30 +1071,33 @@ _EditDate::UpdateAccessibilityElement(void)
        dayString.Append(GetDay());
        String monthString = GetDateTimeBar()->GetMonthValue(GetMonth()).GetPointer();
 
-       switch (__pEditDatePresenter->GetLocaleDateFormat())
+       _DateTimeUtils dateTimeUtils;
+       int localeDateFormat =  dateTimeUtils.GetLocaleDateFormat();
+
+       switch (localeDateFormat)
        {
-       case SETTING_DATE_FORMAT_DD_MM_YYYY:
+       case DATE_FORMAT_DDMMYYYY:
                string.Append(dayString.GetPointer());
                string.Append(space.GetPointer());
                string.Append(monthString.GetPointer());
                string.Append(space.GetPointer());
                string.Append(yearString.GetPointer());
                break;
-       case SETTING_DATE_FORMAT_MM_DD_YYYY:
+       case DATE_FORMAT_MMDDYYYY:
                string.Append(monthString.GetPointer());
                string.Append(space.GetPointer());
                string.Append(dayString.GetPointer());
                string.Append(space.GetPointer());
                string.Append(yearString.GetPointer());
                break;
-       case SETTING_DATE_FORMAT_YYYY_MM_DD:
+       case DATE_FORMAT_YYYYMMDD:
                string.Append(yearString.GetPointer());
                string.Append(space.GetPointer());
                string.Append(monthString.GetPointer());
                string.Append(space.GetPointer());
                string.Append(dayString.GetPointer());
                break;
-       case SETTING_DATE_FORMAT_YYYY_DD_MM:
+       case DATE_FORMAT_YYYYDDMM:
                string.Append(yearString.GetPointer());
                string.Append(space.GetPointer());
                string.Append(dayString.GetPointer());
index e5dc76f..bb5f55f 100644 (file)
@@ -77,6 +77,9 @@ _EditDatePresenter::_EditDatePresenter(void)
        , __isAnimating(false)
        , __isEditDateInitialized(false)
        , __elementWidth(0.0f)
+       , __focusStatus(FOCUS_NONE)
+       , __isEnterKeyPressed(false)
+       , __isFocused(false)
 {
 }
 
@@ -412,19 +415,6 @@ CATCH:
        return r;
 }
 
-int
-_EditDatePresenter::GetLocaleDateFormat(void) const
-{
-       int localeDateFormat = -1;
-       int error = vconf_get_int(VCONFKEY_SETAPPL_DATE_FORMAT_INT, &localeDateFormat);
-       if (error == -1)
-       {
-               localeDateFormat = SETTING_DATE_FORMAT_DD_MM_YYYY;
-       }
-
-       return localeDateFormat;
-}
-
 DateTime
 _EditDatePresenter::GetDate(void) const
 {
@@ -553,7 +543,6 @@ result
 _EditDatePresenter::Draw(void)
 {
        result r = E_SUCCESS;
-
        if (__isAnimating)
        {
                return E_SUCCESS;
@@ -588,36 +577,123 @@ _EditDatePresenter::Draw(void)
        r = DrawText(*pCanvas, GetDateAreaBounds(DATETIME_ID_YEAR), yearString, DATETIME_ID_YEAR);
        SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
 
+       if (__pEditDate->IsFocused())
+       {
+               DrawFocus();
+       }
+
+CATCH:
        delete pCanvas;
+       return r;
+}
+
+result
+_EditDatePresenter::DrawFocus(void)
+{
+       FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
+
+       Canvas* pCanvas = __pEditDate->GetCanvasN();
+       SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create canvas.");
+
+       if (__focusStatus == FOCUS_DAY)
+       {
+               bounds = GetDateAreaBounds(DATETIME_ID_DAY);
+       }
+       else if (__focusStatus == FOCUS_MONTH)
+       {
+               bounds = GetDateAreaBounds(DATETIME_ID_MONTH);
+       }
+       else if (__focusStatus == FOCUS_YEAR)
+       {
+               bounds = GetDateAreaBounds(DATETIME_ID_YEAR);
+       }
+
+       bounds.y = bounds.y - (__adjustFocusHeight / 2.0f);
+       bounds.height = bounds.height + __adjustFocusHeight;
+
+       result r = E_SUCCESS;
+
+       if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pContentBgHighlightedColorReplacementBitmap))
+       {
+               r = pCanvas->DrawNinePatchedBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
+               SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+       else
+       {
+               r = pCanvas->DrawBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
+               SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       }
 
+       delete pCanvas;
        return r;
 
-       CATCH:
+CATCH:
        delete pCanvas;
        return r;
 }
 
+void
+_EditDatePresenter::UpdateLastSelectedValue(_DateTimeId id, bool isTouchPressed)
+{
+       __selectedId = id;
+       SetLastSelectedId(id);
+       __lastSelectedValue = "";
+       _DateTimeUtils dateTimeUtils;
+
+       if (GetLastSelectedId() == DATETIME_ID_YEAR)
+       {
+               __lastSelectedValue.Format(10, L"%04d", GetYear());
+               if (isTouchPressed)
+               {
+                       PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+               }
+       }
+       else if (GetLastSelectedId() == DATETIME_ID_MONTH)
+       {
+               __lastSelectedValue = dateTimeUtils.GetMonthString(GetMonth());
+               if (isTouchPressed)
+               {
+                       PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+               }
+       }
+       else if (GetLastSelectedId() == DATETIME_ID_DAY)
+       {
+               __lastSelectedValue.Format(10, L"%02d", GetDay());
+               if (isTouchPressed)
+               {
+                       PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+               }
+       }
+
+       __pEditDate->Invalidate();
+       return;
+}
+
 result
 _EditDatePresenter::CalculateAreaBounds(void)
 {
        result r = E_SUCCESS;
 
-       if (GetLocaleDateFormat() == DATE_FORMAT_DDMMYYYY)
+        _DateTimeUtils dateTimeUtils;
+       int localeDateFormat =  dateTimeUtils.GetLocaleDateFormat();
+
+       if (localeDateFormat == DATE_FORMAT_DDMMYYYY)
        {
                __monthBounds.x = __dayBounds.x + __dayBounds.width + __elementMargin;
                __yearBounds.x = __monthBounds.x + __monthBounds.width + __elementMargin;
        }
-       else if (GetLocaleDateFormat() == DATE_FORMAT_MMDDYYYY)
+       else if (localeDateFormat == DATE_FORMAT_MMDDYYYY)
        {
                __dayBounds.x = __monthBounds.x + __monthBounds.width + __elementMargin;
                __yearBounds.x = __dayBounds.x + __dayBounds.width + __elementMargin;
        }
-       else if (GetLocaleDateFormat() == DATE_FORMAT_YYYYMMDD)
+       else if (localeDateFormat == DATE_FORMAT_YYYYMMDD)
        {
                __monthBounds.x = __yearBounds.x + __yearBounds.width + __elementMargin;
                __dayBounds.x = __monthBounds.x + __monthBounds.width + __elementMargin;
        }
-       else if (GetLocaleDateFormat() == DATE_FORMAT_YYYYDDMM)
+       else if (localeDateFormat == DATE_FORMAT_YYYYDDMM)
        {
                __dayBounds.x = __yearBounds.x + __yearBounds.width + __elementMargin;
                __monthBounds.x = __dayBounds.x + __dayBounds.width + __elementMargin;
@@ -840,6 +916,213 @@ _EditDatePresenter::OnFontInfoRequested(unsigned long& style, float& size)
        return;
 }
 
+void
+_EditDatePresenter::SetFocusState(bool isFocused)
+{
+       __isFocused = isFocused;
+}
+
+void
+_EditDatePresenter::SetFocusedElement()
+{
+       _DateTimeUtils dateTimeUtils;
+       int localeDateFormat =  dateTimeUtils.GetLocaleDateFormat();
+       if (__focusStatus == FOCUS_NONE)
+       {
+               if (localeDateFormat == DATE_FORMAT_DDMMYYYY)
+               {
+                       __focusStatus = FOCUS_DAY;
+               }
+               else if (localeDateFormat == DATE_FORMAT_MMDDYYYY)
+               {
+                       __focusStatus = FOCUS_MONTH;
+               }
+               else if (localeDateFormat == DATE_FORMAT_YYYYMMDD)
+               {
+                       __focusStatus = FOCUS_YEAR;
+               }
+               else if (localeDateFormat == DATE_FORMAT_YYYYDDMM)
+               {
+                       __focusStatus = FOCUS_YEAR;
+               }
+       }
+       return;
+}
+
+bool
+_EditDatePresenter::OnFocusLost(const _Control &source)
+{
+       if (!__isEnterKeyPressed)
+       {
+               __focusStatus = FOCUS_NONE;
+       }
+       else
+       {
+               __isEnterKeyPressed = false;
+       }
+       __pEditDate->Invalidate();
+       return true;
+}
+
+bool
+_EditDatePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+       if (!__isFocused)
+       {
+               return false;
+       }
+       _KeyCode keyCode = keyInfo.GetKeyCode();
+
+       int minValue = -1;
+       int maxValue = -1;
+       int displayValue = -1;
+
+       _DateTimeId boxId = DATETIME_ID_NONE;
+       _DateTimeUtils dateTimeUtils;
+       int localeDateFormat =  dateTimeUtils.GetLocaleDateFormat();
+
+       switch (keyCode)
+       {
+               case _KEY_RIGHT:
+               {
+                       if (__focusStatus == FOCUS_DAY)
+                       {
+                               if (localeDateFormat == DATE_FORMAT_DDMMYYYY || localeDateFormat == DATE_FORMAT_YYYYDDMM)
+                               {
+                                       __focusStatus = FOCUS_MONTH;
+                               }
+                               else if (localeDateFormat == DATE_FORMAT_MMDDYYYY)
+                               {
+                                       __focusStatus = FOCUS_YEAR;
+                               }
+                       }
+                       else if (__focusStatus == FOCUS_MONTH)
+                       {
+                               if (localeDateFormat == DATE_FORMAT_DDMMYYYY)
+                               {
+                                       __focusStatus = FOCUS_YEAR;
+                               }
+                               else if (localeDateFormat == DATE_FORMAT_MMDDYYYY || localeDateFormat == DATE_FORMAT_YYYYMMDD)
+                               {
+                                       __focusStatus = FOCUS_DAY;
+                               }
+                       }
+                       else if (__focusStatus == FOCUS_YEAR)
+                       {
+                               if (localeDateFormat == DATE_FORMAT_YYYYMMDD)
+                               {
+                                       __focusStatus = FOCUS_MONTH;
+                               }
+                               else if (localeDateFormat == DATE_FORMAT_YYYYDDMM)
+                               {
+                                       __focusStatus = FOCUS_DAY;
+                               }
+                       }
+                       __pEditDate->Invalidate();
+                       break;
+               }
+
+               case _KEY_LEFT:
+               {
+                       if (__focusStatus == FOCUS_DAY)
+                       {
+                               if (localeDateFormat == DATE_FORMAT_YYYYDDMM)
+                               {
+                                       __focusStatus = FOCUS_YEAR;
+                               }
+                               else if (localeDateFormat == DATE_FORMAT_MMDDYYYY || localeDateFormat == DATE_FORMAT_YYYYMMDD)
+                               {
+                                       __focusStatus = FOCUS_MONTH;
+                               }
+                       }
+                       else if (__focusStatus == FOCUS_MONTH)
+                       {
+                               if (localeDateFormat == DATE_FORMAT_YYYYMMDD)
+                               {
+                                       __focusStatus = FOCUS_YEAR;
+                               }
+                               else if (localeDateFormat == DATE_FORMAT_DDMMYYYY || localeDateFormat == DATE_FORMAT_YYYYDDMM)
+                               {
+                                       __focusStatus = FOCUS_DAY;
+                               }
+                       }
+                       else if (__focusStatus == FOCUS_YEAR)
+                       {
+                               if (localeDateFormat == DATE_FORMAT_DDMMYYYY)
+                               {
+                                       __focusStatus = FOCUS_MONTH;
+                               }
+                               else if (localeDateFormat == DATE_FORMAT_MMDDYYYY)
+                               {
+                                       __focusStatus = FOCUS_DAY;
+                               }
+                       }
+                       __pEditDate->Invalidate();
+                       break;
+               }
+
+               case _KEY_ENTER:
+               {
+                       __isEnterKeyPressed = true;
+                       if (__focusStatus == FOCUS_DAY)
+                       {
+                               _DateTimeUtils dateTimeUtils;
+                               maxValue = dateTimeUtils.CalculateMaxDay(GetYear(), GetMonth());
+                               minValue = DATETIME_DAY_MIN;
+                               displayValue = GetDay();
+                               boxId = DATETIME_ID_DAY;
+
+                               if (__pEditDate->GetDateTimeBar()->GetItemCount() > 0)
+                               {
+                                       __pEditDate->GetDateTimeBar()->RemoveAllItems();
+                               }
+                       }
+
+                       else if (__focusStatus == FOCUS_MONTH)
+                       {
+                               minValue = DATETIME_MONTH_MIN;
+                               maxValue = DATETIME_MONTH_MAX;
+                               displayValue = GetMonth();
+                               boxId = DATETIME_ID_MONTH;
+
+                               if (__pEditDate->GetDateTimeBar()->GetItemCount() > 0)
+                               {
+                                       __pEditDate->GetDateTimeBar()->RemoveAllItems();
+                               }
+                       }
+                       else if (__focusStatus == FOCUS_YEAR)
+                       {
+                               minValue = GetMinYear();
+                               maxValue = GetMaxYear();
+                               displayValue = GetYear();
+                               boxId = DATETIME_ID_YEAR;
+
+                               if (__pEditDate->GetDateTimeBar()->GetItemCount() > 0)
+                               {
+                                       __pEditDate->GetDateTimeBar()->RemoveAllItems();
+                               }
+                       }
+                       FloatRectangle absoluteBounds = __pEditDate->GetAbsoluteBoundsF();
+
+                       FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
+                       bounds = GetDateAreaBounds(boxId);
+                       bounds.x += absoluteBounds.x;
+                       __pEditDate->GetDateTimeBar()->CalculateArrowBounds(bounds);
+                       __pEditDate->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
+                       __pEditDate->GetDateTimeBar()->SetVisibleState(true);
+                       __pEditDate->GetDateTimeBar()->Open();
+
+                       UpdateLastSelectedValue(boxId, false);
+                       break;
+               }
+               default:
+               {
+                       return false;
+               }
+       }
+       return true;
+}
+
 bool
 _EditDatePresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
 {
@@ -943,27 +1226,7 @@ _EditDatePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
                return true;
        }
 
-       SetLastSelectedId(__selectedId);
-
-       __lastSelectedValue = "";
-       _DateTimeUtils dateTimeUtils;
-       if (GetLastSelectedId() == DATETIME_ID_YEAR)
-       {
-               __lastSelectedValue.Format(10, L"%04d", GetYear());
-               PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
-       }
-       else if (GetLastSelectedId() == DATETIME_ID_MONTH)
-       {
-               __lastSelectedValue = dateTimeUtils.GetMonthString(GetMonth());
-               PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
-       }
-       else if (GetLastSelectedId() == DATETIME_ID_DAY)
-       {
-               __lastSelectedValue.Format(10, L"%02d", GetDay());
-               PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
-       }
-
-       Draw();
+       UpdateLastSelectedValue(__selectedId, true);
 
        if ((__pEditDate->GetDateTimeBar() != null) && (GetLastSelectedId() != DATETIME_ID_NONE))
        {
index 9709d62..991f6c9 100644 (file)
@@ -490,7 +490,7 @@ _EditTime::OnDraw(void)
 
        __pEditTimePresenter->Draw();
 
-       if(unlikely((_AccessibilityManager::IsActivated())))
+       if (unlikely((_AccessibilityManager::IsActivated())))
        {
                UpdateAccessibilityElement();
        }
@@ -608,8 +608,6 @@ _EditTime::OnChangeLayout(_ControlOrientation orientation)
 bool
 _EditTime::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
 {
-       SetFocused(true);
-
        FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
        if (absoluteBounds.y != __absoluteBounds.y || absoluteBounds.height != __absoluteBounds.height)
        {
@@ -759,6 +757,52 @@ _EditTime::OnSettingChanged(String& key)
        return;
 }
 
+void
+_EditTime::OnDrawFocus(void)
+{
+       __pEditTimePresenter->SetFocusState(true);
+       __pEditTimePresenter->DrawFocus();
+       return;
+}
+
+bool
+_EditTime::OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo)
+{
+       _KeyCode keyCode = keyInfo.GetKeyCode();
+
+       switch (keyCode)
+       {
+               case _KEY_ENTER:
+               {
+                       FloatRectangle absoluteBounds = GetAbsoluteBoundsF();
+
+                       if (absoluteBounds.y != __absoluteBounds.y || absoluteBounds.height != __absoluteBounds.height)
+                       {
+                               CalculateDateTimeBarPosition();
+                       }
+                       break;
+               }
+               default:
+               break;
+
+       }
+
+       return __pEditTimePresenter->OnKeyPressed(source, keyInfo);
+}
+
+bool
+_EditTime::OnFocusGained(const _Control &source)
+{
+       __pEditTimePresenter->SetFocusedElement();
+       return true;
+}
+
+bool
+_EditTime::OnFocusLost(const _Control &source)
+{
+       return __pEditTimePresenter->OnFocusLost(source);
+}
+
 FloatRectangle
 _EditTime::GetParentWindowBounds(void) const
 {
index c59ae76..5c43b9a 100644 (file)
@@ -84,6 +84,9 @@ _EditTimePresenter::_EditTimePresenter(const String& title)
        , __timeFontSize(0.0f)
        , __isAnimating(false)
        , __isEditTimeInitialized(false)
+       , __focusStatus(FOCUS_NONE)
+       , __isEnterKeyPressed(false)
+       , __isFocused(false)
 {
 }
 
@@ -858,9 +861,57 @@ _EditTimePresenter::Draw(void)
                SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
        }
 
+       if (__pEditTime->IsFocused())
+       {
+               DrawFocus();
+       }
+
 CATCH:
        delete pCanvas;
+       return r;
+}
+
+result
+_EditTimePresenter::DrawFocus(void)
+{
+       FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
 
+       Canvas* pCanvas = __pEditTime->GetCanvasN();
+       SysTryReturnResult(NID_UI_CTRL, (pCanvas != null), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Unable to create canvas.");
+
+       if (__focusStatus == FOCUS_HOUR)
+       {
+               bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_HOUR);
+       }
+       else if (__focusStatus == FOCUS_MINUTE)
+       {
+               bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_MINUTE);
+       }
+       else if (__focusStatus == FOCUS_AMPM)
+       {
+               bounds = GetDisplayAreaBoundsFromHoursStyle(DATETIME_ID_AMPM);
+       }
+       result r = E_SUCCESS;
+
+       bounds.y = bounds.y - (__adjustFocusHeight / 2.0f);
+       bounds.height = bounds.height + __adjustFocusHeight;
+
+       if (_BitmapImpl::CheckNinePatchedBitmapStrictly(*__pContentBgHighlightedColorReplacementBitmap))
+       {
+               r = pCanvas->DrawNinePatchedBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
+               SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+       else
+       {
+               r = pCanvas->DrawBitmap(bounds, *__pContentBgHighlightedColorReplacementBitmap);
+               SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+
+       delete pCanvas;
+       return r;
+
+CATCH:
+       delete pCanvas;
        return r;
 }
 
@@ -1081,6 +1132,181 @@ _EditTimePresenter::GetLastSelectedId(void) const
        return __lastSelectedId;
 }
 
+void
+_EditTimePresenter::SetFocusedElement()
+{
+       if (__focusStatus == FOCUS_NONE || __focusStatus == FOCUS_AMPM)
+       {
+               __focusStatus = FOCUS_HOUR;
+       }
+
+       return;
+}
+
+void
+_EditTimePresenter::SetFocusState(bool isFocused)
+{
+       __isFocused = isFocused;
+       return;
+}
+
+bool
+_EditTimePresenter::OnFocusLost(const _Control &source)
+{
+       if (!__isEnterKeyPressed || __focusStatus == FOCUS_AMPM)
+       {
+               __focusStatus = FOCUS_NONE;
+       }
+       else
+       {
+               __isEnterKeyPressed = false;
+       }
+       __pEditTime->Invalidate();
+       return true;
+}
+
+bool
+_EditTimePresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo)
+{
+       if (!__isFocused)
+       {
+               return false;
+       }
+       _KeyCode keyCode = keyInfo.GetKeyCode();
+
+       int minValue = -1;
+       int maxValue = -1;
+       int displayValue = -1;
+
+       _DateTimeId boxId = DATETIME_ID_HOUR;
+
+       switch (keyCode)
+       {
+               case _KEY_RIGHT:
+               {
+                       __isEnterKeyPressed = false;
+                       if (__focusStatus == FOCUS_HOUR)
+                       {
+                               __focusStatus = FOCUS_MINUTE;
+                       }
+                       else if (__focusStatus == FOCUS_MINUTE)
+                       {
+                               if (!Is24HourNotationEnabled())
+                               {
+                                       __focusStatus = FOCUS_AMPM;
+                               }
+                       }
+
+                       __pEditTime->Invalidate();
+                       break;
+               }
+
+               case _KEY_LEFT:
+               {
+                       __isEnterKeyPressed = false;
+                       if (__focusStatus == FOCUS_MINUTE)
+                       {
+                               __focusStatus = FOCUS_HOUR;
+                       }
+                       else if (__focusStatus == FOCUS_AMPM)
+                       {
+                               __focusStatus = FOCUS_MINUTE;
+                       }
+                       __pEditTime->Invalidate();
+                       break;
+               }
+
+               case _KEY_ENTER:
+               {
+                       __isEnterKeyPressed = true;
+                       if (__focusStatus == FOCUS_HOUR)
+                       {
+                               boxId = DATETIME_ID_HOUR;
+                               if (__pEditTime->GetDateTimeBar() != null)
+                               {
+                                       if (!Is24HourNotationEnabled())
+                                       {
+                                               if (GetHour() == 0)
+                                               {
+                                                       minValue = DATETIME_HOUR_MIN + 1;
+                                                       maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
+                                                       displayValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
+                                               }
+                                               else if (GetHour() > DATETIME_HOUR_MAX_FOR_24NOTATION)
+                                               {
+                                                       minValue = DATETIME_HOUR_MIN + 1;
+                                                       maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
+                                                       displayValue = __pEditTime->GetHour() - DATETIME_HOUR_MAX_FOR_24NOTATION;
+                                               }
+                                               else
+                                               {
+                                                       minValue = DATETIME_HOUR_MIN + 1;
+                                                       maxValue = DATETIME_HOUR_MAX_FOR_24NOTATION;
+                                                       displayValue = __pEditTime->GetHour();
+                                               }
+                                       }
+                                       else
+                                       {
+                                               minValue = DATETIME_HOUR_MIN;
+                                               maxValue = DATETIME_HOUR_MAX;
+                                               displayValue = __pEditTime->GetHour();
+                                       }
+
+                                       if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
+                                       {
+                                               __pEditTime->GetDateTimeBar()->RemoveAllItems();
+                                       }
+                               }
+                       }
+                       else if (__focusStatus == FOCUS_MINUTE)
+                       {
+                               if (__pEditTime->GetDateTimeBar() != null)
+                               {
+                                       minValue = DATETIME_MINUTE_MIN;
+                                       maxValue = DATETIME_MINUTE_MAX;
+                                       displayValue = __pEditTime->GetMinute();
+
+                                       if (__pEditTime->GetDateTimeBar()->GetItemCount() > 0)
+                                       {
+                                               __pEditTime->GetDateTimeBar()->RemoveAllItems();
+                                       }
+                               }
+                               boxId = DATETIME_ID_MINUTE;
+                       }
+                       else if (__focusStatus == FOCUS_AMPM)
+                       {
+                               SetAmEnabled(!GetAmEnabled());
+                               __pEditTime->FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
+                               boxId = DATETIME_ID_AMPM;
+
+                               DrawFocus();
+                       }
+
+                       if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM))
+                       {
+                               FloatRectangle absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
+
+                               FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
+                               bounds = GetDisplayAreaBoundsFromHoursStyle(boxId);
+                               bounds.x += absoluteBounds.x;
+
+                               __pEditTime->GetDateTimeBar()->SetInitialValue(minValue, maxValue, displayValue, boxId);
+                               __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
+                               __pEditTime->GetDateTimeBar()->SetVisibleState(true);
+                               __pEditTime->GetDateTimeBar()->Open();
+                               UpdateLastSelectedValue(boxId, false);
+                       }
+                       break;
+               }
+
+               default:
+               {
+                       return false;
+               }
+       }
+       return true;
+}
+
 bool
 _EditTimePresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
 {
@@ -1228,11 +1454,46 @@ _EditTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
 
                return true;
        }
+       UpdateLastSelectedValue(__selectedId, true);
+       if (GetLastSelectedId() == DATETIME_ID_AMPM)
+       {
+               return true;
+       }
+
+       Draw();
+
+       if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM) && (GetLastSelectedId() != DATETIME_ID_NONE))
+       {
+               FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
+               bounds = GetDisplayAreaBoundsFromHoursStyle(GetLastSelectedId());
+               FloatRectangle absoluteBounds(0.0f, 0.0f, 0.0f, 0.0f);
+               absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
+               bounds.x += absoluteBounds.x;
+
+               __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
+
+               if (__pEditTime->GetDateTimeBar()->IsActivated())
+               {
+                       __pEditTime->GetDateTimeBar()->RefreshItems();
+               }
+               else
+               {
+                       __pEditTime->GetDateTimeBar()->SetVisibleState(true);
+                       __pEditTime->GetDateTimeBar()->Open();
+               }
+       }
+
+       __selectedId = DATETIME_ID_NONE;
+       return true;
+}
 
-       SetLastSelectedId(__selectedId);
+void
+_EditTimePresenter::UpdateLastSelectedValue(_DateTimeId boxId, bool isTouchPressed)
+{
+       __selectedId = boxId;
+       SetLastSelectedId(boxId);
 
        __lastSelectedValue = "";
-       _DateTimeUtils dateTimeUtils;
 
        if (GetLastSelectedId() == DATETIME_ID_HOUR)
        {
@@ -1244,24 +1505,32 @@ _EditTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
 
                        if (hours == DATETIME_HOUR_MIN)
                        {
-                               hours = hours + DATETIME_HOUR_MAX_FOR_24NOTATION;
+                               hours = hours + DATETIME_HOUR_MAX_FOR_24NOTATION;
                        }
                }
                __lastSelectedValue.Format(10, L"%02d", hours);
-               PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+               if (isTouchPressed)
+               {
+                       PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+               }
        }
        else if (GetLastSelectedId() == DATETIME_ID_MINUTE)
        {
                __lastSelectedValue.Format(10, L"%02d", GetMinute());
-               PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+               if (isTouchPressed)
+               {
+                       PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+               }
        }
        else if (GetLastSelectedId() == DATETIME_ID_AMPM)
        {
                SetAmEnabled(!GetAmEnabled());
                __pEditTime->FireTimeChangeEvent(TIME_INTERNAL_CHANGE_SAVED);
-               __pEditTime->UpdateAccessibilityElement();
-               PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
-
+               if (isTouchPressed)
+               {
+                       __pEditTime->UpdateAccessibilityElement();
+                       PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+               }
                __selectedId = DATETIME_ID_NONE;
 
                if (__pEditTime->GetDateTimeBar() != null && __pEditTime->GetDateTimeBar()->IsActivated())
@@ -1269,37 +1538,11 @@ _EditTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
                        __pEditTime->GetDateTimeBar()->SetVisibleState(false);
                        __pEditTime->GetDateTimeBar()->Close();
                }
-
-               Draw();
-
-               return true;
-       }
-
-       Draw();
-
-       if ((__pEditTime->GetDateTimeBar() != null) && (boxId != DATETIME_ID_AMPM) && (GetLastSelectedId() != DATETIME_ID_NONE))
-       {
-               FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
-               bounds = GetDisplayAreaBoundsFromHoursStyle(GetLastSelectedId());
-               FloatRectangle absoluteBounds(0.0f, 0.0f, 0.0f, 0.0f);
-               absoluteBounds = __pEditTime->GetAbsoluteBoundsF();
-               bounds.x += absoluteBounds.x;
-
-               __pEditTime->GetDateTimeBar()->CalculateArrowBounds(bounds);
-
-               if (__pEditTime->GetDateTimeBar()->IsActivated())
-               {
-                       __pEditTime->GetDateTimeBar()->RefreshItems();
-               }
-               else
-               {
-                       __pEditTime->GetDateTimeBar()->SetVisibleState(true);
-                       __pEditTime->GetDateTimeBar()->Open();
-               }
        }
 
        __selectedId = DATETIME_ID_NONE;
-       return true;
+       __pEditTime->Invalidate();
+       return;
 }
 
 bool
index 4a0c8ee..afd7460 100644 (file)
@@ -135,7 +135,7 @@ _InputPadPresenter::LoadResource(void)
        }
 
        GET_COLOR_CONFIG(INPUTPAD::BUTTON_BG_NORMAL, buttonColor[DATETIME_STATUS_NORMAL]);
-       GET_COLOR_CONFIG(INPUTPAD::BUTTON_BG_PRESSED, buttonColor[DATETIME_STATUS_PRESSED]);
+       GET_COLOR_CONFIG(INPUTPAD::BUTTON_BG_PRESSED, buttonColor[DATETIME_STATUS_SELECTED]);
        GET_COLOR_CONFIG(INPUTPAD::BUTTON_BG_HIGHLIGHTED, buttonColor[DATETIME_STATUS_HIGHLIGHTED]);
        GET_COLOR_CONFIG(INPUTPAD::BUTTON_BG_DISABLED, buttonColor[DATETIME_STATUS_DISABLED]);
 
@@ -145,7 +145,7 @@ _InputPadPresenter::LoadResource(void)
        r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pButtonBgNormalBitmap[DATETIME_STATUS_NORMAL]);
        SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
 
-       r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pButtonBgNormalBitmap[DATETIME_STATUS_PRESSED]);
+       r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, pButtonBgNormalBitmap[DATETIME_STATUS_SELECTED]);
        SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
 
        r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_HIGHLIGHTED, BITMAP_PIXEL_FORMAT_ARGB8888, pButtonBgNormalBitmap[DATETIME_STATUS_HIGHLIGHTED]);
@@ -155,7 +155,7 @@ _InputPadPresenter::LoadResource(void)
        SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
 
        isCustomBitmap[DATETIME_STATUS_NORMAL] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_NORMAL);
-       isCustomBitmap[DATETIME_STATUS_PRESSED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_PRESSED);
+       isCustomBitmap[DATETIME_STATUS_SELECTED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_PRESSED);
        isCustomBitmap[DATETIME_STATUS_HIGHLIGHTED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_HIGHLIGHTED);
        isCustomBitmap[DATETIME_STATUS_DISABLED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_DISABLED);
 
@@ -178,9 +178,9 @@ _InputPadPresenter::LoadResource(void)
                SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
        }
 
-       if (!isCustomBitmap[DATETIME_STATUS_PRESSED])
+       if (!isCustomBitmap[DATETIME_STATUS_SELECTED])
        {
-               r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadButtonEffectBitmap[DATETIME_STATUS_PRESSED]);
+               r = GET_BITMAP_CONFIG_N(INPUTPAD::BUTTON_BG_EFFECT_PRESSED, BITMAP_PIXEL_FORMAT_ARGB8888, __pKeypadButtonEffectBitmap[DATETIME_STATUS_SELECTED]);
                SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
        }
 
@@ -382,7 +382,7 @@ _InputPadPresenter::DrawButton(Canvas& canvas, int index)
        }
        else if (__pressedIndex == index)
        {
-               status = DATETIME_STATUS_PRESSED;
+               status = DATETIME_STATUS_SELECTED;
                GET_COLOR_CONFIG(INPUTPAD::TEXT_PRESSED, textColor);
        }
        else
@@ -392,7 +392,7 @@ _InputPadPresenter::DrawButton(Canvas& canvas, int index)
        }
 
        isCustomBitmap[DATETIME_STATUS_NORMAL] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_NORMAL);
-       isCustomBitmap[DATETIME_STATUS_PRESSED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_PRESSED);
+       isCustomBitmap[DATETIME_STATUS_SELECTED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_PRESSED);
        isCustomBitmap[DATETIME_STATUS_HIGHLIGHTED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_HIGHLIGHTED);
        isCustomBitmap[DATETIME_STATUS_DISABLED] = IS_CUSTOM_BITMAP(INPUTPAD::BUTTON_BG_DISABLED);
 
@@ -631,11 +631,6 @@ _InputPadPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& tou
        if (__pressedIndex >= 0)
        {
                RefreshButton(__pressedIndex);
-               if (__pInputPadEventListener != null)
-               {
-                       __pInputPadEventListener->OnInputPadValueChanged(source, GetReturnValue(__pressedIndex));
-               }
-
                return true;
        }
 
@@ -650,16 +645,26 @@ _InputPadPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
                return false;
        }
 
-       if (__pressedIndex >= 0)
+       SysTryReturn(NID_UI_CTRL, __pressedIndex >= 0, true, E_SUCCESS, "Touch pressed Index is invalid, ignoring touch release");
+
+       int refreshIndex = __pressedIndex;
+       int currentReleasedIndex = GetIndexFromTouchedPosition(touchinfo.GetCurrentPosition());
+
+       if (currentReleasedIndex >= 0)
        {
-               int refreshIndex = __pressedIndex;
-               __pressedIndex = -1;
-               RefreshButton(refreshIndex);
+               if (__pInputPadEventListener != null)
+               {
+                       __pInputPadEventListener->OnInputPadValueChanged(source, GetReturnValue(currentReleasedIndex));
+               }
+       }
 
-               return true;
+       __pressedIndex = -1;
+       if (refreshIndex >= 0)
+       {
+               RefreshButton(refreshIndex);
        }
 
-       return false;
+       return true;
 }
 
 bool
index 93ed06e..e3d8a05 100644 (file)
@@ -105,6 +105,11 @@ public:
        Tizen::Graphics::FloatRectangle GetParentWindowBounds() const;
        void RefreshItems(void);
 
+       virtual bool OnFocusGained(const _Control &source);
+       virtual bool OnFocusLost(const _Control &source);
+       void OnDrawFocus(void);
+       bool OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo);
+
        // accessibility listener
        virtual bool OnAccessibilityFocusMovedNext(const _AccessibilityContainer& control, const _AccessibilityElement& element);
        virtual bool OnAccessibilityFocusMovedPrevious(const _AccessibilityContainer& control, const _AccessibilityElement& element);
index c468ee2..0bbca5e 100644 (file)
@@ -69,11 +69,15 @@ public:
        int GetMaximumValue(void) const;
        void SetMaximumValue(int maxValue);
 
+       result DrawFocus();
+       void SetItemFocused(bool isFocused);
+
        float GetItemWidth(void) const;
        float GetItemMargin(void) const;
        float GetFontSize(void) const;
        float GetLeftRightMargin(void) const;
 
+       bool OnKeyPressed(const _Control &source, const _KeyInfo &keyInfo);
        virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
        virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
        virtual bool OnTouchMoved(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
@@ -153,10 +157,16 @@ private:
        Tizen::Graphics::FloatRectangle __arrowAreaBounds;
        Tizen::Graphics::FloatRectangle __windowAreaBounds;
        Tizen::Graphics::Bitmap* __pBgColorReplacementBitmap;
+       Tizen::Graphics::Bitmap*  __pFocusBitmap;
        Tizen::Graphics::Bitmap* __pArrowColorReplacementBitmap;
        bool __isInitialAnimation;
        int __initialAnimationValue;
        Tizen::Graphics::Font* __pFont;
+       bool __isFocused;
+       int __focusedIndex;
+       Tizen::Graphics::FloatRectangle __focusBounds;
+       static const int UPDATE_ITEM_COUNT = 3;
+
 }; // _DateTimeBarPresenter
 
 }}} // Tizen::Ui::Controls
index 6e26929..fb13036 100644 (file)
@@ -120,7 +120,7 @@ enum _DateTimeId
 enum DateTimePickerStatus
 {
        DATETIME_STATUS_NORMAL = 0,
-       DATETIME_STATUS_PRESSED,
+       DATETIME_STATUS_SELECTED,
        DATETIME_STATUS_HIGHLIGHTED,
        DATETIME_STATUS_DISABLED,
        DATETIME_STATUS_MAX
@@ -161,6 +161,24 @@ enum _DateFormat
        DATE_FORMAT_YYYYMMDD,
        DATE_FORMAT_YYYYDDMM
 };
+
+enum _TimeFormat
+{
+        TIME_FORMAT_12HOUR = 0,
+        TIME_FORMAT_24HOUR
+};
+
+enum _FocusType
+{
+       FOCUS_DAY = 0,
+       FOCUS_MONTH,
+       FOCUS_YEAR,
+       FOCUS_HOUR,
+       FOCUS_MINUTE,
+       FOCUS_AMPM,
+       FOCUS_NONE
+};
+
 }}} // Tizen::Ui::Controls
 
 #endif  // _FUI_CTRL_INTERNAL_DATETIME_DEFINE_H_
index 68fe433..76b003d 100644 (file)
@@ -26,6 +26,7 @@
 #include <FBaseDateTime.h>
 #include <FBaseString.h>
 #include <FBaseColLinkedListT.h>
+#include <FSysISettingEventListener.h>
 
 #include "FUi_Window.h"
 #include "FUiCtrl_IActionEventListener.h"
@@ -54,6 +55,7 @@ class _DateTimePicker
        , virtual public Tizen::Ui::_IUiEventListener
        , virtual public Tizen::Ui::_IUiEventPreviewer
        , virtual public Tizen::Ui::_IAccessibilityListener
+       , virtual public Tizen::System::ISettingEventListener
 {
        DECLARE_CLASS_BEGIN(_DateTimePicker, _Control);
        DECLARE_PROPERTY("year", GetPropertyYear, SetPropertyYear);
@@ -158,6 +160,15 @@ public:
 
        virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
        virtual void OnFontInfoRequested(unsigned long& style, float& size);
+
+       virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+       virtual bool OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo);
+       virtual void OnDrawFocus(void);
+       bool OnFocusGained(const _Control& source);
+       bool OnFocusLost(const _Control& source);
+
+       virtual void OnSettingChanged(Tizen::Base::String& key);
+
        Tizen::Graphics::Font* GetDateTimeFont(void);
        result InitializeFont(void);
 
@@ -188,6 +199,7 @@ private:
        Tizen::Ui::Animations::_VisualElement* __pDisplayVisualElement;
 
        Tizen::Base::Collection::LinkedListT<Tizen::Ui::_AccessibilityElement*> __accessibilityElements;
+
 }; // _DateTimePicker
 
 }}} // Tizen::Ui::Controls
index 9891044..e5f749e 100644 (file)
@@ -94,6 +94,10 @@ public:
 
        result SetFont(Tizen::Graphics::Font* pFont);
 
+       void UpdateLocaleDateTimeFormat(void);
+
+       void UpdateTimeFormat(void);
+
        virtual void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
 
        virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
@@ -105,6 +109,11 @@ public:
 
        virtual void OnActionPerformed(const Tizen::Ui::_Control& source, int actionId);
 
+       virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+       virtual bool OnKeyReleased(const _Control& source, const _KeyInfo& keyInfo);
+       result DrawFocus(void);
+       result ReleaseFocus(void);
+
 private:
        void UpdateDateTimeOutputConfig(void);
 
@@ -156,10 +165,12 @@ private:
 
        void ChangeFocusBox(void);
 
-       int GetLocaleDateFormat(void) const;
-
        void SetAccessibilityElementText(void);
 
+       void HandleInputPadValueChange(int inputPadReturnValue);
+
+       void HandleSaveCancelAction(int actionId);
+
 private:
        _DateTimePresenter(const _DateTimePresenter&);
 
@@ -198,6 +209,8 @@ private:
 
        bool __is24HourNotation;
 
+       bool __dtp24HourSet;
+
        bool __isPm;
 
        bool __isPmButtonPressed;
@@ -226,6 +239,8 @@ private:
        _DateTimeDisplayBox* __pDisplayBox[DATETIME_ID_MAX];
 
        _DateTimeDisplayBox* __pPmBox;
+
+       bool __keypadEnabled;
 }; // _DateTimePresenter
 
 }}} // Tizen::Ui::Controls
index a04e351..ac2eb1f 100644 (file)
@@ -50,12 +50,15 @@ public:
        int CalculateMaxDay(int displayYear, int month) const ;
        bool IsLeapYear(int year) const;
        void GetAmPm(Tizen::Base::String& timeFormat, _AmPmType amPmType) const;
+       int GetLocaleDateFormat(void) const;
 
 private:
        _DateTimeUtils(const _DateTimeUtils&);
 
        _DateTimeUtils& operator =(const _DateTimeUtils&);
 
+       static const int LOCALE_DATE_FORMAT_STRING_LENGTH = 8;
+
 };
 
 }}} // Tizen::Ui::Controls
index e481b36..37af9d3 100644 (file)
@@ -131,6 +131,13 @@ public:
        virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
        virtual void OnFontInfoRequested(unsigned long& style, float& size);
        virtual void OnSettingChanged(Tizen::Base::String& key);
+
+       virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+
+       virtual bool OnFocusGained(const _Control& source);
+       virtual bool OnFocusLost(const _Control& source);
+       virtual void OnDrawFocus(void);
+
        Tizen::Graphics::FloatRectangle GetParentWindowBounds(void) const;
        void SetXmlBoundsExist(bool isXmlBoundsExist);
 
index b90a11a..ba97812 100644 (file)
@@ -64,13 +64,14 @@ public:
        result Initialize(void);
 
        result Draw(void);
+       result DrawFocus(void);
+       void UpdateLastSelectedValue(_DateTimeId id, bool isTouchPressed);
 
        _DateTimeId GetLastSelectedId(void) const;
        void SetLastSelectedId(_DateTimeId boxId);
        Tizen::Graphics::FloatRectangle GetDateAreaBounds(_DateTimeId id) const;
        Tizen::Graphics::FloatRectangle GetTitleBounds(void) const;
-       int GetLocaleDateFormat(void) const;
-    void Animate(void);
+       void Animate(void);
 
        virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
        virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
@@ -79,6 +80,11 @@ public:
        virtual void OnTouchMoveHandled(const Tizen::Ui::_Control& control);
        void OnFontChanged(Tizen::Graphics::Font* pFont);
        void OnFontInfoRequested(unsigned long& style, float& size);
+       void SetFocusState(bool isFocused);
+       void SetFocusedElement(void);
+       virtual bool OnFocusLost(const _Control& source);
+       virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+
 
        virtual void OnVisualElementAnimationFinished (const Tizen::Ui::Animations::VisualElementAnimation &animation, const Tizen::Base::String &keyName, Tizen::Ui::Animations::VisualElement &target, bool completedNormally);
        virtual void OnVisualElementAnimationRepeated (const Tizen::Ui::Animations::VisualElementAnimation &animation, const Tizen::Base::String &keyName, Tizen::Ui::Animations::VisualElement &target, long currentRepeatCount){}
@@ -139,6 +145,10 @@ private:
        bool __isEditDateInitialized;
        float __elementWidth;
        static const int __dividerCount = 2;
+       static const float __adjustFocusHeight = 8.0f;
+       _FocusType __focusStatus;
+       bool __isEnterKeyPressed;
+       bool __isFocused;
 }; // _EditDatePresenter
 
 }}} // Tizen::Ui::Controls
index beddc06..21db20e 100644 (file)
@@ -116,6 +116,12 @@ public:
        void OnFontChanged(Tizen::Graphics::Font* pFont);
        void OnFontInfoRequested(unsigned long& style, float& size);
        virtual void OnSettingChanged(Tizen::Base::String& key);
+
+       virtual bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+       bool OnFocusGained(const _Control& source);
+       bool OnFocusLost(const _Control& source);
+       virtual void OnDrawFocus(void);
+
        Tizen::Graphics::FloatRectangle GetParentWindowBounds(void) const;
        void SetXmlBoundsExist(bool isXmlBoundsExist);
 
index 9f2f6dd..effdf8f 100644 (file)
@@ -71,6 +71,11 @@ public:
        result Draw(void);
     void Animate(void);
 
+       void SetFocusedElement(void);
+       void SetFocusState(bool isFocused);
+       bool OnFocusLost(const _Control& source);
+       bool OnKeyPressed(const _Control& source, const _KeyInfo& keyInfo);
+
        virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
        virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
        virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
@@ -80,10 +85,13 @@ public:
        void OnFontInfoRequested(unsigned long& style, float& size);
        result Initialize(void);
        void UpdateTimeFormat(void);
+       void UpdateLastSelectedValue(_DateTimeId boxId, bool __isTouchPressed);
 
        virtual void OnVisualElementAnimationFinished (const Tizen::Ui::Animations::VisualElementAnimation &animation, const Tizen::Base::String &keyName, Tizen::Ui::Animations::VisualElement &target, bool completedNormally);
        virtual void OnVisualElementAnimationRepeated (const Tizen::Ui::Animations::VisualElementAnimation &animation, const Tizen::Base::String &keyName, Tizen::Ui::Animations::VisualElement &target, long currentRepeatCount){}
        virtual void OnVisualElementAnimationStarted (const Tizen::Ui::Animations::VisualElementAnimation &animation, const Tizen::Base::String &keyName, Tizen::Ui::Animations::VisualElement &target){}
+       result DrawFocus(void);
+
 
 private:
        _EditTimePresenter(const _EditTimePresenter&);
@@ -141,6 +149,7 @@ private:
        Tizen::Graphics::Bitmap* __pContentBgEffectNormalBitmap;
        Tizen::Graphics::Bitmap* __pContentBgEffectPressedBitmap;
        Tizen::Graphics::Bitmap* __pContentBgEffectDisabledBitmap;
+       Tizen::Graphics::Bitmap* __pfocusBitmap;
        Tizen::Ui::Animations::VisualElement* __pContentProvider;
 
        Tizen::Graphics::_Text::TextObject __textObject;
@@ -152,6 +161,10 @@ private:
        float __timeFontSize;
        bool __isAnimating;
        bool __isEditTimeInitialized;
+       _FocusType __focusStatus;
+       bool __isEnterKeyPressed;
+       bool __isFocused;
+       static const float __adjustFocusHeight = 8.0f;
 }; // _EditTimePresenter
 
 }}} // Tizen::Ui::Controls