, __itemTouchReleasedEventState(TABLE_VIEW_ITEM_TOUCH_RELEASED_EVENT_NORMAL)
, __scrollToItemTag()
, __isOrientationChanged(false)
+ , __isFocusedDuringOrientationChange(false)
{
__sweptItemTag.itemIndex = -1;
__sweptItemTag.groupIndex = -1;
__pTableView->SetFocusNavigateEnabled(true);
}
+ if (!__isRestoreFocus && __isFocusedDuringOrientationChange)
+ {
+ TableViewItemTag bottomDrawnItemIndex = {-1, -1};
+ GetBottomDrawnItem(bottomDrawnItemIndex);
+
+ if ((bottomDrawnItemIndex.groupIndex < __focusItemTag.groupIndex) ||
+ (bottomDrawnItemIndex.groupIndex == __focusItemTag.groupIndex && bottomDrawnItemIndex.itemIndex <= __focusItemTag.itemIndex))
+ {
+ ScrollToItem(__focusItemTag.groupIndex, __focusItemTag.itemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_BOTTOM);
+ }
+ }
+ __isFocusedDuringOrientationChange = false;
return E_SUCCESS;
}
_TableViewPresenter::OnChangeLayout(_ControlOrientation orientation)
{
__isOrientationChanged = true;
+ if (__focusItemTag.groupIndex != -1)
+ {
+ __isFocusedDuringOrientationChange = true;
+ }
}
_UiTouchEventDelivery
{
_UiTouchEventDelivery response = _ScrollPanelPresenter::OnPreviewTouchPressed(source, touchInfo);
+ __focusItemTag.groupIndex = -1;
+ __focusItemTag.itemIndex = -1;
+
_TableViewItem* pItem = GetTableViewItemFromControl(source);
if (pItem == null)
{
if (pItem->GetBoundsF().y < GetScrollPosition())
{
- ScrollToItem(itemPos.groupIndex, itemPos.itemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_BOTTOM);
+ ScrollToItem(itemPos.groupIndex, itemPos.itemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_TOP);
}
if (pItem->GetEnableState() && pItem->GetVisibleState()
}
if (pItem->GetBoundsF().y + pItem->GetBoundsF().height > GetScrollPosition() + __pTableView->GetBoundsF().height)
{
- ScrollToItem(itemPos.groupIndex, itemPos.itemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_TOP);
+ ScrollToItem(itemPos.groupIndex, itemPos.itemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_BOTTOM);
}
if (pItem->GetEnableState() && pItem->GetVisibleState()
_TableViewItem* pItem = null;
TableViewItemTag itemPos = {-1, -1};
+ if (__isFocusedDuringOrientationChange)
+ {
+ TableViewItemTag bottomDrawnItemIndex = {-1, -1};
+ GetBottomDrawnItem(bottomDrawnItemIndex);
+
+ if ((bottomDrawnItemIndex.groupIndex < __focusItemTag.groupIndex) ||
+ (bottomDrawnItemIndex.groupIndex == __focusItemTag.groupIndex && bottomDrawnItemIndex.itemIndex <= __focusItemTag.itemIndex))
+ {
+ ScrollToItem(__focusItemTag.groupIndex, __focusItemTag.itemIndex, TABLE_VIEW_SCROLL_ITEM_ALIGNMENT_BOTTOM);
+ }
+ __isFocusedDuringOrientationChange = false;
+ }
+
pItem = FindItem(__focusItemTag);
if (__isRestoreFocus && pItem != null)