diff options
-rw-r--r-- | alarm-app/inc/Input/InputView.h | 3 | ||||
-rw-r--r-- | alarm-app/src/Input/InputView.cpp | 55 | ||||
-rw-r--r-- | lib-common/.cproject | 97 | ||||
-rw-r--r-- | lib-common/edje/common/images/check_18.png | bin | 0 -> 3386 bytes | |||
-rw-r--r-- | lib-common/inc/Common/AlarmDeletedPopup.h | 34 | ||||
-rw-r--r-- | lib-common/res/common/edje/CommonPath.h | 3 | ||||
-rw-r--r-- | lib-common/res/common/edje/toast-check-layout.edc | 61 | ||||
-rw-r--r-- | lib-common/src/Common/AlarmDeletedPopup.cpp | 34 |
8 files changed, 178 insertions, 109 deletions
diff --git a/alarm-app/inc/Input/InputView.h b/alarm-app/inc/Input/InputView.h index 7f7f8e8..19b4139 100644 --- a/alarm-app/inc/Input/InputView.h +++ b/alarm-app/inc/Input/InputView.h @@ -48,6 +48,9 @@ namespace Input Evas_Object *createScroller(Evas_Object *parent); void updateButton(); + void saveAlarm(); + void deleteAlarm(); + bool isFirstPage() const; void onTimeChanged(Evas_Object *datetime, void *eventInfo); void onPageChanged(Evas_Object *scroller, void *eventInfo); diff --git a/alarm-app/src/Input/InputView.cpp b/alarm-app/src/Input/InputView.cpp index f5b561e..752036f 100644 --- a/alarm-app/src/Input/InputView.cpp +++ b/alarm-app/src/Input/InputView.cpp @@ -17,6 +17,7 @@ #include "Input/InputView.h" #include "Input/SetRepeatView.h" #include "Input/SetTimeView.h" +#include "Common/AlarmDeletedPopup.h" #include "Common/Model/AlarmConsumer.h" #include "Ui/PageIndex.h" @@ -104,6 +105,41 @@ void InputView::updateButton() elm_object_translatable_text_set(m_Button, text); } +void InputView::saveAlarm() +{ + tm time = m_TimeView->getTimePicker()->getTime(); + m_Alarm.setTime(time.tm_hour, time.tm_min); + m_Alarm.setRepeat(m_RepeatView->getDaySelector()->getSelectedDays()); + + elm_object_disabled_set(m_Button, EINA_TRUE); + AlarmConsumer::getInstance().saveAlarm(m_Alarm, [this](bool isSuccess) { + if (!isSuccess) { + /* TODO: Show error message */ + elm_object_disabled_set(m_Button, EINA_FALSE); + return; + } + + getPage()->close(); + }); +} + +void InputView::deleteAlarm() +{ + elm_object_disabled_set(m_Button, EINA_TRUE); + AlarmConsumer::getInstance().deleteAlarm(m_Alarm.getId(), [this](bool isSuccess) { + if (!isSuccess) { + /* TODO: Show error message */ + elm_object_disabled_set(m_Button, EINA_FALSE); + return; + } + + auto popup = new Common::AlarmDeletedPopup(); + popup->create(getEvasObject()); + popup->show(); + getPage()->close(); + }); +} + bool InputView::isFirstPage() const { int index = 0; @@ -124,29 +160,14 @@ void InputView::onPageChanged(Evas_Object *scroller, void *eventInfo) void InputView::onButtonPressed(Evas_Object *button, void *eventInfo) { - auto resultCallback = [this](bool isSuccess) { - if (isSuccess) { - getPage()->close(); - } else { - /* TODO: Show error message */ - elm_object_disabled_set(m_Button, EINA_FALSE); - } - }; - if (isFirstPage()) { if (!m_HasDeleteButton) { elm_scroller_page_bring_in(m_Scroller, 1, 0); return; } - elm_object_disabled_set(button, EINA_FALSE); - AlarmConsumer::getInstance().deleteAlarm(m_Alarm.getId(), resultCallback); + deleteAlarm(); } else { - tm time = m_TimeView->getTimePicker()->getTime(); - m_Alarm.setTime(time.tm_hour, time.tm_min); - m_Alarm.setRepeat(m_RepeatView->getDaySelector()->getSelectedDays()); - - elm_object_disabled_set(button, EINA_FALSE); - AlarmConsumer::getInstance().saveAlarm(m_Alarm, resultCallback); + saveAlarm(); } } diff --git a/lib-common/.cproject b/lib-common/.cproject index 7f4056a..07dc980 100644 --- a/lib-common/.cproject +++ b/lib-common/.cproject @@ -28,95 +28,7 @@ <option id="sbi.gnu.cpp.compiler.option.1379021540" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs"> <listOptionValue builtIn="false" value="wearable-3.0-emulator.core_llvm37.i386.core.sharedLib"/> </option> - <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.1812812065" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath"> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/libxml2""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/EGL""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/GLES""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/GLES2""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/GLES3""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/KHR""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/SDL2""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-agent""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appcore-watch""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/appfw""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/badge""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/base""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/cairo""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/calendar-service2""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/chromium-ewk""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ckm""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/contacts-svc""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/content""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/context-service""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/csr""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/dali""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/dali-toolkit""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/dbus-1.0""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/device""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/dlog""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-buffer-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-con-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-evas-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-file-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-imf-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-imf-evas-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-input-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-input-evas-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ecore-ipc-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ector-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/e_dbus-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/edje-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eet-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/efl-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/efl-extension""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/efreet-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eina-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eina-1/eina""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eio-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eldbus-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/elementary-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/embryo-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/emile-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eo-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/eom""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ethumb-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ethumb-client-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/evas-1""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/feedback""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/fontconfig""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/freetype2""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/gio-unix-2.0""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/glib-2.0""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/harfbuzz""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/iotcon""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/json-glib-1.0""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/location""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/maps""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/media""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/media-content""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/messaging""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/metadata-editor""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/minizip""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/network""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/notification""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/nsd/""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/phonenumber-utils""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/sensor""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/storage""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/system""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/telephony""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/tzsh""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/ui""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/vulkan""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/widget_service""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/widget_viewer_dali""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/widget_viewer_evas""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/yaca""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/dbus-1.0/include""/> - <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/glib-2.0/include""/> - </option> + <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.1812812065" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath"/> <option id="sbi.gnu.cpp.compiler.option.frameworks_cflags.core.953420719" name="Tizen-Frameworks-Other-Cflags" superClass="sbi.gnu.cpp.compiler.option.frameworks_cflags.core" valueType="stringList"> <listOptionValue builtIn="false" value="${TC_COMPILER_MISC}"/> <listOptionValue builtIn="false" value="${RS_COMPILER_MISC}"/> @@ -213,6 +125,7 @@ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/dbus-1.0/include""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/glib-2.0/include""/> <listOptionValue builtIn="false" value=""${workspace_loc:/lib-apps-common/inc}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/lib-common/res/common/edje}""/> </option> <option id="sbi.gnu.cpp.compiler.option.frameworks.core.1296940181" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs"> <listOptionValue builtIn="false" value="Native_API"/> @@ -362,13 +275,13 @@ <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib.178013541" name="Archive Generator" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib"/> <tool id="org.tizen.nativecore.tool.sbi.po.compiler.284142865" name="PO Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.po.compiler"/> <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.2065305140" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"> - <option id="sbi.gnu.edc.compiler.option.misc.id.1235266472" superClass="sbi.gnu.edc.compiler.option.misc.id" valueType="stringList"> + <option id="sbi.gnu.edc.compiler.option.misc.id.1235266472" name="Image Path (-id)" superClass="sbi.gnu.edc.compiler.option.misc.id" valueType="stringList"> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edje""/> </option> - <option id="sbi.gnu.edc.compiler.option.misc.sd.259343775" superClass="sbi.gnu.edc.compiler.option.misc.sd" valueType="stringList"> + <option id="sbi.gnu.edc.compiler.option.misc.sd.259343775" name="Sound Path (-sd)" superClass="sbi.gnu.edc.compiler.option.misc.sd" valueType="stringList"> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edje""/> </option> - <option id="sbi.gnu.edc.compiler.option.misc.fd.114004466" superClass="sbi.gnu.edc.compiler.option.misc.fd" valueType="stringList"> + <option id="sbi.gnu.edc.compiler.option.misc.fd.114004466" name="Font Path (-fd)" superClass="sbi.gnu.edc.compiler.option.misc.fd" valueType="stringList"> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edje""/> </option> </tool> diff --git a/lib-common/edje/common/images/check_18.png b/lib-common/edje/common/images/check_18.png Binary files differnew file mode 100644 index 0000000..0f149f4 --- /dev/null +++ b/lib-common/edje/common/images/check_18.png diff --git a/lib-common/inc/Common/AlarmDeletedPopup.h b/lib-common/inc/Common/AlarmDeletedPopup.h new file mode 100644 index 0000000..ceb8b48 --- /dev/null +++ b/lib-common/inc/Common/AlarmDeletedPopup.h @@ -0,0 +1,34 @@ +/* + * 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 COMMON_ALARM_DELETED_POPUP_H +#define COMMON_ALARM_DELETED_POPUP_H + +#include "Ui/Toast.h" + +namespace Common +{ + /** + * @brief Toast popup notifying that alarm(s) was successfully deleted. + */ + class EXPORT_API AlarmDeletedPopup : public Ui::Toast + { + private: + virtual void onCreated() override; + }; +} + +#endif /* COMMON_ALARM_DELETED_POPUP_H */ diff --git a/lib-common/res/common/edje/CommonPath.h b/lib-common/res/common/edje/CommonPath.h index be24b8f..43cfb58 100644 --- a/lib-common/res/common/edje/CommonPath.h +++ b/lib-common/res/common/edje/CommonPath.h @@ -21,10 +21,13 @@ #define COMMON_IMG_DIR "common/images/" #define PATH_ALARM_CHECK_STYLE COMMON_EDJ_DIR"alarm-check-style.edj" +#define PATH_TOAST_CHECK_LAYOUT COMMON_EDJ_DIR"toast-check-layout.edj" #define PATH_ALARM_ICON COMMON_IMG_DIR"alarm_widget_icon.png" #define PATH_ALARM_ICON_BG COMMON_IMG_DIR"alarm_widget_icon_bg.png" +#define PATH_TOAST_CHECK_ICON COMMON_IMG_DIR"check_18.png" #define STYLE_CHECK_ALARM_ON_OFF "alarm_on_off" +#define LAYOUT_TOAST_CHECK "toast_check" #endif /* COMMON_PATH_H */ diff --git a/lib-common/res/common/edje/toast-check-layout.edc b/lib-common/res/common/edje/toast-check-layout.edc new file mode 100644 index 0000000..f4b2922 --- /dev/null +++ b/lib-common/res/common/edje/toast-check-layout.edc @@ -0,0 +1,61 @@ +/* + * 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 "CommonPath.h" + +collections { + base_scale: 1.3; + + group { LAYOUT_TOAST_CHECK; + parts { + image { "image.icon"; + images.image: PATH_TOAST_CHECK_ICON COMP; + clip: "rect.clipper"; + desc { "default"; + aspect: 1 1; + aspect_preference: VERTICAL; + image.normal: PATH_TOAST_CHECK_ICON; + } + } + rect { "rect.clipper"; + desc { "default"; + rel.to: "image.icon"; + rel2.relative: 0.0 1.0; + } + desc { "full"; + inherit: "default"; + rel2.relative: 1.0 1.0; + } + } + } + programs { + program { + signal: "load"; + source: "*"; + sequence { + /* Do nothing during popup "show" animation */ + action: STATE_SET "default"; + target: "rect.clipper"; + transition: LINEAR 0.3; + + action: STATE_SET "full"; + target: "rect.clipper"; + transition: LINEAR 0.3; + } + } + } + } +} diff --git a/lib-common/src/Common/AlarmDeletedPopup.cpp b/lib-common/src/Common/AlarmDeletedPopup.cpp new file mode 100644 index 0000000..3858677 --- /dev/null +++ b/lib-common/src/Common/AlarmDeletedPopup.cpp @@ -0,0 +1,34 @@ +/* + * 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 "Common/AlarmDeletedPopup.h" +#include "App/Path.h" +#include "CommonPath.h" + +using namespace Common; + +void AlarmDeletedPopup::onCreated() +{ + Evas_Object *popup = getEvasObject(); + elm_object_style_set(popup, "toast/circle"); + + Evas_Object *icon = elm_layout_add(popup); + 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"); +} |