From d8966f0909b0d0d9770cd2e04acec7e50af95fbd Mon Sep 17 00:00:00 2001 From: MinSung Jin Date: Wed, 10 Apr 2013 15:31:38 +0900 Subject: [PATCH] modifiy table view item touch release event during touch pressed processing Change-Id: Ice1733612ba754e72909d3e0de344b06e498d6c7 Signed-off-by: MinSung Jin --- src/ui/controls/FUiCtrl_TableView.cpp | 6 +++++ src/ui/controls/FUiCtrl_TableViewItem.cpp | 11 +++++--- src/ui/controls/FUiCtrl_TableViewPresenter.cpp | 36 ++++++++++++++++++++++++++ src/ui/inc/FUiCtrl_TableView.h | 2 ++ src/ui/inc/FUiCtrl_TableViewItem.h | 6 ++--- src/ui/inc/FUiCtrl_TableViewPresenter.h | 11 ++++++++ 6 files changed, 66 insertions(+), 6 deletions(-) diff --git a/src/ui/controls/FUiCtrl_TableView.cpp b/src/ui/controls/FUiCtrl_TableView.cpp index 27e8e0e..b4ccab5 100644 --- a/src/ui/controls/FUiCtrl_TableView.cpp +++ b/src/ui/controls/FUiCtrl_TableView.cpp @@ -1154,6 +1154,12 @@ _TableView::GetSectionFooterTextHorizontalAlignment(int sectionIndex) const } void +_TableView::FireItemTouchReleasedEventDuringPressing(int groupIndex, int itemIndex) +{ + __pTableViewPresenter->FireItemTouchReleasedEventDuringPressing(groupIndex, itemIndex); +} + +void _TableView::OnDraw(void) { __pTableViewPresenter->Draw(); diff --git a/src/ui/controls/FUiCtrl_TableViewItem.cpp b/src/ui/controls/FUiCtrl_TableViewItem.cpp index 7b90909..3644bd9 100644 --- a/src/ui/controls/FUiCtrl_TableViewItem.cpp +++ b/src/ui/controls/FUiCtrl_TableViewItem.cpp @@ -1241,9 +1241,14 @@ _TableViewItem::OnTouchPressed(const _Control& source, const _TouchInfo& touchin { StopTouchReleasedTimer(); - __itemSelected = true; - - FireItemTouchReleased(); + _TableView* pParent = dynamic_cast<_TableView*>(GetParent()); + if (pParent != null) + { + int groupIndex = -1; + int itemIndex = -1; + GetItemIndex(groupIndex, itemIndex); + pParent->FireItemTouchReleasedEventDuringPressing(groupIndex, itemIndex); + } } else { diff --git a/src/ui/controls/FUiCtrl_TableViewPresenter.cpp b/src/ui/controls/FUiCtrl_TableViewPresenter.cpp index 43267e3..3307843 100644 --- a/src/ui/controls/FUiCtrl_TableViewPresenter.cpp +++ b/src/ui/controls/FUiCtrl_TableViewPresenter.cpp @@ -72,6 +72,7 @@ _TableViewPresenter::_TableViewPresenter() , __scrollPositionOnFlickStarted(0) , __isAnimationCallbackBlocked(false) , __lockLoadItemWithScroll(false) + , __itemTouchReleasedEventState(TABLE_VIEW_ITEM_TOUCH_RELEASED_EVENT_NORMAL) { __sweptItemTag.itemIndex = -1; __sweptItemTag.groupIndex = -1; @@ -634,6 +635,10 @@ _TableViewPresenter::UpdateTableView(void) __statusChangedFlag = true; + if (__itemTouchReleasedEventState == TABLE_VIEW_ITEM_TOUCH_RELEASED_EVENT_FIRE) + { + __itemTouchReleasedEventState = TABLE_VIEW_ITEM_TOUCH_RELEASED_EVENT_UPDATE_TABLE_VIEW; + } } return E_SUCCESS; @@ -5059,6 +5064,36 @@ _TableViewPresenter::GetAccessibilityElementFocusedState(void) return false; } +void +_TableViewPresenter::FireItemTouchReleasedEventDuringPressing(int groupIndex, int itemIndex) +{ + TableViewItemTag fireItemPos; + fireItemPos.groupIndex = groupIndex; + fireItemPos.itemIndex = itemIndex; + + __itemTouchReleasedEventState = TABLE_VIEW_ITEM_TOUCH_RELEASED_EVENT_FIRE; + _TableViewItem* pItem = FindItem(fireItemPos); + if (pItem != null) + { + pItem->FireItemTouchReleased(); + } + + // for new item after UpdateTableView. + pItem = FindItem(fireItemPos); + if (pItem != null) + { + if (__itemTouchReleasedEventState == TABLE_VIEW_ITEM_TOUCH_RELEASED_EVENT_UPDATE_TABLE_VIEW) + { + __itemTouchReleasedEventState = TABLE_VIEW_ITEM_TOUCH_RELEASED_EVENT_NORMAL; + } + else + { + pItem->SetSelectionState(true); + pItem->FireItemTouchPressed(); + } + } +} + bool _TableViewSectionStringAlignment::operator== (const _TableViewSectionStringAlignment& rhs) const { @@ -5069,6 +5104,7 @@ _TableViewSectionStringAlignment::operator== (const _TableViewSectionStringAlign return false; } + bool _TableViewSectionStringAlignment::operator!= (const _TableViewSectionStringAlignment& rhs) const { diff --git a/src/ui/inc/FUiCtrl_TableView.h b/src/ui/inc/FUiCtrl_TableView.h index 448a136..e2735b7 100644 --- a/src/ui/inc/FUiCtrl_TableView.h +++ b/src/ui/inc/FUiCtrl_TableView.h @@ -218,6 +218,8 @@ public: result SetSectionFooterTextHorizontalAlignment(int sectionIndex, HorizontalAlignment alignment); HorizontalAlignment GetSectionFooterTextHorizontalAlignment(int sectionIndex) const; + void FireItemTouchReleasedEventDuringPressing(int groupIndex, int itemIndex); + virtual void OnDraw(void); virtual void OnBoundsChanged(void); diff --git a/src/ui/inc/FUiCtrl_TableViewItem.h b/src/ui/inc/FUiCtrl_TableViewItem.h index 8646de0..f0ef601 100644 --- a/src/ui/inc/FUiCtrl_TableViewItem.h +++ b/src/ui/inc/FUiCtrl_TableViewItem.h @@ -248,6 +248,9 @@ public: bool IsAnnexOnOffSliding(void); static float GetAnnexWidth(TableViewAnnexStyle style); + void FireItemTouchReleased(void); + void FireItemTouchPressed(void); + // Accessibility virtual void SetAccessibilityElement(void); Tizen::Ui::_AccessibilityElement* GetAccessibilityElement(void); @@ -347,9 +350,6 @@ private: result CreateOnOffButton(void); result CreateDetailButton(void); - void FireItemTouchReleased(void); - void FireItemTouchPressed(void); - private: void* __pAppInfo; int __refCount; diff --git a/src/ui/inc/FUiCtrl_TableViewPresenter.h b/src/ui/inc/FUiCtrl_TableViewPresenter.h index 0c752df..f8efe33 100644 --- a/src/ui/inc/FUiCtrl_TableViewPresenter.h +++ b/src/ui/inc/FUiCtrl_TableViewPresenter.h @@ -45,6 +45,13 @@ enum ItemAlignment TABLE_VIEW_ITEM_ALIGNMENT_BOTTOM }; +enum ItemTouchReleasedEventState +{ + TABLE_VIEW_ITEM_TOUCH_RELEASED_EVENT_NORMAL = 0, + TABLE_VIEW_ITEM_TOUCH_RELEASED_EVENT_FIRE, + TABLE_VIEW_ITEM_TOUCH_RELEASED_EVENT_UPDATE_TABLE_VIEW +}; + struct _TableViewReorderInfo { int groupIndex; @@ -235,6 +242,8 @@ public: void BlockAnimationCallback(bool blocked); + void FireItemTouchReleasedEventDuringPressing(int groupIndex, int itemIndex); + protected: virtual float ScrollToInternal(float targetPosition); virtual void FadeInScrollBar(void); @@ -383,6 +392,8 @@ private: bool __isAnimationCallbackBlocked; bool __lockLoadItemWithScroll; + int __itemTouchReleasedEventState; + static const int TABLEVIEW_MAX_ITEM_COUNT = 30; static const int REORDER_SCROLL_ANIMATION_TIMER_DURATION = 10; static const float REORDER_SCROLL_ANIMATION_DISTANCE = 10.0f; -- 2.7.4