Modified the items when bounds changed. Fixed for VPSS-746.
authorHyeonmi Kim <hm_85.kim@samsung.com>
Tue, 19 Mar 2013 11:32:53 +0000 (20:32 +0900)
committerHyeonmi Kim <hm_85.kim@samsung.com>
Wed, 20 Mar 2013 07:02:37 +0000 (16:02 +0900)
Change-Id: Id5de32d681f1760d0ac007874968d56b197a80d4
Signed-off-by: Hyeonmi Kim <hm_85.kim@samsung.com>
src/ui/controls/FUiCtrl_GroupedListViewImpl.cpp
src/ui/controls/FUiCtrl_ListViewImpl.cpp
src/ui/inc/FUiCtrl_GroupedListViewImpl.h
src/ui/inc/FUiCtrl_ListViewImpl.h

index 30c631e..93f301d 100644 (file)
@@ -77,6 +77,7 @@ _GroupedListViewImpl::_GroupedListViewImpl(GroupedListView* pGroupedList, _Table
        , __pEmptyBitmap(null)
        , __pEmptyText(null)
        , __redrawListView(true)
+       , __isBoundsChanged(false)
        , __pItemNeedsLazyDeletion(null)
        , __pTouchEventHandler(null)
        , __pLongPressedGesture(null)
@@ -601,7 +602,7 @@ _GroupedListViewImpl::SetItemDescriptionTextShowState(int groupIndex, int itemIn
 }
 
 result
-_GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType type)
+_GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType type, bool needFlush)
 {
        result r = E_SUCCESS;
 
@@ -719,8 +720,11 @@ _GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType
 
        CheckEmptyListShowState();
 
-       Draw();
-       Show();
+       if (needFlush)
+       {
+               Draw();
+               Show();
+       }
 
        SetLastResultReturn(r);
 }
@@ -1378,6 +1382,17 @@ _GroupedListViewImpl::OnDraw(void)
        }
 }
 
+result
+_GroupedListViewImpl::OnBoundsChanging(const Tizen::Graphics::FloatRectangle& bounds)
+{
+       if (GetCore().GetBoundsF().width != bounds.width)
+       {
+               __isBoundsChanged = true;
+       }
+
+       return _ControlImpl::OnBoundsChanging(bounds);
+}
+
 void
 _GroupedListViewImpl::OnBoundsChanged(void)
 {
@@ -1392,22 +1407,35 @@ _GroupedListViewImpl::OnBoundsChanged(void)
                SetTextOfEmptyList(__pEmptyText->GetText());
        }
 
-       _GroupedListViewItemProviderAdaptor* pProviderAdaptor =
-                       static_cast <_GroupedListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
-
-       if (pProviderAdaptor != null)
+       if (__isBoundsChanged)
        {
-               float itemWidth = GetCore().GetBoundsF().width;
+               int firstGroup = -1;
+               int firstItem = -1;
+               int lastGroup = -1;
+               int lastItem = -1;
+               int currentItem = -1;
+               int lastItemInGroup = -1;
+
+               GetCore().GetFirstLoadedItemIndex(firstGroup, firstItem);
+               GetCore().GetLastLoadedItemIndex(lastGroup, lastItem);
 
-               if (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_SECTION)
+               for (int i = firstGroup; i <= lastGroup; i++)
                {
-                       float margin = 0;
-                       GET_SHAPE_CONFIG(TABLEVIEW::GROUPITEM_LEFT_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, margin);
+                       currentItem = ((i == firstGroup) ? firstItem : -1);
+                       lastItemInGroup = ((i == lastGroup) ? lastItem : GetCore().GetItemCountAt(i));
 
-                       itemWidth -= (margin * 2.0f);
+                       for (; currentItem <= lastItemInGroup; currentItem++)
+                       {
+                               _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(i, currentItem));
+
+                               if (pListViewItem != null)
+                               {
+                                       RefreshList(i, currentItem, LIST_REFRESH_TYPE_ITEM_MODIFY, false);
+                               }
+                       }
                }
 
-               pProviderAdaptor->SetListWidth(itemWidth);
+               __isBoundsChanged = false;
        }
 }
 
index 8599d5c..66cafcf 100644 (file)
@@ -75,6 +75,7 @@ _ListViewImpl::_ListViewImpl(ListView* pList, _TableView* pCore)
        , __pEmptyBitmap(null)
        , __pEmptyText(null)
        , __redrawListView(true)
+       , __isBoundsChanged(false)
        , __pItemNeedsLazyDeletion(null)
        , __pTouchEventHandler(null)
        , __pLongPressedGesture(null)
@@ -583,7 +584,7 @@ _ListViewImpl::SetItemDescriptionTextShowState(int index, bool show)
 }
 
 result
-_ListViewImpl::RefreshList(int index, ListRefreshType type)
+_ListViewImpl::RefreshList(int index, ListRefreshType type, bool needFlush)
 {
        result r = E_SUCCESS;
 
@@ -696,8 +697,11 @@ _ListViewImpl::RefreshList(int index, ListRefreshType type)
 
        CheckEmptyListShowState();
 
-       Draw();
-       Show();
+       if (needFlush)
+       {
+               Draw();
+               Show();
+       }
 
        SetLastResultReturn(r);
 }
@@ -1260,6 +1264,17 @@ _ListViewImpl::OnDraw(void)
        }
 }
 
+result
+_ListViewImpl::OnBoundsChanging(const FloatRectangle& bounds)
+{
+       if (GetCore().GetBoundsF().width != bounds.width)
+       {
+               __isBoundsChanged = true;
+       }
+
+       return _ControlImpl::OnBoundsChanging(bounds);
+}
+
 void
 _ListViewImpl::OnBoundsChanged(void)
 {
@@ -1274,11 +1289,35 @@ _ListViewImpl::OnBoundsChanged(void)
                SetTextOfEmptyList(__pEmptyText->GetText());
        }
 
-       _ListViewItemProviderAdaptor* pProviderAdaptor = static_cast <_ListViewItemProviderAdaptor*>(GetCore().GetItemProviderAdaptor());
-
-       if (pProviderAdaptor != null)
+       if (__isBoundsChanged)
        {
-               pProviderAdaptor->SetListWidth(GetCore().GetBoundsF().width);
+               int firstGroup = -1;
+               int firstItem = -1;
+               int lastGroup = -1;
+               int lastItem = -1;
+               int currentItem = -1;
+               int lastItemInGroup = -1;
+
+               GetCore().GetFirstLoadedItemIndex(firstGroup, firstItem);
+               GetCore().GetLastLoadedItemIndex(lastGroup, lastItem);
+
+               for (int i = firstGroup; i <= lastGroup; i++)
+               {
+                       currentItem = ((i == firstGroup) ? firstItem : -1);
+                       lastItemInGroup = ((i == lastGroup) ? lastItem : GetCore().GetItemCountAt(i));
+
+                       for (; currentItem <= lastItemInGroup; currentItem++)
+                       {
+                               _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(i, currentItem));
+
+                               if (pListViewItem != null)
+                               {
+                                       RefreshList(currentItem, LIST_REFRESH_TYPE_ITEM_MODIFY, false);
+                               }
+                       }
+               }
+
+               __isBoundsChanged = false;
        }
 }
 
index e0200b5..c4ca2e3 100644 (file)
@@ -123,7 +123,7 @@ public:
 
        result HideItemDescriptionText(int groupIndex, int itemIndex);
 
-       result RefreshList(int groupIndex, int itemIndex, ListRefreshType type);
+       result RefreshList(int groupIndex, int itemIndex, ListRefreshType type, bool needFlush = true);
 
        result RefreshList(int groupIndex, int itemIndex, int elementId);
 
@@ -231,6 +231,8 @@ public:
 
        virtual void OnDraw(void);
 
+       virtual result OnBoundsChanging(const Tizen::Graphics::FloatRectangle& bounds);
+
        virtual void OnBoundsChanged(void);
 
        virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
@@ -289,6 +291,7 @@ private:
        Tizen::Graphics::Color __emptyTextColor;
 
        bool __redrawListView;
+       bool __isBoundsChanged;
        _ListViewItem* __pItemNeedsLazyDeletion;
 
        _ListViewTouchEventHandler* __pTouchEventHandler;
index 2ee266a..827ef41 100644 (file)
@@ -120,7 +120,7 @@ public:
 
        result HideItemDescriptionText(int index);
 
-       result RefreshList(int index, ListRefreshType type);
+       result RefreshList(int index, ListRefreshType type, bool needFlush = true);
 
        result RefreshList(int index, int elementId);
 
@@ -213,6 +213,8 @@ public:
 
        virtual void OnDraw(void);
 
+       virtual result OnBoundsChanging(const Tizen::Graphics::FloatRectangle& bounds);
+
        virtual void OnBoundsChanged(void);
 
        virtual void OnFontChanged(Tizen::Graphics::Font* pFont);
@@ -268,6 +270,7 @@ private:
        Tizen::Graphics::Color __emptyTextColor;
 
        bool __redrawListView;
+       bool __isBoundsChanged;
        _ListViewItem* __pItemNeedsLazyDeletion;
 
        _ListViewTouchEventHandler* __pTouchEventHandler;