TizenRefApp-8698 [Call UI] Fix issue with sliding label duration 12/134212/1
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Mon, 12 Jun 2017 07:00:23 +0000 (10:00 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Thu, 15 Jun 2017 08:31:21 +0000 (11:31 +0300)
Change-Id: I4e04879a12cbde06d6bcf8008ef4634748ef45bd

inc/presenters/CallInfoPresenter.h
inc/presenters/MoreOptionsPresenter.h
src/main.cpp
src/presenters/CallInfoPresenter.cpp
src/presenters/MoreOptionsPresenter.cpp
src/view/Slider.cpp
src/view/VolumeControl.cpp

index eb9a9f3585d4f5dfdc0149586ca44b8c83ec24aa..9bdacc93a486c52a119947936e6f293a30ca703b 100644 (file)
@@ -59,6 +59,7 @@ namespace callui {
 
                ucl::Result createWidget(ucl::ElmWidget &parent);
                ucl::Result createLabel(const std::string &text);
+               ucl::Result createCallerIdImage(const std::string &imagePath);
                ucl::Result createCallStatus();
 
                ucl::Result update();
index b82aaba0165e3c04315760d122a8eb66e880dd84..b574a312460d6a8180270a1d82cdce94bc1b2584 100644 (file)
@@ -84,8 +84,12 @@ namespace callui {
 
                void onBackKey(Evas_Object *obj, void *eventInfo);
 
-               void onActivate(Evas_Object *obj, const char *emission, const char *source);
-               void onInactivate(Evas_Object *obj, const char *emission, const char *source);
+               void onPanelActivate(Evas_Object *obj,
+                               const char *emission,
+                               const char *source);
+               void onPanelInactivate(Evas_Object *obj,
+                               const char *emission,
+                               const char *source);
 
                ucl::Result startCallDurationTimer();
                void stopCallDurationTimer();
@@ -96,7 +100,8 @@ namespace callui {
                void onAudioStateChanged(AudioStateType state);
 
                void unsetPanelContent(const ucl::EdjePart &part);
-               void setPanelContent(ucl::StyledWidgetSRef &widget, const ucl::EdjePart &part);
+               void setPanelContent(ucl::StyledWidgetSRef &widget,
+                               const ucl::EdjePart &part);
 
                void onPageExitRequest(Page &page);
 
index b00dae035f29313d8dedee071550a117e5808df5..31ba8425ad26a4fd130e6f770f1f30a9a2ef7c47 100644 (file)
@@ -25,8 +25,12 @@ using namespace callui;
 
 int main(int argc, char *argv[])
 {
+       ILOG("MAIN START");
+
        InstanceManager mgr;
        const int ret = UIApp(mgr).run(argc, argv);
-       ILOG("ret: %d", ret);
+
+       ILOG("MAIN END. ret[%d]", ret);
+
        return ret;
 }
index 58cef09d05bbedc60a1e92712dd0fb807d6e95e9..ca5632cabb7986225b0415c7cb68b57d2b4e3d02 100644 (file)
@@ -38,7 +38,7 @@ namespace callui { namespace { namespace impl {
        constexpr int SUB_TXT_WIDTH = 208;
        constexpr int MAIN_TXT_WIDTH_SIMPLE = 208;
        constexpr int MAIN_TXT_WIDTH_INCOM = 190;
-       constexpr int SLIDE_LABEL_DURATION_KOEFF = 20;
+       constexpr int SLIDE_LABEL_DURATION_KOEFF = 8;
 
        constexpr LayoutTheme LAYOUT_CALLER_INFO_WIDGET
                        {"layout", "callui", "call_info"};
@@ -70,13 +70,16 @@ namespace callui { namespace { namespace impl {
        constexpr EdjePart PART_SWL_CALLER_ID {"caller_id"};
        constexpr EdjePart PART_SWL_2LINE {"text_2line"};
 
-       const TString STR_LABEL_CALLER_ID_ENABLE{
+       const TString STR_LABEL_CID_ENABLE{
                "<align=center><color=#ffffff99><font_size=24>%s</color></font_size></align>"};
-       const TString STR_LABEL_CALLER_ID_DISABLE{
+       const TString STR_LABEL_CID_DISABLE{
                "<align=center><color=#ffffff99><font_size=24>%s</color></font_size></align>"};
 
        int getTextBlockActualWidth(const Evas_Object *obj)
        {
+               if (!obj) {
+                       LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, 0, "Evas object is NULL");
+               }
                int resWidth = 0;
                evas_object_textblock_size_native_get(obj, &resWidth, NULL);
                return resWidth;
@@ -205,8 +208,7 @@ namespace callui {
                }
        }
 
-       Result CallInfoPresenter::update(CallMode mode,
-                       const ICallManagerSRef &cm)
+       Result CallInfoPresenter::update(CallMode mode, const ICallManagerSRef &cm)
        {
                m_needModifyCallStatus = false;
                if (mode != m_mode || mode == CallMode::DURING) {
@@ -257,7 +259,7 @@ namespace callui {
                }
 
                if (m_incomCallInfo->isVoiceMailNumber() ||
-                               m_incomCallInfo->isEmergency()){
+                               m_incomCallInfo->isEmergency()) {
                        return "";
                }
 
@@ -267,7 +269,8 @@ namespace callui {
        std::string CallInfoPresenter::getDuringCallSubText() const
        {
                if (m_activeCallInfo) {
-                       auto confMemberCount = m_activeCallInfo->getConferenceMemberCount();
+                       auto confMemberCount =
+                                       m_activeCallInfo->getConferenceMemberCount();
                        if (m_heldCallInfo) {
                                return STR_CALL_ON_HOLD.translate();
                        } else if (confMemberCount > 1) {
@@ -275,7 +278,8 @@ namespace callui {
                                                format(confMemberCount);
                        }
                } else if (m_heldCallInfo) {
-                       auto confMemberCount = m_heldCallInfo->getConferenceMemberCount();
+                       auto confMemberCount =
+                                       m_heldCallInfo->getConferenceMemberCount();
                        if (confMemberCount > 1) {
                                return TString{STR_WITH_PD_PEOPLE.translate()}.
                                                format(confMemberCount);
@@ -293,7 +297,8 @@ namespace callui {
                        FAIL_RETURN_VALUE(RES_FAIL, "", "end is NULL!");
                }
 
-               auto confMemberCount = m_endCallInfo->getConferenceMemberCount();
+               auto confMemberCount =
+                               m_endCallInfo->getConferenceMemberCount();
                if (confMemberCount > 1) {
                        return TString{STR_WITH_PD_PEOPLE.translate()}.
                                        format(confMemberCount);
@@ -304,31 +309,53 @@ namespace callui {
 
        Result CallInfoPresenter::createLabel(const std::string &text)
        {
-               TString tmp;
-               if (m_callerId) {
-                       tmp = impl::STR_LABEL_CALLER_ID_ENABLE.format(text.c_str());
-               } else {
-                       tmp = impl::STR_LABEL_CALLER_ID_DISABLE.format(text.c_str());
-               }
+               auto *eo = elm_label_add(*m_widget);
+               if (!eo) {
+                       LOG_RETURN(RES_FAIL, "elm_label_add() failed!");
+               }
+               m_label = makeShared<StyledWidget>(eo, true);
+               m_label->setStyle(impl::STYLE_SLIDING_LABEL);
+               m_label->setText((m_callerId) ?
+                               impl::STR_LABEL_CID_ENABLE.format(text.c_str()) :
+                               impl::STR_LABEL_CID_DISABLE.format(text.c_str()));
+
+               elm_label_slide_mode_set(*m_label,
+                               ELM_LABEL_SLIDE_MODE_AUTO);
+               elm_label_wrap_width_set(*m_label,
+                               ELM_SCALE_SIZE(impl::SUB_TXT_WIDTH));
+
                double duration = (static_cast<double>(text.size())) /
                                impl::SLIDE_LABEL_DURATION_KOEFF;
+               elm_label_slide_duration_set(*m_label, duration);
+               elm_label_slide_go(*m_label);
+
+               m_widget->setContent(*m_label, impl::PART_SWL_2LINE);
 
-               auto label = makeShared<StyledWidget>(elm_label_add(*m_widget), true);
-               if (!label) {
-                       LOG_RETURN(RES_FAIL, "Create label failed!");
+               return RES_OK;
+       }
+
+       Result CallInfoPresenter::createCallerIdImage(const std::string &imagePath)
+       {
+               auto *eo = elm_image_add(*m_widget);
+               if (!eo) {
+                       LOG_RETURN(RES_FAIL, "elm_image_add() failed");
                }
-               label->setStyle(impl::STYLE_SLIDING_LABEL);
-               label->setText(tmp);
+               auto callerId = makeShared<StyledWidget>(eo, true);
+               elm_image_file_set(*callerId, imagePath.c_str(), NULL);
+               elm_image_aspect_fixed_set(*callerId, EINA_TRUE);
+               elm_image_fill_outside_set(*callerId, EINA_TRUE);
 
-               elm_label_slide_mode_set(*label, ELM_LABEL_SLIDE_MODE_AUTO);
-               elm_label_wrap_width_set(*label,
-                               ELM_SCALE_SIZE(impl::SUB_TXT_WIDTH));
-               elm_label_slide_duration_set(*label, duration);
-               elm_label_slide_go(*label);
+               auto window = callerId->getWindow();
+               if (!window) {
+                       LOG_RETURN(RES_FAIL, "Window is NULL!");
+               }
+               int w = 0, h = 0;
+               window->getScreenSize(&w, &h);
+               evas_object_size_hint_min_set(*callerId, w, h);
 
-               m_widget->setContent(*label, impl::PART_SWL_2LINE);
+               m_widget->setContent(*callerId, impl::PART_SWL_CALLER_ID);
 
-               m_label = label;
+               m_callerId = callerId;
 
                return RES_OK;
        }
@@ -336,7 +363,7 @@ namespace callui {
        Result CallInfoPresenter::updateCallerId()
        {
                m_callerId.reset();
-               m_widget->emit(impl::SIGN_CALLER_ID_DISABLE, impl::SRC_CALLER_ID);
+               m_widget->emit(impl::SIGN_CALLER_ID_DISABLE,impl::SRC_CALLER_ID);
 
                if (m_mode == CallMode::INCOMING) {
 
@@ -346,41 +373,18 @@ namespace callui {
 
                        auto contactInfo = m_incomCallInfo->getContactInfo();
                        if (!contactInfo) {
-                               ILOG("No contact info");
-                               return RES_OK;
+                               LOG_RETURN(RES_OK, "No contact info");
                        }
 
                        auto callerIdPath = contactInfo->getImagePath();
                        if (callerIdPath.empty()) {
-                               ILOG("No caller id content to set");
-                               return RES_OK;
-                       }
-
-                       auto callerId = makeShared<StyledWidget>(
-                                       elm_image_add(*m_widget), true);
-                       if (!callerId) {
-                               LOG_RETURN(RES_FAIL, "Create callerId failed!");
-                       }
-
-                       elm_image_file_set(*callerId, callerIdPath.c_str(), NULL);
-                       elm_image_aspect_fixed_set(*callerId, EINA_TRUE);
-                       elm_image_fill_outside_set(*callerId, EINA_TRUE);
-
-                       auto window = callerId->getWindow();
-                       if (!window) {
-                               LOG_RETURN(RES_FAIL, "Window is NULL!");
+                               LOG_RETURN(RES_OK, "No caller id content to set");
                        }
-                       int w = 0, h = 0;
-                       window->getScreenSize(&w, &h);
-                       ILOG("size w[%d] h[%d]", w, h);
-                       evas_object_size_hint_min_set(*callerId, w, h);
 
-                       m_widget->setContent(*callerId,
-                                       impl::PART_SWL_CALLER_ID);
+                       FAIL_RETURN(createCallerIdImage(callerIdPath),
+                                       "createCallerIdImage() failed");
 
                        m_widget->emit(impl::SIGN_CALLER_ID_ENABLE, impl::SRC_CALLER_ID);
-
-                       m_callerId = callerId;
                }
 
                return RES_OK;
@@ -414,14 +418,7 @@ namespace callui {
 
                if (!subTxt.empty()) {
                        m_isSubTxtEnable = true;
-
-                       TString tmp;
-                       if (m_callerId) {
-                               tmp = impl::STR_LABEL_CALLER_ID_ENABLE.format(subTxt.c_str());
-                       } else {
-                               tmp = impl::STR_LABEL_CALLER_ID_DISABLE.format(subTxt.c_str());
-                       }
-                       FAIL_RETURN(createLabel(tmp), "createLabel() failed");
+                       FAIL_RETURN(createLabel(subTxt), "createLabel() failed");
                }
 
                return RES_OK;
@@ -472,40 +469,51 @@ namespace callui {
                if (tempEo) {
 
                        int lineWidth = m_incomCallInfo ?
-                                       impl::MAIN_TXT_WIDTH_INCOM : impl::MAIN_TXT_WIDTH_SIMPLE;
+                                       impl::MAIN_TXT_WIDTH_INCOM :
+                                       impl::MAIN_TXT_WIDTH_SIMPLE;
                        bool isMainTxtSingleLine =
                                        (impl::getTextBlockActualWidth(tempEo) <= lineWidth);
 
-                       m_widget->emit(impl::SIGN_CALLER_ID_DISABLE, impl::SRC_TXT_1LINE);
+                       m_widget->emit(impl::SIGN_CALLER_ID_DISABLE,
+                                       impl::SRC_TXT_1LINE);
 
                        if (info->isEmergency()) {
-                               m_widget->emit(impl::SIGN_EMERGENCY_MODE, impl::SRC_TXT_1LINE);
+                               m_widget->emit(impl::SIGN_EMERGENCY_MODE,
+                                               impl::SRC_TXT_1LINE);
                        }
 
                        if (m_mode == CallMode::INCOMING) {
                                if (m_callerId) {
-                                       m_widget->emit(impl::SIGN_CALLER_ID_ENABLE, impl::SRC_TXT_1LINE);
+                                       m_widget->emit(impl::SIGN_CALLER_ID_ENABLE,
+                                                       impl::SRC_TXT_1LINE);
                                } else {
-                                       m_widget->emit(impl::SIGN_CALLER_ID_DISABLE, impl::SRC_TXT_1LINE);
+                                       m_widget->emit(impl::SIGN_CALLER_ID_DISABLE,
+                                                       impl::SRC_TXT_1LINE);
                                }
                                if (isMainTxtSingleLine) {
-                                       m_widget->emit(impl::SIGN_INCOM_1LINE, impl::SRC_TOP_PAD);
+                                       m_widget->emit(impl::SIGN_INCOM_1LINE,
+                                                       impl::SRC_TOP_PAD);
                                } else {
-                                       m_widget->emit(impl::SIGN_INCOM_2LINE, impl::SRC_TOP_PAD);
+                                       m_widget->emit(impl::SIGN_INCOM_2LINE,
+                                                       impl::SRC_TOP_PAD);
                                }
 
                        } else {
                                if (isMainTxtSingleLine) {
                                        if (m_isSubTxtEnable) {
-                                               m_widget->emit(impl::SIGN_1LINE_2TXT, impl::SRC_TOP_PAD);
+                                               m_widget->emit(impl::SIGN_1LINE_2TXT,
+                                                               impl::SRC_TOP_PAD);
                                        } else {
-                                               m_widget->emit(impl::SIGN_1LINE, impl::SRC_TOP_PAD);
+                                               m_widget->emit(impl::SIGN_1LINE,
+                                                               impl::SRC_TOP_PAD);
                                        }
                                } else {
                                        if (m_isSubTxtEnable) {
-                                               m_widget->emit(impl::SIGN_2LINE_2TXT, impl::SRC_TOP_PAD);
+                                               m_widget->emit(impl::SIGN_2LINE_2TXT,
+                                                               impl::SRC_TOP_PAD);
                                        } else {
-                                               m_widget->emit(impl::SIGN_2LINE, impl::SRC_TOP_PAD);
+                                               m_widget->emit(impl::SIGN_2LINE,
+                                                               impl::SRC_TOP_PAD);
                                        }
                                }
                        }
@@ -591,7 +599,7 @@ namespace callui {
                                build();
 
                if (!m_callStatus) {
-                       LOG_RETURN(RES_FAIL, "CallStatus::Builder()::build() failed!");
+                       LOG_RETURN(RES_FAIL, "CallStatus::build() failed!");
                }
 
                return RES_OK;
index e14d91b90c73f754f4790641d10bbf07f5601760..00ac1110ab1888638fdeb61948b631def811ea9e 100644 (file)
@@ -198,10 +198,10 @@ namespace callui {
                elm_panel_toggle(*m_panel);
 
                elm_layout_signal_callback_add(*m_panel, "elm,state,active,finished",
-                               "elm", CALLBACK_A(MoreOptionsPresenter::onActivate), this);
+                               "elm", CALLBACK_A(MoreOptionsPresenter::onPanelActivate), this);
 
                elm_layout_signal_callback_add(*m_panel, "elm,state,inactive,finished",
-                               "elm", CALLBACK_A(MoreOptionsPresenter::onInactivate), this);
+                               "elm", CALLBACK_A(MoreOptionsPresenter::onPanelInactivate), this);
 
                return RES_OK;
        }
@@ -419,7 +419,9 @@ namespace callui {
                updateStatusText();
        }
 
-       void MoreOptionsPresenter::onActivate(Evas_Object *obj, const char *emission, const char *source)
+       void MoreOptionsPresenter::onPanelActivate(Evas_Object *obj,
+                       const char *emission,
+                       const char *source)
        {
                eext_object_event_callback_add(*m_widget, EEXT_CALLBACK_BACK,
                                                CALLBACK_A(MoreOptionsPresenter::onBackKey), this);
@@ -429,7 +431,9 @@ namespace callui {
                activateBy(m_widget.get());
        }
 
-       void MoreOptionsPresenter::onInactivate(Evas_Object *obj, const char *emission, const char *source)
+       void MoreOptionsPresenter::onPanelInactivate(Evas_Object *obj,
+                       const char *emission,
+                       const char *source)
        {
                eext_object_event_callback_del(*m_widget, EEXT_CALLBACK_BACK,
                                CALLBACK_A(MoreOptionsPresenter::onBackKey));
index 7d3219f8425aef02cd844cfe6a6857894356546b..5fb0f8ecd98478782ea08c165c5020b8dc33e5de 100644 (file)
@@ -25,20 +25,7 @@ namespace callui { namespace { namespace impl {
        constexpr LayoutTheme LAYOUT_SLIDER
                {"layout", "callui", "slider"};
 
-       constexpr ElmStyle STYLE_BTN_MINUS {"callui/minus"};
-       constexpr ElmStyle STYLE_BTN_PLUS {"callui/plus"};
-
        constexpr EdjePart PART_SWL_SLIDER {"swl.slider"};
-       constexpr EdjePart PART_SWL_MINUS {"swl.minus"};
-       constexpr EdjePart PART_SWL_PLUS {"swl.plus"};
-
-       constexpr EdjePart PART_TXT_INFO {"txt.info"};
-       constexpr EdjePart PART_TXT_VALUE {"txt.value"};
-
-       constexpr EdjeSignal SIGNAL_SHOW_CONTROLS {"show_controls"};
-       constexpr EdjeSignal SIGNAL_HIDE_CONTROLS {"hide_controls"};
-
-       constexpr EdjeSignalSrc SIGNAL_SRC_VOICE_CONTROL {"volume_control"};
 }}}
 
 namespace callui {
@@ -118,7 +105,6 @@ namespace callui {
        void Slider::setValue(int value)
        {
                eext_circle_object_value_set(m_slider, static_cast<double>(value));
-               m_layout->setText(std::to_string(value), impl::PART_TXT_VALUE);
        }
 
        void Slider::setMaxValue(int maxValue)
index 16ea0ef096cb1fc6e0cd4ff7623520553f1f2195..e4e2c769503536c45f8de9635cfc6f9132fe3246 100644 (file)
@@ -28,17 +28,12 @@ namespace callui { namespace { namespace impl {
        constexpr ElmStyle STYLE_BTN_MINUS {"callui/minus"};
        constexpr ElmStyle STYLE_BTN_PLUS {"callui/plus"};
 
-       constexpr EdjePart PART_SWL_SLIDER {"swl.slider"};
        constexpr EdjePart PART_SWL_MINUS {"swl.minus"};
        constexpr EdjePart PART_SWL_PLUS {"swl.plus"};
 
        constexpr EdjePart PART_TXT_INFO {"txt.info"};
        constexpr EdjePart PART_TXT_VALUE {"txt.value"};
 
-       constexpr EdjeSignal SIGNAL_SHOW_CONTROLS {"show_controls"};
-       constexpr EdjeSignal SIGNAL_HIDE_CONTROLS {"hide_controls"};
-
-       constexpr EdjeSignalSrc SIGNAL_SRC_VOICE_CONTROL {"volume_control"};
 }}}
 
 namespace callui {