Modified Expand/Collapse action in TableView
authorMinSung Jin <minsung.jin@samsung.com>
Sun, 24 Mar 2013 06:47:41 +0000 (15:47 +0900)
committerMinSung Jin <minsung.jin@samsung.com>
Sun, 24 Mar 2013 06:47:41 +0000 (15:47 +0900)
Change-Id: I8f8f142b85883b6eae0796af66c27b37b3f372b9
Signed-off-by: MinSung Jin <minsung.jin@samsung.com>
src/ui/controls/FUiCtrl_TableViewItem.cpp [changed mode: 0755->0644]
src/ui/controls/FUiCtrl_TableViewPresenter.cpp
src/ui/inc/FUiCtrl_IListItemCommon.h
src/ui/inc/FUiCtrl_TableViewItem.h
src/ui/inc/FUiCtrl_TableViewPresenter.h

old mode 100755 (executable)
new mode 100644 (file)
index 800932e..6822bc1
@@ -226,6 +226,7 @@ _TableViewItem::_TableViewItem(float itemHeight)
        , __isZoomInOutItemAnimationEnabled(false)
        , __isFadeInOutItemAnimationEnabled(false)
        , __isAnimationCallbackBlocked(false)
+       , __isItemTapSoundEnabled(true)
        , __pHighlightVisualElement(null)
        , __pBitmapVisualElement(null)
        , __pMoveItemAnimation(null)
@@ -784,14 +785,8 @@ _TableViewItem::GetSelectionStyle(void) const
        return __selectionStyle;
 }
 
-int
-_TableViewItem::GetItemHeight(void) const
-{
-       return GetSize().height;
-}
-
 float
-_TableViewItem::GetItemHeightF(void) const
+_TableViewItem::GetItemHeight(void) const
 {
        return GetSizeF().height;
 }
@@ -957,6 +952,20 @@ _TableViewItem::DrawItem(FloatRectangle& rcItem, ListItemState itemState, bool i
        return true;
 }
 
+bool
+_TableViewItem::SetItemTapSoundEnabled(bool tapSoundEnabled)
+{
+       bool oldValue = __isItemTapSoundEnabled;
+       __isItemTapSoundEnabled = tapSoundEnabled;
+       return oldValue;
+}
+
+bool
+_TableViewItem::GetItemTapSoundEnabled(void)
+{
+       return __isItemTapSoundEnabled;
+}
+
 void
 _TableViewItem::FireItemEvent(bool selectedItem)
 {
@@ -1000,13 +1009,15 @@ _TableViewItem::FireItemEvent(bool selectedItem)
                }
        }
 
-       PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+       if (__isItemTapSoundEnabled)
+       {
+               PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP);
+       }
 
        __checkItemHeightNeeded = true;
 
        int groupIndex = -1;
        int itemIndex = -1;
-
        GetItemIndex(groupIndex, itemIndex);
        pParent->FireTableViewItemEvent(groupIndex, itemIndex, eventType, this);
 }
@@ -1049,7 +1060,10 @@ _TableViewItem::OnTouchPressed(const _Control& source, const _TouchInfo& touchin
 
        __itemSelected = true;
 
-       StartTouchPressedTimer(source, touchinfo);
+       if (!IsIndividualSelectionEnabled(source))
+       {
+               StartTouchPressedTimer(source, touchinfo);
+       }
 
        return true;
 }
index 3cf95e2..9e6e00d 100644 (file)
@@ -49,9 +49,9 @@ _TableViewPresenter::_TableViewPresenter()
        : __pTableView(null)
        , __pListModel(null)
        , __pProviderAdaptor(null)
-       , __topMargin(0)
-       , __bottomMargin(0)
-       , __leftMargin(0)
+       , __topMargin(0.0f)
+       , __bottomMargin(0.0f)
+       , __leftMargin(0.0f)
        , __modelInitialized(false)
        , __firstDrawnFlag(true)
        , __statusChangedFlag(true)
@@ -61,10 +61,11 @@ _TableViewPresenter::_TableViewPresenter()
        , __sweepOccured(false)
        , __sweptItemPosition()
        , __reservedScrollItemAlignment(TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_TOP)
-       , __firstTouchMoved(0)
+       , __firstTouchMoved(false)
        , __pReorderScrollTimer(null)
        , __reorderInfo()
-       , __itemTotalHeight(0)
+       , __itemTotalHeight(0.0f)
+       , __pCapturedItemVisualElement(null)
        , __pFastScrollTimer(null)
        , __isFastScrollTimerEnabled(false)
        , __scrollHeightOnFlickStarted(0)
@@ -183,6 +184,13 @@ _TableViewPresenter::Dispose(void)
 
        delete __pFastScrollTimer;
        __pFastScrollTimer = null;
+
+       if (__pCapturedItemVisualElement)
+       {
+               GetView()->GetVisualElement()->DetachChild(*__pCapturedItemVisualElement);
+               __pCapturedItemVisualElement->Destroy();
+       }
+       __pCapturedItemVisualElement = null;
 }
 
 result
@@ -649,7 +657,6 @@ _TableViewPresenter::AdjustLayoutItems(float scrollPosition)
 
                currentItemPos = firstLoadedItemPos;
 
-               //while ((positionY > scrollPosition) && GetPreviousItemPosition(currentItemPos, currentItemPos))
                while (!_FloatCompareLE(positionY, scrollPosition) && GetPreviousItemPosition(currentItemPos, currentItemPos))
                {
                        pItem = LoadItem(currentItemPos.groupIndex, currentItemPos.itemIndex);
@@ -1590,7 +1597,6 @@ _TableViewPresenter::Draw(void)
 
                        return E_SUCCESS;
                }
-
        }
 
        __firstDrawnFlag = false;
@@ -2338,13 +2344,13 @@ _TableViewPresenter::ExpandGroup(int groupIndex, bool withAnimation)
 
        __pListModel->SetGroupExpandState(groupIndex, true);
 
-       float groupTotalHeight = 0;
+       float groupTotalHeight = 0.0f;
        int itemCount = GetItemCountAt(groupIndex);
-       _IListItemCommon* pItem = null;
+       _TableViewItem* pItem = null;
        for (int i = 0; i < itemCount; i++)
        {
-               pItem = __pListModel->GetItemFromTemporaryBuffer(groupIndex, i);
-               groupTotalHeight += pItem->GetItemHeight(); // +++ check floating
+               pItem = static_cast<_TableViewItem*>(__pListModel->GetItemFromTemporaryBuffer(groupIndex, i));
+               groupTotalHeight += pItem->GetItemHeight();
        }
 
        AdjustClientAreaBounds(false, groupTotalHeight);
@@ -2379,6 +2385,9 @@ _TableViewPresenter::ExpandGroup(int groupIndex, bool withAnimation)
        itemTag.groupIndex = groupIndex;
        itemTag.itemIndex = -1;
 
+       __expandableItemTag.groupIndex = groupIndex;
+       __expandableItemTag.itemIndex = -1;
+
        if (withAnimation)
        {
                _TableViewItem *pItem = FindItem(itemTag);
@@ -2391,7 +2400,7 @@ _TableViewPresenter::ExpandGroup(int groupIndex, bool withAnimation)
                float startPosition = itemBounds.y + itemBounds.height;
 
                float endPosition = startPosition + groupTotalHeight;
-               if (endPosition > screenPosition + __pTableView->GetBoundsF().height)
+               if (!_FloatCompareLE(endPosition, screenPosition + __pTableView->GetBoundsF().height))
                {
                        endPosition = screenPosition + __pTableView->GetBoundsF().height;
                }
@@ -2403,38 +2412,11 @@ _TableViewPresenter::ExpandGroup(int groupIndex, bool withAnimation)
                pAnimation->SetStartValue(Variant(startPosition));
                pAnimation->SetEndValue(Variant(endPosition));
                pAnimation->SetDuration(EXPAND_GROUP_ANIMATION_DURATION);
-               __expandableItemTag.groupIndex = groupIndex;
-               __expandableItemTag.itemIndex = -1;
                pVisualElement->AddAnimation(animationName, *pAnimation);
        }
        else
        {
-               LoadItemsToBeVisible(itemTag);
-               AttachNextItemsToBottom(itemTag);
-               SetLoadedItemsVisibleInGroup(groupIndex, true);
-
-               int currentGroupIndex = -1;
-               int currentItemIndex = -1;
-               GetBottomDrawnItemIndex(currentGroupIndex, currentItemIndex);
-
-               int lastLoadedGroupIndex = -1;
-               int lastLoadedItemIndex = -1;
-               __pListModel->GetLastLoadedItemIndex(lastLoadedGroupIndex, lastLoadedItemIndex);
-
-               for (int j = currentGroupIndex; j <= lastLoadedGroupIndex; j++)
-               {
-                       int itemCount = GetItemCountAt(j);
-
-                       for (int i = -1; i < itemCount; i++)
-                       {
-                               if (i <= currentItemIndex && j == currentGroupIndex)
-                               {
-                                       continue;
-                               }
-
-                               UnloadItem(j, i);
-                       }
-               }
+               ExpandGroupAnimationFinished(false);
        }
 
        return E_SUCCESS;
@@ -2471,11 +2453,11 @@ _TableViewPresenter::CollapseGroup(int groupIndex, bool withAnimation)
 
        float groupTotalHeight = 0;
        int itemCount = GetItemCountAt(groupIndex);
-       _IListItemCommon* pItem = null;
+       _TableViewItem* pItem = null;
        for (int i = 0; i < itemCount; i++)
        {
-               pItem = __pListModel->GetItemFromTemporaryBuffer(groupIndex, i);
-               groupTotalHeight += pItem->GetItemHeight(); // +++ check floating
+               pItem = static_cast<_TableViewItem*>(__pListModel->GetItemFromTemporaryBuffer(groupIndex, i));
+               groupTotalHeight += pItem->GetItemHeight();
        }
 
        if (groupIndex < itemTag.groupIndex || groupIndex > bottomTag.groupIndex)
@@ -2520,6 +2502,8 @@ _TableViewPresenter::CollapseGroup(int groupIndex, bool withAnimation)
                itemTag.groupIndex = groupIndex;
                itemTag.itemIndex = -1;
        }
+       __expandableItemTag.groupIndex = itemTag.groupIndex;
+       __expandableItemTag.itemIndex = itemTag.itemIndex;
 
        if(__firstDrawnFlag)
        {
@@ -2564,7 +2548,7 @@ _TableViewPresenter::CollapseGroup(int groupIndex, bool withAnimation)
                        endPosition += itemBounds.height;
                }
 
-               if (endPosition > screenPosition + __pTableView->GetBoundsF().height)
+               if (!_FloatCompareLE(endPosition, screenPosition + __pTableView->GetBoundsF().height))
                {
                        endPosition = screenPosition + __pTableView->GetBoundsF().height;
                }
@@ -2576,34 +2560,11 @@ _TableViewPresenter::CollapseGroup(int groupIndex, bool withAnimation)
                pAnimation->SetStartValue(Variant(endPosition));
                pAnimation->SetEndValue(Variant(startPosition));
                pAnimation->SetDuration(COLLAPSE_GROUP_ANIMATION_DURATION);
-               __expandableItemTag.groupIndex = itemTag.groupIndex;
-               __expandableItemTag.itemIndex = itemTag.itemIndex;
                pVisualElement->AddAnimation(animationName, *pAnimation);
        }
        else
        {
-               TableViewItemTag nextTag = {groupIndex + 1, -1};
-
-               if (itemTag.itemIndex != -1)
-               {
-                       float itemPositionY = CalculateItemPositionY(nextTag.groupIndex, nextTag.itemIndex);
-                       _TableViewItem* pNextItem = LoadItem(nextTag.groupIndex, nextTag.itemIndex);
-
-                       FloatRectangle itemBounds = pNextItem->GetBoundsF();
-                       itemBounds.y = itemPositionY;
-                       pNextItem->SetBounds(itemBounds);
-
-                       AttachNextItemsToBottom(nextTag);
-
-                       _ScrollPanelPresenter::ScrollTo(itemPositionY);
-               }
-               else
-               {
-                       AttachNextItemsToBottom(itemTag);
-               }
-
-               LoadItemsToBeVisible(nextTag);
-               SetLoadedItemsVisibleInGroup(groupIndex, false);
+               CollapseGroupAnimationFinished(false);
        }
 
        AdjustClientAreaBounds(false, -groupTotalHeight);
@@ -2922,7 +2883,6 @@ _TableViewPresenter::ScrollToInternal(float newPosition)
        return _ScrollPanelPresenter::ScrollToInternal(newScrollPosition);
 }
 
-
 void
 _TableViewPresenter::LoadItemWithScrollPosition(float previousScrollPosition, float currentScrollPos)
 {
@@ -3244,7 +3204,16 @@ _TableViewPresenter::FadeOutScrollBar(void)
                        StartFastScrollTimer();
                }
        }
-       else if (scrollStyle != TABLE_VIEW_SCROLL_BAR_STYLE_FIXED)
+       else if (scrollStyle == TABLE_VIEW_SCROLL_BAR_STYLE_FIXED)
+       {
+               _Scroll* pScroll = __pTableView->GetScrollBar();
+
+               if (pScroll != null)
+               {
+                       pScroll->SetScrollingEffectVisibility(false);
+               }
+       }
+       else
        {
                _ScrollPanelPresenter::FadeOutScrollBar();
        }
@@ -3253,7 +3222,6 @@ _TableViewPresenter::FadeOutScrollBar(void)
 void
 _TableViewPresenter::SweepItem(float x)
 {
-       //if (x != 0.0f)
        if (!_FloatCompare(x,  0.0f))
        {
                _TableViewItem* pItem = static_cast<_TableViewItem*>(__pListModel->LoadItem(__sweptItemTag.groupIndex, __sweptItemTag.itemIndex));
@@ -4191,7 +4159,7 @@ _TableViewPresenter::CheckItemHeightAndRefreshLayout(TableViewItemTag itemTag, b
 
        FloatRectangle itemBounds = pItem->GetBoundsF();
 
-       if (GetItemHeight(itemTag) == itemBounds.height)
+       if (_FloatCompare(GetItemHeight(itemTag), itemBounds.height))
        {
                return false;
        }
@@ -4461,7 +4429,6 @@ _TableViewPresenter::PresetItemHeightList(void)
        }
 }
 
-
 _TableViewItem*
 _TableViewPresenter::GetTableViewItemFromControl(const _Control& source)
 {
@@ -4484,6 +4451,68 @@ _TableViewPresenter::GetTableViewItemFromControl(const _Control& source)
 }
 
 void
+_TableViewPresenter::ShowTableViewCapturedItem(int groupIndex, int itemIndex, float height)
+{
+       TableViewItemTag itemTag = {groupIndex, itemIndex};
+       _TableViewItem* pItem = FindItem(itemTag);
+
+       if ((pItem == null) || _FloatCompare(height, 0.0f))
+       {
+               return;
+       }
+
+       result r = E_SUCCESS;
+       Canvas* pCanvas = null;
+       FloatRectangle itemBounds = pItem->GetBoundsF();
+
+       bool visibleState = pItem->GetVisibleState();
+       pItem->SetVisibleState(true);
+       Bitmap* pBitmap = pItem->GetCapturedBitmapN(true);
+       pItem->SetVisibleState(visibleState);
+
+       if (pBitmap == null)
+       {
+               return;
+       }
+
+       if (__pCapturedItemVisualElement == null)
+       {
+               __pCapturedItemVisualElement = new (std::nothrow) _VisualElement();
+               SysTryCatch(NID_UI_CTRL, __pCapturedItemVisualElement != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+               r = __pCapturedItemVisualElement->Construct();
+               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+               r = GetView()->GetVisualElement()->AttachChild(*__pCapturedItemVisualElement);
+               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to attach child to the control VisualElement.", GetErrorMessage(r));
+
+               __pCapturedItemVisualElement->SetSurfaceOpaque(false);
+               __pCapturedItemVisualElement->SetImplicitAnimationEnabled(false);
+       }
+
+       __pCapturedItemVisualElement->SetShowState(true);
+       __pCapturedItemVisualElement->SetBounds(FloatRectangle(itemBounds.x, itemBounds.y, itemBounds.width, height));
+
+       pCanvas = __pCapturedItemVisualElement->GetCanvasN();
+       SysTryCatch(NID_UI_CTRL, pCanvas != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient.");
+
+       pCanvas->SetBackgroundColor(Color(0, 0, 0, 0));
+       pCanvas->Clear();
+       pCanvas->DrawBitmap(FloatPoint(0.0f, 0.0f), *pBitmap);
+
+       delete pCanvas;
+       delete pBitmap;
+
+       return;
+
+CATCH:
+       delete pCanvas;
+       delete pBitmap;
+
+       __pCapturedItemVisualElement->Destroy();
+}
+
+void
 _TableViewPresenter::SetLoadedItemsVisibleFromPosition(float position, bool visible)
 {
        _TableViewItem* pItem;
@@ -4516,20 +4545,32 @@ _TableViewPresenter::SetLoadedItemsVisibleFromPosition(float position, bool visi
 
                if (visible)
                {
-                       pItem->SetVisibleState(visible);
-                       pItem->GetVisualElement()->SetZOrder(null, false);
-
-                       if (position < itemBounds.y + itemBounds.height)
+                       if (_FloatCompareGE(position, itemBounds.y) && !_FloatCompareGE(position, itemBounds.y + itemBounds.height))
                        {
+                               ShowTableViewCapturedItem(current.groupIndex, current.itemIndex, position - itemBounds.y);
+                               pItem->SetVisibleState(false);
                                break;
                        }
+                       else
+                       {
+                               pItem->SetVisibleState(true);
+                       }
                }
                else
                {
-                       if (position < itemBounds.y)
+                       if (!_FloatCompareGE(position, itemBounds.y))
                        {
                                UnloadItem(current);
                        }
+                       else if (_FloatCompareGE(position, itemBounds.y) && !_FloatCompareGE(position, itemBounds.y + itemBounds.height))
+                       {
+                               pItem->SetVisibleState(false);
+                               ShowTableViewCapturedItem(current.groupIndex, current.itemIndex, position - itemBounds.y);
+                       }
+                       else
+                       {
+                               pItem->SetVisibleState(true);
+                       }
                }
        }
 }
@@ -4577,6 +4618,188 @@ _TableViewPresenter::MoveLoadedItemsFromPosition(float position)
 }
 
 void
+_TableViewPresenter::ExpandGroupAnimationFinished(bool completedNormally)
+{
+       if (completedNormally == false)
+       {
+               TableViewItemTag current;
+               TableViewItemTag next;
+
+               current.groupIndex = __expandableItemTag.groupIndex;
+               current.itemIndex = -1;
+
+               _TableViewItem* pNextItem = null;
+               _TableViewItem* pCurrentItem = null;
+               pCurrentItem = LoadItem(current.groupIndex, current.itemIndex);
+
+               if (pCurrentItem == null)
+               {
+                       return;
+               }
+
+               FloatRectangle itemBounds;
+               FloatRectangle screenBounds = __pTableView->GetBoundsF();
+               float screenPosition = GetScrollPosition() + screenBounds.height;
+               float nextItemPositionY = pCurrentItem->GetBoundsF().y + pCurrentItem->GetBoundsF().height;
+
+               while (GetNextItemPosition(current, next))
+               {
+                       if (_FloatCompareGE(screenPosition, nextItemPositionY))
+                       {
+                               pCurrentItem = LoadItem(current.groupIndex, current.itemIndex);
+                               if (pCurrentItem == null)
+                               {
+                                       break;
+                               }
+                               pNextItem = LoadItem(next.groupIndex, next.itemIndex);
+                               if (pNextItem == null)
+                               {
+                                       break;
+                               }
+                               pNextItem->SetVisibleState(true);
+                               itemBounds = pNextItem->GetBoundsF();
+                               itemBounds.y = pCurrentItem->GetBoundsF().y + pCurrentItem->GetBoundsF().height;
+                               pNextItem->SetBounds(itemBounds);
+                               nextItemPositionY = itemBounds.y + itemBounds.height;
+                       }
+                       else
+                       {
+                               UnloadItem(next.groupIndex, next.itemIndex);
+                       }
+
+                       current = next;
+               }
+       }
+       else
+       {
+               int currentGroupIndex = -1;
+               int currentItemIndex = -1;
+               GetBottomDrawnItemIndex(currentGroupIndex, currentItemIndex);
+
+               int lastLoadedGroupIndex = -1;
+               int lastLoadedItemIndex = -1;
+               __pListModel->GetLastLoadedItemIndex(lastLoadedGroupIndex, lastLoadedItemIndex);
+
+               for (int j = currentGroupIndex; j <= lastLoadedGroupIndex; j++)
+               {
+                       int itemCount = GetItemCountAt(j);
+
+                       for (int i = -1; i < itemCount; i++)
+                       {
+                               if (i <= currentItemIndex && j == currentGroupIndex)
+                               {
+                                       continue;
+                               }
+
+                               UnloadItem(j, i);
+                       }
+               }
+       }
+}
+
+void
+_TableViewPresenter::CollapseGroupAnimationFinished(bool completedNormally)
+{
+       if (completedNormally == false)
+       {
+               TableViewItemTag current;
+               TableViewItemTag next;
+
+               current.groupIndex = __expandableItemTag.groupIndex;
+               current.itemIndex = -1;
+
+               _TableViewItem* pCurrentItem = null;
+               int itemCountInGroup = __pListModel->GetItemCountInGroup(__expandableItemTag.groupIndex);
+
+               for (int i = 0; i < itemCountInGroup; i++)
+               {
+                       UnloadItem(__expandableItemTag.groupIndex, i);
+               }
+
+               pCurrentItem = FindItem(current);
+               if (pCurrentItem == null)
+               {
+                       SysTryReturnVoidResult(NID_UI_CTRL, pCurrentItem != null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.")
+               }
+
+               FloatRectangle itemBounds;
+               float nextItemPositionY = pCurrentItem->GetBoundsF().y + pCurrentItem->GetBoundsF().height;
+
+               FloatRectangle screenBounds = __pTableView->GetBoundsF();
+               float screenPosition = GetScrollPosition() + screenBounds.height;
+
+               while (GetNextItemPosition(current, next))
+               {
+                       current = next;
+                       if (_FloatCompareGE(screenPosition, nextItemPositionY))
+                       {
+                               pCurrentItem = LoadItem(current.groupIndex, current.itemIndex);
+                               if (pCurrentItem == null)
+                               {
+                                       break;
+                               }
+
+                               pCurrentItem->SetVisibleState(true);
+                               itemBounds = pCurrentItem->GetBoundsF();
+                               itemBounds.y = nextItemPositionY;
+                               pCurrentItem->SetBounds(itemBounds);
+
+                               nextItemPositionY = pCurrentItem->GetBoundsF().y + pCurrentItem->GetBoundsF().height;
+                       }
+                       else
+                       {
+                               UnloadItem(current.groupIndex, current.itemIndex);
+                       }
+               }
+       }
+       else
+       {
+               float scrollPosition = GetScrollPosition();
+
+               int groupItemsHeight = 0;
+               _TableViewItem* pItem = null;
+               for (int i = 0; i < __expandableItemTag.itemIndex; i++)
+               {
+                       pItem = static_cast<_TableViewItem*>(__pListModel->GetItemFromTemporaryBuffer(__expandableItemTag.groupIndex, i));
+                       groupItemsHeight += pItem->GetItemHeight();
+               }
+
+               _TableViewItem* pTableViewItem = static_cast<_TableViewItem*>(__pListModel->GetItemFromTemporaryBuffer(__expandableItemTag.groupIndex, __expandableItemTag.itemIndex));
+               FloatRectangle itemBounds = pTableViewItem->GetBoundsF();
+               groupItemsHeight += (scrollPosition - itemBounds.y);
+
+               int currentGroupIndex = -1;
+               int currentItemIndex = -1;
+               GetTopDrawnItemIndex(currentGroupIndex, currentItemIndex);
+
+               int firstLoadedGroupIndex = -1;
+               int firstLoadedItemIndex = -1;
+               __pListModel->GetFirstLoadedItemIndex(firstLoadedGroupIndex, firstLoadedItemIndex);
+
+               for (int j = firstLoadedGroupIndex; j <= currentGroupIndex; j++)
+               {
+                       int itemCount = GetItemCountAt(j);
+
+                       for (int i = -1; i < itemCount; i++)
+                       {
+                               if (i >= currentItemIndex && j == currentGroupIndex)
+                               {
+                                       break;
+                               }
+
+                               UnloadItem(j, i);
+                       }
+               }
+
+               int itemCount = GetItemCountAt(__expandableItemTag.groupIndex);
+               for (int i = 0; i < itemCount; i++)
+               {
+                       UnloadItem(__expandableItemTag.groupIndex, i);
+               }
+       }
+}
+
+void
 _TableViewPresenter::OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target)
 {
        if (keyName == L"REMOVE_ITEM_ANIMATION")
@@ -4588,7 +4811,6 @@ _TableViewPresenter::OnVisualElementAnimationStarted(const Tizen::Ui::Animations
        {
                __scrollHeightOnFlickStarted = GetScrollAreaBounds().height;
                __scrollPositionOnFlickStarted = GetScrollPosition();
-
        }
 
        _ScrollPanelPresenter::OnVisualElementAnimationStarted(animation, keyName, target);
@@ -4623,182 +4845,22 @@ _TableViewPresenter::OnVisualElementAnimationFinished(const Tizen::Ui::Animation
        }
        else if (keyName == L"EXPAND_GROUP_ANIMATION")
        {
-               if (completedNormally == false)
+               if (__pCapturedItemVisualElement)
                {
-                       TableViewItemTag current;
-                       TableViewItemTag next;
-
-                       current.groupIndex = __expandableItemTag.groupIndex;
-                       current.itemIndex = -1;
-
-                       _TableViewItem* pNextItem = null;
-                       _TableViewItem* pCurrentItem = null;
-                       pCurrentItem = LoadItem(current.groupIndex, current.itemIndex);
-
-                       if (pCurrentItem == null)
-                       {
-                               return;
-                       }
-
-                       FloatRectangle itemBounds;
-                       FloatRectangle screenBounds = __pTableView->GetBoundsF();
-                       float screenPosition = GetScrollPosition() + screenBounds.height;
-                       float nextItemPositionY = pCurrentItem->GetBoundsF().y + pCurrentItem->GetBoundsF().height;
-
-                       while (GetNextItemPosition(current, next))
-                       {
-                               if (screenPosition >= nextItemPositionY)
-                               {
-                                       pCurrentItem = LoadItem(current.groupIndex, current.itemIndex);
-                                       if (pCurrentItem == null)
-                                       {
-                                               break;
-                                       }
-                                       pNextItem = LoadItem(next.groupIndex, next.itemIndex);
-                                       if (pNextItem == null)
-                                       {
-                                               break;
-                                       }
-
-                                       itemBounds = pNextItem->GetBoundsF();
-                                       itemBounds.y = pCurrentItem->GetBoundsF().y + pCurrentItem->GetBoundsF().height;
-                                       pNextItem->SetBounds(itemBounds);
-                                       nextItemPositionY = itemBounds.y + itemBounds.height;
-                               }
-                               else
-                               {
-                                       UnloadItem(next.groupIndex, next.itemIndex);
-                               }
-
-                               current = next;
-                       }
+                       __pCapturedItemVisualElement->SetShowState(false);
                }
-               else
-               {
-                       int currentGroupIndex = -1;
-                       int currentItemIndex = -1;
-                       GetBottomDrawnItemIndex(currentGroupIndex, currentItemIndex);
-
-                       int lastLoadedGroupIndex = -1;
-                       int lastLoadedItemIndex = -1;
-                       __pListModel->GetLastLoadedItemIndex(lastLoadedGroupIndex, lastLoadedItemIndex);
 
-                       for (int j = currentGroupIndex; j <= lastLoadedGroupIndex; j++)
-                       {
-                               int itemCount = GetItemCountAt(j);
-
-                               for (int i = -1; i < itemCount; i++)
-                               {
-                                       if (i <= currentItemIndex && j == currentGroupIndex)
-                                       {
-                                               continue;
-                                       }
-
-                                       UnloadItem(j, i);
-                               }
-                       }
-               }
+               ExpandGroupAnimationFinished(completedNormally);
                return;
        }
        else if (keyName == L"COLLAPSE_GROUP_ANIMATION")
        {
-               if (completedNormally == false)
-               {
-                       TableViewItemTag current;
-                       TableViewItemTag next;
-
-                       current.groupIndex = __expandableItemTag.groupIndex;
-                       current.itemIndex = -1;
-
-                       _TableViewItem* pCurrentItem = null;
-                       int itemCountInGroup = __pListModel->GetItemCountInGroup(__expandableItemTag.groupIndex);
-
-                       for (int i = 0; i < itemCountInGroup; i++)
-                       {
-                               UnloadItem(__expandableItemTag.groupIndex, i);
-                       }
-
-                       pCurrentItem = FindItem(current);
-                       if (pCurrentItem == null)
-                       {
-                               SysTryReturnVoidResult(NID_UI_CTRL, pCurrentItem != null, E_SYSTEM, "[E_SYSTEM] A system error has been occurred.")
-                       }
-
-                       FloatRectangle itemBounds;
-                       float nextItemPositionY = pCurrentItem->GetBoundsF().y + pCurrentItem->GetBoundsF().height;
-
-                       FloatRectangle screenBounds = __pTableView->GetBoundsF();
-                       float screenPosition = GetScrollPosition() + screenBounds.height;
-
-                       while (GetNextItemPosition(current, next))
-                       {
-                               current = next;
-                               if (screenPosition >= nextItemPositionY)
-                               {
-                                       pCurrentItem = LoadItem(current.groupIndex, current.itemIndex);
-                                       if (pCurrentItem == null)
-                                       {
-                                               break;
-                                       }
-
-                                       itemBounds = pCurrentItem->GetBoundsF();
-                                       itemBounds.y = nextItemPositionY;
-                                       pCurrentItem->SetBounds(itemBounds);
-
-                                       nextItemPositionY = pCurrentItem->GetBoundsF().y + pCurrentItem->GetBoundsF().height;
-                               }
-                               else
-                               {
-                                       UnloadItem(current.groupIndex, current.itemIndex);
-                               }
-                       }
-               }
-               else
+               if (__pCapturedItemVisualElement)
                {
-                       float scrollPosition = GetScrollPosition();
-
-                       int groupItemsHeight = 0;
-                       _IListItemCommon* pItem = null;
-                       for (int i = 0; i < __expandableItemTag.itemIndex; i++)
-                       {
-                               pItem = __pListModel->GetItemFromTemporaryBuffer(__expandableItemTag.groupIndex, i);
-                               groupItemsHeight += pItem->GetItemHeight();
-                       }
-
-                       _TableViewItem* pTableViewItem = static_cast<_TableViewItem*>(__pListModel->GetItemFromTemporaryBuffer(__expandableItemTag.groupIndex, __expandableItemTag.itemIndex));
-                       FloatRectangle itemBounds = pTableViewItem->GetBoundsF();
-                       groupItemsHeight += (scrollPosition - itemBounds.y);
-
-                       int currentGroupIndex = -1;
-                       int currentItemIndex = -1;
-                       GetTopDrawnItemIndex(currentGroupIndex, currentItemIndex);
-
-                       int firstLoadedGroupIndex = -1;
-                       int firstLoadedItemIndex = -1;
-                       __pListModel->GetFirstLoadedItemIndex(firstLoadedGroupIndex, firstLoadedItemIndex);
-
-                       for (int j = firstLoadedGroupIndex; j <= currentGroupIndex; j++)
-                       {
-                               int itemCount = GetItemCountAt(j);
-
-                               for (int i = -1; i < itemCount; i++)
-                               {
-                                       if (i >= currentItemIndex && j == currentGroupIndex)
-                                       {
-                                               break;
-                                       }
-
-                                       UnloadItem(j, i);
-                               }
-                       }
-
-                       int itemCount = GetItemCountAt(__expandableItemTag.groupIndex);
-                       for (int i = 0; i < itemCount; i++)
-                       {
-                               UnloadItem(__expandableItemTag.groupIndex, i);
-                       }
+                       __pCapturedItemVisualElement->SetShowState(false);
                }
 
+               CollapseGroupAnimationFinished(completedNormally);
                return;
        }
 
index 88c164a..a2974df 100644 (file)
@@ -51,10 +51,6 @@ class _IListItemCommon
 public:
        virtual ~_IListItemCommon(void) {};
 
-       virtual int GetItemHeight(void) const = 0;
-
-       virtual void SetItemHeight(int itemHeight) = 0;
-
        virtual void SetChecked(bool checked) = 0;
 
        virtual bool IsChecked(void) const = 0;
index cb3b913..3349698 100644 (file)
@@ -138,8 +138,7 @@ public:
 
        virtual bool DrawItem(Tizen::Graphics::FloatRectangle& rcItem, ListItemState isFocused, bool itemDivider = false);
 
-       virtual int GetItemHeight(void) const;  // +++ check floating
-       virtual float GetItemHeightF(void) const;
+       virtual float GetItemHeight(void) const;
        virtual void SetItemHeight(int itemHeight);     // +++ check floating
        virtual void SetItemHeight(float itemHeight);
 
@@ -294,6 +293,12 @@ protected:
        _TableViewItem(float nItemHeight);
        result Initialize(void);
 
+       bool SetItemTapSoundEnabled(bool tapSoundEnabled);
+       bool GetItemTapSoundEnabled(void);
+
+       result StartTouchPressedTimer(const _Control& source, const _TouchInfo& touchinfo);
+       void StopTouchPressedTimer(void);
+
 private:
        _TableViewItem(const _TableViewItem&);
        _TableViewItem& operator =(const _TableViewItem&);
@@ -330,9 +335,6 @@ private:
        result CreateItemDivider(void);
        result CreateItemAnnexDivider(void);
 
-       result StartTouchPressedTimer(const _Control& source, const _TouchInfo& touchinfo);
-       void StopTouchPressedTimer(void);
-
 private:
        void* __pAppInfo;
        int __refCount;
@@ -413,6 +415,8 @@ private:
        bool __isFadeInOutItemAnimationEnabled;
        bool __isAnimationCallbackBlocked;
 
+       bool __isItemTapSoundEnabled;
+
        Tizen::Ui::Animations::_VisualElement* __pHighlightVisualElement;
        Tizen::Ui::Animations::_VisualElement* __pBitmapVisualElement;
 
index a7b0b4d..e827db3 100644 (file)
@@ -286,10 +286,7 @@ private:
        result DrawEmptyTableView(void);
 
        void LoadItemWithScrollPosition(float previousScrollPosition, float currentScrollPos);
-
-
        bool GetTableViewItemPosition(_TableViewItem& item, TableViewItemTag& itemTag); // item must exist between from tag and end tag
-
        int LoadAllItemsInGroup(int groupIndex, bool downward);
        void SetLoadedItemsVisibleInGroup(int groupIndex, bool visible);
        TableViewItemTag LoadItemsToBeVisible(const TableViewItemTag& from);
@@ -326,8 +323,12 @@ private:
 
        void CaptureAndStartRemoveItemAnimation(int groupIndex, int itemIndex);
 
+       void ShowTableViewCapturedItem(int groupIndex, int itemIndex, float height);
        void SetLoadedItemsVisibleFromPosition(float position, bool visible);
        void MoveLoadedItemsFromPosition(float position);
+       void ExpandGroupAnimationFinished(bool completedNormally);
+       void CollapseGroupAnimationFinished(bool completedNormally);
+
 
        void SweepItem(float x);
        void ResetSweptItem(void);
@@ -371,6 +372,7 @@ private:
        float __itemTotalHeight;
 
        TableViewItemTag __expandableItemTag;
+       Tizen::Ui::Animations::_VisualElement* __pCapturedItemVisualElement;
 
        Tizen::Base::Runtime::Timer* __pFastScrollTimer;
        bool __isFastScrollTimerEnabled;