Merge "Fix for N_SE-43296: Removing ContextItemEventListener on Item Delete" into...
authorVinay Dutt Vyas <vinay.vyas@samsung.com>
Fri, 5 Jul 2013 13:39:38 +0000 (13:39 +0000)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Fri, 5 Jul 2013 13:39:38 +0000 (13:39 +0000)
15 files changed:
res/common/usr/share/osp/bitmaps/480x800/black/00_color_picker_handler.png [moved from res/common/usr/share/osp/bitmaps/480x800/00_color_picker_handler.png with 100% similarity]
res/common/usr/share/osp/bitmaps/480x800/default/00_color_picker_handler.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/480x800/white/00_color_picker_handler.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/720x1280/black/00_color_picker_handler.png [moved from res/common/usr/share/osp/bitmaps/720x1280/00_color_picker_handler.png with 93% similarity]
res/common/usr/share/osp/bitmaps/720x1280/default/00_color_picker_handler.png [new file with mode: 0644]
res/common/usr/share/osp/bitmaps/720x1280/white/00_color_picker_handler.png [new file with mode: 0644]
src/ui/controls/FUiCtrl_DateTimeBar.cpp
src/ui/controls/FUiCtrl_DateTimeBarPresenter.cpp
src/ui/controls/FUiCtrl_EditDatePresenter.cpp
src/ui/controls/FUiCtrl_EditTimePresenter.cpp
src/ui/controls/FUiCtrl_IconListPresenter.cpp
src/ui/controls/FUiCtrl_OptionMenuItem.cpp
src/ui/controls/FUiCtrl_OptionMenuPresenter.cpp
src/ui/inc/FUiCtrl_DateTimeBarPresenter.h
src/ui/inc/FUiCtrl_OptionMenuPresenter.h

diff --git a/res/common/usr/share/osp/bitmaps/480x800/default/00_color_picker_handler.png b/res/common/usr/share/osp/bitmaps/480x800/default/00_color_picker_handler.png
new file mode 100644 (file)
index 0000000..7d02fdf
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/480x800/default/00_color_picker_handler.png differ
diff --git a/res/common/usr/share/osp/bitmaps/480x800/white/00_color_picker_handler.png b/res/common/usr/share/osp/bitmaps/480x800/white/00_color_picker_handler.png
new file mode 100644 (file)
index 0000000..7d02fdf
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/480x800/white/00_color_picker_handler.png differ
similarity index 93%
rename from res/common/usr/share/osp/bitmaps/720x1280/00_color_picker_handler.png
rename to res/common/usr/share/osp/bitmaps/720x1280/black/00_color_picker_handler.png
index bbaa7e7..02250e6 100644 (file)
Binary files a/res/common/usr/share/osp/bitmaps/720x1280/00_color_picker_handler.png and b/res/common/usr/share/osp/bitmaps/720x1280/black/00_color_picker_handler.png differ
diff --git a/res/common/usr/share/osp/bitmaps/720x1280/default/00_color_picker_handler.png b/res/common/usr/share/osp/bitmaps/720x1280/default/00_color_picker_handler.png
new file mode 100644 (file)
index 0000000..02250e6
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/720x1280/default/00_color_picker_handler.png differ
diff --git a/res/common/usr/share/osp/bitmaps/720x1280/white/00_color_picker_handler.png b/res/common/usr/share/osp/bitmaps/720x1280/white/00_color_picker_handler.png
new file mode 100644 (file)
index 0000000..02250e6
Binary files /dev/null and b/res/common/usr/share/osp/bitmaps/720x1280/white/00_color_picker_handler.png differ
index bfdbca9..34ecacd 100644 (file)
@@ -686,6 +686,10 @@ _DateTimeBar::RefreshItems(void)
 bool
 _DateTimeBar::OnFocusGained(const _Control& control)
 {
+       __pDateTimeBarPresenter->ChangeFocusStatus();
+       __pDateTimeBarPresenter->SetFocusedItemBounds();
+       __pDateTimeBarPresenter->SetItemFocused(true);
+
        return true;
 }
 
@@ -707,9 +711,6 @@ _DateTimeBar::OnFocusModeStateChanged(void)
 void
 _DateTimeBar::OnDrawFocus(void)
 {
-       __pDateTimeBarPresenter->RefreshDateTimeBar();
-       __pDateTimeBarPresenter->SetItemFocused(true);
-       __pDateTimeBarPresenter->ChangeFocusStatus();
        return;
 }
 
index ed29811..1c475c4 100644 (file)
@@ -255,6 +255,11 @@ void
 _DateTimeBarPresenter::ChangeFocusStatus(void)
 {
        _DateTimeBarItem* pItem = null;
+
+       if (__focusedIndex == -1)
+       {
+               __focusedIndex = GetSelectedItemIndex() - 1;
+       }
        pItem = GetItemAt(__focusedIndex);
 
        if (pItem != null)
@@ -277,22 +282,16 @@ _DateTimeBarPresenter::SetItemFocused(bool isFocused)
 }
 
 void
-_DateTimeBarPresenter::RefreshDateTimeBar()
+_DateTimeBarPresenter::SetFocusedItemBounds()
 {
-       __initialAnimationValue = 0.0f;
-       __isInitialAnimation = false;
        _DateTimeBarItem* pItem = null;
 
-       ResetFlickAnimationTimer();
-       RemoveAllItems();
-       __pDateTimeBar->SetInitialValue(GetMinimumValue(), GetMaximumValue(), __focusedValue, __pDateTimeBar->GetSelectedBoxId());
-       __distance = (GetItemWidth() * (-1.0f));
-
-       LoadItems();
-       AdjustItemPosition(__distance);
-       ValidateAndAdjustStartPosition();
-       pItem = GetItemAt(__focusedIndex);
-       __focusBounds = pItem->GetBounds();
+       if (__focusedIndex > 0)
+       {
+               pItem = GetItemAt(__focusedIndex);
+               SysTryReturnVoidResult(NID_UI,  pItem != NULL, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+               __focusBounds = pItem->GetBounds();
+       }
 }
 
 void
@@ -1048,15 +1047,30 @@ _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_UP:
+                       //fall through
+               case KEY_DOWN:
+                       //fall through:
+               case KEY_TAB:
+               {
+                       __pDateTimeBar->CloseDateTimeBar();
+                       ResetFlickAnimationTimer();
+
+                       if (__pDateTimeBar->GetSelectedBoxId() >= DATETIME_ID_YEAR && __pDateTimeBar->GetSelectedBoxId() <= DATETIME_ID_DAY)
+                       {
+                               __pDateTimeBar->FireDateTimeChangeEvent(DATE_INTERNAL_CHANGE_CANCELED);
+                       }
+                       else if (__pDateTimeBar->GetSelectedBoxId() >= DATETIME_ID_HOUR && __pDateTimeBar->GetSelectedBoxId() <= DATETIME_ID_MINUTE)
+                       {
+                               __pDateTimeBar->FireDateTimeChangeEvent(TIME_INTERNAL_CHANGE_CANCELED);
+                       }
+
+                       break;
+               }
                case KEY_RIGHT:
                {
                        if ((__focusBounds.x + __focusBounds.width) > (GetWindowBounds().width - __focusBounds.width))
@@ -1066,7 +1080,6 @@ _DateTimeBarPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyI
                        else
                        {
                                __focusBounds.x = __focusBounds.x + __focusBounds.width + GetItemMargin();
-
                        }
                        __focusedIndex = GetItemIndexFromPosition(FloatPoint(__focusBounds.x, __focusBounds.y));
                        __pDateTimeBar->Invalidate();
@@ -1104,7 +1117,7 @@ _DateTimeBarPresenter::OnKeyPressed(const _Control& source, const _KeyInfo& keyI
                        if (pItem != null)
                        {
                                __pDateTimeBar->SetVisibleState(false);
-                               __pDateTimeBar->Close();
+                               __pDateTimeBar->CloseDateTimeBar();
 
                                __pDateTimeBar->FireActionEvent(pItem->GetActionId());
 
index 1d17713..54c3687 100644 (file)
@@ -1276,7 +1276,6 @@ _EditDatePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
        if ((__pEditDate->GetDateTimeBar() != null) && (GetLastSelectedId() != DATETIME_ID_NONE))
        {
                __pEditDate->SetFocused(true);
-
                FloatRectangle bounds(0.0f, 0.0f, 0.0f, 0.0f);
                bounds = GetDateAreaBounds(GetLastSelectedId());
                FloatRectangle absoluteBounds(0.0f, 0.0f, 0.0f, 0.0f);
@@ -1287,7 +1286,8 @@ _EditDatePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
 
                if (__pEditDate->GetDateTimeBar()->IsActivated())
                {
-                       __pEditDate->GetDateTimeBar()->RefreshItems();
+                       __pEditDate->GetDateTimeBar()->Close();
+                       __pEditDate->GetDateTimeBar()->Open();
                }
                else
                {
index 7b866c5..47de18b 100644 (file)
@@ -1499,7 +1499,8 @@ _EditTimePresenter::OnTouchReleased(const _Control& source, const _TouchInfo& to
 
                if (__pEditTime->GetDateTimeBar()->IsActivated())
                {
-                       __pEditTime->GetDateTimeBar()->RefreshItems();
+                       __pEditTime->GetDateTimeBar()->Close();
+                       __pEditTime->GetDateTimeBar()->Open();
                }
                else
                {
index 67a35fa..c7812d5 100644 (file)
@@ -1017,7 +1017,7 @@ _IconListPresenter::UpdateList(void)
                for (int index = 0; index < itemCount; index++)
                {
                        _IconListItem* pItem = dynamic_cast <_IconListItem*>(__pItemProviderAdaptor->LoadItem(DEFAULT_GROUP_INDEX, index));
-                       if (pItem->GetItemAccessibilityElement() != null)
+                       if (pItem != null && pItem->GetItemAccessibilityElement() != null)
                        {
                                pItem->GetItemAccessibilityElement()->Activate(false);
                        }
index 5bc7eca..0cd1d37 100755 (executable)
@@ -630,17 +630,11 @@ _OptionMenuItem::DrawArrow(void)
 
        if (__selected == true)
        {
-               if (__pArrowPressedBitmap)
-               {
-                       __pArrowLabel->SetBackgroundBitmap(*__pArrowPressedBitmap);
-               }
+               __pArrowLabel->SetBackgroundBitmap(*__pArrowPressedBitmap);
        }
        else
        {
-               if (__pArrowBitmap)
-               {
-                       __pArrowLabel->SetBackgroundBitmap(*__pArrowBitmap);
-               }
+               __pArrowLabel->SetBackgroundBitmap(*__pArrowBitmap);
        }
 
        __pArrowLabel->Invalidate();
index cccde7a..da80ff1 100755 (executable)
@@ -423,52 +423,71 @@ _OptionMenuPresenter::GetSubItemActionIdAt(int mainIndex, int subIndex) const
        return pItem->GetActionId();
 }
 
-result
-_OptionMenuPresenter::SetItem(int index, const String& text, int actionId, const Bitmap* normalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap)
+FloatDimension
+_OptionMenuPresenter::GetMainItemMaximumWidth(void)
 {
-       SysTryReturn(NID_UI_CTRL, index >=0 && index < __pModel->GetItemCount(), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid mainIndex %d.", index);
-
-       result r = __pModel->SetItemAt(index, text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap, __itemFontSize);
-       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       float labelLeftMargin = 0.0f;
+       FloatDimension itemSize(0.0f, 0.0f);
+       FloatDimension maxItemTextArea(0.0f, 0.0f);
 
-       _OptionMenuItem* pItem = __pModel->GetItem(index);
+       GET_SHAPE_CONFIG(LABEL::LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, labelLeftMargin);
 
-       if (pItem == null)
+       for (int i = 0; i < __pModel->GetItemCount() - 1; i++)
        {
-               SysLog(NID_UI_CTRL, "Item is null.");
-               return r;
-       }
-
-       float bitmapWidth = 0.0f;
-       FloatDimension textArea(0.0f, 0.0f);
-       FloatDimension itemSize(0.0f, 0.0f);
+               FloatDimension currentItemTextArea(0.0f, 0.0f);
+               _OptionMenuItem* pItem = null;
 
-       __pFont->GetTextExtent(text, text.GetLength(), textArea);
+               pItem = __pModel->GetItem(i);
+               SysTryReturn(NID_UI_CTRL, pItem != null, FloatDimension(0.0f, 0.0f), E_SYSTEM, "[E_SYSTEM] A system error occurred. Unable to get the item.");
 
-       float labelLeftMargin = 0.0f;
+               String itemText = pItem->GetText();
 
-       GET_SHAPE_CONFIG(LABEL::LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, labelLeftMargin);
+               __pFont->GetTextExtent(itemText, itemText.GetLength(), currentItemTextArea);
 
-       textArea.width  += 2.0f * labelLeftMargin;
-       itemSize.width =  __leftMargin + textArea.width + __rightMargin;
+               if (currentItemTextArea.width > maxItemTextArea.width)
+               {
+                       maxItemTextArea = currentItemTextArea;
+               }
 
-       if (pItem->GetType() == OPTION_MENU_ITEM_DRAWING_TYPE_BITMAP)
-       {
-               bitmapWidth = __itemBitmapWidth;
-               itemSize.width =  itemSize.width + bitmapWidth;
+               if (pItem->GetType() == OPTION_MENU_ITEM_DRAWING_TYPE_BITMAP)
+               {
+                       itemSize.width =  itemSize.width + __itemBitmapWidth;
+               }
        }
 
+       maxItemTextArea.width  += 2.0f * labelLeftMargin;
+       itemSize.width +=  __leftMargin + maxItemTextArea.width + __rightMargin;
+
        itemSize.width = itemSize.width < __itemMinWidth ? __itemMinWidth : itemSize.width;
 
        if (itemSize.width > __itemMaxWidth)
        {
-               textArea.width -= itemSize.width - __itemMaxWidth;
                itemSize.width = __itemMaxWidth;
        }
 
-       pItem->SetSize(itemSize);
+       return itemSize;
+}
+
+result
+_OptionMenuPresenter::SetItem(int index, const String& text, int actionId, const Bitmap* normalBitmap, const Bitmap* pPressedBitmap, const Bitmap* pHighlightedBitmap)
+{
+       SysTryReturn(NID_UI_CTRL, index >=0 && index < __pModel->GetItemCount(), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid mainIndex %d.", index);
 
-       __itemWidth = __itemWidth < itemSize.width ? itemSize.width : __itemWidth;
+       result r = __pModel->SetItemAt(index, text, actionId, normalBitmap, pPressedBitmap, pHighlightedBitmap, __itemFontSize);
+       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       _OptionMenuItem* pItem = __pModel->GetItem(index);
+
+       if (pItem == null)
+       {
+               SysLog(NID_UI_CTRL, "Item is null.");
+               return r;
+       }
+
+       FloatDimension maxItemTextArea = GetMainItemMaximumWidth();
+       pItem->SetSize(maxItemTextArea);
+
+       __itemWidth = maxItemTextArea.width;
 
        return r;
 }
@@ -485,6 +504,10 @@ _OptionMenuPresenter::DeleteItem(int index)
        r = __pModel->RemoveItem(index);
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "Failed to delete item.");
 
+       FloatDimension maxItemTextArea = GetMainItemMaximumWidth();
+
+       __itemWidth = maxItemTextArea.width;
+
        return r;
 }
 
index 90da69f..1b6d791 100644 (file)
@@ -72,7 +72,7 @@ public:
        void ChangeFocusStatus(void);
        void FocusModeChanged(void);
        void SetItemFocused(bool isFocused);
-       void RefreshDateTimeBar(void);
+       void SetFocusedItemBounds(void);
 
        float GetItemWidth(void) const;
        float GetItemMargin(void) const;
index 7e988e6..cc7b015 100644 (file)
@@ -89,8 +89,8 @@ public:
        virtual result CalculateWindowRect(void);
        virtual result ApplyColorProperty(void);
        int GetSubItemIndexFromActionId(int actionId) const;
-
        int GetSubItemActionIdAt(int mainIndex, int subIndex) const;
+       Tizen::Graphics::FloatDimension GetMainItemMaximumWidth(void);
 
        virtual _UiTouchEventDelivery OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo);
        virtual _UiTouchEventDelivery OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo);