summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Nazarov <i.nazarov@samsung.com>2017-06-01 18:07:34 +0300
committerIgor Nazarov <i.nazarov@samsung.com>2017-06-01 18:07:34 +0300
commita34f32e6bc1d864a5056e74b7ee5c6511c0cc15d (patch)
tree87f5a184acd5a16458e3d021bf28a1a4fd0aef04
parent846a61381b23d24745b5228f4d2b8cac400bece3 (diff)
downloadgallery-a34f32e6bc1d864a5056e74b7ee5c6511c0cc15d.tar.gz
gallery-a34f32e6bc1d864a5056e74b7ee5c6511c0cc15d.tar.bz2
gallery-a34f32e6bc1d864a5056e74b7ee5c6511c0cc15d.zip
TizenRefApp-8606 [Gallery] Implement ImageGrid autoscrolling in ScreenReader mode
Change-Id: I0cbad3fe97ed0bbdc76753f2c1aaaf0d8342a73f
-rw-r--r--inc/view/ImageGrid.h1
-rw-r--r--src/view/ImageGrid.cpp40
2 files changed, 30 insertions, 11 deletions
diff --git a/inc/view/ImageGrid.h b/inc/view/ImageGrid.h
index af1a65b..399201b 100644
--- a/inc/view/ImageGrid.h
+++ b/inc/view/ImageGrid.h
@@ -135,6 +135,7 @@ namespace gallery {
void removeUnrealizeLock();
void handleItemEvent(int itemIndex, int event, int x, int y) const;
+ Elm_Interface_Atspi_Accessible *requestAtspi(int itemIndex);
Elm_Interface_Atspi_Accessible *getItemAtspi(int itemIndex);
// Selection mode hanling
diff --git a/src/view/ImageGrid.cpp b/src/view/ImageGrid.cpp
index 29cabf9..6c8e14c 100644
--- a/src/view/ImageGrid.cpp
+++ b/src/view/ImageGrid.cpp
@@ -140,8 +140,7 @@ namespace gallery {
virtual int calcMaxSlotCount(const int itemCount) const = 0;
- virtual int calcExtraPaddingSize(const int slotSize,
- const int itemCount) const
+ virtual int calcExtraPaddingSize(const int slotSize) const
{
return 0;
}
@@ -187,8 +186,8 @@ namespace gallery {
return ((itemCount + (totalLength - 1)) / totalLength * 2);
}
- virtual int calcExtraPaddingSize(const int slotSize,
- const int itemCount) const final override
+ virtual int calcExtraPaddingSize(
+ const int slotSize) const final override
{
return slotSize;
}
@@ -538,7 +537,7 @@ namespace gallery {
(m_realizeIndex + 1) :
(m_realizeIndex - 1));
- auto relationObject = m_imageGrid.getItemAtspi(relationIndex);
+ auto relationObject = m_imageGrid.requestAtspi(relationIndex);
if (!relationObject) {
relationObject = m_btn.getEo();
}
@@ -1054,9 +1053,7 @@ namespace gallery {
Elm_Interface_Atspi_Accessible *ImageGrid::getAccessObject(
const bool isFlowsTo)
{
- const int itemIndex = (isFlowsTo ? 0 : (m_itemCount - 1));
- scrollToItem(itemIndex);
- return getItemAtspi(itemIndex);
+ return getItemAtspi(isFlowsTo ? 0 : (m_itemCount - 1));
}
template <class FUNC>
@@ -1120,12 +1117,25 @@ namespace gallery {
return doWithCell(itemIndex,
[this, &showFunc](const int slotIndex, const int itemOffset)
{
- const int scrollOffset = ((slotIndex / 2) * m_slotSize);
+ const int extraPadding = ((slotIndex & 1) ?
+ m_info.calcExtraPaddingSize(m_slotSize) : 0);
+
+ const int maxOffest = ((slotIndex / 2) * m_slotSize);
+ const int minOffset = (maxOffest + extraPadding -
+ ((m_scrollerSize / m_slotSize) - 1) * m_slotSize);
+ if ((m_scrollOffset >= minOffset) &&
+ (m_scrollOffset <= maxOffest)) {
+ return RES_OK;
+ }
+
+ const int scrollOffset = ((m_scrollOffset > maxOffest) ?
+ maxOffest : minOffset);
if (m_info.isHorizontal) {
showFunc(*m_scroller, scrollOffset, 0, m_scrollerSize, 1);
} else {
showFunc(*m_scroller, 0, scrollOffset, 1, m_scrollerSize);
}
+
return RES_OK;
});
}
@@ -1186,7 +1196,7 @@ namespace gallery {
}
}
- Elm_Interface_Atspi_Accessible *ImageGrid::getItemAtspi(const int itemIndex)
+ Elm_Interface_Atspi_Accessible *ImageGrid::requestAtspi(const int itemIndex)
{
if ((itemIndex < 0) || (itemIndex >= m_itemCount)) {
if (m_listener) {
@@ -1195,6 +1205,14 @@ namespace gallery {
}
return nullptr;
}
+ return getItemAtspi(itemIndex);
+ }
+
+ Elm_Interface_Atspi_Accessible *ImageGrid::getItemAtspi(
+ const int itemIndex)
+ {
+ FAIL_RETURN_VALUE(scrollToItem(itemIndex), nullptr,
+ "scrollToItem() failed!");
Elm_Interface_Atspi_Accessible *result = nullptr;
@@ -1391,7 +1409,7 @@ namespace gallery {
m_padSize1 = std::lround(spaceSize / 2.0);
m_padSize2 = (spaceSize - m_padSize1 +
- m_info.calcExtraPaddingSize(m_slotSize, m_itemCount));
+ m_info.calcExtraPaddingSize(m_slotSize));
}
void ImageGrid::updateScrollBias()