Modified RefreshList() to UpdateList() when orientation has changed (N_SE-37158)
authorSuhwan_Park <suhwan0927.park@samsung.com>
Fri, 3 May 2013 07:55:59 +0000 (16:55 +0900)
committerSuhwan_Park <suhwan0927.park@samsung.com>
Fri, 3 May 2013 07:56:07 +0000 (16:56 +0900)
Change-Id: I0c03bed9db643b2da928cebd42aa49dc496dcfff
Signed-off-by: Suhwan_Park <suhwan0927.park@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 b35594f..67b488c 100644 (file)
@@ -557,7 +557,7 @@ _GroupedListViewImpl::_GroupedListViewImpl(GroupedListView* pGroupedList, _Table
        , __pEmptyText(null)
        , __pAccessibilityElement(null)
        , __redrawListView(true)
-       , __isBoundsChanged(false)
+       , __isOrientationChanged(false)
        , __needReloadItems(false)
        , __pItemNeedsLazyDeletion(null)
        , __pPropagatedTouchEventListener(null)
@@ -693,7 +693,7 @@ result
 _GroupedListViewImpl::SetItemProvider(IGroupedListViewItemProvider& provider)
 {
        result r = E_SUCCESS;
-       float itemWidth = GetCore().GetBoundsF().width;
+       float itemWidth = GetBoundsF().width;
 
        if (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_SECTION)
        {
@@ -734,7 +734,7 @@ result
 _GroupedListViewImpl::SetItemProvider(IGroupedListViewItemProviderF& provider)
 {
        result r = E_SUCCESS;
-       float itemWidth = GetCore().GetBoundsF().width;
+       float itemWidth = GetBoundsF().width;
 
        if (GetCore().GetTableViewStyle() == TABLE_VIEW_STYLE_SECTION)
        {
@@ -1068,7 +1068,7 @@ _GroupedListViewImpl::SetItemDescriptionTextShowState(int groupIndex, int itemIn
 }
 
 result
-_GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType type, bool needFlush)
+_GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType type)
 {
        result r = E_SUCCESS;
 
@@ -1174,11 +1174,8 @@ _GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType
 
        CheckEmptyListShowState();
 
-       if (needFlush)
-       {
-               Draw();
-               Show();
-       }
+       Draw();
+       Show();
 
        SetLastResultReturn(r);
 }
@@ -1524,7 +1521,7 @@ _GroupedListViewImpl::CheckEmptyListShowState(void)
                                pContainer->AddElement(*__pAccessibilityElement);
                        }
 
-                       Rectangle bounds = GetCore().GetBounds();
+                       Rectangle bounds = GetBounds();
                        __pAccessibilityElement->SetBounds(Rectangle(0, 0, bounds.width, bounds.height));
 
                        String accessibilityLable;
@@ -1900,7 +1897,7 @@ _GroupedListViewImpl::OnChangeLayout(_ControlOrientation orientation)
 {
        _ControlImpl::OnChangeLayout(orientation);
 
-       __isBoundsChanged = true;
+       __isOrientationChanged = true;
 }
 
 void
@@ -1917,35 +1914,10 @@ _GroupedListViewImpl::OnBoundsChanged(void)
                SetTextOfEmptyList(__pEmptyText->GetText());
        }
 
-       if (__isBoundsChanged)
+       if (__isOrientationChanged)
        {
-               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(i, currentItem, LIST_REFRESH_TYPE_ITEM_MODIFY, false);
-                               }
-                       }
-               }
-
-               __isBoundsChanged = false;
+               __isOrientationChanged = false;
+               UpdateList();
        }
 }
 
@@ -1980,7 +1952,7 @@ _GroupedListViewImpl::OnFontChanged(Font* pFont)
        for (int i = firstGroup; i <= lastGroup; i++)
        {
                currentItem = ((i == firstGroup) ? firstItem : -1);
-               lastItemInGroup = ((i == lastGroup) ? lastItem : GetCore().GetItemCountAt(i));
+               lastItemInGroup = ((i == lastGroup) ? lastItem : (GetCore().GetItemCountAt(i) - 1));
 
                for (; currentItem <= lastItemInGroup; currentItem++)
                {
index 39c6998..a4329cb 100644 (file)
@@ -555,7 +555,7 @@ _ListViewImpl::_ListViewImpl(ListView* pList, _TableView* pCore)
        , __pEmptyText(null)
        , __pAccessibilityElement(null)
        , __redrawListView(true)
-       , __isBoundsChanged(false)
+       , __isOrientationChanged(false)
        , __needReloadItems(false)
        , __pItemNeedsLazyDeletion(null)
        , __pPropagatedTouchEventListener(null)
@@ -702,13 +702,13 @@ _ListViewImpl::SetItemProvider(IListViewItemProvider& provider)
 
                pProviderAdaptor->SetListViewItemEventListener(*this);
 
-               r = pProviderAdaptor->SetListWidth(GetCore().GetBoundsF().width);
+               r = pProviderAdaptor->SetListWidth(GetBoundsF().width);
                GetCore().SetItemProviderAdaptor(pProviderAdaptor);
        }
        else
        {
                pProviderAdaptor->SetItemProvider(provider);
-               r = pProviderAdaptor->SetListWidth(GetCore().GetBoundsF().width);
+               r = pProviderAdaptor->SetListWidth(GetBoundsF().width);
 
                UpdateList();
        }
@@ -735,13 +735,13 @@ _ListViewImpl::SetItemProvider(IListViewItemProviderF& provider)
 
                pProviderAdaptor->SetListViewItemEventListener(*this);
 
-               r = pProviderAdaptor->SetListWidth(GetCore().GetBoundsF().width);
+               r = pProviderAdaptor->SetListWidth(GetBoundsF().width);
                GetCore().SetItemProviderAdaptor(pProviderAdaptor);
        }
        else
        {
                pProviderAdaptor->SetItemProvider(provider);
-               r = pProviderAdaptor->SetListWidth(GetCore().GetBoundsF().width);
+               r = pProviderAdaptor->SetListWidth(GetBoundsF().width);
 
                UpdateList();
        }
@@ -1050,7 +1050,7 @@ _ListViewImpl::SetItemDescriptionTextShowState(int index, bool show)
 }
 
 result
-_ListViewImpl::RefreshList(int index, ListRefreshType type, bool needFlush)
+_ListViewImpl::RefreshList(int index, ListRefreshType type)
 {
        result r = E_SUCCESS;
 
@@ -1152,11 +1152,8 @@ _ListViewImpl::RefreshList(int index, ListRefreshType type, bool needFlush)
 
        CheckEmptyListShowState();
 
-       if (needFlush)
-       {
-               Draw();
-               Show();
-       }
+       Draw();
+       Show();
 
        SetLastResultReturn(r);
 }
@@ -1361,7 +1358,7 @@ _ListViewImpl::CheckEmptyListShowState(void)
                                pContainer->AddElement(*__pAccessibilityElement);
                        }
 
-                       Rectangle bounds = GetCore().GetBounds();
+                       Rectangle bounds = GetBounds();
                        __pAccessibilityElement->SetBounds(Rectangle(0, 0, bounds.width, bounds.height));
 
                        String accessibilityLable;
@@ -1763,7 +1760,7 @@ _ListViewImpl::OnChangeLayout(_ControlOrientation orientation)
 {
        _ControlImpl::OnChangeLayout(orientation);
 
-       __isBoundsChanged = true;
+       __isOrientationChanged = true;
 }
 
 void
@@ -1780,35 +1777,10 @@ _ListViewImpl::OnBoundsChanged(void)
                SetTextOfEmptyList(__pEmptyText->GetText());
        }
 
-       if (__isBoundsChanged)
+       if (__isOrientationChanged)
        {
-               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;
+               __isOrientationChanged = false;
+               UpdateList();
        }
 }
 
@@ -1833,25 +1805,19 @@ _ListViewImpl::OnFontChanged(Font* pFont)
        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++)
+       firstItem = ((firstItem == -1) ?  0 : firstItem);
+
+       for (int i = firstItem; i <= lastItem; i++)
        {
-               currentItem = ((i == firstGroup) ? firstItem : -1);
-               lastItemInGroup = ((i == lastGroup) ? lastItem : GetCore().GetItemCountAt(i));
+               _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(0, i));
 
-               for (; currentItem <= lastItemInGroup; currentItem++)
+               if (pListViewItem != null)
                {
-                       _ListViewItem* pListViewItem = static_cast<_ListViewItem*>(GetCore().FindItem(i, currentItem));
-
-                       if (pListViewItem != null)
-                       {
-                               pListViewItem->SetFont(fontName);
-                       }
+                       pListViewItem->SetFont(fontName);
                }
        }
 }
index 5d9bb91..b3e0142 100644 (file)
@@ -124,7 +124,7 @@ public:
 
        result HideItemDescriptionText(int groupIndex, int itemIndex);
 
-       result RefreshList(int groupIndex, int itemIndex, ListRefreshType type, bool needFlush = true);
+       result RefreshList(int groupIndex, int itemIndex, ListRefreshType type);
 
        result RefreshList(int groupIndex, int itemIndex, int elementId);
 
@@ -281,7 +281,7 @@ private:
        Tizen::Ui::_AccessibilityElement* __pAccessibilityElement;
 
        bool __redrawListView;
-       bool __isBoundsChanged;
+       bool __isOrientationChanged;
        bool __needReloadItems;
        _ListViewItem* __pItemNeedsLazyDeletion;
 
index 7601dca..be78452 100644 (file)
@@ -121,7 +121,7 @@ public:
 
        result HideItemDescriptionText(int index);
 
-       result RefreshList(int index, ListRefreshType type, bool needFlush = true);
+       result RefreshList(int index, ListRefreshType type);
 
        result RefreshList(int index, int elementId);
 
@@ -260,7 +260,7 @@ private:
        Tizen::Ui::_AccessibilityElement* __pAccessibilityElement;
 
        bool __redrawListView;
-       bool __isBoundsChanged;
+       bool __isOrientationChanged;
        bool __needReloadItems;
        _ListViewItem* __pItemNeedsLazyDeletion;