diff options
author | Igor Olshevskyi <i.olshevskyi@samsung.com> | 2017-08-11 16:49:43 +0300 |
---|---|---|
committer | Igor Olshevskyi <i.olshevskyi@samsung.com> | 2017-08-23 10:26:03 +0300 |
commit | 0b66d5706b1dcb6940f8a32a1d2f84eb9adbd87e (patch) | |
tree | e2a46de30754294d44667ecf8618a1eaedb3c73e | |
parent | 7f3c6db9d5efcc65b8f2519f3f96e252c824c02f (diff) | |
download | call-ui-0b66d5706b1dcb6940f8a32a1d2f84eb9adbd87e.tar.gz call-ui-0b66d5706b1dcb6940f8a32a1d2f84eb9adbd87e.tar.bz2 call-ui-0b66d5706b1dcb6940f8a32a1d2f84eb9adbd87e.zip |
Fix TizenRefApp-8997 Keypad isn't closed by Home key
Fix TizenRefApp-9011 Power key does not turn LCD off during cally
Fix TizenRefApp-9116 More options displayed when closing Keypad
Change name VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER -> VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER_BOOL
Change-Id: I4a9ff4b871ef3cfd253e8e7d9d3b0472247c5a4b
-rw-r--r-- | call-ui/model/impl/SoundManager.cpp | 2 | ||||
-rw-r--r-- | call-ui/model/impl/VoiceControlStateProvider.cpp | 10 | ||||
-rw-r--r-- | call-ui/presenters/Instance.cpp | 77 | ||||
-rw-r--r-- | call-ui/presenters/Instance.h | 9 | ||||
-rw-r--r-- | call-ui/presenters/common.h | 1 | ||||
-rw-r--r-- | call-ui/presenters/misc/AccessoryPresenter.cpp | 10 | ||||
-rw-r--r-- | call-ui/presenters/misc/AtspiHighlightHelper.cpp | 16 | ||||
-rw-r--r-- | call-ui/presenters/misc/MoreOptionsPresenter.cpp | 30 | ||||
-rw-r--r-- | call-ui/presenters/misc/MoreOptionsPresenter.h | 4 | ||||
-rw-r--r-- | call-ui/presenters/misc/helpers.cpp | 16 | ||||
-rw-r--r-- | call-ui/presenters/misc/helpers.h | 6 | ||||
-rw-r--r-- | call-ui/presenters/pages/KeypadPage.cpp | 64 | ||||
-rw-r--r-- | call-ui/presenters/pages/KeypadPage.h | 6 | ||||
-rw-r--r-- | call-ui/presenters/pages/MainPage.cpp | 80 | ||||
-rw-r--r-- | call-ui/presenters/pages/MainPage.h | 7 | ||||
-rw-r--r-- | call-ui/presenters/types.h | 7 | ||||
-rw-r--r-- | call-ui/view/AcceptRejectWidget.cpp | 6 | ||||
-rw-r--r-- | edc/main_ly.edc | 24 |
18 files changed, 305 insertions, 70 deletions
diff --git a/call-ui/model/impl/SoundManager.cpp b/call-ui/model/impl/SoundManager.cpp index a29f12e..12d34c0 100644 --- a/call-ui/model/impl/SoundManager.cpp +++ b/call-ui/model/impl/SoundManager.cpp @@ -112,7 +112,7 @@ namespace callui { DLOG(); if (state == CM_AUDIO_STATE_NONE_E) { - ILOG("Ignore. Unhandled state [%d]", state); + ILOG("Ignored. Unhandled state [%d]", state); return; } m_audioStateEvent.dispatch(convertCMAudioState(state)); diff --git a/call-ui/model/impl/VoiceControlStateProvider.cpp b/call-ui/model/impl/VoiceControlStateProvider.cpp index e05f9ca..384d3cb 100644 --- a/call-ui/model/impl/VoiceControlStateProvider.cpp +++ b/call-ui/model/impl/VoiceControlStateProvider.cpp @@ -19,7 +19,7 @@ #include "common.h" // Temporary until VCONFLAG will not be added to a system -#define VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER VCONFKEY_CISSAPPL_ANSWERING_KEY_BOOL +#define VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER_BOOL VCONFKEY_CISSAPPL_ANSWERING_KEY_BOOL namespace callui { @@ -54,7 +54,7 @@ namespace callui { Result VoiceControlStateProvider::initState() { auto val = 0; - if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, &val) != 0) { + if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER_BOOL, &val) != 0) { LOG_RETURN(RES_FAIL, "vconf_get_bool() failed!" "err[%d]", vconf_get_ext_errno()); } @@ -82,7 +82,7 @@ namespace callui { Result VoiceControlStateProvider::addSysStateCallback() { - if (vconf_notify_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, + if (vconf_notify_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER_BOOL, CALLBACK_B(VoiceControlStateProvider::onStateChanged), this) != 0) { @@ -94,7 +94,7 @@ namespace callui { void VoiceControlStateProvider::delSysStateCallback() { - vconf_ignore_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, + vconf_ignore_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER_BOOL, CALLBACK_B(VoiceControlStateProvider::onStateChanged)); } @@ -102,7 +102,7 @@ namespace callui { keynode_t *node) { auto val = 0; - if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, &val) != 0) { + if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER_BOOL, &val) != 0) { LOG_RETURN_VOID(RES_FAIL, "vconf_get_bool() failed!" "err[%d]", vconf_get_ext_errno()); } diff --git a/call-ui/presenters/Instance.cpp b/call-ui/presenters/Instance.cpp index 7086452..0fb6df4 100644 --- a/call-ui/presenters/Instance.cpp +++ b/call-ui/presenters/Instance.cpp @@ -28,12 +28,15 @@ #include "pages/MainPage.h" #include "call-ui/resources.h" +#include "call-ui/presenters/types.h" #include "common.h" namespace callui { namespace { namespace impl { using namespace ucl; + constexpr auto POWER_KEY_HOLD_TIMEOUT = 0.4; + const char *STR_POWER_KEY = "XF86PowerOff"; }}} @@ -47,12 +50,16 @@ namespace callui { RefCountAware(&rc), m_sysEventProvider(sysEventProvider), m_context(nullptr), - m_keyUpEventHandler(nullptr) + m_keyUpEventHandler(nullptr), + m_keyDownEventHandler(nullptr), + m_ignorePowerClick(false) { } Instance::~Instance() { + m_powerKeyHoldTimout.reset(); + elm_win_keygrab_unset(*m_win, impl::STR_POWER_KEY, 0, 0); if (m_keyUpEventHandler) { @@ -69,10 +76,13 @@ namespace callui { m_win = m_context->getWindow(); elm_win_keygrab_set(*m_win, impl::STR_POWER_KEY, 0, 0, 0, - ELM_WIN_KEYGRAB_EXCLUSIVE); + ELM_WIN_KEYGRAB_TOPMOST); m_keyUpEventHandler = ecore_event_handler_add(ECORE_EVENT_KEY_UP, CALLBACK_A(Instance::onKeyUpEventCb), this); + m_keyDownEventHandler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, + CALLBACK_A(Instance::onKeyDownEventCb), this); + if (!m_keyUpEventHandler) { LOG_RETURN(RES_FAIL, "m_eventHandler is NULL"); } @@ -105,12 +115,16 @@ namespace callui { void Instance::onPause() { - ILOG("PAUSED"); + DLOG("PAUSE"); + + setInstancePaused(*m_win, true); } void Instance::onResume() { - ILOG("RESUMED"); + DLOG("RESUME"); + + setInstancePaused(*m_win, false); } void Instance::onAppControl(app_control_h appControl) @@ -154,20 +168,69 @@ namespace callui { return RES_OK; } + Eina_Bool Instance::onKeyDownEventCb(int type, void *event) + { + if (!event) { + LOG_RETURN_VALUE(RES_FAIL, ECORE_CALLBACK_PASS_ON, "event is NULL"); + } + + Ecore_Event_Key *ev = static_cast<Ecore_Event_Key *>(event); + if (!strcmp(ev->keyname, impl::STR_POWER_KEY)) { + DLOG("Key Power [Down]"); + return processPowerKeyDownEvent(); + } + return ECORE_CALLBACK_PASS_ON; + } + Eina_Bool Instance::onKeyUpEventCb(int type, void *event) { if (!event) { - LOG_RETURN_VALUE(RES_FAIL, ECORE_CALLBACK_DONE, "event is NULL"); + LOG_RETURN_VALUE(RES_FAIL, ECORE_CALLBACK_PASS_ON, "event is NULL"); } Ecore_Event_Key *ev = static_cast<Ecore_Event_Key *>(event); if (!strcmp(ev->keyname, impl::STR_POWER_KEY)) { - DLOG("Key power [Up]"); - m_win->callEvent(WIN_POWER_KEY_UP_EVENT, nullptr); + DLOG("Key Power [Up]"); + return processPowerKeyUpEvent(); + } + return ECORE_CALLBACK_PASS_ON; + } + + Eina_Bool Instance::processPowerKeyDownEvent() + { + m_ignorePowerClick = isInstancePaused(*m_win); + if (m_ignorePowerClick) { + DLOG("Ignored. Instance is in pause state"); + return ECORE_CALLBACK_PASS_ON; } + + m_powerKeyHoldTimout = Timeout::create( + impl::POWER_KEY_HOLD_TIMEOUT, + WEAK_DELEGATE(Instance::onPowerKeyHoldTimeout, + asWeak(*this))); + return ECORE_CALLBACK_DONE; } + Eina_Bool Instance::processPowerKeyUpEvent() + { + if (m_ignorePowerClick) { + DLOG("Ignored."); + return ECORE_CALLBACK_PASS_ON; + } + + PowerBtnEventInfo eventInfo; + m_win->callEvent(WIN_POWER_KEY_UP_EVENT, &eventInfo); + + return ECORE_CALLBACK_DONE; + } + + void Instance::onPowerKeyHoldTimeout(Timeout *sender) + { + m_ignorePowerClick = true; + m_powerKeyHoldTimout.reset(); + } + void Instance::onPageExitRequest(Page &page) { m_context->exitApp(); diff --git a/call-ui/presenters/Instance.h b/call-ui/presenters/Instance.h index 73ddcce..ca3f4a2 100644 --- a/call-ui/presenters/Instance.h +++ b/call-ui/presenters/Instance.h @@ -22,6 +22,7 @@ #include "ucl/appfw/SysEventProvider.h" #include "ucl/gui/Theme.h" #include "ucl/gui/Naviframe.h" +#include "ucl/misc/Timeout.h" #include "call-ui/model/ICallUI.h" @@ -54,7 +55,11 @@ namespace callui { void onSysEvent(const ucl::SysEvent sysEvent); void onPageExitRequest(Page &page); + Eina_Bool onKeyDownEventCb(int type, void *event); Eina_Bool onKeyUpEventCb(int type, void *event); + Eina_Bool processPowerKeyDownEvent(); + Eina_Bool processPowerKeyUpEvent(); + void onPowerKeyHoldTimeout(ucl::Timeout *sender); private: ucl::SysEventProvider &m_sysEventProvider; @@ -69,6 +74,10 @@ namespace callui { PageWRef m_page; Ecore_Event_Handler *m_keyUpEventHandler; + Ecore_Event_Handler *m_keyDownEventHandler; + ucl::TimeoutSRef m_powerKeyHoldTimout; + + bool m_ignorePowerClick; }; } diff --git a/call-ui/presenters/common.h b/call-ui/presenters/common.h index 16f8ab0..c515baf 100644 --- a/call-ui/presenters/common.h +++ b/call-ui/presenters/common.h @@ -26,6 +26,7 @@ #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; diff --git a/call-ui/presenters/misc/AccessoryPresenter.cpp b/call-ui/presenters/misc/AccessoryPresenter.cpp index 0b463c1..6eeee67 100644 --- a/call-ui/presenters/misc/AccessoryPresenter.cpp +++ b/call-ui/presenters/misc/AccessoryPresenter.cpp @@ -415,7 +415,7 @@ namespace callui { void AccessoryPresenter::onVolumeBtnClicked(Widget &widget, void *eventInfo) { if (!isActive()) { - ILOG("Presenter is not active. Ignore"); + ILOG("Ignored. Presenter is not active"); return; } @@ -428,7 +428,7 @@ namespace callui { void AccessoryPresenter::onMuteBtnClicked(Widget &widget, void *eventInfo) { if (!isActive()) { - ILOG("Presenter is not active. Ignore"); + ILOG("Ignored. Presenter is not active"); return; } @@ -582,7 +582,7 @@ namespace callui { { if (!isActive()) { LOG_RETURN_VALUE(RES_OK, EINA_TRUE, - "Presenter is not active. Ignore"); + "Ignored. Presenter is not active"); } if (m_vcTimer) { @@ -613,11 +613,11 @@ namespace callui { void AccessoryPresenter::onVolumeControlEventCb(VolumeControl::Event event) { if (!isActive()) { - LOG_RETURN_VOID(RES_OK, "Presenter is not active. Ignore"); + LOG_RETURN_VOID(RES_OK, "Ignored. Presenter is not active"); } if (!m_vcTimer) { - DLOG("Ignore as control is hidden"); + DLOG("Ignored. Control is hidden"); return; } diff --git a/call-ui/presenters/misc/AtspiHighlightHelper.cpp b/call-ui/presenters/misc/AtspiHighlightHelper.cpp index 8d1c13d..98ec77b 100644 --- a/call-ui/presenters/misc/AtspiHighlightHelper.cpp +++ b/call-ui/presenters/misc/AtspiHighlightHelper.cpp @@ -72,8 +72,6 @@ namespace callui { void AtspiHighlightHelper::registerWidget(ElmWidget &widget) { - DLOG("this [%p] widget [%p]", this, widget.getEo()); - widget.addEventHandler(ATSPI_ON_GESTURE, WEAK_DELEGATE( AtspiHighlightHelper::onAtspiGesture, asWeak(*this))); } @@ -82,16 +80,17 @@ namespace callui { Elm_Interface_Atspi_Accessible *ao, AtspiGestureEventInfo &e) { - DLOG("this [%p] ao [%p]", this, ao); + DLOG("Access object [%p]", ao); if (e.stopPropagation) { - DLOG("e.stopPropagation"); + DLOG("Ignored. Propagation was stopped."); return; } if (!isActive()) { - DLOG("!isActive()"); + DLOG("Ignored. Presenter is not active"); if (e.gestureInfo.type != ELM_ATSPI_GESTURE_ONE_FINGER_SINGLE_TAP) { + DLOG("Prevent default handler"); e.preventDefault = true; } return; @@ -100,8 +99,8 @@ namespace callui { e.stopPropagation = true; if (m_gestureEventHandler) { - DLOG("m_gestureEventHandler"); if (m_gestureEventHandler(ao, e.gestureInfo.type)) { + DLOG("Prevent default handler"); e.preventDefault = true; return; } @@ -110,19 +109,22 @@ namespace callui { e.preventDefault = false; if (!m_relationEventHandler) { - DLOG("!m_relationEventHandler"); + DLOG("Relation event handler does not set"); return; } const Elm_Atspi_Relation_Type relation = getFlowRelation(e.gestureInfo); if (relation == ELM_ATSPI_RELATION_NULL) { + DLOG("Not supported gesture type for processing"); return; } const auto relationObj = m_relationEventHandler(ao, relation); if (!relationObj) { + DLOG("Relation object is NULL!"); return; } + DLOG("Relation object [%p]", relationObj); auto &win = getWindow(); auto atspiHelper = static_cast<Elm_Interface_Atspi_Accessible *> diff --git a/call-ui/presenters/misc/MoreOptionsPresenter.cpp b/call-ui/presenters/misc/MoreOptionsPresenter.cpp index 6aa148c..55d2415 100644 --- a/call-ui/presenters/misc/MoreOptionsPresenter.cpp +++ b/call-ui/presenters/misc/MoreOptionsPresenter.cpp @@ -136,6 +136,8 @@ namespace callui { sendActivate(*m_widget); } + unregisterPageTransitionCallback(); + util::dispose(m_keypad); } @@ -157,6 +159,8 @@ namespace callui { FAIL_RETURN(createAtspiHighlightHelper(), "createAtspiHighlightHelper() failed!"); + registerPageTransitionCallback(); + deactivateBy(m_widget.get()); parent.addDeactivatorSource(*m_widget); @@ -233,6 +237,32 @@ namespace callui { return RES_OK; } + void MoreOptionsPresenter::registerPageTransitionCallback() + { + m_navi->addEventHandler(NAVI_TRANSITION_FINISHED, + WEAK_DELEGATE( + MoreOptionsPresenter::onPageTransitionFinished, + asWeak(*this))); + } + + void MoreOptionsPresenter::unregisterPageTransitionCallback() + { + m_navi->delEventHandler(NAVI_TRANSITION_FINISHED, + WEAK_DELEGATE( + MoreOptionsPresenter::onPageTransitionFinished, + asWeak(*this))); + } + + void MoreOptionsPresenter::onPageTransitionFinished(Widget &widget, + void *eventInfo) + { + if (const auto keypad = m_keypad.lock()) { + if (keypad->isAtTop()) { + elm_panel_hidden_set(*m_panel, EINA_TRUE); + } + } + } + void MoreOptionsPresenter::updateSlots() { unsetPanelContent(impl::PART_SWL_SLOT1); diff --git a/call-ui/presenters/misc/MoreOptionsPresenter.h b/call-ui/presenters/misc/MoreOptionsPresenter.h index f2c4fb5..8a599f2 100644 --- a/call-ui/presenters/misc/MoreOptionsPresenter.h +++ b/call-ui/presenters/misc/MoreOptionsPresenter.h @@ -83,6 +83,10 @@ namespace callui { const ucl::TString &txt, const ucl::WidgetEventHandler &handler); + void registerPageTransitionCallback(); + void unregisterPageTransitionCallback(); + void onPageTransitionFinished(ucl::Widget &widget, void *eventInfo); + void updateSlots(); void updateStatusText(); diff --git a/call-ui/presenters/misc/helpers.cpp b/call-ui/presenters/misc/helpers.cpp index adc682d..9867516 100644 --- a/call-ui/presenters/misc/helpers.cpp +++ b/call-ui/presenters/misc/helpers.cpp @@ -14,10 +14,14 @@ * limitations under the License. */ +#include "ucl/gui/Window.h" + #include "common.h" namespace callui { namespace { namespace himpl { + constexpr EoDataKey INSTANCE_PTR {"callui,instance,data,ptr"}; + const TString STR_HH_MM_SS_TIME{"%02d:%02d:%02d"}; const TString STR_MM_SS_TIME{"%02d:%02d"}; @@ -27,6 +31,18 @@ namespace callui { using namespace ucl; + void setInstancePaused(Window &win, const bool value) + { + win.setData(himpl::INSTANCE_PTR, reinterpret_cast<void *>(value)); + win.callEvent((value ? INSTANCE_PAUSED : INSTANCE_RESUMED), nullptr); + } + + bool isInstancePaused(const Window &win) + { + return (reinterpret_cast<intptr_t>( + win.getData(himpl::INSTANCE_PTR)) != 0); + } + void replaceSubstringInString(std::string &str, const std::string &from, const std::string &to) { diff --git a/call-ui/presenters/misc/helpers.h b/call-ui/presenters/misc/helpers.h index 9a1c16b..7686b27 100644 --- a/call-ui/presenters/misc/helpers.h +++ b/call-ui/presenters/misc/helpers.h @@ -25,6 +25,12 @@ namespace callui { + constexpr ucl::SmartEvent INSTANCE_PAUSED {"callui,instance,paused"}; + constexpr ucl::SmartEvent INSTANCE_RESUMED {"callui,instance,resumed"}; + + void setInstancePaused(ucl::Window &win, bool value); + bool isInstancePaused(const ucl::Window &win); + void replaceSubstringInString(std::string &str, const std::string &from, const std::string &to); diff --git a/call-ui/presenters/pages/KeypadPage.cpp b/call-ui/presenters/pages/KeypadPage.cpp index 2c06b75..abbe65c 100644 --- a/call-ui/presenters/pages/KeypadPage.cpp +++ b/call-ui/presenters/pages/KeypadPage.cpp @@ -16,6 +16,7 @@ #include "KeypadPage.h" +#include "call-ui/presenters/types.h" #include "call-ui/resources.h" #include "common.h" @@ -81,6 +82,7 @@ namespace callui { namespace { namespace impl { }}} namespace callui { + using namespace ucl; // KeypadPage::Builder @@ -151,19 +153,31 @@ namespace callui { KeypadPage::~KeypadPage() { stopDtmf(); + stopVCTimer(); + + unregisterPowerKeyHandling(); + unregisterCallbacks(); + } Result KeypadPage::doPrepare(NaviItem &item) { - FAIL_RETURN(createWidget(), "createWidget() failed!"); + FAIL_RETURN(createWidget(), + "createWidget() failed!"); + + FAIL_RETURN(createEntry(), + "createEntry() failed!"); - FAIL_RETURN(createEntry(), "createEntry() failed!"); + FAIL_RETURN(createButtons(), + "createButtons() failed!"); - FAIL_RETURN(createButtons(), "createButtons() failed!"); + FAIL_RETURN(createVolumeControl(), + "createVolumeControl() failed!"); - FAIL_RETURN(createVolumeControl(), "createVolumeControl() failed!"); + FAIL_RETURN(registerPowerKeyHandling(), + "registerPowerKeyHandling() failed!"); registerCallbacks(); @@ -180,6 +194,40 @@ namespace callui { return RES_OK; } + Result KeypadPage::registerPowerKeyHandling() + { + auto win = m_widget->getWindow(); + if (!win) { + LOG_RETURN(RES_FAIL, "win is NULL!"); + } + + win->addEventHandler(WIN_POWER_KEY_UP_EVENT, WEAK_DELEGATE( + KeypadPage::onPowerKeyUp, asWeak(*this))); + + return RES_OK; + } + + void KeypadPage::unregisterPowerKeyHandling() + { + auto win = m_widget->getWindow(); + if (!win) { + LOG_RETURN_VOID(RES_FAIL, "win is NULL!"); + } + + win->delEventHandler(WIN_POWER_KEY_UP_EVENT, WEAK_DELEGATE( + KeypadPage::onPowerKeyUp, asWeak(*this))); + } + + void KeypadPage::onPowerKeyUp(Widget &widget, void *eventInfo) + { + auto info = static_cast<PowerBtnEventInfo *>(eventInfo); + if (info) { + info->stopPropagation = true; + } + + requestExit(); + } + void KeypadPage::onBtnPressed(Widget &widget, void *eventInfo) { impl::ButtonInfo *info = @@ -366,11 +414,11 @@ namespace callui { void KeypadPage::onVolumeControlEventCb(VolumeControl::Event event) { if (!isActive()) { - LOG_RETURN_VOID(RES_OK, "Presenter is not active. Ignore"); + LOG_RETURN_VOID(RES_OK, "Ignored. Presenter is not active"); } if (!m_vcTimer) { - DLOG("Ignore as control is hidden"); + DLOG("Ignored. Control is hidden"); return; } @@ -496,11 +544,11 @@ namespace callui { if (!isActive()) { LOG_RETURN_VALUE(RES_OK, EINA_TRUE, - "Presenter is not active. Ignore"); + "Ignored. Presenter is not active"); } if (!m_vcTimer) { - DLOG("Ignore as control is hidden"); + DLOG("Ignore .Control is hidden"); return EINA_FALSE; } diff --git a/call-ui/presenters/pages/KeypadPage.h b/call-ui/presenters/pages/KeypadPage.h index d3c8441..351fb27 100644 --- a/call-ui/presenters/pages/KeypadPage.h +++ b/call-ui/presenters/pages/KeypadPage.h @@ -55,6 +55,11 @@ namespace callui { ucl::Result doPrepare(ucl::NaviItem &item); + ucl::Result registerPowerKeyHandling(); + void unregisterPowerKeyHandling(); + + void onPowerKeyUp(ucl::Widget &widget, void *eventInfo); + void onBtnPressed(ucl::Widget &widget, void *eventInfo); void onBtnUnpressed(ucl::Widget &widget, void *eventInfo); void onBtnClicked(ucl::Widget &widget, void *eventInfo); @@ -108,7 +113,6 @@ namespace callui { VolumeControlSRef m_vc; Ecore_Timer *m_vcTimer; - AudioStateType m_audioState; // Screen Reader diff --git a/call-ui/presenters/pages/MainPage.cpp b/call-ui/presenters/pages/MainPage.cpp index 3cf0ef3..23ed352 100644 --- a/call-ui/presenters/pages/MainPage.cpp +++ b/call-ui/presenters/pages/MainPage.cpp @@ -20,14 +20,16 @@ #include "ucl/gui/Widget.h" #include "call-ui/resources.h" +#include "call-ui/presenters/types.h" + #include "common.h" namespace callui { namespace { namespace impl { using namespace ucl; - constexpr double CU_RECALL_BTN_SHOW_TIMEOUT = 1.0; - constexpr double CU_EXIT_APP_TIMEOUT = 4.0; + constexpr auto RECALL_BTN_SHOW_TIMEOUT = 1.0; + constexpr auto EXIT_APP_TIMEOUT = 4.0; constexpr LayoutTheme LAYOUT_MAIN_WIDGET {"layout", "callui", "main"}; @@ -132,44 +134,61 @@ namespace callui { } FAIL_RETURN(createWidget(), "createWidget() failed!"); - FAIL_RETURN(createIndicatorPresenter(), "createIndicatorPresenter() failed!"); - FAIL_RETURN(createDisplayPresenter(), "createDisplayPresenter() failed!"); + FAIL_RETURN(createIndicatorPresenter(), + "createIndicatorPresenter() failed!"); + + FAIL_RETURN(createDisplayPresenter(), + "createDisplayPresenter() failed!"); + + FAIL_RETURN(registerPowerKeyHandling(), + "registerPowerKeyHandling() failed!"); + + item = getNaviframe().push(*m_widget); + if (!item) { + LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); + } + + return RES_OK; + } + + Result MainPage::registerPowerKeyHandling() + { auto win = m_widget->getWindow(); if (!win) { LOG_RETURN(RES_FAIL, "win is NULL!"); } + win->addEventHandler(WIN_POWER_KEY_UP_EVENT, WEAK_DELEGATE( MainPage::onPowerKeyUp, asWeak(*this))); - item = getNaviframe().push(*m_widget); - if (!item) { - LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); - } - return RES_OK; } - void MainPage::processKeyPress() + void MainPage::unregisterPowerKeyHandling() { - switch (m_mode) { - case CallMode::INCOMING: - { - auto incom = m_cm->getIncomingCall(); - if (!incom) { - LOG_RETURN_VOID(RES_FAIL, "incom is NULL"); - } - incom->stopAlert(); - break; + auto win = m_widget->getWindow(); + if (!win) { + LOG_RETURN_VOID(RES_FAIL, "win is NULL!"); } - case CallMode::END: + + win->delEventHandler(WIN_POWER_KEY_UP_EVENT, WEAK_DELEGATE( + MainPage::onPowerKeyUp, asWeak(*this))); + } + + void MainPage::processKeyPress(bool isPowerKey) + { + if (m_mode == CallMode::END) { requestExit(); - break; - default: - if (m_accessoryPrs) { - m_accessoryPrs->hideVolumeControls(); + } else if (m_mode != CallMode::INCOMING) { + if (isPowerKey) { + m_devicePrs->setDisplayState( + DeviceStatePresenter::DisplayState::OFF); + } else { + if (m_accessoryPrs) { + m_accessoryPrs->hideVolumeControls(); + } } - break; } } @@ -180,9 +199,12 @@ namespace callui { void MainPage::onPowerKeyUp(Widget &widget, void *eventInfo) { - if (isActive()) { - processKeyPress(); + auto info = static_cast<PowerBtnEventInfo *>(eventInfo); + if (info && info->stopPropagation) { + DLOG("Ignored. Propagation was stopped."); + return; } + processKeyPress(true); } Result MainPage::processIncomingCallMode() @@ -350,7 +372,7 @@ namespace callui { stopEndCallTimer(); m_ecTimer = ecore_timer_add( - impl::CU_RECALL_BTN_SHOW_TIMEOUT, + impl::RECALL_BTN_SHOW_TIMEOUT, CALLBACK_B(MainPage::onEndCallTimerCb), this); } @@ -399,7 +421,7 @@ namespace callui { m_widget->setContent(*m_bottomBtn, impl::PART_SWL_BOTTOM_BTN); show(*m_bottomBtn); } - ecore_timer_interval_set(m_ecTimer, impl::CU_EXIT_APP_TIMEOUT); + ecore_timer_interval_set(m_ecTimer, impl::EXIT_APP_TIMEOUT); m_ecTimerBtnReq = true; return ECORE_CALLBACK_RENEW; } else { diff --git a/call-ui/presenters/pages/MainPage.h b/call-ui/presenters/pages/MainPage.h index 92c7eed..4a826a9 100644 --- a/call-ui/presenters/pages/MainPage.h +++ b/call-ui/presenters/pages/MainPage.h @@ -23,7 +23,6 @@ #include "ucl/gui/Layout.h" #include "call-ui/model/ICallUI.h" - #include "call-ui/presenters/misc/IndicatorPresenter.h" #include "call-ui/presenters/misc/AcceptRejectPresenter.h" #include "call-ui/presenters/misc/CallInfoPresenter.h" @@ -62,6 +61,11 @@ namespace callui { ucl::Result doPrepare(ucl::NaviItem &item); + ucl::Result registerPowerKeyHandling(); + void unregisterPowerKeyHandling(); + + void processKeyPress(bool isPowerKey = false); + ucl::Result showWindow(); void updateCallMode(); @@ -89,7 +93,6 @@ namespace callui { Eina_Bool onEndCallTimerCb(); void onPowerKeyUp(ucl::Widget &widget, void *eventInfo); - void processKeyPress(); ucl::Result updateDeviceState(CallMode prevMode, CallMode curMode); diff --git a/call-ui/presenters/types.h b/call-ui/presenters/types.h index c7beb84..df9dd48 100644 --- a/call-ui/presenters/types.h +++ b/call-ui/presenters/types.h @@ -20,4 +20,11 @@ #include "call-ui/view/types.h" #include "call-ui/model/types.h" +namespace callui { + + struct PowerBtnEventInfo { + bool stopPropagation = false; + }; +} + #endif // __CALL_UI_PRESENTERS_TYPES_H__ diff --git a/call-ui/view/AcceptRejectWidget.cpp b/call-ui/view/AcceptRejectWidget.cpp index b16d4c9..4b3ed5f 100644 --- a/call-ui/view/AcceptRejectWidget.cpp +++ b/call-ui/view/AcceptRejectWidget.cpp @@ -1207,7 +1207,7 @@ namespace callui { m_isContracting = true; setAcceptUnpressedState(); } else { - DLOG("Counter is 0. Ignored"); + DLOG("Ignored. Counter is 0"); } m_expandTimeout.reset(); } @@ -1219,7 +1219,7 @@ namespace callui { m_isContracting = true; setRejectUnpressedState(); } else { - DLOG("Counter is 0. Ignored"); + DLOG("Ignored. Counter is 0"); } m_expandTimeout.reset(); } @@ -1293,7 +1293,7 @@ namespace callui { m_expandTimeout.reset(); if (m_isContracting) { - DLOG("Contracting. Ignore"); + DLOG("Ignored. Contracting state"); return EINA_TRUE; } diff --git a/edc/main_ly.edc b/edc/main_ly.edc index 1e9dd3d..cd9bfc4 100644 --- a/edc/main_ly.edc +++ b/edc/main_ly.edc @@ -16,31 +16,47 @@ group { "elm/layout/callui/main"; parts { + rect { "bg"; + scale; + desc { "default"; + min: CU_WIN_W CU_WIN_H; + max: CU_WIN_W CU_WIN_H; + color: 0 0 0 0; + } + } swallow { "swl.call_info"; scale; desc { "default"; + rel1.to: "bg"; + rel2.to: "bg"; } } swallow { "swl.indicator"; scale; desc { "default"; + rel1.to: "bg"; + rel2.to: "bg"; } } swallow { "swl.rm" scale; desc { "default"; + rel1.to: "bg"; + rel2.to: "bg"; } } swallow { "swl.accept_reject"; scale; desc { "default"; + rel1.to: "bg"; + rel2.to: "bg"; } } swallow { "swl.bottom_btn"; scale; desc { "default"; - rel1.relative: 0.0 1.0; - rel2.relative: 1.0 1.0; + rel1 { relative: 0.0 1.0; to: "bg"; } + rel2 { relative: 1.0 1.0; to: "bg"; } align: 0.5 1.0; fixed: 0 1; } @@ -48,11 +64,15 @@ group { "elm/layout/callui/main"; swallow { "swl.overlay"; scale; desc { "default"; + rel1.to: "bg"; + rel2.to: "bg"; } } swallow { "swl.more_option"; scale; desc { "default"; + rel1.to: "bg"; + rel2.to: "bg"; } } } |