Modified RefreshListon ListView, GroupedListView
authorSuhwan_Park <suhwan0927.park@samsung.com>
Fri, 12 Apr 2013 08:41:10 +0000 (17:41 +0900)
committerSuhwan_Park <suhwan0927.park@samsung.com>
Fri, 12 Apr 2013 08:41:10 +0000 (17:41 +0900)
Change-Id: Icb5d0736703d2b7877a1c3f0aa9564f5c6e22d6d
Signed-off-by: Suhwan_Park <suhwan0927.park@samsung.com>
src/ui/controls/FUiCtrl_GroupedListViewImpl.cpp
src/ui/controls/FUiCtrl_ListViewImpl.cpp
src/ui/controls/FUiCtrl_ListViewItem.cpp
src/ui/inc/FUiCtrl_ListViewItem.h

index 71995aa..3fcb6f8 100644 (file)
@@ -1111,17 +1111,9 @@ _GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType
                {
                        _ListViewItemStatus itemStatus;
                        memset(&itemStatus, 0, sizeof(_ListViewItemStatus));
-
-                       _TouchManager* pTouchManager = _TouchManager::GetInstance();
                        bool needChangeEventTarget = false;
-                       int touchedGroupIndex = -1;
-                       int touchedItemIndex = -1;
-
-                       // find touched item.
-                       GetItemIndexFromPosition(GetCurrentTouchPosition(), touchedGroupIndex, touchedItemIndex);
 
-                       if (pListViewItem->IsItemSelected() && (touchedGroupIndex == groupIndex) && (touchedItemIndex == itemIndex)
-                                       && (pTouchManager->GetTouchStatus(0) != TOUCH_RELEASED))
+                       if (pListViewItem->IsItemSelected())
                        {
                                needChangeEventTarget = true;
                        }
@@ -1153,7 +1145,7 @@ _GroupedListViewImpl::RefreshList(int groupIndex, int itemIndex, ListRefreshType
 
                                // change touch event target
                                pTarget->SetChangingEventTarget(true);
-                               pTouchManager->SetChangedTouchableTarget(pTarget);
+                               _TouchManager::GetInstance()->SetChangedTouchableTarget(pTarget);
                        }
                }
        }
index f213097..970e24a 100644 (file)
@@ -1084,12 +1084,9 @@ _ListViewImpl::RefreshList(int index, ListRefreshType type, bool needFlush)
                {
                        _ListViewItemStatus itemStatus;
                        memset(&itemStatus, 0, sizeof(_ListViewItemStatus));
-
-                       _TouchManager* pTouchManager = _TouchManager::GetInstance();
                        bool needChangeEventTarget = false;
 
-                       if (pListViewItem->IsItemSelected() && (GetItemIndexFromPosition(GetCurrentTouchPosition()) == index)
-                                       && (pTouchManager->GetTouchStatus(0) != TOUCH_RELEASED))
+                       if (pListViewItem->IsItemSelected())
                        {
                                needChangeEventTarget = true;
                        }
@@ -1121,7 +1118,7 @@ _ListViewImpl::RefreshList(int index, ListRefreshType type, bool needFlush)
 
                                // change touch event target
                                pTarget->SetChangingEventTarget(true);
-                               pTouchManager->SetChangedTouchableTarget(pTarget);
+                               _TouchManager::GetInstance()->SetChangedTouchableTarget(pTarget);
                        }
                }
                else
index 06a1922..a6b0380 100755 (executable)
@@ -61,6 +61,7 @@ _ListViewItem::_ListViewItem(float itemHeight)
        : _TableViewItem(itemHeight)
        , __needAlignContextItem(false)
        , __touchPressed(false)
+       , __touchEnabled(false)
        , __selectedElementId(-1)
        , __descriptionTextShowState(false)
        , __pDescriptionText(null)
@@ -532,22 +533,20 @@ _ListViewItem::SetCurrentStatus(_ListViewItemStatus& currentStatus)
        // This function was made to modify of ListView::RefreshList().
        // This function could adversely affect touch event handling. So, you should be used with caution.
 
-       if (currentStatus.annexStyle == GetItemStyle())
-       {
-               SetPressedControl(currentStatus.pressedControl);
-       }
-       else
-       {
-               SetPressedControl(TABLE_VIEW_ITEM_PRESSED_ITEM);
-       }
-
+       SetPressedControl((currentStatus.annexStyle == GetItemStyle()) ? currentStatus.pressedControl : TABLE_VIEW_ITEM_PRESSED_ITEM);
        SetSelectionState(currentStatus.itemSelected);
        SetLastTouchPressedPosition(currentStatus.currentTouchPosition);
 
+       if (!currentStatus.itemSelected)
+       {
+               SetItemDrawingStatus(LISTVIEW_ITEM_STATUS_NORMAL);
+       }
+
        __prevTouchPos = currentStatus.currentTouchPosition;
+       __touchEnabled = currentStatus.touchEnabled;
        __selectionEabled = currentStatus.elementSelectionEnabled;
        __selectedElementId = currentStatus.selectedElementId;
-       __touchPressed = true;
+       __touchPressed = (currentStatus.itemSelected || currentStatus.elementSelectionEnabled);
 
        if (__selectionEabled)
        {
@@ -592,9 +591,10 @@ _ListViewItem::GetCurrentStatus(_ListViewItemStatus& currentStatus)
        currentStatus.annexStyle = GetItemStyle();
        currentStatus.pressedControl = GetPressedControl();
        currentStatus.itemSelected = GetSelectionState();
-       currentStatus.currentTouchPosition = GetLastTouchPressedPositionF();
+       currentStatus.currentTouchPosition = __prevTouchPos;
 
        // for _ListViewItem
+       currentStatus.touchEnabled = __touchEnabled;
        currentStatus.elementSelectionEnabled = __selectionEabled;
        currentStatus.selectedElementId = __selectedElementId;
 }
@@ -602,7 +602,7 @@ _ListViewItem::GetCurrentStatus(_ListViewItemStatus& currentStatus)
 bool
 _ListViewItem::IsItemSelected(void)
 {
-       return __touchPressed;
+       return __touchEnabled;
 }
 
 int
@@ -1043,6 +1043,7 @@ _ListViewItem::OnTouchPressed(const _Control& source, const _TouchInfo& touchinf
        }
 
        __touchPressed = true;
+       __touchEnabled = true;
 
        SetLastStateChangedInfo();
 
@@ -1063,6 +1064,9 @@ _ListViewItem::OnTouchPressed(const _Control& source, const _TouchInfo& touchinf
 bool
 _ListViewItem::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
 {
+       FloatPoint pos = touchinfo.GetCurrentPosition();
+       __prevTouchPos.SetPosition(pos.x, pos.y);
+
        if ((&source != this) && (source.GetParent() != this))
        {
                return false;
@@ -1086,7 +1090,9 @@ _ListViewItem::OnTouchReleased(const _Control& source, const _TouchInfo& touchin
        }
 
        __selectedElementId = -1;
+       __selectionEabled = false;
        __touchPressed = false;
+       __touchEnabled = false;
 
        return false;
 }
@@ -1094,6 +1100,9 @@ _ListViewItem::OnTouchReleased(const _Control& source, const _TouchInfo& touchin
 bool
 _ListViewItem::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
 {
+       FloatPoint pos = touchinfo.GetCurrentPosition();
+       __prevTouchPos.SetPosition(pos.x, pos.y);
+
        if (__touchPressed)
        {
                ClearLastStateChangedInfo();
@@ -1102,6 +1111,7 @@ _ListViewItem::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
        ResetTextSlide();
 
        __selectedElementId = -1;
+       __selectionEabled = false;
        __touchPressed = false;
 
        _TableViewItem::OnTouchMoved(source, touchinfo);
@@ -1112,12 +1122,15 @@ _ListViewItem::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
 bool
 _ListViewItem::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
 {
+       FloatPoint pos = touchinfo.GetCurrentPosition();
+       __prevTouchPos.SetPosition(pos.x, pos.y);
+
        ResetTextSlide();
 
-       if (__selectionEabled)
-       {
-               __selectionEabled = false;
-       }
+       __selectedElementId = -1;
+       __selectionEabled = false;
+       __touchPressed = false;
+       __touchEnabled = false;
 
        _TableViewItem::OnTouchCanceled(source, touchinfo);
 
index 64bf485..844329f 100644 (file)
@@ -114,6 +114,7 @@ struct _ListViewItemStatus
        TableViewItemPressedControl pressedControl;
        TableViewAnnexStyle annexStyle;
        bool itemSelected;
+       bool touchEnabled;
        bool elementSelectionEnabled;
        int selectedElementId;
        Tizen::Graphics::FloatPoint currentTouchPosition;
@@ -303,6 +304,8 @@ private:
 
        bool __touchPressed;
 
+       bool __touchEnabled;
+
        int __selectedElementId;
 
        bool __descriptionTextShowState;