summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Nazarov <i.nazarov@samsung.com>2017-06-08 17:19:02 +0300
committerIgor Nazarov <i.nazarov@samsung.com>2017-06-08 17:19:02 +0300
commit9650f73e0ecd218e189f43f6d0dab7ebfe2f9018 (patch)
tree71f721a1fa91e82c230cbeb79267c3664c4961e9
parent1bb9af3e8e0c78e44dacabc05c5abaeb229d148c (diff)
downloadgallery-9650f73e0ecd218e189f43f6d0dab7ebfe2f9018.tar.gz
gallery-9650f73e0ecd218e189f43f6d0dab7ebfe2f9018.tar.bz2
gallery-9650f73e0ecd218e189f43f6d0dab7ebfe2f9018.zip
TizenRefApp-8641 [Gallery] Implement custom accessibility order in
PreviewPage Change-Id: Ibd0086d578305a8c76a0ecccc36746a784bf62ab
-rw-r--r--inc/presenters/PreviewPage.h9
-rw-r--r--inc/presenters/SelectModePresenter.h3
-rw-r--r--src/presenters/PreviewPage.cpp50
-rw-r--r--src/presenters/SelectModePresenter.cpp12
4 files changed, 72 insertions, 2 deletions
diff --git a/inc/presenters/PreviewPage.h b/inc/presenters/PreviewPage.h
index c07f089..fe05dec 100644
--- a/inc/presenters/PreviewPage.h
+++ b/inc/presenters/PreviewPage.h
@@ -21,6 +21,7 @@
#include "view/IImageGridListener.h"
+#include "AtspiHighlightHelper.h"
#include "IMoreOptionsListener.h"
#include "ISelectModeListener.h"
@@ -82,6 +83,9 @@ namespace gallery {
bool onAlertEvent(AlertDialog &dialog, int event);
void onJobComplete();
+ Elm_Interface_Atspi_Accessible *onAtspiHighlight(
+ ucl::Widget &widget, Elm_Atspi_Relation_Type flowRelation);
+
// Presenter //
virtual void onActivateBy(const DeactivatorInfo &info) final override;
@@ -98,6 +102,8 @@ namespace gallery {
virtual void onItemEvent(int itemIndex,
int event, int x, int y) final override;
virtual void onTransitionFinished() final override;
+ virtual Elm_Interface_Atspi_Accessible *onAccessObjectRequest(
+ bool isFlowsTo) final override;
// IMoreOptionsListener //
@@ -118,11 +124,14 @@ namespace gallery {
ImageGridSRef m_imageGrid;
std::vector<ItemUPtr> m_items;
IJobSRef m_job;
+
PageContentSRef m_content;
MoreOptionsPresenterSRef m_more;
SelectModePresenterSRef m_smp;
AlertDialogWRef m_alert;
ProcessingPresenterSRef m_processing;
+ AtspiHighlightHelperSRef m_atspiHelper;
+
PageWRef m_page;
int m_selectCount;
bool m_isInSelectMode;
diff --git a/inc/presenters/SelectModePresenter.h b/inc/presenters/SelectModePresenter.h
index b46cba2..2fe4546 100644
--- a/inc/presenters/SelectModePresenter.h
+++ b/inc/presenters/SelectModePresenter.h
@@ -53,6 +53,9 @@ namespace gallery {
void setVisible(bool value);
bool isVisible() const;
+ ucl::ElmWidget &getSelectButton();
+ ucl::ElmWidget &getBottomButton();
+
void setBottomButtonText(const ucl::TString &value);
void update(int selectCount, int totalCount = -1);
diff --git a/src/presenters/PreviewPage.cpp b/src/presenters/PreviewPage.cpp
index 0bdd68c..283ec7a 100644
--- a/src/presenters/PreviewPage.cpp
+++ b/src/presenters/PreviewPage.cpp
@@ -335,6 +335,11 @@ namespace gallery {
}),
"Page::prepare() failed!");
+ m_atspiHelper = AtspiHighlightHelper::newInstance(getWindow());
+ if (!m_atspiHelper) {
+ LOG_RETURN(RES_FAIL, "AtspiHighlightHelper::newInstance() failed!");
+ }
+
m_imageGrid->setItemCount(m_items.size());
m_album->addChangeHandler(WEAK_DELEGATE(
@@ -343,6 +348,11 @@ namespace gallery {
m_more->setListener(asWeakThis<IMoreOptionsListener>(this));
m_smp->setListener(asWeakThis<ISelectModeListener>(this));
+ m_atspiHelper->setEventHandler(WEAK_DELEGATE(
+ PreviewPage::onAtspiHighlight, asWeak(*this)));
+ m_atspiHelper->registerWidget(m_smp->getSelectButton());
+ m_atspiHelper->registerWidget(m_smp->getBottomButton());
+
if (m_selectModeStartup) {
switchToSelectMode();
}
@@ -405,8 +415,13 @@ namespace gallery {
impl::PAGE_SCROLL_IN_FRICTION);
elm_config_scroll_bring_in_scroll_friction_set(
impl::BRING_IN_SCROLL_FRICTION);
+ }
+ if (!info.isBroadcast) {
m_more->activateBy(info.deactivator);
+ if (m_atspiHelper) {
+ m_atspiHelper->activateBy(info.deactivator);
+ }
}
m_smp->activateBy(info.deactivator);
@@ -418,8 +433,9 @@ namespace gallery {
void PreviewPage::onDeactivateBy(const DeactivatorInfo &info)
{
- if (info.deactivator == &getNaviframe()) {
+ if (!info.isBroadcast) {
m_more->deactivateBy(info.deactivator);
+ m_atspiHelper->deactivateBy(info.deactivator);
}
m_smp->deactivateBy(info.deactivator);
@@ -485,6 +501,38 @@ namespace gallery {
activateBy(m_imageGrid.get());
}
+ Elm_Interface_Atspi_Accessible *PreviewPage::onAccessObjectRequest(
+ bool isFlowsTo)
+ {
+ if (m_isInSelectMode) {
+ return (isFlowsTo ?
+ m_smp->getBottomButton() :
+ m_smp->getSelectButton());
+ }
+ return nullptr;
+ }
+
+ Elm_Interface_Atspi_Accessible *PreviewPage::onAtspiHighlight(
+ Widget &widget, Elm_Atspi_Relation_Type flowRelation)
+ {
+ if (widget == m_smp->getSelectButton()) {
+ if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
+ return m_imageGrid->getAccessObject(true);
+ }
+ } else if (widget == m_smp->getBottomButton()) {
+ if (flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM) {
+ return m_imageGrid->getAccessObject(false);
+ }
+ } else if (widget == getWindow()) {
+ return (m_isInSelectMode ?
+ m_smp->getSelectButton() :
+ m_imageGrid->getAccessObject(true));
+ } else {
+ LOG_RETURN_VALUE(RES_FAIL, nullptr, "Unknown object!");
+ }
+ return widget.getEo();
+ }
+
void PreviewPage::onMoreOptionClicked(MoreOptionsPresenter &sender,
const MoreOption &option)
{
diff --git a/src/presenters/SelectModePresenter.cpp b/src/presenters/SelectModePresenter.cpp
index 031da3e..bba872c 100644
--- a/src/presenters/SelectModePresenter.cpp
+++ b/src/presenters/SelectModePresenter.cpp
@@ -121,7 +121,6 @@ namespace gallery {
}
addDeactivatorException(this);
- Presenter::prepare(*m_selectButton);
return RES_OK;
}
@@ -175,6 +174,17 @@ namespace gallery {
deletePopup();
}
+ ElmWidget &SelectModePresenter::getSelectButton()
+ {
+ return *m_selectButton;
+ }
+
+ ElmWidget &SelectModePresenter::getBottomButton()
+ {
+ UCL_ASSERT(m_bottomButton, "No bottom button!");
+ return *m_bottomButton;
+ }
+
void SelectModePresenter::setBottomButtonText(const TString &value)
{
if (m_bottomButton) {