modifiy table view item touch release event during touch pressed processing
authorMinSung Jin <minsung.jin@samsung.com>
Wed, 10 Apr 2013 06:31:38 +0000 (15:31 +0900)
committerMinSung Jin <minsung.jin@samsung.com>
Wed, 10 Apr 2013 08:24:37 +0000 (17:24 +0900)
Change-Id: Ice1733612ba754e72909d3e0de344b06e498d6c7
Signed-off-by: MinSung Jin <minsung.jin@samsung.com>
src/ui/controls/FUiCtrl_TableView.cpp
src/ui/controls/FUiCtrl_TableViewItem.cpp
src/ui/controls/FUiCtrl_TableViewPresenter.cpp
src/ui/inc/FUiCtrl_TableView.h
src/ui/inc/FUiCtrl_TableViewItem.h
src/ui/inc/FUiCtrl_TableViewPresenter.h

index 27e8e0e..b4ccab5 100644 (file)
@@ -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();
index 7b90909..3644bd9 100644 (file)
@@ -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
        {
index 43267e3..3307843 100644 (file)
@@ -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
 {
index 448a136..e2735b7 100644 (file)
@@ -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);
 
index 8646de0..f0ef601 100644 (file)
@@ -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;
index 0c752df..f8efe33 100644 (file)
@@ -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;