diff options
author | Igor Olshevskyi <i.olshevskyi@samsung.com> | 2017-08-29 15:07:58 +0300 |
---|---|---|
committer | Igor Olshevskyi <i.olshevskyi@samsung.com> | 2017-08-30 12:56:53 +0300 |
commit | 0a520333fac1512db2f93934f419d7450e41b295 (patch) | |
tree | 1921c37f84a9ac25e9c5ba7a4472b240902f9917 | |
parent | 83f0ecd879ac672af12519f59baaf57d36a68cef (diff) | |
download | call-ui-0a520333fac1512db2f93934f419d7450e41b295.tar.gz call-ui-0a520333fac1512db2f93934f419d7450e41b295.tar.bz2 call-ui-0a520333fac1512db2f93934f419d7450e41b295.zip |
TizenRefApp-9215 [Call UI] Implement RTL mode support
Change-Id: I0a5ad0216f7c370732413beb5a437f286d5fcfa9
-rw-r--r-- | call-ui/common.h | 1 | ||||
-rw-r--r-- | call-ui/presenters/Instance.cpp | 38 | ||||
-rw-r--r-- | call-ui/presenters/Instance.h | 2 | ||||
-rw-r--r-- | call-ui/presenters/dialogs/AcceptDialog.cpp | 22 | ||||
-rw-r--r-- | call-ui/presenters/dialogs/AcceptDialog.h | 4 | ||||
-rw-r--r-- | call-ui/presenters/misc/CallInfoPresenter.cpp | 44 | ||||
-rw-r--r-- | call-ui/presenters/misc/CallInfoPresenter.h | 4 | ||||
-rw-r--r-- | call-ui/presenters/misc/CallStatusPresenter.cpp | 51 | ||||
-rw-r--r-- | call-ui/presenters/misc/CallStatusPresenter.h | 4 | ||||
-rw-r--r-- | call-ui/presenters/misc/RejectMsgPresenter.cpp | 23 | ||||
-rw-r--r-- | call-ui/presenters/misc/RejectMsgPresenter.h | 4 | ||||
-rw-r--r-- | call-ui/presenters/misc/helpers.cpp | 78 | ||||
-rw-r--r-- | call-ui/presenters/misc/helpers.h | 18 | ||||
-rw-r--r-- | call-ui/presenters/pages/KeypadPage.cpp | 8 | ||||
-rw-r--r-- | call-ui/view/AcceptRejectWidget.cpp | 85 | ||||
-rw-r--r-- | call-ui/view/helpers.cpp | 10 | ||||
-rw-r--r-- | call-ui/view/helpers.h | 4 | ||||
-rw-r--r-- | edc/call_info.edc | 124 |
18 files changed, 365 insertions, 159 deletions
diff --git a/call-ui/common.h b/call-ui/common.h index c5fcfd1..f3bf02a 100644 --- a/call-ui/common.h +++ b/call-ui/common.h @@ -38,6 +38,7 @@ namespace callui { using namespace ucl; constexpr SmartEvent WIN_POWER_KEY_UP_EVENT {"callui,powerkey,up"}; + constexpr SmartEvent WIN_LANGUAGE_CHANGED {"callui,language,changed"}; namespace util { diff --git a/call-ui/presenters/Instance.cpp b/call-ui/presenters/Instance.cpp index 2a5b842..6ab95b6 100644 --- a/call-ui/presenters/Instance.cpp +++ b/call-ui/presenters/Instance.cpp @@ -29,6 +29,7 @@ #include "call-ui/resources.h" #include "call-ui/presenters/types.h" +#include "call-ui/view/helpers.h" #include "common.h" namespace callui { namespace { namespace impl { @@ -152,6 +153,8 @@ namespace callui { m_context->exitApp(); } } + + updateAppLanguage(false); } Result Instance::setupTheme() @@ -236,23 +239,44 @@ namespace callui { m_context->exitApp(); } + void Instance::onSysEvent(const SysEvent sysEvent) { switch(sysEvent) { case SysEvent::LANGUAGE_CHANGED: + { ILOG("SysEvent::LANGUAGE_CHANGED"); - { - char *locale = NULL; - system_settings_get_value_string( - SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale); - elm_language_set(locale); - free(locale); - } + FAIL_RETURN_VOID(updateAppLanguage(), + "updateAppLanguage() failed!"); break; + } default: ILOG("sysEvent: %d", sysEvent); break; } } + Result Instance::updateAppLanguage(bool needNotify) + { + char *locale = NULL; + system_settings_get_value_string( + SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, + &locale); + elm_language_set(locale); + + Result res = isLTRCharacterOrientation(locale); + if (res == RES_FAIL) { + ELOG("isLTRCharacterOrientation() failed!"); + } else { + utils::setMirroredMode(res == RES_OK ? false : true); + } + free(locale); + + if (needNotify) { + m_win->callEvent(WIN_LANGUAGE_CHANGED, nullptr); + } + + return res; + } + } diff --git a/call-ui/presenters/Instance.h b/call-ui/presenters/Instance.h index ca3f4a2..ac094e1 100644 --- a/call-ui/presenters/Instance.h +++ b/call-ui/presenters/Instance.h @@ -61,6 +61,8 @@ namespace callui { Eina_Bool processPowerKeyUpEvent(); void onPowerKeyHoldTimeout(ucl::Timeout *sender); + ucl::Result updateAppLanguage(bool needNotify = true); + private: ucl::SysEventProvider &m_sysEventProvider; ucl::IInstanceContext *m_context; diff --git a/call-ui/presenters/dialogs/AcceptDialog.cpp b/call-ui/presenters/dialogs/AcceptDialog.cpp index 2bbffa9..af607e2 100644 --- a/call-ui/presenters/dialogs/AcceptDialog.cpp +++ b/call-ui/presenters/dialogs/AcceptDialog.cpp @@ -85,6 +85,7 @@ namespace callui { AcceptDialog::~AcceptDialog() { + unsetLanguageChangeCallback(); } Result AcceptDialog::prepare(ElmWidget &parent) @@ -100,6 +101,8 @@ namespace callui { m_selfRef = asShared(*this); + setLanguageChangeCallback(); + addDeactivatorException(this); broadcastDeactivate(); @@ -240,6 +243,25 @@ namespace callui { return RES_OK; } + void AcceptDialog::setLanguageChangeCallback() + { + getWindow().addEventHandler(WIN_LANGUAGE_CHANGED, WEAK_DELEGATE( + AcceptDialog::onLanguageChanged, asWeak(*this))); + } + + void AcceptDialog::unsetLanguageChangeCallback() + { + getWindow().delEventHandler(WIN_LANGUAGE_CHANGED, WEAK_DELEGATE( + AcceptDialog::onLanguageChanged, asWeak(*this))); + } + + void AcceptDialog::onLanguageChanged(Widget &widget, void *eventInfo) + { + if (m_genlist) { + elm_genlist_realized_items_update(*m_genlist); + } + } + void AcceptDialog::handleEvent(Event event) { const auto keepAliver = asShared(*this); diff --git a/call-ui/presenters/dialogs/AcceptDialog.h b/call-ui/presenters/dialogs/AcceptDialog.h index c89c3ed..c1627d3 100644 --- a/call-ui/presenters/dialogs/AcceptDialog.h +++ b/call-ui/presenters/dialogs/AcceptDialog.h @@ -73,6 +73,10 @@ namespace callui { ucl::Result addGenlistTextItem(Event event); ucl::Result addGenlistBottomItem(); + void setLanguageChangeCallback(); + void unsetLanguageChangeCallback(); + void onLanguageChanged(ucl::Widget &widget, void *eventInfo); + void handleEvent(Event event); bool dispatchEvent(Event event); diff --git a/call-ui/presenters/misc/CallInfoPresenter.cpp b/call-ui/presenters/misc/CallInfoPresenter.cpp index 1dba75f..b8176e8 100644 --- a/call-ui/presenters/misc/CallInfoPresenter.cpp +++ b/call-ui/presenters/misc/CallInfoPresenter.cpp @@ -149,6 +149,7 @@ namespace callui { CallInfoPresenter::~CallInfoPresenter() { + unsetLanguageChangeCallback(); } Result CallInfoPresenter::prepare(GuiPresenter &parent, @@ -167,9 +168,28 @@ namespace callui { FAIL_RETURN(update(), "update() failed!"); + setLanguageChangeCallback(); + return RES_OK; } + void CallInfoPresenter::setLanguageChangeCallback() + { + getWindow().addEventHandler(WIN_LANGUAGE_CHANGED, WEAK_DELEGATE( + CallInfoPresenter::onLanguageChanged, asWeak(*this))); + } + + void CallInfoPresenter::unsetLanguageChangeCallback() + { + getWindow().delEventHandler(WIN_LANGUAGE_CHANGED, WEAK_DELEGATE( + CallInfoPresenter::onLanguageChanged, asWeak(*this))); + } + + void CallInfoPresenter::onLanguageChanged(Widget &widget, void *eventInfo) + { + update(); + } + Result CallInfoPresenter::createWidget(ElmWidget &parent) { m_widget = Layout::Builder(). @@ -245,7 +265,9 @@ namespace callui { IContactInfoSCRef contactInfo = callInfo->getContactInfo(); if (contactInfo) { - return callInfo->getPhoneNumber(); + return encloseBidirectionalText(std::move( + callInfo->getPhoneNumber()), + BidiTextEncoseType::LRM); } return ""; } @@ -258,11 +280,20 @@ namespace callui { } if (m_activeCallInfo && m_heldCallInfo) { auto displStr = m_activeCallInfo->getPhoneNumber(); + if (displStr.empty()) { + displStr = encloseBidirectionalText(std::move(displStr), + BidiTextEncoseType::LRM); + } auto contactInfo = m_activeCallInfo->getContactInfo(); if (contactInfo) { const auto contName = contactInfo->getName(); if (!contName.empty()) { displStr = contName; + if (contactInfo->getNameSourceType() == + ContactNameSourceType::NUMBER) { + displStr = encloseBidirectionalText(std::move(displStr), + BidiTextEncoseType::LRM); + } } } if (displStr.empty()) { @@ -476,6 +507,11 @@ namespace callui { auto contactInfo = callInfo->getContactInfo(); if (contactInfo) { mainTxt = contactInfo->getName(); + if (contactInfo->getNameSourceType() == + ContactNameSourceType::NUMBER) { + mainTxt = encloseBidirectionalText(std::move(mainTxt), + BidiTextEncoseType::LRM); + } } if (mainTxt.empty()) { @@ -640,8 +676,10 @@ namespace callui { FAIL_RETURN(updateMainTxt(), "diplayMainTxt() failed!"); if (m_needModifyCallStatus) { - if (const auto parent = m_parent.lock()) - return createCallStatus(*parent); + m_needModifyCallStatus = false; + if (const auto parent = m_parent.lock()) { + return createCallStatus(*parent); + } } return RES_OK; diff --git a/call-ui/presenters/misc/CallInfoPresenter.h b/call-ui/presenters/misc/CallInfoPresenter.h index da8c5cd..bc9a32a 100644 --- a/call-ui/presenters/misc/CallInfoPresenter.h +++ b/call-ui/presenters/misc/CallInfoPresenter.h @@ -89,6 +89,10 @@ namespace callui { void displayMainTxt(const ICallInfoSCRef &info, const std::string &text); + void setLanguageChangeCallback(); + void unsetLanguageChangeCallback(); + void onLanguageChanged(ucl::Widget &widget, void *eventInfo); + // Screen Reader ucl::Result setMainTxtAccessObject(const std::string &text); ucl::Result setSubTxtAccessObject(const std::string &text); diff --git a/call-ui/presenters/misc/CallStatusPresenter.cpp b/call-ui/presenters/misc/CallStatusPresenter.cpp index eb4eb9d..8b80a6b 100644 --- a/call-ui/presenters/misc/CallStatusPresenter.cpp +++ b/call-ui/presenters/misc/CallStatusPresenter.cpp @@ -29,8 +29,7 @@ namespace callui { namespace { namespace impl { constexpr EdjePart PART_TXT_TEXT_INFO {"text_info"}; - constexpr EdjeSignal SIGN_DOT_RTL {"default:RTL"}; - constexpr EdjeSignal SIGN_DOT_LTR {"default:LTR"}; + constexpr EdjeSignal SIGN_DOT_ANIMATE {"animate"}; constexpr EdjeSignal SIGN_RESET {"reset"}; constexpr EdjePart PART_AO_STATUS {"ao_text_info"}; @@ -115,6 +114,8 @@ namespace callui { CallStatusPresenter::~CallStatusPresenter() { + unsetLanguageChangeCallback(); + m_ly.reset(); if (m_timer) { ecore_timer_del(m_timer); @@ -127,6 +128,8 @@ namespace callui { FAIL_RETURN(GuiPresenter::prepare(parent, PF_PASSIVE), "Presenter::prepare() failed!"); + setLanguageChangeCallback(); + m_ly->emit(impl::SIGN_RESET, impl::SIGN_SRC_DOT); m_ly->setText("", impl::PART_TXT_TEXT_INFO); createStatusTxtAo(); @@ -144,12 +147,46 @@ namespace callui { return RES_OK; } + void CallStatusPresenter::setLanguageChangeCallback() + { + getWindow().addEventHandler(WIN_LANGUAGE_CHANGED, WEAK_DELEGATE( + CallStatusPresenter::onLanguageChanged, asWeak(*this))); + } + + void CallStatusPresenter::unsetLanguageChangeCallback() + { + getWindow().delEventHandler(WIN_LANGUAGE_CHANGED, WEAK_DELEGATE( + CallStatusPresenter::onLanguageChanged, asWeak(*this))); + } + + void CallStatusPresenter::onLanguageChanged(Widget &widget, void *eventInfo) + { + Result res = RES_FAIL; + switch (m_mode) { + case CallMode::INCOMING: + res = processIncomingMode(); + break; + case CallMode::OUTGOING: + res = processOutgoingMode(); + break; + case CallMode::DURING: + res = processDuringMode(); + break; + case CallMode::END: + res = processEndMode(); + break; + default: + ELOG("Unknown mode"); + break; + } + LOG_RETURN_VOID(res, "Failed"); + + } + Result CallStatusPresenter::processIncomingMode() { m_ly->setText(STR_INCOMING_CALL, impl::PART_TXT_TEXT_INFO); - - // TODO: need add logic for RTL mode in the future - m_ly->emit(impl::SIGN_DOT_LTR, impl::SIGN_SRC_DOT); + m_ly->emit(impl::SIGN_DOT_ANIMATE, impl::SIGN_SRC_DOT); return RES_OK; } @@ -157,9 +194,7 @@ namespace callui { Result CallStatusPresenter::processOutgoingMode() { m_ly->setText(STR_DIALING_CALL, impl::PART_TXT_TEXT_INFO); - - // TODO: need add logic for RTL mode in the future - m_ly->emit(impl::SIGN_DOT_LTR, impl::SIGN_SRC_DOT); + m_ly->emit(impl::SIGN_DOT_ANIMATE, impl::SIGN_SRC_DOT); return RES_OK; } diff --git a/call-ui/presenters/misc/CallStatusPresenter.h b/call-ui/presenters/misc/CallStatusPresenter.h index a95b82e..c1ea4eb 100644 --- a/call-ui/presenters/misc/CallStatusPresenter.h +++ b/call-ui/presenters/misc/CallStatusPresenter.h @@ -72,6 +72,10 @@ namespace callui { Eina_Bool onCallDurationTimerCb(); Eina_Bool onBlinkingTimerCb(); + void setLanguageChangeCallback(); + void unsetLanguageChangeCallback(); + void onLanguageChanged(ucl::Widget &widget, void *eventInfo); + // Screen Reader ucl::Result createStatusTxtAo(); diff --git a/call-ui/presenters/misc/RejectMsgPresenter.cpp b/call-ui/presenters/misc/RejectMsgPresenter.cpp index c6a14c8..64c5b3c 100644 --- a/call-ui/presenters/misc/RejectMsgPresenter.cpp +++ b/call-ui/presenters/misc/RejectMsgPresenter.cpp @@ -148,6 +148,8 @@ namespace callui { RejectMsgPresenter::~RejectMsgPresenter() { + unsetLanguageChangeCallback(); + if (m_widget) { sendActivate(*m_widget); } @@ -174,6 +176,8 @@ namespace callui { FAIL_RETURN(createAtspiHighlightHelper(), "createScreenReaderRoute() failed!"); + setLanguageChangeCallback(); + deactivateBy(m_widget.get()); parent.addDeactivatorSource(*m_widget); @@ -299,6 +303,25 @@ namespace callui { return RES_OK; } + void RejectMsgPresenter::setLanguageChangeCallback() + { + getWindow().addEventHandler(WIN_LANGUAGE_CHANGED, WEAK_DELEGATE( + RejectMsgPresenter::onLanguageChanged, asWeak(*this))); + } + + void RejectMsgPresenter::unsetLanguageChangeCallback() + { + getWindow().delEventHandler(WIN_LANGUAGE_CHANGED, WEAK_DELEGATE( + RejectMsgPresenter::onLanguageChanged, asWeak(*this))); + } + + void RejectMsgPresenter::onLanguageChanged(Widget &widget, void *eventInfo) + { + if (m_genlist) { + elm_genlist_realized_items_update(*m_genlist); + } + } + Result RejectMsgPresenter::createGenlist() { // Genlist scroller Layout diff --git a/call-ui/presenters/misc/RejectMsgPresenter.h b/call-ui/presenters/misc/RejectMsgPresenter.h index bd6b952..ba754c8 100644 --- a/call-ui/presenters/misc/RejectMsgPresenter.h +++ b/call-ui/presenters/misc/RejectMsgPresenter.h @@ -107,6 +107,10 @@ namespace callui { void onBackKey(Evas_Object *obj, void *eventInfo); + void setLanguageChangeCallback(); + void unsetLanguageChangeCallback(); + void onLanguageChanged(ucl::Widget &widget, void *eventInfo); + // Screen Reader ucl::Result createAtspiHighlightHelper(); void registerGenlistAtspiGestureCallbacks(); diff --git a/call-ui/presenters/misc/helpers.cpp b/call-ui/presenters/misc/helpers.cpp index 9867516..ccf81f8 100644 --- a/call-ui/presenters/misc/helpers.cpp +++ b/call-ui/presenters/misc/helpers.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#include <utils_i18n_ulocale.h> + #include "ucl/gui/Window.h" #include "common.h" @@ -25,6 +27,11 @@ namespace callui { namespace { namespace himpl { const TString STR_HH_MM_SS_TIME{"%02d:%02d:%02d"}; const TString STR_MM_SS_TIME{"%02d:%02d"}; + constexpr const char *BIDI_TXT_LRM = "\u200E"; + constexpr const char *BIDI_TXT_RLM = "\u200F"; + constexpr const char *BIDI_TXT_LRM_RLM = "\u200E\u200F"; + constexpr const char *BIDI_TXT_RLM_LRM = "\u200F\u200E"; + }}} namespace callui { @@ -81,4 +88,75 @@ namespace callui { } } + std::string encloseBidirectionalText(const std::string &txt, BidiTextEncoseType type) + { + switch (type) { + case BidiTextEncoseType::LRM: + return himpl::BIDI_TXT_LRM + txt + himpl::BIDI_TXT_LRM; + case BidiTextEncoseType::RLM: + return himpl::BIDI_TXT_RLM + txt + himpl::BIDI_TXT_RLM; + case BidiTextEncoseType::LRM_RLM: + return himpl::BIDI_TXT_LRM_RLM + txt + himpl::BIDI_TXT_RLM_LRM; + case BidiTextEncoseType::RLM_LRM: + return himpl::BIDI_TXT_RLM_LRM + txt + himpl::BIDI_TXT_LRM_RLM; + default: + ELOG("Invalid type"); + return txt; + } + return txt; + } + + std::string encloseBidirectionalText(std::string &&txt, BidiTextEncoseType type) + { + switch (type) { + case BidiTextEncoseType::LRM: + txt.insert(0, himpl::BIDI_TXT_LRM); + txt.append(himpl::BIDI_TXT_LRM); + break; + case BidiTextEncoseType::RLM: + txt.insert(0, himpl::BIDI_TXT_RLM); + txt.append(himpl::BIDI_TXT_RLM); + break; + case BidiTextEncoseType::LRM_RLM: + txt.insert(0, himpl::BIDI_TXT_LRM_RLM); + txt.append(himpl::BIDI_TXT_RLM_LRM); + break; + case BidiTextEncoseType::RLM_LRM: + txt.insert(0, himpl::BIDI_TXT_RLM_LRM); + txt.append(himpl::BIDI_TXT_LRM_RLM); + break; + default: + ELOG("Invalid type"); + break; + } + return std::move(txt); + } + + Result isLTRCharacterOrientation(const std::string &lang) + { + if (lang.empty()) { + LOG_RETURN(RES_INVALID_ARGUMENTS, "lang is empty"); + } + + i18n_ulocale_layout_type_e layout = I18N_ULOCALE_LAYOUT_UNKNOWN; + int ret = i18n_ulocale_get_character_orientation(lang.c_str(), + &layout); + if (ret != I18N_ERROR_NONE) { + LOG_RETURN(RES_FAIL, + "i18n_ulocale_get_character_orientation() failed!"); + } + + switch (layout) { + case I18N_ULOCALE_LAYOUT_LTR: + return RES_OK; + case I18N_ULOCALE_LAYOUT_RTL: + return RES_FALSE; + default: + LOG_RETURN(RES_FAIL, + "Unsupported character orientation type [%d]", + layout); + } + return RES_OK; + } } + diff --git a/call-ui/presenters/misc/helpers.h b/call-ui/presenters/misc/helpers.h index 7686b27..6ff05bf 100644 --- a/call-ui/presenters/misc/helpers.h +++ b/call-ui/presenters/misc/helpers.h @@ -25,21 +25,33 @@ namespace callui { + enum class BidiTextEncoseType { + LRM, + RLM, + LRM_RLM, + RLM_LRM + }; + 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); - ucl::TString getCallDuration(const struct tm &time); void tryUpdateCallDurationTime( struct tm &curTime, struct tm &compTime, ucl::EdjeWidget &widget, const ucl::EdjePart &part); + void replaceSubstringInString(std::string &str, + const std::string &from, const std::string &to); + + ucl::Result isLTRCharacterOrientation(const std::string &lang); + + std::string encloseBidirectionalText(const std::string &txt, BidiTextEncoseType type); + + std::string encloseBidirectionalText(std::string &&txt, BidiTextEncoseType type); } #endif // __CALL_UI_PRESENTERS_MISC_HELPERS_H__ diff --git a/call-ui/presenters/pages/KeypadPage.cpp b/call-ui/presenters/pages/KeypadPage.cpp index f397dbe..a967e86 100644 --- a/call-ui/presenters/pages/KeypadPage.cpp +++ b/call-ui/presenters/pages/KeypadPage.cpp @@ -273,6 +273,10 @@ namespace callui { LOG_RETURN(RES_FAIL, "Layout::build() failed!"); } + // RTL support + elm_object_mirrored_automatic_set(*m_widget, EINA_FALSE); + elm_object_mirrored_set(*m_widget, false); + setDeactivatorSink(m_widget); return RES_OK; @@ -332,6 +336,10 @@ namespace callui { buttonSRef->addEventHandler(BTN_CLICKED, WEAK_DELEGATE(KeypadPage::onBtnClicked, asWeak(*this))); + + // RTL support + elm_object_mirrored_automatic_set(*buttonSRef, EINA_FALSE); + elm_object_mirrored_set(*buttonSRef, false); } // Screen Reader diff --git a/call-ui/view/AcceptRejectWidget.cpp b/call-ui/view/AcceptRejectWidget.cpp index ab059f4..5e94849 100644 --- a/call-ui/view/AcceptRejectWidget.cpp +++ b/call-ui/view/AcceptRejectWidget.cpp @@ -16,8 +16,9 @@ #include "call-ui/view/AcceptRejectWidget.h" -#include "common.h" #include "call-ui/resources.h" +#include "helpers.h" +#include "common.h" #define CU_COL_TRANSPARENT 0, 0, 0, 0 #define CU_COL_WHITE 255, 255, 255, 255 @@ -659,12 +660,24 @@ namespace callui { Evas_Coord x; m_rejIcon->getGeometry(&x, nullptr, nullptr, nullptr); - int dx = x - impl::REJ_ICON_RIGHT_PAD_X; - int animTrace = impl::ACC_REJ_ICON_HIDE_THRESHOLD_W - dx; - if (animTrace <= 0) { - DLOG("No need to add transition"); - return; + // RTL support + int dx = 0; + int animTrace = 0; + if (utils::getMirroredMode()) { + dx = impl::ACC_ICON_RIGHT_PAD_X - x; + animTrace = dx - impl::ACC_REJ_ICON_HIDE_THRESHOLD_W; + if (animTrace >= 0) { + DLOG("No need to add transition"); + return; + } + } else { + dx = x - impl::REJ_ICON_RIGHT_PAD_X; + animTrace = impl::ACC_REJ_ICON_HIDE_THRESHOLD_W - dx; + if (animTrace <= 0) { + DLOG("No need to add transition"); + return; + } } m_rejIconTr = elm_transit_add(); @@ -716,11 +729,22 @@ namespace callui { Evas_Coord x; m_rejIcon->getGeometry(&x, nullptr, nullptr, nullptr); - int dx = impl::REJ_ICON_RIGHT_PAD_X - x; - if (dx >= 0) { - DLOG("No need to add transition"); - return; + + // RTL support + int dx = 0; + if (utils::getMirroredMode()) { + dx = impl::ACC_ICON_RIGHT_PAD_X - x; + if (dx <= 0) { + DLOG("No need to add transition"); + return; + } + } else { + dx = impl::REJ_ICON_RIGHT_PAD_X - x; + if (dx >= 0) { + DLOG("No need to add transition"); + return; + } } m_rejIconTr = elm_transit_add(); @@ -800,13 +824,26 @@ namespace callui { Evas_Coord x; m_accIcon->getGeometry(&x, nullptr, nullptr, nullptr); - int dx = impl::ACC_ICON_RIGHT_PAD_X - x; - int animTrace = dx - impl::ACC_REJ_ICON_HIDE_THRESHOLD_W; - if (animTrace >= 0) { - DLOG("No need to add transition"); - return; + // RTL support + int dx = 0; + int animTrace = 0; + if (utils::getMirroredMode()) { + dx = x - impl::REJ_ICON_RIGHT_PAD_X; + animTrace = impl::ACC_REJ_ICON_HIDE_THRESHOLD_W - dx; + if (animTrace <= 0) { + DLOG("No need to add transition"); + return; + } + } else { + dx = impl::ACC_ICON_RIGHT_PAD_X - x; + animTrace = dx - impl::ACC_REJ_ICON_HIDE_THRESHOLD_W; + if (animTrace >= 0) { + DLOG("No need to add transition"); + return; + } } + m_accIconTr = elm_transit_add(); elm_transit_effect_translation_add(m_accIconTr, 0, 0, animTrace, 0); elm_transit_object_add(m_accIconTr, *m_accIcon); @@ -824,11 +861,21 @@ namespace callui { Evas_Coord x; m_accIcon->getGeometry(&x, nullptr, nullptr, nullptr); - int dx = impl::ACC_ICON_RIGHT_PAD_X - x; - if (dx <= 0) { - DLOG("No need to add transition"); - return; + // RTL support + int dx = 0; + if (utils::getMirroredMode()) { + dx = impl::REJ_ICON_RIGHT_PAD_X - x; + if (dx >= 0) { + DLOG("No need to add transition"); + return; + } + } else { + dx = impl::ACC_ICON_RIGHT_PAD_X - x; + if (dx <= 0) { + DLOG("No need to add transition"); + return; + } } m_accIconTr = elm_transit_add(); diff --git a/call-ui/view/helpers.cpp b/call-ui/view/helpers.cpp index e4f931d..dcc8951 100644 --- a/call-ui/view/helpers.cpp +++ b/call-ui/view/helpers.cpp @@ -154,6 +154,16 @@ namespace callui { namespace utils { elm_access_object_unregister(ao); } + void setMirroredMode(bool isMirroredMode) + { + elm_config_mirrored_set(isMirroredMode); + } + + bool getMirroredMode() + { + return elm_config_mirrored_get(); + } + }} namespace callui { diff --git a/call-ui/view/helpers.h b/call-ui/view/helpers.h index 8c4fe6e..30769ab 100644 --- a/call-ui/view/helpers.h +++ b/call-ui/view/helpers.h @@ -48,6 +48,10 @@ namespace callui { namespace utils { void destroyAccessObject(ucl::ElmWidget &ao); + void setMirroredMode(bool isMirroredMode); + + bool getMirroredMode(); + }} namespace callui { diff --git a/edc/call_info.edc b/edc/call_info.edc index 86dc549..f6b7e39 100644 --- a/edc/call_info.edc +++ b/edc/call_info.edc @@ -46,7 +46,7 @@ styles { } -#define CU_DOT(_name, _ltr_offset, _rtl_offset) \ +#define CU_DOT(_name, _ltr_offset) \ image { _name; \ scale; \ desc { "default"; \ @@ -79,32 +79,6 @@ styles { color_class: AO0311D; \ visible: 1; \ } \ - desc { "default_rtl"; \ - inherit: "default"; \ - align: 1.0 0.5; \ - rel1 { relative: 0.0 0.0; offset: _rtl_offset 0; to: "text_info"; } \ - rel2 { relative: 0.0 1.0; offset: _rtl_offset 0; to: "text_info"; } \ - } \ - desc { "rtl_on"; \ - inherit: "default_rtl"; \ - color_class: AO031; \ - visible: 1; \ - } \ - desc { "rtl_off"; \ - inherit: "default_rtl"; \ - color_class: AO031D; \ - visible: 1; \ - } \ - desc { "rtl_on_photo"; \ - inherit: "default_rtl"; \ - color_class: AO0311; \ - visible: 1; \ - } \ - desc { "rtl_off_photo"; \ - inherit: "default_rtl"; \ - color_class: AO0311D; \ - visible: 1; \ - } \ } group { "elm/layout/callui/call_info"; @@ -188,12 +162,6 @@ group { "elm/layout/callui/call_info"; max: 191 32; rel2 { relative: 0.0 1.0; offset: -17 0; to_x: "right.pad"; to_y: "top.pad"; } } - desc { "incom_rtl"; - inherit: "default"; - min: 191 32; - max: 191 32; - rel1 { relative: 1.0 1.0; offset: 17 0; to_x: "left.pad"; to_y: "top.pad"; } - } } textblock { "text_info"; nomouse; @@ -215,9 +183,9 @@ group { "elm/layout/callui/call_info"; } } } - CU_DOT("dot.first", 3, -3) - CU_DOT("dot.second", 9, -9) - CU_DOT("dot.third", 15, -15) + CU_DOT("dot.first", 3) + CU_DOT("dot.second", 9) + CU_DOT("dot.third", 15) rect { "ao_text_info"; mouse; @@ -446,80 +414,6 @@ group { "elm/layout/callui/call_info"; set_int(blink_dot_timer, timer(0.5, "do_blinking", count+1)); } } - public do_blinking_rtl(count, part_state) { - if (count%6 == 0) { - if (get_int(b_set_photo) == 1) { - set_state(PART:"dot.first", "rtl_on_photo", 0.0); - set_state(PART:"dot.second", "rtl_off_photo", 0.0); - set_state(PART:"dot.third", "rtl_off_photo", 0.0); - } else { - set_state(PART:"dot.first", "rtl_on", 0.0); - set_state(PART:"dot.second", "rtl_off", 0.0); - set_state(PART:"dot.third", "rtl_off", 0.0); - } - set_int(blink_dot_timer, timer(0.5, "do_blinking_rtl", count+1)); - } - else if (count%6 == 1) { - if (get_int(b_set_photo) == 1) { - set_state(PART:"dot.first", "rtl_on_photo", 0.0); - set_state(PART:"dot.second", "rtl_on_photo", 0.0); - set_state(PART:"dot.third", "rtl_off_photo", 0.0); - } else { - set_state(PART:"dot.first", "rtl_on", 0.0); - set_state(PART:"dot.second", "rtl_on", 0.0); - set_state(PART:"dot.third", "rtl_off", 0.0); - } - set_int(blink_dot_timer, timer(0.5, "do_blinking_rtl", count+1)); - } - else if (count%6 == 2) { - if (get_int(b_set_photo) == 1) { - set_state(PART:"dot.first", "rtl_on_photo", 0.0); - set_state(PART:"dot.second", "rtl_on_photo", 0.0); - set_state(PART:"dot.third", "rtl_on_photo", 0.0); - } else { - set_state(PART:"dot.first", "rtl_on", 0.0); - set_state(PART:"dot.second", "rtl_on", 0.0); - set_state(PART:"dot.third", "rtl_on", 0.0); - } - set_int(blink_dot_timer, timer(0.5, "do_blinking_rtl", count+1)); - } - else if (count%6 == 3) { - if (get_int(b_set_photo) == 1) { - set_state(PART:"dot.first", "rtl_off_photo", 0.0); - set_state(PART:"dot.second", "rtl_on_photo", 0.0); - set_state(PART:"dot.third", "rtl_on_photo", 0.0); - } else { - set_state(PART:"dot.first", "rtl_off", 0.0); - set_state(PART:"dot.second", "rtl_on", 0.0); - set_state(PART:"dot.third", "rtl_on", 0.0); - } - set_int(blink_dot_timer, timer(0.5, "do_blinking_rtl", count+1)); - } - else if (count%6 == 4) { - if (get_int(b_set_photo) == 1) { - set_state(PART:"dot.first", "rtl_off_photo", 0.0); - set_state(PART:"dot.second", "rtl_off_photo", 0.0); - set_state(PART:"dot.third", "rtl_on_photo", 0.0); - } else { - set_state(PART:"dot.first", "rtl_off", 0.0); - set_state(PART:"dot.second", "rtl_off", 0.0); - set_state(PART:"dot.third", "rtl_on", 0.0); - } - set_int(blink_dot_timer, timer(0.5, "do_blinking_rtl", count+1)); - } - else if (count%6 == 5) { - if (get_int(b_set_photo) == 1) { - set_state(PART:"dot.first", "rtl_off_photo", 0.0); - set_state(PART:"dot.second", "rtl_off_photo", 0.0); - set_state(PART:"dot.third", "rtl_off_photo", 0.0); - } else { - set_state(PART:"dot.first", "rtl_off", 0.0); - set_state(PART:"dot.second", "rtl_off", 0.0); - set_state(PART:"dot.third", "rtl_off", 0.0); - } - set_int(blink_dot_timer, timer(0.5, "do_blinking_rtl", count+1)); - } - } } program { signal: "reset"; @@ -544,15 +438,7 @@ group { "elm/layout/callui/call_info"; } } program { - signal: "default:RTL"; - source: "dot"; - script { - set_state(PART:"zone.text_info", "incom_rtl", 0.0); - set_int(blink_dot_timer, timer(0.1, "do_blinking_rtl", 0)); - } - } - program { - signal: "default:LTR"; + signal: "animate"; source: "dot"; script { set_state(PART:"zone.text_info", "incom", 0.0); |