diff options
author | Eugene Kurzberg <i.kurtsberg@samsung.com> | 2017-03-16 17:31:31 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.vlan103.tizen.org> | 2017-03-17 05:53:23 -0700 |
commit | 3130d790acd22890b0fcd1321822d2dd58d41083 (patch) | |
tree | 6437ac9ff9c018b0aaff38aacb00b95d2861a513 | |
parent | 1e5f284e4c3df43436e020ae5e1b4b26fe117985 (diff) | |
download | alarm-3130d790acd22890b0fcd1321822d2dd58d41083.tar.gz alarm-3130d790acd22890b0fcd1321822d2dd58d41083.tar.bz2 alarm-3130d790acd22890b0fcd1321822d2dd58d41083.zip |
Customize Toast popup for wearable.
Change-Id: I81c8fcc23895351e527369c17b023014f26597f3
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
-rw-r--r-- | alarm-app/src/Input/InputView.cpp | 1 | ||||
-rw-r--r-- | alarm-app/src/List/AlarmsView.cpp | 1 | ||||
-rw-r--r-- | lib-apps-common/inc/Ui/Toast.h | 12 | ||||
-rw-r--r-- | lib-apps-common/src/Ui/Toast.cpp | 13 | ||||
-rw-r--r-- | lib-common/src/Common/AlarmDeletedPopup.cpp | 8 | ||||
-rw-r--r-- | lib-common/src/Common/AlarmSetPopup.cpp | 1 |
6 files changed, 26 insertions, 10 deletions
diff --git a/alarm-app/src/Input/InputView.cpp b/alarm-app/src/Input/InputView.cpp index 2011c21..a44c778 100644 --- a/alarm-app/src/Input/InputView.cpp +++ b/alarm-app/src/Input/InputView.cpp @@ -200,7 +200,6 @@ void InputView::handleDuplicateAlarm() auto popup = new Ui::Toast(); popup->create(getEvasObject()); - elm_object_style_set(popup->getEvasObject(), "toast/circle"); popup->setText(buffer); popup->show(); getPage()->close(); diff --git a/alarm-app/src/List/AlarmsView.cpp b/alarm-app/src/List/AlarmsView.cpp index d492de7..30c3b24 100644 --- a/alarm-app/src/List/AlarmsView.cpp +++ b/alarm-app/src/List/AlarmsView.cpp @@ -265,7 +265,6 @@ void AlarmsView::onAddPressed() auto toast = new Ui::Toast(); toast->create(getEvasObject()); - elm_object_style_set(toast->getEvasObject(), "toast/circle"); toast->setText(buffer); toast->show(); } diff --git a/lib-apps-common/inc/Ui/Toast.h b/lib-apps-common/inc/Ui/Toast.h index 9cdd3a0..50d6991 100644 --- a/lib-apps-common/inc/Ui/Toast.h +++ b/lib-apps-common/inc/Ui/Toast.h @@ -23,6 +23,18 @@ namespace Ui { class EXPORT_API Toast : public Popup { + public: + /** + * @see Popup::setText() + */ + void setText(const char *text); + + /** + * @brief Set toast popup icon. + * @param[in] icon Icon to be displayed in popup + */ + void setIcon(Evas_Object *icon); + protected: /** * @see Control::onCreate() diff --git a/lib-apps-common/src/Ui/Toast.cpp b/lib-apps-common/src/Ui/Toast.cpp index 803ecf9..c193c8b 100644 --- a/lib-apps-common/src/Ui/Toast.cpp +++ b/lib-apps-common/src/Ui/Toast.cpp @@ -19,10 +19,21 @@ using namespace Ui; +void Toast::setText(const char *text) +{ + elm_object_translatable_part_text_set(getEvasObject(), "elm.text", text); +} + +void Toast::setIcon(Evas_Object *icon) +{ + elm_object_part_content_set(getEvasObject(), "toast,icon", icon); + elm_layout_signal_emit(getEvasObject(), "elm,state,tizen,toast,icon,show", "elm"); +} + Evas_Object *Toast::onCreate(Evas_Object *parent) { Evas_Object *popup = Popup::onCreate(findParent<Window>(parent)->getEvasObject()); - elm_object_style_set(popup, "toast"); + elm_object_style_set(popup, "toast/circle"); elm_popup_timeout_set(popup, 2.0); evas_object_smart_callback_add(popup, "timeout", [](void *data, Evas_Object *popup, void *) { diff --git a/lib-common/src/Common/AlarmDeletedPopup.cpp b/lib-common/src/Common/AlarmDeletedPopup.cpp index 3858677..d321b9e 100644 --- a/lib-common/src/Common/AlarmDeletedPopup.cpp +++ b/lib-common/src/Common/AlarmDeletedPopup.cpp @@ -22,13 +22,9 @@ using namespace Common; void AlarmDeletedPopup::onCreated() { - Evas_Object *popup = getEvasObject(); - elm_object_style_set(popup, "toast/circle"); - - Evas_Object *icon = elm_layout_add(popup); + Evas_Object *icon = elm_layout_add(getEvasObject()); elm_layout_file_set(icon, App::getResourcePath(PATH_TOAST_CHECK_LAYOUT).c_str(), LAYOUT_TOAST_CHECK); - elm_object_part_content_set(popup, "toast,icon", icon); - elm_layout_signal_emit(popup, "elm,state,tizen,toast,icon,show", "elm"); setText("WDS_ALM_TPOP_DELETED_ABB"); + setIcon(icon); } diff --git a/lib-common/src/Common/AlarmSetPopup.cpp b/lib-common/src/Common/AlarmSetPopup.cpp index 350524c..2ed3587 100644 --- a/lib-common/src/Common/AlarmSetPopup.cpp +++ b/lib-common/src/Common/AlarmSetPopup.cpp @@ -27,6 +27,5 @@ AlarmSetPopup::AlarmSetPopup(Model::Alarm &alarm) void AlarmSetPopup::onCreated() { - elm_object_style_set(getEvasObject(), "toast/circle"); setText(Common::formatAlarmSetMessage(m_Alarm.getDate())); } |