Modified Section footer item layout
authorSangYong Lee <sangyongim.lee@samsung.com>
Mon, 25 Mar 2013 05:07:06 +0000 (14:07 +0900)
committerSangYong Lee <sangyongim.lee@samsung.com>
Mon, 25 Mar 2013 05:50:45 +0000 (14:50 +0900)
Change-Id: Ica5542f90da1d8db202532813f723bc335104ca0
Signed-off-by: SangYong Lee <sangyongim.lee@samsung.com>
src/ui/controls/FUiCtrl_TableViewItemProviderAdaptor.cpp
src/ui/controls/FUiCtrl_TableViewPresenter.cpp

index e426551..d95d175 100644 (file)
@@ -178,7 +178,7 @@ _TableViewItemProviderAdaptor::LoadItem(int groupIndex, int itemIndex)
                        }
                }
        }
-       else if ((__style == TABLE_VIEW_STYLE_SECTION) && (itemIndex == GetItemCount(groupIndex) - 1) && HasSectionFooter(groupIndex))
+       else if ((__style == TABLE_VIEW_STYLE_SECTION) && (itemIndex == __pTableViewPresenter->GetItemCountAt(groupIndex) - 1) && HasSectionFooter(groupIndex))
        {
                pItem = new (std::nothrow) TableViewItem();
                if (pItem == null)
index 51b29a3..09cd71c 100644 (file)
@@ -341,7 +341,7 @@ _TableViewPresenter::GetItemCountAt(int groupIndex) const
 bool
 _TableViewPresenter::HasSectionHeader(int groupIndex) const
 {
-       if (__pProviderAdaptor == null)
+       if (__pProviderAdaptor == null || __pTableView->GetTableViewStyle() != TABLE_VIEW_STYLE_SECTION)
        {
                return false;
        }
@@ -352,7 +352,7 @@ _TableViewPresenter::HasSectionHeader(int groupIndex) const
 bool
 _TableViewPresenter::HasSectionFooter(int groupIndex) const
 {
-       if (__pProviderAdaptor == null)
+       if (__pProviderAdaptor == null || __pTableView->GetTableViewStyle() != TABLE_VIEW_STYLE_SECTION)
        {
                return false;
        }
@@ -1233,16 +1233,6 @@ _TableViewPresenter::SetItemType(_TableViewItem* pItem, TableViewItemTag itemPos
 {
        TableViewStyle style = __pTableView->GetTableViewStyle();
 
-       int lastItem = GetItemCountAt(itemPosition.groupIndex) - 1;
-
-       if (style == TABLE_VIEW_STYLE_SECTION)
-       {
-               if (HasSectionFooter(itemPosition.groupIndex))
-               {
-                       lastItem--;
-               }
-       }
-
        if (itemPosition.itemIndex == -1)
        {
                if (style == TABLE_VIEW_STYLE_SECTION)
@@ -1254,29 +1244,68 @@ _TableViewPresenter::SetItemType(_TableViewItem* pItem, TableViewItemTag itemPos
                        pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_TITLE);
                }
        }
-       else if (style == TABLE_VIEW_STYLE_SECTION || (itemPosition.groupIndex != GetGroupCount() - 1))
+       else
        {
-               if (lastItem == 0)
-               {
-                       pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_ONE);
-               }
-               else
+               int itemCount = GetItemCountAt(itemPosition.groupIndex);
+
+               if (itemPosition.itemIndex == 0)
                {
-                       if (itemPosition.itemIndex == 0)
+                       if (HasSectionFooter(itemPosition.groupIndex))
                        {
-                               pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_TOP);
+                               if (itemCount == 1)
+                               {
+                                       pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_FOOTER);
+                               }
+                               else if (itemCount == 2)
+                               {
+                                       pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_ONE);
+                               }
+                               else
+                               {
+                                       pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_TOP);
+                               }
                        }
-                       else if (itemPosition.itemIndex == lastItem)
+                       else
                        {
-                               pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_BOTTOM);
+                               if (itemCount == 1)
+                               {
+                                       pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_ONE);
+                               }
+                               else
+                               {
+                                       pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_TOP);
+                               }
                        }
-                       else if (itemPosition.itemIndex == lastItem + 1)
-                       {       // this case is for TABLE_VIEW_STYLE_SECTION only
-                               pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_FOOTER);
+               }
+               else
+               {
+                       int lastItemIndex = itemCount - 1;
+
+                       if (HasSectionFooter(itemPosition.groupIndex))
+                       {
+                               if (itemPosition.itemIndex == lastItemIndex)
+                               {
+                                       pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_FOOTER);
+                               }
+                               else if (itemPosition.itemIndex == lastItemIndex - 1)
+                               {
+                                       pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_BOTTOM);
+                               }
+                               else
+                               {
+                                       pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_MIDDLE);
+                               }
                        }
                        else
                        {
-                               pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_MIDDLE);
+                               if (itemPosition.itemIndex == lastItemIndex)
+                               {
+                                       pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_BOTTOM);
+                               }
+                               else
+                               {
+                                       pItem->SetItemType(TABLE_VIEW_ITEM_TYPE_MIDDLE);
+                               }
                        }
                }
        }
@@ -2992,6 +3021,8 @@ _TableViewPresenter::ScrollToItem(int groupIndex, int itemIndex, TableViewScroll
 {
        TableViewItemTag itemPos = {groupIndex, itemIndex};
 
+       StopAllItemAnimation();
+
        if (!__pListModel->IsLoadedItem(groupIndex, itemIndex))
        {
                ResetItemLayout(itemPos);