Apply that item is not checked when element selection enabled.
Apply that item is drawn normal state BG when touch released during RefreshList.
Change-Id: I2c3a79f4a4421650cf106244fb824550cb04704d
Signed-off-by: Suhwan_Park <suhwan0927.park@samsung.com>
}
else
{
- TableViewItemDrawingStatus itemDrawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
- bool itemSelected = false;
- FloatPoint touchPosition(-1.0f, -1.0f);
+ _ListViewItemStatus itemStatus;
+ _TouchManager* pTouchManager = _TouchManager::GetInstance();
+ bool needChangeEventTarget = false;
+ int touchedGroupIndex = -1;
+ int touchedItemIndex = -1;
- if (pListViewItem != null)
+ // find touched item.
+ GetItemIndexFromPosition(GetCurrentTouchPosition(), touchedGroupIndex, touchedItemIndex);
+
+ if ((touchedGroupIndex == groupIndex) && (touchedItemIndex == itemIndex) && (pTouchManager->GetTouchStatus(0) != TOUCH_RELEASED))
+ {
+ needChangeEventTarget = true;
+ }
+
+ if (needChangeEventTarget && (pListViewItem != null))
{
- itemDrawingStatus = pListViewItem->GetDrawingStatus();
- itemSelected = pListViewItem->GetSelectionState();
- touchPosition = pListViewItem->GetLastTouchPressedPositionF();
+ pListViewItem->GetCurrentStatus(itemStatus);
+ pListViewItem = null;
}
+ // item unload
GetCore().UnloadItem(groupIndex, itemIndex);
+ // item load
pListViewItem = static_cast<_ListViewItem*>(GetCore().LoadItem(groupIndex, itemIndex));
- if ((pListViewItem != null) && (itemDrawingStatus != TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL))
+ if (needChangeEventTarget && (pListViewItem != null))
{
- pListViewItem->SetDrawingStatus(itemDrawingStatus);
- pListViewItem->SetSelectionState(itemSelected);
- pListViewItem->SetLastTouchPressedPosition(touchPosition);
+ pListViewItem->SetCurrentStatus(itemStatus);
// for create Annex
pListViewItem->Draw();
pListViewItem->Show();
- _Control* target = static_cast<_Control*>(pListViewItem);
+ _Control* pTarget = static_cast<_Control*>(pListViewItem);
for (int i = 0; i < pListViewItem->GetChildCount(); i++)
{
- if (pListViewItem->GetChild(i)->GetBoundsF().Contains(touchPosition))
+ if (pListViewItem->GetChild(i)->GetBoundsF().Contains(itemStatus.currentTouchPosition))
{
- target = pListViewItem->GetChild(i);
+ pTarget = pListViewItem->GetChild(i);
}
}
- if (target != null)
- {
- target->SetChangingEventTarget(true);
- }
- else
- {
- pListViewItem->SetDrawingStatus(TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
- pListViewItem->SetSelectionState(false);
- }
+ // change touch event target
+ pTarget->SetChangingEventTarget(true);
+ pTouchManager->SetChangedTouchableTarget(pTarget);
}
}
}
if (!filtered && (__pListItemEvent != null))
{
- _TouchManager* pTouchManager = _TouchManager::GetInstance();
- FloatPoint currentTouchPos = pTouchManager->GetScreenPoint(0);
- FloatRectangle bounds = GetCore().GetAbsoluteBoundsF();
int groupIndex = -1;
int itemIndex = -1;
int elementId = -1;
- currentTouchPos.x -= bounds.x;
- currentTouchPos.y -= bounds.y;
-
- if ((GetItemIndexFromPosition(currentTouchPos, groupIndex, itemIndex, elementId) == E_SUCCESS) && (itemIndex != -1))
+ if ((GetItemIndexFromPosition(GetCurrentTouchPosition(), groupIndex, itemIndex, elementId) == E_SUCCESS) && (itemIndex != -1))
{
__pItemNeedsLazyDeletion = static_cast<_ListViewItem*>(GetCore().FindItem(groupIndex, itemIndex));
return filtered;
}
+FloatPoint
+_GroupedListViewImpl::GetCurrentTouchPosition(void)
+{
+ FloatPoint currentTouchPos = _TouchManager::GetInstance()->GetScreenPoint(0);
+ FloatRectangle bounds = GetCore().GetAbsoluteBoundsF();
+
+ currentTouchPos.x -= bounds.x;
+ currentTouchPos.y -= bounds.y;
+
+ return currentTouchPos;
+}
+
class _GroupedListViewMaker
: public _UiBuilderControlMaker
{
if ((topItemIndex <= index) && (bottomItemIndex >= index))
{
- TableViewItemDrawingStatus itemDrawingStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
- bool itemSelected = false;
- FloatPoint touchPosition(-1.0f, -1.0f);
+ _ListViewItemStatus itemStatus;
+ _TouchManager* pTouchManager = _TouchManager::GetInstance();
+ bool needChangeEventTarget = false;
- if (pListViewItem != null)
+ if ((GetItemIndexFromPosition(GetCurrentTouchPosition()) == index) && (pTouchManager->GetTouchStatus(0) != TOUCH_RELEASED))
+ {
+ needChangeEventTarget = true;
+ }
+
+ if (needChangeEventTarget && (pListViewItem != null))
{
- itemDrawingStatus = pListViewItem->GetDrawingStatus();
- itemSelected = pListViewItem->GetSelectionState();
- touchPosition = pListViewItem->GetLastTouchPressedPositionF();
+ pListViewItem->GetCurrentStatus(itemStatus);
+ pListViewItem = null;
}
+ // item unload
GetCore().UnloadItem(0, index);
+ // item load
pListViewItem = static_cast<_ListViewItem*>(GetCore().LoadItem(0, index));
- if ((pListViewItem != null) && (itemDrawingStatus != TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL))
+ if (needChangeEventTarget && (pListViewItem != null))
{
- pListViewItem->SetDrawingStatus(itemDrawingStatus);
- pListViewItem->SetSelectionState(itemSelected);
- pListViewItem->SetLastTouchPressedPosition(touchPosition);
+ pListViewItem->SetCurrentStatus(itemStatus);
// for create Annex
pListViewItem->Draw();
pListViewItem->Show();
- _Control* target = static_cast<_Control*>(pListViewItem);
+ _Control* pTarget = static_cast<_Control*>(pListViewItem);
for (int i = 0; i < pListViewItem->GetChildCount(); i++)
{
- if (pListViewItem->GetChild(i)->GetBoundsF().Contains(touchPosition))
+ if (pListViewItem->GetChild(i)->GetBoundsF().Contains(itemStatus.currentTouchPosition))
{
- target = pListViewItem->GetChild(i);
+ pTarget = pListViewItem->GetChild(i);
}
}
- if (target != null)
- {
- target->SetChangingEventTarget(true);
- }
- else
- {
- pListViewItem->SetDrawingStatus(TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL);
- pListViewItem->SetSelectionState(false);
- }
+ // change touch event target
+ pTarget->SetChangingEventTarget(true);
+ pTouchManager->SetChangedTouchableTarget(pTarget);
}
}
else
if (!filtered && (__pListItemEvent != null))
{
- _TouchManager* pTouchManager = _TouchManager::GetInstance();
- FloatPoint currentTouchPos = pTouchManager->GetScreenPoint(0);
- FloatRectangle bounds = GetCore().GetAbsoluteBoundsF();
int itemIndex = -1;
int elementId = -1;
- currentTouchPos.x -= bounds.x;
- currentTouchPos.y -= bounds.y;
-
- if (GetItemIndexFromPosition(currentTouchPos, itemIndex, elementId) == E_SUCCESS)
+ if (GetItemIndexFromPosition(GetCurrentTouchPosition(), itemIndex, elementId) == E_SUCCESS)
{
__pItemNeedsLazyDeletion = static_cast<_ListViewItem*>(GetCore().FindItem(0, itemIndex));
return filtered;
}
+FloatPoint
+_ListViewImpl::GetCurrentTouchPosition(void)
+{
+ FloatPoint currentTouchPos = _TouchManager::GetInstance()->GetScreenPoint(0);
+ FloatRectangle bounds = GetCore().GetAbsoluteBoundsF();
+
+ currentTouchPos.x -= bounds.x;
+ currentTouchPos.y -= bounds.y;
+
+ return currentTouchPos;
+}
+
class _ListViewMaker
: public _UiBuilderControlMaker
{
#include "FUiCtrl_Label.h"
#include "FUiCtrl_ListViewContextItem.h"
#include "FUiCtrl_ListViewItem.h"
-#include "FUiCtrl_Progress.h"
#include "FUiCtrl_UiListViewItemEvent.h"
#include "FUiCtrl_UiListViewItemEventArg.h"
, __needAlignContextItem(false)
, __touchPressed(false)
, __selectedElementId(-1)
- , __progressLeftMargin(0.0f)
- , __progressRightMargin(0.0f)
- , __pProgress(null)
, __descriptionTextShowState(false)
, __pDescriptionText(null)
, __pDivider(null)
delete __pTextSlideTimer;
__pTextSlideTimer = null;
- if (__pProgress != null)
- {
- DetachChild(*__pProgress);
-
- delete __pProgress;
- __pProgress = null;
- }
-
if (__pDescriptionText != null)
{
DetachChild(*__pDescriptionText);
___stateChangedInfo.pUiLinkInfo = null;
}
+void
+_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.
+
+ ListViewItemDrawingStatus drawingStatus = (currentStatus.itemSelected ? LISTVIEW_ITEM_STATUS_PRESSED
+ : currentStatus.currentStatus);
+
+ SetItemDrawingStatus(drawingStatus);
+ SetSelectionState(currentStatus.itemSelected);
+ SetLastTouchPressedPosition(currentStatus.currentTouchPosition);
+
+ __prevTouchPos = currentStatus.currentTouchPosition;
+ __selectionEabled = currentStatus.elementSelectionEnabled;
+ __selectedElementId = currentStatus.selectedElementId;
+
+ // set item state changed info
+ SetLastStateChangedInfo();
+
+ if (__selectionEabled)
+ {
+ __selectionEabledBgColor = GetItemBackgroundColor(LIST_ITEM_STATE_PRESSED);
+ SetItemBackgroundColor(LIST_ITEM_STATE_PRESSED, GetItemBackgroundColor(LIST_ITEM_STATE_NORMAL));
+ }
+
+ _ListViewItemElement* pElement = GetElement(__selectedElementId);
+
+ // text sliding check and invoke
+ if (pElement != null)
+ {
+ if (pElement->elementType == LISTVIEW_ITEM_ELEMENT_TEXT)
+ {
+ RefreshElement(__selectedElementId);
+
+ SetCutlinkTextFocus(currentStatus.currentTouchPosition);
+
+ if (pElement->pTextElement->textSlidingEnabled)
+ {
+ pElement->pTextElement->pTextObject->SetAction(TEXT_OBJECT_ACTION_TYPE_SLIDE_LEFT);
+ pElement->pTextElement->pTextObject->Compose();
+
+ if (pElement->pTextElement->pTextObject->IsActionOn())
+ {
+ StartTextSlideTimer();
+ }
+ }
+ }
+ }
+}
+
+void
+_ListViewItem::GetCurrentStatus(_ListViewItemStatus& currentStatus)
+{
+ // for _TableViewItem
+ currentStatus.currentStatus = GetItemDrawingStatus();
+ currentStatus.itemSelected = GetSelectionState();
+ currentStatus.currentTouchPosition = GetLastTouchPressedPositionF();
+
+ // for _ListViewItem
+ currentStatus.elementSelectionEnabled = __selectionEabled;
+ currentStatus.selectedElementId = __selectedElementId;
+ // for event fire
+ GetLastStateChangedInfo(currentStatus.stateChangedInfo);
+}
+
int
_ListViewItem::GetElementIdFromPosition(const FloatPoint& position) const
{
return true;
}
-void
-_ListViewItem::AdjustProgressBounds(void)
-{
- if (__pProgress != null)
- {
- FloatRectangle progressRect = GetBoundsF();
- float progressHeight = 0.0f;
- float bottomMargin = 0.0f;
-
- // Calculate progress position
- GET_SHAPE_CONFIG(SLIDER::BAR_HEIGHT, _CONTROL_ORIENTATION_PORTRAIT, progressHeight);
- GET_SHAPE_CONFIG(SLIDER::BAR_TOP_MARGIN, _CONTROL_ORIENTATION_PORTRAIT, bottomMargin);
-
- progressHeight = progressHeight + (bottomMargin * 2.0f);
- progressRect.x = __progressLeftMargin;
- progressRect.y = progressRect.height - progressHeight;
- progressRect.height = progressHeight;
- progressRect.width = progressRect.width - __progressLeftMargin - __progressRightMargin;
-
- progressRect.y -= ((__descriptionTextShowState) ? GetDescriptionTextHeight() : 0.0f);
-
- __pProgress->SetBounds(progressRect);
- }
-}
-
bool
_ListViewItem::SetDescriptionText(const String& text)
{
_TableViewItem::OnTouchPressed(source, touchinfo);
+ // for do not occur annex selection.
+ if (__selectionEabled)
+ {
+ StopTouchPressedTimer();
+ SetSelectionState(false);
+
+ RefreshElement(__selectedElementId);
+ }
+
return false;
}
ResetTextSlide();
ResetCutlinkFocus();
+ _TableViewItem::OnTouchReleased(source, touchinfo);
+
if (__selectionEabled)
{
SetItemBackgroundColor(LIST_ITEM_STATE_PRESSED, __selectionEabledBgColor);
__selectionEabled = false;
+
+ //Invalidate();
+ RefreshElement(__selectedElementId);
+
+ bool enabled = SetItemTapSoundEnabled(false);
+ FireItemEvent();
+ SetItemTapSoundEnabled(enabled);
}
__selectedElementId = -1;
__touchPressed = false;
- _TableViewItem::OnTouchReleased(source, touchinfo);
-
return false;
}
void
_ListViewItem::OnDraw(void)
{
+ bool needDraw = IsItemChanged();
+
_TableViewItem::OnDraw();
- DrawElements();
- DrawDivider();
+ if (needDraw)
+ {
+ DrawElements();
+ DrawDivider();
+ }
}
result
}
}
+void
+_ListViewItem::SetItemDrawingStatus(ListViewItemDrawingStatus status)
+{
+ TableViewItemDrawingStatus parentStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
+
+ switch (status)
+ {
+ case LISTVIEW_ITEM_STATUS_PRESSED:
+ parentStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED;
+ break;
+
+ case LISTVIEW_ITEM_STATUS_HIGHLIGHTED:
+ parentStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED;
+ break;
+
+ default:
+ parentStatus = TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL;
+ break;
+ }
+
+ SetDrawingStatus(parentStatus);
+}
+
ListViewItemDrawingStatus
_ListViewItem::GetItemDrawingStatus(void)
{
TableViewItemDrawingStatus parentStatus = GetDrawingStatus();
- ListViewItemDrawingStatus status;
switch (parentStatus)
{
case TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED:
- status = LISTVIEW_ITEM_STATUS_PRESSED;
- break;
+ return LISTVIEW_ITEM_STATUS_PRESSED;
case TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED:
- status = LISTVIEW_ITEM_STATUS_HIGHLIGHTED;
- break;
+ return LISTVIEW_ITEM_STATUS_HIGHLIGHTED;
default:
- status = LISTVIEW_ITEM_STATUS_NORMAL;
- break;
+ return LISTVIEW_ITEM_STATUS_NORMAL;
}
-
- return status;
}
void
}
}
}
+ else
+ {
+ if ((__selectedElementId == pElement->elementId) && __selectionEabled)
+ {
+ status = LISTVIEW_ITEM_STATUS_PRESSED;
+ }
+ }
Canvas* pCanvas = null;
void CheckEmptyListShowState(void);
+ Tizen::Graphics::FloatPoint GetCurrentTouchPosition(void);
+
void FireListViewItemEvent(int groupIndex, int itemIndex, Tizen::Ui::Controls::_TableViewItem* pItem,
Tizen::Ui::Controls::TableViewItemStatus status);
void CheckEmptyListShowState(void);
+ Tizen::Graphics::FloatPoint GetCurrentTouchPosition(void);
+
virtual result OnTouchEventListenerAdded(void);
virtual result OnTouchEventListenerRemoved(void);
class _Label;
class _ListViewContextItem;
-class _Progress;
enum ListViewItemElementType
{
Tizen::Graphics::FloatRectangle bounds;
};
+struct _ListViewItemStatus
+{
+ ListViewItemDrawingStatus currentStatus;
+ bool itemSelected;
+ bool elementSelectionEnabled;
+ int selectedElementId;
+ Tizen::Graphics::FloatPoint currentTouchPosition;
+ _ListViewItemStateChangedInfo stateChangedInfo;
+};
+
class _ListViewItemHitTestVEDelegator
: public Tizen::Ui::Animations::VisualElementContentProvider
{
void ClearLastStateChangedInfo(void);
+ void SetCurrentStatus(_ListViewItemStatus& currentStatus);
+
+ void GetCurrentStatus(_ListViewItemStatus& currentStatus);
+
int GetElementIdFromPosition(const Tizen::Graphics::FloatPoint& position) const;
int GetElementIdFromCurrentTouchPosition(void) const;
_ListViewItemElementBitmap* GetElementBitmap(int elementId) const;
+ void SetItemDrawingStatus(ListViewItemDrawingStatus status);
+
ListViewItemDrawingStatus GetItemDrawingStatus(void);
void DrawElement(_ListViewItemElement* pElement);
float GetDescriptionTextHeight(void);
- void AdjustProgressBounds(void);
-
Tizen::Graphics::Font* GetFont(unsigned long fontStyle, float fontSize);
// TextSlide
int __selectedElementId;
- float __progressLeftMargin;
-
- float __progressRightMargin;
-
- _Progress* __pProgress;
-
bool __descriptionTextShowState;
Tizen::Graphics::Color __descriptionTextColor;