TizenRefApp-9756 [Call UI] Implement VoiceControlPresenter 43/158643/3 tizen_4.0
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Wed, 1 Nov 2017 08:40:51 +0000 (10:40 +0200)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Wed, 8 Nov 2017 08:49:03 +0000 (10:49 +0200)
Change-Id: If4ca654d1f846f7dad54b83a9abb0143a4b66bd0

call-ui/presenters/common.h
call-ui/presenters/misc/AccessoryPresenter.cpp
call-ui/presenters/misc/AccessoryPresenter.h
call-ui/presenters/misc/AtspiHighlightHelper.cpp
call-ui/presenters/misc/VolumeControlPresenter.cpp [new file with mode: 0644]
call-ui/presenters/misc/VolumeControlPresenter.h [new file with mode: 0644]
call-ui/presenters/pages/KeypadPage.cpp
call-ui/presenters/pages/KeypadPage.h
call-ui/presenters/pages/MainPage.cpp
project_def.prop

index c515baf3e27bf37133b6638e72d62608c57dd73a..81832031044c05acd2d22e8de558bf175a5ff195 100644 (file)
 
 #include "call-ui/view/common.h"
 
-namespace callui {
-
-       constexpr auto CALL_VC_TIMER_INTERVAL = 1.5;
-       constexpr auto CALL_VC_SCREEN_READER_TIMER_INTERVAL = 5.0;
-       constexpr auto VOLUME_LEVEL_MIN = 1;
-}
-
 #endif // __CALL_UI_PRESENTERS_COMMON_H__
index 66f68fa40ba87f304894fec03d6c36cb44d59ed5..686d73590255be5a514f0787e5119230d9197bc3 100644 (file)
@@ -164,16 +164,13 @@ namespace callui {
                m_sm(std::move(sm)),
                m_exitHandler(std::move(exitHandler)),
                m_aoRequestHandler(std::move(aoReqHandler)),
-               m_vcTimer(nullptr),
                m_audioState(m_sm->getAudioState()),
-               m_mode(CallMode::UNDEFINED),
-               m_isVcShowOnRotaryEvent(false)
+               m_mode(CallMode::UNDEFINED)
        {
        }
 
        AccessoryPresenter::~AccessoryPresenter()
        {
-               stopVCTimer();
                unregisterCallbacks();
        }
 
@@ -187,8 +184,8 @@ namespace callui {
                                "createWidget() failed!");
                FAIL_RETURN(createSlider(),
                                "createSlider() failed!");
-               FAIL_RETURN(createVolumeControl(),
-                               "createVolumeControl() failed!");
+               FAIL_RETURN(createVolumeControlPresenter(parent),
+                               "createVolumeControlPresenter() failed!");
                FAIL_RETURN(createAtspiHighlightHelper(),
                                "createAtspiHighlightHelper() failed!");
 
@@ -242,6 +239,8 @@ namespace callui {
                m_unsavedPhoneNumber.clear();
 
                setVolumeSliderVisiblity(m_mode != CallMode::END);
+               m_voiceControl->setRotaryVisibility(m_mode != CallMode::END);
+               m_voiceControl->setVisible(false);
 
                switch (m_mode) {
                case CallMode::OUTGOING:
@@ -314,13 +313,7 @@ namespace callui {
 
        void AccessoryPresenter::hideVolumeControls()
        {
-               stopVCTimer();
-               hide(*m_vc);
-       }
-
-       bool AccessoryPresenter::getVolumeControlsVisibility()
-       {
-               return m_vc->isVisible();
+               m_voiceControl->setVisible(false);
        }
 
        Result AccessoryPresenter::createWidget(ElmWidget &parent)
@@ -350,33 +343,17 @@ namespace callui {
                return RES_OK;
        }
 
-       Result AccessoryPresenter::createVolumeControl()
+       Result AccessoryPresenter::createVolumeControlPresenter(
+                       GuiPresenter &parent)
        {
-               m_vc = VolumeControl::Builder().
-                               setInfoText(STR_VOLUME).
-                               setMaxValue(m_sm->getMaxVolume()).
-                               setEventHandler(WEAK_DELEGATE_THIS(onVolumeControlEventCb)).
-                               build(*m_widget);
-               if (!m_vc) {
-                       LOG_RETURN(RES_FAIL, "VolumeControl::build() failed!");
-               }
-
-               auto window = m_vc->getWindow();
-               if (!window) {
-                       LOG_RETURN(RES_FAIL, "Window is NULL!");
+               m_voiceControl = VolumeControlPresenter::Builder().
+                               setSoundManager(m_sm).
+                               setRotaryVisibility(true).
+                               setParentWidget(m_widget).
+                               build(parent);
+               if (!m_voiceControl) {
+                       LOG_RETURN(RES_FAIL, "m_voiceControl::build() failed!");
                }
-               int w = 0, h = 0;
-               window->getScreenSize(&w, &h);
-
-               m_vc->move(0, 0);
-               m_vc->resize(w, h);
-               hide(*m_vc);
-
-               m_vc->getDecreaseBtn().addEventHandler(ATSPI_HIGHLIGHTED,
-                               WEAK_DELEGATE_THIS(onVolumeControlScreenReaderReadStart));
-
-               m_vc->getIncreaseBtn().addEventHandler(ATSPI_HIGHLIGHTED,
-                               WEAK_DELEGATE_THIS(onVolumeControlScreenReaderReadStart));
 
                return RES_OK;
        }
@@ -474,9 +451,7 @@ namespace callui {
                        return;
                }
 
-               show(*m_vc);
-               startVCTimer();
-               m_vc->getAtspi().highlight();
+               m_voiceControl->setVisible(true);
        }
 
        void AccessoryPresenter::onMuteBtnClicked(Widget &widget, void *eventInfo)
@@ -524,9 +499,6 @@ namespace callui {
 
        void AccessoryPresenter::registerCallbacks()
        {
-               addRotaryEventHandler(
-                               CALLBACK_A(AccessoryPresenter::onRotaryEvent), this);
-
                m_sm->addAudioStateHandler(WEAK_DELEGATE_THIS(onAudioStateChanged));
                m_sm->addVolumeStateHandler(WEAK_DELEGATE_THIS(onVolumeLevelChanged));
                m_sm->addMuteStateHandler(WEAK_DELEGATE_THIS(onMuteStateChanged));
@@ -534,141 +506,11 @@ namespace callui {
 
        void AccessoryPresenter::unregisterCallbacks()
        {
-               delRotaryEventHandler(
-                               CALLBACK_A(AccessoryPresenter::onRotaryEvent), this);
-
                m_sm->delAudioStateHandler(DELEGATE_THIS(onAudioStateChanged));
                m_sm->delVolumeStateHandler(DELEGATE_THIS(onVolumeLevelChanged));
                m_sm->delMuteStateHandler(DELEGATE_THIS(onMuteStateChanged));
        }
 
-       Eina_Bool AccessoryPresenter::onVCTimerCb()
-       {
-               hide(*m_vc);
-               m_vcTimer = nullptr;
-
-               return ECORE_CALLBACK_CANCEL;
-       }
-
-       void AccessoryPresenter::startVCTimer()
-       {
-               stopVCTimer();
-
-               auto timerInterval = CALL_VC_TIMER_INTERVAL;
-               if (elm_atspi_bridge_utils_is_screen_reader_enabled()) {
-                       timerInterval = CALL_VC_SCREEN_READER_TIMER_INTERVAL;
-               }
-
-               m_vcTimer = ecore_timer_add(timerInterval,
-                               CALLBACK_B(AccessoryPresenter::onVCTimerCb),
-                               this);
-       }
-
-       void AccessoryPresenter::restartVCTimer()
-       {
-               if (m_vcTimer) {
-                       ecore_timer_reset(m_vcTimer);
-               }
-       }
-
-       void AccessoryPresenter::stopVCTimer()
-       {
-               if (m_vcTimer) {
-                       ecore_timer_del(m_vcTimer);
-                       m_vcTimer = nullptr;
-               }
-       }
-
-       Eina_Bool AccessoryPresenter::onRotaryEvent(Eext_Rotary_Event_Info *info)
-       {
-               if (!isActive()) {
-                       LOG_RETURN_VALUE(RES_OK, EINA_TRUE,
-                                       "Ignored. Presenter is not active");
-               }
-
-               if (m_mode == CallMode::END) {
-                       return RES_OK;
-               }
-
-               if (m_vcTimer) {
-                       restartVCTimer();
-               } else {
-                       show(*m_vc);
-                       startVCTimer();
-                       m_isVcShowOnRotaryEvent = true;
-                       m_vc->getAtspi().highlight();
-               }
-
-               if (m_isVcShowOnRotaryEvent) {
-                       m_isVcShowOnRotaryEvent = checkPossibilityToModifyVolume(
-                                       m_sm->getVolume(),
-                                       info->direction ==
-                                                       EEXT_ROTARY_DIRECTION_CLOCKWISE);
-               }
-
-               if (info->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE) {
-                       tryIncreaseVolume();
-               } else {
-                       tryDecreaseVolume();
-               }
-
-               return EINA_TRUE;
-       }
-
-       void AccessoryPresenter::onVolumeControlEventCb(VolumeControl::Event event)
-       {
-               if (!isActive()) {
-                       LOG_RETURN_VOID(RES_OK, "Ignored. Presenter is not active");
-               }
-
-               if (!m_vcTimer) {
-                       DLOG("Ignored. Control is hidden");
-                       return;
-               }
-
-               restartVCTimer();
-
-               switch (event) {
-               case VolumeControl::Event::INCREASE:
-                       tryIncreaseVolume();
-                       break;
-               case VolumeControl::Event::DECREASE:
-                       tryDecreaseVolume();
-                       break;
-               default:
-                       break;
-               }
-       }
-
-       bool AccessoryPresenter::checkPossibilityToModifyVolume(int volume, bool needIncrease)
-       {
-               if (needIncrease) {
-                       auto max = m_sm->getMaxVolume();
-                       return (max >= volume);
-               } else {
-                       return (volume - 1 >= VOLUME_LEVEL_MIN);
-               }
-               return false;
-       }
-
-       void AccessoryPresenter::tryIncreaseVolume()
-       {
-               auto cur = m_sm->getVolume();
-               if (checkPossibilityToModifyVolume(cur, true)) {
-                       FAIL_RETURN_VOID(m_sm->setVolume(cur + 1),
-                                       "setVolume() failed!");
-               }
-       }
-
-       void AccessoryPresenter::tryDecreaseVolume()
-       {
-               auto cur = m_sm->getVolume();
-               if (checkPossibilityToModifyVolume(cur, false)) {
-                       FAIL_RETURN_VOID(m_sm->setVolume(cur - 1),
-                                       "setVolume() failed!");
-               }
-       }
-
        void AccessoryPresenter::onAudioStateChanged()
        {
                auto state = m_sm->getAudioState();
@@ -696,38 +538,12 @@ namespace callui {
 
        void AccessoryPresenter::updateCurrentVolume()
        {
-               auto max = m_sm->getMaxVolume();
-               auto cur = m_sm->getVolume();
-
-               m_vc->setValue(cur);
-               m_slider->setValue(cur);
-
-               if (cur == max) {
-                       m_vc->setIncreaseBtnEnable(false);
-                       m_vc->setDecreaseBtnEnable(true);
-               } else if (cur <= VOLUME_LEVEL_MIN) {
-                       m_vc->setIncreaseBtnEnable(true);
-                       m_vc->setDecreaseBtnEnable(false);
-               } else {
-                       m_vc->setIncreaseBtnEnable(true);
-                       m_vc->setDecreaseBtnEnable(true);
-               }
-
-               if (m_vc->isVisible()) {
-                       if (!m_isVcShowOnRotaryEvent) {
-                               elm_atspi_bridge_utils_say(std::to_string(cur).c_str(),
-                                               EINA_FALSE, nullptr, nullptr);
-                       }
-                       m_isVcShowOnRotaryEvent = false;
-               }
+               m_slider->setValue(m_sm->getVolume());
        }
 
        void AccessoryPresenter::updateMaxVolume()
        {
-               auto max = m_sm->getMaxVolume();
-
-               m_vc->setMaxValue(max);
-               m_slider->setMaxValue(max);
+               m_slider->setMaxValue(m_sm->getMaxVolume());
        }
 
        void AccessoryPresenter::onVolumeLevelChanged()
@@ -751,17 +567,11 @@ namespace callui {
                if (!m_muteBtn) {
                        return;
                }
+
                m_sm->getMuteState() ? m_muteBtn->emit(impl::SIGNAL_TURN_ON) :
                                m_muteBtn->emit(impl::SIGNAL_TURN_OFF);
        }
 
-       void AccessoryPresenter::onVolumeControlScreenReaderReadStart(
-                       Widget &widget,
-                       void *eventInfo)
-       {
-               restartVCTimer();
-       }
-
        Result AccessoryPresenter::createAtspiHighlightHelper()
        {
                m_atspiHelper = AtspiHighlightHelper::newInstance(*this);
@@ -785,20 +595,12 @@ namespace callui {
                switch (m_mode) {
                case CallMode::OUTGOING:
                case CallMode::DURING:
-                       if (m_vc->isVisible()) {
-                               return seq.process(m_vc).
-                                               process(m_vc->getDecreaseBtn()).
-                                               process(m_vc->getValueTxtAo()).
-                                               process(m_vc->getIncreaseBtn()).
-                                               getNext();
-                       } else {
-                               return seq.process(requestNextAo(false)).
-                                               process(m_volumeBtn).
-                                               process(m_bluetoothBtn).
-                                               process(m_muteBtn).
-                                               process(requestNextAo(true)).
-                                               getNext();
-                       }
+                       return seq.process(requestNextAo(false)).
+                                       process(m_volumeBtn).
+                                       process(m_bluetoothBtn).
+                                       process(m_muteBtn).
+                                       process(requestNextAo(true)).
+                                       getNext();
                case CallMode::END:
                        return seq.process(requestNextAo(false)).
                                        process(m_addContactBtn).
@@ -816,11 +618,6 @@ namespace callui {
                m_atspiHelper->registerObject(*m_volumeBtn);
                m_atspiHelper->registerObject(*m_bluetoothBtn);
                m_atspiHelper->registerObject(*m_muteBtn);
-
-               m_atspiHelper->registerObject(*m_vc);
-               m_atspiHelper->registerObject(m_vc->getDecreaseBtn());
-               m_atspiHelper->registerObject(m_vc->getIncreaseBtn());
-               m_atspiHelper->registerObject(m_vc->getValueTxtAo());
        }
 
        void AccessoryPresenter::registerEndCallAoCompomnents()
@@ -840,21 +637,10 @@ namespace callui {
        Elm_Interface_Atspi_Accessible *AccessoryPresenter::getNextAo(
                        bool isFlowsTo)
        {
-               switch (m_mode) {
-               case CallMode::OUTGOING:
-               case CallMode::DURING:
-                       if (m_vc->isVisible()) {
-                               return as_ao(m_vc);
-                       } else {
-                               return isFlowsTo ? as_ao(m_volumeBtn) : as_ao(m_muteBtn);
-                       }
-                       break;
-               case CallMode::END:
+               if (m_mode == CallMode::END) {
                        return as_ao(m_addContactBtn);
-                       break;
-               default:
-                       break;
+               } else {
+                       return isFlowsTo ? as_ao(m_volumeBtn) : as_ao(m_muteBtn);
                }
-               return nullptr;
        }
 }
index 86d1cb63578e7836d84be0df49f8262cd63a9a21..466435698fd9ecb408cadd2db6b852d4c4a80e2a 100644 (file)
 
 #include "ucl/mvp/GuiPresenter.h"
 
-#include "ucl/gui/Layout.h"
-#include "ucl/gui/StyledWidget.h"
-
 #include <app_control.h>
 
-#include "call-ui/model/ISoundManager.h"
 #include "call-ui/model/ICallManager.h"
 
-#include "call-ui/view/VolumeControl.h"
-#include "call-ui/view/Slider.h"
-
-#include "call-ui/presenters/misc/AtspiHighlightHelper.h"
+#include "VolumeControlPresenter.h"
 
 #include "call-ui/presenters/types.h"
 
@@ -120,13 +113,6 @@ namespace callui {
                 */
                void hideVolumeControls();
 
-               /**
-                * @brief Gets volume control UI components visibility status
-                * @return true - if volume control UI components are visible,
-                *  false - if not
-                */
-               bool getVolumeControlsVisibility();
-
                /**
                 * @brief Updates presenter
                 * @param[in] cm Call Manager instance
@@ -137,10 +123,9 @@ namespace callui {
                /**
                 * @brief Gets next ATSPI access object according to
                 *  relation flow direction
-                * param[in] isFlowsTo ATSPI highlight flow relation flag
-                *  (true for get to next object request,
-                *  false for get to previous object request)
-                *@return ATSPI object
+                * @param[in] isFlowsTo ATSPI highlight flow relation flag (true for
+                *  get to next access object, false for get to previous access object)
+                * @return Access object pointer
                 */
                Elm_Interface_Atspi_Accessible *getNextAo(bool isFlowsTo);
 
@@ -156,7 +141,7 @@ namespace callui {
 
                ucl::Result createWidget(ucl::ElmWidget &parent);
                ucl::Result createSlider();
-               ucl::Result createVolumeControl();
+               ucl::Result createVolumeControlPresenter(ucl::GuiPresenter &parent);
 
                ucl::Result createVolumeBtn();
                ucl::Result createMuteBtn();
@@ -170,24 +155,12 @@ namespace callui {
 
                void registerCallbacks();
                void unregisterCallbacks();
-               void onVolumeControlEventCb(VolumeControl::Event event);
-               Eina_Bool onRotaryEvent(Eext_Rotary_Event_Info *info);
-
-               bool checkPossibilityToModifyVolume(int volume,
-                               bool needIncrease);
-               void tryIncreaseVolume();
-               void tryDecreaseVolume();
 
                void onAudioStateChanged();
                void onVolumeLevelChanged();
                void onMuteStateChanged();
                void updateMuteBtn();
 
-               Eina_Bool onVCTimerCb();
-               void startVCTimer();
-               void restartVCTimer();
-               void stopVCTimer();
-
                void updateCurrentVolume();
                void updateMaxVolume();
 
@@ -198,9 +171,6 @@ namespace callui {
                ucl::Result setActiveCallCompomnents();
                ucl::Result setEndCallCompomnents(const ICallManagerSRef &cm);
 
-               void onVolumeControlScreenReaderReadStart(ucl::Widget &widget,
-                               void *eventInfo);
-
                ucl::Result createAtspiHighlightHelper();
                const Elm_Interface_Atspi_Accessible *onAtspiHighlight(
                                const Elm_Interface_Atspi_Accessible *ao,
@@ -220,16 +190,13 @@ namespace callui {
                ucl::StyledWidgetSRef m_bluetoothBtn;
                ucl::StyledWidgetSRef m_addContactBtn;
                SliderSRef m_slider;
-               VolumeControlSRef m_vc;
+               VolumeControlPresenterSRef m_voiceControl;
                AtspiHighlightHelperSRef m_atspiHelper;
 
-               Ecore_Timer *m_vcTimer;
                AudioStateType m_audioState;
                CallMode m_mode;
                std::string m_unsavedPhoneNumber;
 
-               bool m_isVcShowOnRotaryEvent;
-
                friend class ucl::ReffedObj<AccessoryPresenter>;
        };
 }
index 6dc83530821266dbd67abcafccc7e02127992a6d..472e1b506a2e4b321cb8bbd2e3f2b639b28192d7 100644 (file)
@@ -145,4 +145,5 @@ namespace callui {
        {
                handleAtspiGesture(atspi, eventInfo);
        }
+
 }
diff --git a/call-ui/presenters/misc/VolumeControlPresenter.cpp b/call-ui/presenters/misc/VolumeControlPresenter.cpp
new file mode 100644 (file)
index 0000000..7d6a81d
--- /dev/null
@@ -0,0 +1,418 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "VolumeControlPresenter.h"
+
+#include "call-ui/view/AoSequencer.h"
+
+#include "call-ui/resources.h"
+
+#include "call-ui/presenters/common.h"
+
+namespace callui { namespace { namespace impl {
+
+       constexpr auto DEFAULT_TIMER_INTERVAL = 1.5;
+       constexpr auto SCREEN_READER_TIMER_INTERVAL = 5;
+       constexpr auto VOLUME_LEVEL_MIN = 1;
+}}}
+
+namespace callui {
+
+       using namespace ucl;
+
+       // VolumeControlPresenter::Builder //
+
+       VolumeControlPresenter::Builder::Builder():
+               m_rotaryVisibility(true)
+       {
+       }
+
+       VolumeControlPresenter::Builder &
+       VolumeControlPresenter::Builder::setSoundManager(ISoundManagerSRef sm)
+       {
+               m_sm = std::move(sm);
+               return *this;
+       }
+
+       VolumeControlPresenter::Builder &
+       VolumeControlPresenter::Builder::setRotaryVisibility(bool rotaryVisibility)
+       {
+               m_rotaryVisibility = rotaryVisibility;
+               return *this;
+       }
+
+       VolumeControlPresenter::Builder &
+       VolumeControlPresenter::Builder::setParentWidget(ElmWidgetSRef parentWidget)
+       {
+               m_parentWidget = std::move(parentWidget);
+               return *this;
+       }
+
+       VolumeControlPresenterSRef VolumeControlPresenter::Builder::build(
+                       ucl::GuiPresenter &parent) const
+       {
+               if (!m_sm || !m_parentWidget) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "Main params are not set");
+               }
+
+               auto result = makeShared<VolumeControlPresenter>(m_sm,
+                               m_rotaryVisibility);
+               FAIL_RETURN_VALUE(result->prepare(parent, *m_parentWidget), {},
+                               "result->prepare() failed!");
+
+               return result;
+       }
+
+       // VolumeControlPresenter //
+
+       VolumeControlPresenter::VolumeControlPresenter(IRefCountObj &rc,
+                       ISoundManagerSRef sm, bool rotaryVisibility):
+               GuiPresenter(rc),
+               m_sm(std::move(sm)),
+               m_audioState(m_sm->getAudioState()),
+               m_rotaryVisibility(rotaryVisibility),
+               m_changedByRotary(false)
+       {
+       }
+
+       VolumeControlPresenter::~VolumeControlPresenter()
+       {
+               unregisterCallbacks();
+       }
+
+       Result VolumeControlPresenter::prepare(GuiPresenter &parent,
+                               ElmWidget &parentWidget)
+       {
+               FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR),
+                               "Presenter::prepare() failed!");
+
+               FAIL_RETURN(createWidget(parentWidget),
+                               "createWidget() failed!");
+               FAIL_RETURN(setupDeactivatorSink(),
+                               "setupDeactivatorSink() failed!");
+               FAIL_RETURN(createAtspiHighlightHelper(),
+                               "createAtspiHighlightHelper() failed!");
+
+               updateCurrentVolume();
+
+               registerCallbacks();
+
+               parent.addDeactivatorSource(*m_widget);
+
+               return RES_OK;
+       }
+
+       void VolumeControlPresenter::registerCallbacks()
+       {
+               addRotaryEventHandler(
+                               CALLBACK_A(VolumeControlPresenter::onRotaryEvent), this);
+
+               m_sm->addAudioStateHandler(WEAK_DELEGATE_THIS(onAudioStateChanged));
+               m_sm->addVolumeStateHandler(WEAK_DELEGATE_THIS(onVolumeLevelChanged));
+
+               eext_object_event_callback_add(as_eo(*m_widget), EEXT_CALLBACK_BACK,
+                                               CALLBACK_A(VolumeControlPresenter::onBackKey), this);
+       }
+
+       void VolumeControlPresenter::unregisterCallbacks()
+       {
+               eext_object_event_callback_del(as_eo(*m_widget), EEXT_CALLBACK_BACK,
+                               CALLBACK_A(VolumeControlPresenter::onBackKey));
+
+               m_sm->delVolumeStateHandler(DELEGATE_THIS(onVolumeLevelChanged));
+               m_sm->delAudioStateHandler(DELEGATE_THIS(onAudioStateChanged));
+
+               delRotaryEventHandler(
+                               CALLBACK_A(VolumeControlPresenter::onRotaryEvent), this);
+       }
+
+       Result VolumeControlPresenter::createWidget(ElmWidget &parent)
+       {
+               m_widget = VolumeControl::Builder().
+                               setInfoText(STR_VOLUME).
+                               setMaxValue(m_sm->getMaxVolume()).
+                               setEventHandler(WEAK_DELEGATE_THIS(onWidgetEventCb)).
+                               build(parent);
+               if (!m_widget) {
+                       LOG_RETURN(RES_FAIL, "VolumeControl::build() failed!");
+               }
+
+               auto window = m_widget->getWindow();
+               if (!window) {
+                       LOG_RETURN(RES_FAIL, "Window is NULL!");
+               }
+
+               int w = 0, h = 0;
+               window->getScreenSize(&w, &h);
+
+               m_widget->move(0, 0);
+               m_widget->resize(w, h);
+               hide(*m_widget);
+
+               m_widget->getDecreaseBtn().addEventHandler(ATSPI_HIGHLIGHTED,
+                               WEAK_DELEGATE_THIS(onWidgetBtnAtspiHighlight));
+
+               m_widget->getIncreaseBtn().addEventHandler(ATSPI_HIGHLIGHTED,
+                               WEAK_DELEGATE_THIS(onWidgetBtnAtspiHighlight));
+
+               return RES_OK;
+       }
+
+       Result VolumeControlPresenter::createAtspiHighlightHelper()
+       {
+               m_atspiHelper = AtspiHighlightHelper::newInstance(*this);
+               if (!m_atspiHelper) {
+                       LOG_RETURN(RES_FAIL,
+                                       "AtspiHighlightHelper::newInstance() failed!");
+               }
+               m_atspiHelper->deactivateBy(this);
+
+               m_atspiHelper->setEventHandler(
+                               WEAK_DELEGATE_THIS(onAtspiHighlight));
+
+               m_atspiHelper->registerObject(getWindow());
+
+               m_atspiHelper->registerObject(*m_widget);
+               m_atspiHelper->registerObject(m_widget->getDecreaseBtn());
+               m_atspiHelper->registerObject(m_widget->getIncreaseBtn());
+               m_atspiHelper->registerObject(m_widget->getValueTxtAo());
+
+               return RES_OK;
+       }
+
+       const Elm_Interface_Atspi_Accessible *
+       VolumeControlPresenter::onAtspiHighlight(
+                       const Elm_Interface_Atspi_Accessible *ao,
+                       Elm_Atspi_Relation_Type flowRelation)
+       {
+               return AoSequencer(ao, flowRelation).
+                               process(m_widget).
+                               process(m_widget->getDecreaseBtn()).
+                               process(m_widget->getValueTxtAo()).
+                               process(m_widget->getIncreaseBtn()).
+                               getNext();
+       }
+
+       ucl::Result VolumeControlPresenter::setupDeactivatorSink()
+       {
+               Evas_Object *const eo = elm_grid_add(as_eo(m_widget));
+               if (!eo) {
+                       LOG_RETURN(RES_FAIL, "evas_object_rectangle_add() failed!");
+               }
+
+               const auto sink = makeShared<Widget>(eo, false);
+               setDeactivatorSink(sink);
+               hide(*sink);
+
+               return RES_OK;
+       }
+
+       void VolumeControlPresenter::setVisible(bool isVisible)
+       {
+               isVisible ? showWidget() : hideWidget();
+       }
+
+       void VolumeControlPresenter::setRotaryVisibility(bool rotaryVisibility)
+       {
+               m_rotaryVisibility = rotaryVisibility;
+       }
+
+       void VolumeControlPresenter::showWidget()
+       {
+               show(*m_widget);
+               m_widget->getAtspi().highlight();
+
+               scheduleAutoHide();
+
+               sendDeactivate(*m_widget);
+
+               m_atspiHelper->activateBy(this);
+       }
+
+       void VolumeControlPresenter::hideWidget()
+       {
+               hide(*m_widget);
+
+               m_timeout.reset();
+
+               sendActivate(*m_widget);
+
+               m_atspiHelper->deactivateBy(this);
+       }
+
+       void VolumeControlPresenter::scheduleAutoHide()
+       {
+               m_timeout = Timeout::create(
+                               (elm_atspi_bridge_utils_is_screen_reader_enabled() ?
+                                               impl::SCREEN_READER_TIMER_INTERVAL :
+                                               impl::DEFAULT_TIMER_INTERVAL),
+                                               WEAK_DELEGATE_THIS(onAutoHideTimeout));
+       }
+
+       void VolumeControlPresenter::onAutoHideTimeout(Timeout *sender)
+       {
+               hideWidget();
+       }
+
+       bool VolumeControlPresenter::checkVolumeChangePossibility(int volume,
+                       bool needIncrease)
+       {
+               if (needIncrease) {
+                       return (m_sm->getMaxVolume() >= volume);
+               } else {
+                       return (volume - 1 >= impl::VOLUME_LEVEL_MIN);
+               }
+               return false;
+       }
+
+       Result VolumeControlPresenter::tryIncreaseVolume()
+       {
+               auto cur = m_sm->getVolume();
+               if (checkVolumeChangePossibility(cur, true)) {
+                       FAIL_RETURN(m_sm->setVolume(cur + 1), "setVolume() failed!");
+               }
+               return RES_OK;
+       }
+
+       Result VolumeControlPresenter::tryDecreaseVolume()
+       {
+               auto cur = m_sm->getVolume();
+               if (checkVolumeChangePossibility(cur, false)) {
+                       FAIL_RETURN(m_sm->setVolume(cur - 1), "setVolume() failed!");
+               }
+               return RES_OK;
+       }
+
+       void VolumeControlPresenter::updateCurrentVolume()
+       {
+               auto cur = m_sm->getVolume();
+
+               m_widget->setValue(cur);
+
+               if (cur == m_sm->getMaxVolume()) {
+                       m_widget->setIncreaseBtnEnable(false);
+                       m_widget->setDecreaseBtnEnable(true);
+               } else if (cur <= impl::VOLUME_LEVEL_MIN) {
+                       m_widget->setIncreaseBtnEnable(true);
+                       m_widget->setDecreaseBtnEnable(false);
+               } else {
+                       m_widget->setIncreaseBtnEnable(true);
+                       m_widget->setDecreaseBtnEnable(true);
+               }
+
+               if (m_widget->isVisible()) {
+                       if (m_changedByRotary) {
+                               elm_atspi_bridge_utils_say(std::to_string(cur).c_str(),
+                                               EINA_TRUE, nullptr, nullptr);
+                       }
+                       m_changedByRotary = false;
+               }
+       }
+
+       void VolumeControlPresenter::updateMaxVolume()
+       {
+               m_widget->setMaxValue(m_sm->getMaxVolume());
+       }
+
+       void VolumeControlPresenter::onWidgetEventCb(VolumeControl::Event event)
+       {
+               if (!isActive()) {
+                       LOG_RETURN_VOID(RES_OK, "Ignored. Presenter is not active");
+               }
+
+               if (!m_widget->isVisible()) {
+                       LOG_RETURN_VOID(RES_OK, "Ignored. Widget is hidden");
+               }
+
+               scheduleAutoHide();
+
+               switch (event) {
+               case VolumeControl::Event::INCREASE:
+                       tryIncreaseVolume();
+                       break;
+               case VolumeControl::Event::DECREASE:
+                       tryDecreaseVolume();
+                       break;
+               default:
+                       break;
+               }
+       }
+
+       void VolumeControlPresenter::onWidgetBtnAtspiHighlight(Widget &widget,
+                       void *eventInfo)
+       {
+               scheduleAutoHide();
+       }
+
+       void VolumeControlPresenter::onVolumeLevelChanged()
+       {
+               updateCurrentVolume();
+       }
+
+       void VolumeControlPresenter::onAudioStateChanged()
+       {
+               auto state = m_sm->getAudioState();
+
+               if ((m_audioState != AudioStateType::BT &&
+                               state == AudioStateType::BT) ||
+                               (m_audioState == AudioStateType::BT &&
+                                               state != AudioStateType::BT)) {
+                       m_audioState = state;
+
+                       updateMaxVolume();
+                       updateCurrentVolume();
+               }
+       }
+
+       Eina_Bool VolumeControlPresenter::onRotaryEvent(
+                       Eext_Rotary_Event_Info *info)
+       {
+               if (!isActive()) {
+                       LOG_RETURN_VALUE(RES_OK, EINA_TRUE,
+                                       "Ignored. Presenter is not active");
+               }
+
+               if (!m_rotaryVisibility) {
+                       LOG_RETURN_VALUE(RES_OK, EINA_TRUE,
+                                       "Ignored. Not visible by rotary event");
+               }
+
+               if (m_widget->isVisible()) {
+                       scheduleAutoHide();
+               } else {
+                       showWidget();
+               }
+
+               m_changedByRotary = checkVolumeChangePossibility(m_sm->getVolume(),
+                               info->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE);
+
+               auto res = (info->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE) ?
+                               tryIncreaseVolume() : tryDecreaseVolume();
+               if (res != RES_OK) {
+                       m_changedByRotary = false;
+               }
+
+               return EINA_TRUE;
+       }
+
+       void VolumeControlPresenter::onBackKey(Evas_Object *obj, void *eventInfo)
+       {
+               if (isActive()) {
+                       hideWidget();
+               }
+       }
+
+}
diff --git a/call-ui/presenters/misc/VolumeControlPresenter.h b/call-ui/presenters/misc/VolumeControlPresenter.h
new file mode 100644 (file)
index 0000000..4889ce1
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CALL_UI_PRESENTERS_MISC_VOLUME_CONTROL_PRESENTER_H__
+#define __CALL_UI_PRESENTERS_MISC_VOLUME_CONTROL_PRESENTER_H__
+
+#include "ucl/mvp/GuiPresenter.h"
+
+#include "ucl/misc/Timeout.h"
+
+#include "call-ui/model/ISoundManager.h"
+
+#include "call-ui/view/VolumeControl.h"
+
+#include "AtspiHighlightHelper.h"
+
+#include "call-ui/presenters/types.h"
+
+namespace callui {
+
+       UCL_DECLARE_REF_ALIASES(VolumeControlPresenter);
+
+       /**
+        * @brief Presenter of volume control UI components
+        */
+       class VolumeControlPresenter final : public ucl::GuiPresenter {
+       public:
+
+               /**
+                * @brief Builder for VolumeControlPresenter
+                */
+               class Builder {
+               public:
+
+                       /**
+                        * @brief Constructor
+                        */
+                       Builder();
+
+                       /**
+                        * @brief Sets ISoundManager instance
+                        * @param[in] sm ISoundManager instance
+                        * @return Reference to builder
+                        */
+                       Builder &setSoundManager(ISoundManagerSRef sm);
+
+                       /**
+                        * @brief Sets visibility of UI components by rotary events flag
+                        * @param[in] rotaryVisibility Visibility of UI components flag
+                        *  (true - if UI components will be auto shown by rotary events,
+                        *  false - if not)
+                        * @return Reference to builder
+                        */
+                       Builder &setRotaryVisibility(bool rotaryVisibility);
+
+                       /**
+                        * @brief Sets parent widget for UI components creation
+                        * @param[in] parentWidget Parent widget
+                        * @return Reference to builder
+                        */
+                       Builder &setParentWidget(ucl::ElmWidgetSRef parentWidget);
+
+                       /**
+                        * @brief Creates new instance of VolumeControlPresenter
+                        * @param[in] parent Parent presenter
+                        * @return Shared reference to VolumeControlPresenter instance
+                        *  on success or NULL otherwise
+                        */
+                       VolumeControlPresenterSRef build(ucl::GuiPresenter &parent) const;
+
+               private:
+                       ISoundManagerSRef m_sm;
+                       ucl::ElmWidgetSRef m_parentWidget;
+                       bool m_rotaryVisibility;
+               };
+
+       public:
+
+               /**
+                * @brief Sets visibility of UI components
+                * @param[in] isVisible Visibility flag
+                */
+               void setVisible(bool isVisible);
+
+               /**
+                * @brief Sets visibility of UI components by rotary events flag
+                * @param[in] rotaryVisibility Visibility of UI components flag
+                *  (true - if UI components will be auto shown by rotary events,
+                *  false - if not)
+                */
+               void setRotaryVisibility(bool rotaryVisibility);
+
+       private:
+               VolumeControlPresenter(ucl::IRefCountObj &rc,
+                               ISoundManagerSRef sm,
+                               bool rotaryVisibility);
+               ~VolumeControlPresenter();
+
+               ucl::Result prepare(ucl::GuiPresenter &parent,
+                               ucl::ElmWidget &parentWidget);
+
+               ucl::Result createWidget(ucl::ElmWidget &parent);
+               ucl::Result setupDeactivatorSink();
+
+               ucl::Result createAtspiHighlightHelper();
+               const Elm_Interface_Atspi_Accessible *onAtspiHighlight(
+                               const Elm_Interface_Atspi_Accessible *ao,
+                               Elm_Atspi_Relation_Type flowRelation);
+
+               void registerCallbacks();
+               void unregisterCallbacks();
+
+               void showWidget();
+               void hideWidget();
+
+               void scheduleAutoHide();
+               void onAutoHideTimeout(ucl::Timeout *sender);
+
+               bool checkVolumeChangePossibility(int volume, bool needIncrease);
+               ucl::Result tryIncreaseVolume();
+               ucl::Result tryDecreaseVolume();
+
+               void updateCurrentVolume();
+               void updateMaxVolume();
+
+               void onVolumeLevelChanged();
+               void onAudioStateChanged();
+               Eina_Bool onRotaryEvent(Eext_Rotary_Event_Info *info);
+
+               void onWidgetEventCb(VolumeControl::Event event);
+               void onWidgetBtnAtspiHighlight(ucl::Widget &widget, void *eventInfo);
+
+               void onBackKey(Evas_Object *obj, void *eventInfo);
+
+       private:
+               const ISoundManagerSRef m_sm;
+
+               VolumeControlSRef m_widget;
+               AtspiHighlightHelperSRef m_atspiHelper;
+               ucl::TimeoutSRef m_timeout;
+               AudioStateType m_audioState;
+
+               bool m_rotaryVisibility;
+               bool m_changedByRotary;
+
+               friend class ucl::ReffedObj<VolumeControlPresenter>;
+       };
+}
+
+#endif // __CALL_UI_PRESENTERS_MISC_VOLUME_CONTROL_PRESENTER_H__
index 95559d90e73a6c45a1c344c47ab6fdd156f60a08..ecfe1762a76377a88b0c1b5af8059c0730139d85 100644 (file)
@@ -142,9 +142,7 @@ namespace callui {
                        ISoundManagerSRef sm):
                Page(rc, std::move(navi), std::move(onExitRequest)),
                m_sm(std::move(sm)),
-               m_smInUse(false),
-               m_vcTimer(nullptr),
-               m_audioState(m_sm->getAudioState())
+               m_smInUse(false)
        {
        }
 
@@ -152,11 +150,7 @@ namespace callui {
        {
                stopDtmf();
 
-               stopVCTimer();
-
                unregisterPowerKeyHandling();
-
-               unregisterCallbacks();
        }
 
        Result KeypadPage::doPrepare(NaviItem &item)
@@ -167,20 +161,13 @@ namespace callui {
                                "createEntry() failed!");
                FAIL_RETURN(createButtons(),
                                "createButtons() failed!");
-               FAIL_RETURN(createVolumeControl(),
-                               "createVolumeControl() failed!");
+               FAIL_RETURN(createVolumeControlPresenter(),
+                               "createVolumeControlPresenter() failed!");
                FAIL_RETURN(registerPowerKeyHandling(),
                                "registerPowerKeyHandling() failed!");
                FAIL_RETURN(createAtspiHighlightHelper(),
                                "createAtspiHighlightHelper() failed!");
 
-               registerCallbacks();
-
-               updateVolume();
-
-               FAIL_RETURN(createAtspiHighlightHelper(),
-                               "createAtspiHighlightHelper() failed!");
-
                item = getNaviframe().push(*m_widget);
                if (!item) {
                        LOG_RETURN(RES_FAIL, "Naviframe::push() failed!");
@@ -220,6 +207,8 @@ namespace callui {
                        info->stopPropagation = true;
                }
 
+               m_voiceControl->setVisible(false);
+
                requestExit();
        }
 
@@ -251,10 +240,7 @@ namespace callui {
 
                if(info->type == impl::OperationType::VOLUME) {
                        DLOG("Button clicked [volume]");
-                       show(*m_vc);
-                       startVCTimer();
-
-                       m_vc->getAtspi().highlight();
+                       m_voiceControl->setVisible(true);
                }
        }
 
@@ -366,217 +352,23 @@ namespace callui {
                }
        }
 
-       Result KeypadPage::createVolumeControl()
+       Result KeypadPage::createVolumeControlPresenter()
        {
-               m_vc = VolumeControl::Builder().
-                               setInfoText(STR_VOLUME).
-                               setMaxValue(m_sm->getMaxVolume()).
-                               setEventHandler(WEAK_DELEGATE_THIS(onVolumeControlEventCb)).
-                               build(*m_widget);
-               if (!m_vc) {
-                       LOG_RETURN(RES_FAIL, "VolumeControl::build() failed!");
+               m_voiceControl = VolumeControlPresenter::Builder().
+                               setSoundManager(m_sm).
+                               setRotaryVisibility(false).
+                               setParentWidget(m_widget).
+                               build(*this);
+               if (!m_voiceControl) {
+                       LOG_RETURN(RES_FAIL, "VolumeControlPresenter::build() failed!");
                }
 
-               auto window = m_vc->getWindow();
-               if (!window) {
-                       LOG_RETURN(RES_FAIL, "Window is NULL!");
-               }
-               int w = 0, h = 0;
-               window->getScreenSize(&w, &h);
-
-               m_vc->move(0, 0);
-               m_vc->resize(w, h);
-               hide(*m_vc);
-
-               m_vc->getDecreaseBtn().addEventHandler(ATSPI_HIGHLIGHTED,
-                               WEAK_DELEGATE_THIS(onVolumeControlScreenReaderReadStart));
-
-               m_vc->getIncreaseBtn().addEventHandler(ATSPI_HIGHLIGHTED,
-                               WEAK_DELEGATE_THIS(onVolumeControlScreenReaderReadStart));
-
                return RES_OK;
        }
 
        void KeypadPage::onBackKey()
        {
-               if (m_vcTimer) {
-                       stopVCTimer();
-                       hide(*m_vc);
-               } else {
-                       requestExit();
-               }
-       }
-
-       void KeypadPage::onVolumeControlEventCb(VolumeControl::Event event)
-       {
-               if (!isActive()) {
-                       LOG_RETURN_VOID(RES_OK, "Ignored. Presenter is not active");
-               }
-
-               if (!m_vcTimer) {
-                       DLOG("Ignored. Control is hidden");
-                       return;
-               }
-
-               restartVCTimer();
-
-               switch (event) {
-               case VolumeControl::Event::INCREASE:
-                       tryIncreaseVolume();
-                       break;
-               case VolumeControl::Event::DECREASE:
-                       tryDecreaseVolume();
-                       break;
-               default:
-                       break;
-               }
-       }
-
-       void KeypadPage::updateVolume()
-       {
-               auto max = m_sm->getMaxVolume();
-               auto cur = m_sm->getVolume();
-
-               m_vc->setValue(cur);
-
-               if (cur == max) {
-                       m_vc->setIncreaseBtnEnable(false);
-                       m_vc->setDecreaseBtnEnable(true);
-               } else if (cur <= VOLUME_LEVEL_MIN) {
-                       m_vc->setIncreaseBtnEnable(true);
-                       m_vc->setDecreaseBtnEnable(false);
-               } else {
-                       m_vc->setIncreaseBtnEnable(true);
-                       m_vc->setDecreaseBtnEnable(true);
-               }
-
-               // Screen Reader
-               if (m_vc->isVisible()) {
-                       elm_atspi_bridge_utils_say(std::to_string(cur).c_str(),
-                                       EINA_FALSE, nullptr, nullptr);
-               }
-       }
-
-       void KeypadPage::updateMaxVolume()
-       {
-               m_vc->setMaxValue(m_sm->getMaxVolume());
-       }
-
-       void KeypadPage::onAudioStateChanged()
-       {
-               auto state = m_sm->getAudioState();
-               if ((m_audioState != AudioStateType::BT &&
-                               state == AudioStateType::BT) ||
-                               (m_audioState == AudioStateType::BT &&
-                                               state != AudioStateType::BT)) {
-                       m_audioState = state;
-
-                       updateMaxVolume();
-                       updateVolume();
-               }
-       }
-
-       void KeypadPage::onVolumeLevelChanged()
-       {
-               updateVolume();
-       }
-
-       Eina_Bool KeypadPage::onVCTimerCb()
-       {
-               hide(*m_vc);
-               m_vcTimer = nullptr;
-
-               return ECORE_CALLBACK_CANCEL;
-       }
-
-       void KeypadPage::startVCTimer()
-       {
-               stopVCTimer();
-
-               auto timerInterval = CALL_VC_TIMER_INTERVAL;
-               if (elm_atspi_bridge_utils_is_screen_reader_enabled()) {
-                       timerInterval = CALL_VC_SCREEN_READER_TIMER_INTERVAL;
-               }
-
-               m_vcTimer = ecore_timer_add(timerInterval,
-                               CALLBACK_B(KeypadPage::onVCTimerCb),
-                               this);
-       }
-
-       void KeypadPage::restartVCTimer()
-       {
-               if (m_vcTimer) {
-                       ecore_timer_reset(m_vcTimer);
-               }
-       }
-
-       void KeypadPage::stopVCTimer()
-       {
-               if (m_vcTimer) {
-                       ecore_timer_del(m_vcTimer);
-                       m_vcTimer = nullptr;
-               }
-       }
-
-       void KeypadPage::tryIncreaseVolume()
-       {
-               auto max = m_sm->getMaxVolume();
-               auto cur = m_sm->getVolume();
-
-               if (max != cur) {
-                       m_sm->setVolume(cur + 1);
-               }
-       }
-
-       void KeypadPage::tryDecreaseVolume()
-       {
-               auto cur = m_sm->getVolume();
-
-               if (cur - 1 >= VOLUME_LEVEL_MIN) {
-                       m_sm->setVolume(cur - 1);
-               }
-       }
-
-       Eina_Bool KeypadPage::onRotaryEvent(Eext_Rotary_Event_Info *info)
-       {
-               if (!isActive()) {
-                       LOG_RETURN_VALUE(RES_OK,
-                                       EINA_TRUE,
-                                       "Ignored. Presenter is not active");
-               }
-
-               if (!m_vcTimer) {
-                       DLOG("Ignore .Control is hidden");
-                       return EINA_FALSE;
-               }
-
-               restartVCTimer();
-
-               if (info->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE) {
-                       tryIncreaseVolume();
-               } else {
-                       tryDecreaseVolume();
-               }
-
-               return EINA_TRUE;
-       }
-
-       void KeypadPage::registerCallbacks()
-       {
-               addRotaryEventHandler(
-                               CALLBACK_A(KeypadPage::onRotaryEvent), this);
-
-               m_sm->addAudioStateHandler(WEAK_DELEGATE_THIS(onAudioStateChanged));
-               m_sm->addVolumeStateHandler(WEAK_DELEGATE_THIS(onVolumeLevelChanged));
-       }
-
-       void KeypadPage::unregisterCallbacks()
-       {
-               delRotaryEventHandler(
-                               CALLBACK_A(KeypadPage::onRotaryEvent), this);
-
-               m_sm->delAudioStateHandler(DELEGATE_THIS(onAudioStateChanged));
-               m_sm->delVolumeStateHandler(DELEGATE_THIS(onVolumeLevelChanged));
+               requestExit();
        }
 
        Result KeypadPage::createAtspiHighlightHelper()
@@ -595,11 +387,6 @@ namespace callui {
                m_atspiHelper->registerObject(*m_firstBtn);
                m_atspiHelper->registerObject(*m_lastBtn);
 
-               m_atspiHelper->registerObject(*m_vc);
-               m_atspiHelper->registerObject(m_vc->getDecreaseBtn());
-               m_atspiHelper->registerObject(m_vc->getIncreaseBtn());
-               m_atspiHelper->registerObject(m_vc->getValueTxtAo());
-
                return RES_OK;
        }
 
@@ -607,32 +394,10 @@ namespace callui {
                                const Elm_Interface_Atspi_Accessible *ao,
                                Elm_Atspi_Relation_Type flowRelation)
        {
-               if (m_vc->isVisible()) {
-                       if (ao == as_ao(getWindow())) {
-                               return as_ao(m_vc);
-                       }
-                       return AoSequencer(ao, flowRelation).
-                                       process(m_vc).
-                                       process(m_vc->getDecreaseBtn()).
-                                       process(m_vc->getValueTxtAo()).
-                                       process(m_vc->getIncreaseBtn()).
-                                       getNext();
-               } else {
-                       if (ao == as_ao(getWindow())) {
-                               return as_ao(m_firstBtn);
-                       }
-                       return AoSequencer(ao, flowRelation).
-                                       process(m_firstBtn).
-                                       processDefault().
-                                       process(m_lastBtn).
-                                       getNext();
-               }
-       }
-
-       void KeypadPage::onVolumeControlScreenReaderReadStart(
-                       Widget &widget,
-                       void *eventInfo)
-       {
-               restartVCTimer();
+               return AoSequencer(ao, flowRelation).
+                               process(m_firstBtn).
+                               processDefault().
+                               process(m_lastBtn).
+                               getNext();
        }
 }
index b9f7987ff63e42718759dea14de19e46865f0b68..2625b4c38203c4683075c4bb32769a117ffc6673 100644 (file)
@@ -22,8 +22,9 @@
 #include "ucl/gui/Layout.h"
 
 #include "call-ui/model/ISoundManager.h"
-#include "call-ui/view/VolumeControl.h"
+
 #include "call-ui/presenters/misc/AtspiHighlightHelper.h"
+#include "call-ui/presenters/misc/VolumeControlPresenter.h"
 
 #include "call-ui/presenters/types.h"
 
@@ -95,34 +96,15 @@ namespace callui {
                ucl::Result createWidget();
                ucl::Result createEntry();
                ucl::Result createButtons();
-               ucl::Result createVolumeControl();
+               ucl::Result createVolumeControlPresenter();
 
                void startDtmf(const unsigned char digit);
                void stopDtmf();
 
-               void onAudioStateChanged();
-               void onVolumeControlEventCb(VolumeControl::Event event);
-               Eina_Bool onVCTimerCb();
-               void startVCTimer();
-               void restartVCTimer();
-               void stopVCTimer();
-               void tryIncreaseVolume();
-               void tryDecreaseVolume();
-               void updateVolume();
-               void updateMaxVolume();
-               void onVolumeLevelChanged();
-               Eina_Bool onRotaryEvent(Eext_Rotary_Event_Info *info);
-
-               void registerCallbacks();
-               void unregisterCallbacks();
-
                ucl::Result createAtspiHighlightHelper();
                const Elm_Interface_Atspi_Accessible *onAtspiHighlight(
                                const Elm_Interface_Atspi_Accessible *ao,
                                Elm_Atspi_Relation_Type flowRelation);
-               void onVolumeControlScreenReaderReadStart(
-                               ucl::Widget &widget,
-                               void *eventInfo);
 
                // Page //
 
@@ -135,15 +117,11 @@ namespace callui {
                ucl::ElmWidgetSRef m_entry;
                ucl::ElmWidgetSRef m_firstBtn;
                ucl::ElmWidgetSRef m_lastBtn;
+               VolumeControlPresenterSRef m_voiceControl;
+               AtspiHighlightHelperSRef m_atspiHelper;
 
                bool m_smInUse;
 
-               VolumeControlSRef m_vc;
-               Ecore_Timer *m_vcTimer;
-               AudioStateType m_audioState;
-
-               AtspiHighlightHelperSRef m_atspiHelper;
-
                friend class ucl::ReffedObj<KeypadPage>;
        };
 }
index 903ecd30e40562dba697027ba35abc3238016ef3..5ad70a6ba8d743f6803df6e023b18e73ea07a267 100644 (file)
@@ -793,12 +793,6 @@ namespace callui {
                                        const Elm_Interface_Atspi_Accessible *ao,
                                        Elm_Atspi_Relation_Type flowRelation)
        {
-               if (ao == as_ao(getWindow())) {
-                       if (m_accessoryPrs->getVolumeControlsVisibility()) {
-                               m_accessoryPrs->getNextAo(true);
-                       }
-               }
-
                return AoSequencer(ao, flowRelation).
                                process(m_callInfoPrs->getStatusTxtAo()).
                                process(m_callInfoPrs->getMainTxtAo()).
index e263ef5f9830fcec9be112562920e183c4fb97a0..24fe320b23e3fb1f0d207a520494b6970fd17709 100644 (file)
@@ -9,7 +9,7 @@ type = app
 profile = wearable-4.0
 
 # C/CPP Sources
-USER_SRCS = call-ui/presenters/dialogs/base/Dialog.cpp call-ui/view/VolumeControl.cpp call-ui/model/impl/CallInfo.cpp call-ui/presenters/items/SimpleListItem.cpp call-ui/model/impl/IncomingCall.cpp ucl/source/appfw/helpers.cpp ucl/source/mvp/ListItemPresenter.cpp call-ui/model/impl/RejectMsg.cpp ucl/source/gui/Genlist.cpp ucl/source/util/types/Result.cpp call-ui/model/impl/ConferenceCallInfo.cpp call-ui/presenters/items/RejectMsgListItem.cpp call-ui/model/impl/BluetoothManager.cpp ucl/source/gui/Layout.cpp call-ui/presenters/misc/MotionSensorPresenter.cpp call-ui/model/impl/RssiStateSource.cpp call-ui/presenters/Instance.cpp call-ui/model/impl/ActiveCall.cpp call-ui/view/AoSequencer.cpp call-ui/model/impl/SimSlotStateSource.cpp call-ui/presenters/misc/AcceptRejectPresenter.cpp ucl/source/gui/WidgetItem.cpp call-ui/presenters/pages/MainPage.cpp ucl/source/gui/NaviItem.cpp call-ui/presenters/misc/DeviceStatePresenter.cpp call-ui/model/impl/ContactInfoProvider.cpp call-ui/model/impl/HdVoiceStateSource.cpp ucl/source/gui/Window.cpp call-ui/model/impl/ConnectionStateSource.cpp call-ui/presenters/misc/RejectMsgPresenter.cpp call-ui/presenters/pages/KeypadPage.cpp ucl/source/util/logging.cpp ucl/source/appfw/UIApp.cpp call-ui/presenters/misc/AccessoryPresenter.cpp call-ui/model/impl/ContactInfo.cpp call-ui/model/impl/EndCall.cpp call-ui/view/Slider.cpp call-ui/model/impl/RejectMsgProvider.cpp ucl/source/mvp/GuiPresenter.cpp ucl/source/appfw/InstanceManagerBase.cpp call-ui/model/impl/BatteryStateSource.cpp ucl/source/gui/Widget.cpp call-ui/presenters/dialogs/AcceptDialog.cpp call-ui/types.cpp call-ui/presenters/misc/helpers.cpp call-ui/model/impl/IndicatorStateProvider.cpp call-ui/view/AcceptRejectWidget.cpp ucl/source/misc/Timeout.cpp call-ui/resources.cpp ucl/source/util/types/classTypes.cpp call-ui/model/CallUIBuilder.cpp call-ui/presenters/misc/CallStatusPresenter.cpp call-ui/model/impl/HeldCall.cpp call-ui/model/impl/SoundManager.cpp ucl/source/gui/EdjeWidget.cpp call-ui/model/impl/MsgClient.cpp call-ui/presenters/InstanceManager.cpp call-ui/presenters/pages/base/Page.cpp call-ui/presenters/misc/MoreOptionsPresenter.cpp call-ui/presenters/misc/IndicatorPresenter.cpp call-ui/presenters/misc/AtspiHighlightHelper.cpp ucl/source/gui/Naviframe.cpp call-ui/model/impl/CallUI.cpp ucl/source/gui/ElmWidget.cpp ucl/source/gui/RadioBox.cpp ucl/source/misc/Variant.cpp call-ui/view/helpers.cpp call-ui/main.cpp call-ui/model/impl/CallManager.cpp call-ui/presenters/misc/CallInfoPresenter.cpp ucl/source/appfw/SysEventProvider.cpp call-ui/model/impl/CallClient.cpp ucl/source/mvp/ListPresenter.cpp 
+USER_SRCS = call-ui/presenters/dialogs/base/Dialog.cpp call-ui/view/VolumeControl.cpp call-ui/model/impl/CallInfo.cpp call-ui/presenters/items/SimpleListItem.cpp call-ui/model/impl/IncomingCall.cpp ucl/source/appfw/helpers.cpp ucl/source/mvp/ListItemPresenter.cpp call-ui/model/impl/RejectMsg.cpp ucl/source/gui/Genlist.cpp ucl/source/util/types/Result.cpp call-ui/model/impl/ConferenceCallInfo.cpp call-ui/presenters/items/RejectMsgListItem.cpp call-ui/model/impl/BluetoothManager.cpp ucl/source/gui/Layout.cpp call-ui/presenters/misc/MotionSensorPresenter.cpp call-ui/model/impl/RssiStateSource.cpp call-ui/presenters/Instance.cpp call-ui/model/impl/ActiveCall.cpp call-ui/view/AoSequencer.cpp call-ui/model/impl/SimSlotStateSource.cpp call-ui/presenters/misc/AcceptRejectPresenter.cpp ucl/source/gui/WidgetItem.cpp call-ui/presenters/pages/MainPage.cpp ucl/source/gui/NaviItem.cpp call-ui/presenters/misc/DeviceStatePresenter.cpp call-ui/model/impl/ContactInfoProvider.cpp call-ui/model/impl/HdVoiceStateSource.cpp ucl/source/gui/Window.cpp call-ui/model/impl/ConnectionStateSource.cpp call-ui/presenters/misc/RejectMsgPresenter.cpp call-ui/presenters/pages/KeypadPage.cpp ucl/source/util/logging.cpp ucl/source/appfw/UIApp.cpp call-ui/presenters/misc/AccessoryPresenter.cpp call-ui/model/impl/ContactInfo.cpp call-ui/model/impl/EndCall.cpp call-ui/view/Slider.cpp call-ui/model/impl/RejectMsgProvider.cpp ucl/source/mvp/GuiPresenter.cpp call-ui/presenters/misc/VolumeControlPresenter.cpp ucl/source/appfw/InstanceManagerBase.cpp call-ui/model/impl/BatteryStateSource.cpp ucl/source/gui/Widget.cpp call-ui/presenters/dialogs/AcceptDialog.cpp call-ui/types.cpp call-ui/presenters/misc/helpers.cpp call-ui/model/impl/IndicatorStateProvider.cpp call-ui/view/AcceptRejectWidget.cpp ucl/source/misc/Timeout.cpp call-ui/resources.cpp ucl/source/util/types/classTypes.cpp call-ui/model/CallUIBuilder.cpp call-ui/presenters/misc/CallStatusPresenter.cpp call-ui/model/impl/HeldCall.cpp call-ui/model/impl/SoundManager.cpp ucl/source/gui/EdjeWidget.cpp call-ui/model/impl/MsgClient.cpp call-ui/presenters/InstanceManager.cpp call-ui/presenters/pages/base/Page.cpp call-ui/presenters/misc/MoreOptionsPresenter.cpp call-ui/presenters/misc/IndicatorPresenter.cpp call-ui/presenters/misc/AtspiHighlightHelper.cpp ucl/source/gui/Naviframe.cpp call-ui/model/impl/CallUI.cpp ucl/source/gui/ElmWidget.cpp ucl/source/gui/RadioBox.cpp ucl/source/misc/Variant.cpp call-ui/view/helpers.cpp call-ui/main.cpp call-ui/model/impl/CallManager.cpp call-ui/presenters/misc/CallInfoPresenter.cpp ucl/source/appfw/SysEventProvider.cpp call-ui/model/impl/CallClient.cpp ucl/source/mvp/ListPresenter.cpp 
 
 # EDC Sources
 USER_EDCS =