From 513e32adc37fad5ba8763c5f6bb2e7bd0ec043ee Mon Sep 17 00:00:00 2001 From: SangYong Lee Date: Mon, 25 Mar 2013 14:07:06 +0900 Subject: [PATCH] Modified Section footer item layout Change-Id: Ica5542f90da1d8db202532813f723bc335104ca0 Signed-off-by: SangYong Lee --- .../FUiCtrl_TableViewItemProviderAdaptor.cpp | 2 +- src/ui/controls/FUiCtrl_TableViewPresenter.cpp | 83 +++++++++++++++------- 2 files changed, 58 insertions(+), 27 deletions(-) diff --git a/src/ui/controls/FUiCtrl_TableViewItemProviderAdaptor.cpp b/src/ui/controls/FUiCtrl_TableViewItemProviderAdaptor.cpp index e426551..d95d175 100644 --- a/src/ui/controls/FUiCtrl_TableViewItemProviderAdaptor.cpp +++ b/src/ui/controls/FUiCtrl_TableViewItemProviderAdaptor.cpp @@ -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) diff --git a/src/ui/controls/FUiCtrl_TableViewPresenter.cpp b/src/ui/controls/FUiCtrl_TableViewPresenter.cpp index 51b29a3..09cd71c 100644 --- a/src/ui/controls/FUiCtrl_TableViewPresenter.cpp +++ b/src/ui/controls/FUiCtrl_TableViewPresenter.cpp @@ -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); -- 2.7.4