diff options
author | Eugene Kurzberg <i.kurtsberg@samsung.com> | 2017-07-24 09:42:21 +0300 |
---|---|---|
committer | Eugene Kurzberg <i.kurtsberg@samsung.com> | 2017-07-24 09:42:21 +0300 |
commit | 48de4caee33d90997bf2c1a25e14cf8c6f8d7106 (patch) | |
tree | 5b810e2c0c6634746df8f7f52515389bb3c84dd5 | |
parent | af883c7ad9c56ac47cdb782bf63f806bdd9b6881 (diff) | |
download | alarm-48de4caee33d90997bf2c1a25e14cf8c6f8d7106.tar.gz alarm-48de4caee33d90997bf2c1a25e14cf8c6f8d7106.tar.bz2 alarm-48de4caee33d90997bf2c1a25e14cf8c6f8d7106.zip |
Replace custom UI components with new apps-common components.
Change-Id: Ifbe4c64192f1d7fc4b53f62db2175473a100b3ea
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
19 files changed, 63 insertions, 612 deletions
diff --git a/alarm-app/.cproject b/alarm-app/.cproject index a7045d2..9ba3b68 100644 --- a/alarm-app/.cproject +++ b/alarm-app/.cproject @@ -123,6 +123,7 @@ <option id="gnu.cpp.compiler.option.include.paths.1572219696" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath"> <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/lib-apps-common/inc}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/lib-apps-common/res/apps-common/edje}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/lib-common/inc}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/lib-common/res/common/edje}""/> <listOptionValue builtIn="false" value=""${workspace_loc:/alarm-app/res/alert/edje}""/> diff --git a/alarm-app/edje/list/images/alarm_add_icon_bg.png b/alarm-app/edje/list/images/alarm_add_icon_bg.png Binary files differdeleted file mode 100644 index 1f3739a..0000000 --- a/alarm-app/edje/list/images/alarm_add_icon_bg.png +++ /dev/null diff --git a/alarm-app/edje/list/images/b_ic_press_full_circle_bg.png b/alarm-app/edje/list/images/b_ic_press_full_circle_bg.png Binary files differdeleted file mode 100644 index 5b9f7e4..0000000 --- a/alarm-app/edje/list/images/b_ic_press_full_circle_bg.png +++ /dev/null diff --git a/alarm-app/edje/list/images/tw_no_item_bg.png b/alarm-app/edje/list/images/tw_no_item_bg.png Binary files differdeleted file mode 100644 index de5ac92..0000000 --- a/alarm-app/edje/list/images/tw_no_item_bg.png +++ /dev/null diff --git a/alarm-app/inc/List/AddAlarmItem.h b/alarm-app/inc/List/AddAlarmItem.h deleted file mode 100644 index 569708e..0000000 --- a/alarm-app/inc/List/AddAlarmItem.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 LIST_ADD_ALARM_ITEM_H -#define LIST_ADD_ALARM_ITEM_H - -#include "Ui/GenItem.h" - -namespace List -{ - class AddAlarmItem: public Ui::GenItem - { - public: - /** - * @brief Set item's enabled state. - * @param[in] isEnabled Whether item is enabled - */ - void setEnabled(bool isEnabled); - - private: - virtual Elm_Gen_Item_Class *getItemClass() const override; - virtual Evas_Object *getContent(Evas_Object *parent, const char *part) override; - }; -} - -#endif /* LIST_ADD_ALARM_ITEM_H */ diff --git a/alarm-app/inc/List/AlarmsView.h b/alarm-app/inc/List/AlarmsView.h index f2a5a0a..ad3c9b1 100644 --- a/alarm-app/inc/List/AlarmsView.h +++ b/alarm-app/inc/List/AlarmsView.h @@ -26,10 +26,14 @@ namespace Ui class Genlist; } +namespace Ux +{ + class ActionButtonsItem; +} + namespace List { class AlarmItem; - class AddAlarmItem; class AlarmsView: public Ux::SelectView { public: @@ -61,7 +65,6 @@ namespace List Evas_Object *createContentLayout(Evas_Object *parent); Evas_Object *createNoContents(Evas_Object *parent); - Evas_Object *createAddButton(Evas_Object *parent); void updateEmptyState(); AlarmItem *createItem(::Model::DataItem &dataItem); @@ -85,7 +88,7 @@ namespace List Evas_Object *m_NoContents; Evas_Object *m_ContentLayout; Ui::Genlist *m_Genlist; - AddAlarmItem *m_AddAlarmItem; + Ux::ActionButtonsItem *m_AddAlarmItem; Evas_Object *m_DeleteButton; AddCallback m_OnAlarmAdded; diff --git a/alarm-app/project_def.prop b/alarm-app/project_def.prop index 59e2b28..13df4a5 100644 --- a/alarm-app/project_def.prop +++ b/alarm-app/project_def.prop @@ -12,31 +12,31 @@ profile = wearable-4.0 USER_SRCS = src/*.cpp src/*/*.cpp # EDC Sources -USER_EDCS = +USER_EDCS = # PO Sources USER_POS = res/po/*.po # User Defines -USER_DEFS = -USER_CPP_DEFS = TIZEN_DEPRECATION DEPRECATION_WARNING "TEXT_DOMAIN=\"alarm\"" +USER_DEFS = +USER_CPP_DEFS = "TEXT_DOMAIN=\"alarm\"" # User Undefines -USER_UNDEFS = -USER_CPP_UNDEFS = +USER_UNDEFS = +USER_CPP_UNDEFS = # User Libraries -USER_LIBS = apps-common common +USER_LIBS = apps-common common # User Objects -USER_OBJS = +USER_OBJS = # User Includes ## C Compiler -USER_C_INC_DIRS = -USER_INC_FILES = +USER_C_INC_DIRS = +USER_INC_FILES = ## C++ Compiler -USER_CPP_INC_DIRS = inc res/alert/edje res/input/edje res/list/edje $(workspace_loc)/lib-apps-common/inc $(workspace_loc)/lib-common/inc $(workspace_loc)/lib-common/res/common/edje +USER_CPP_INC_DIRS = inc res/alert/edje res/input/edje res/list/edje $(workspace_loc)/lib-apps-common/inc $(workspace_loc)/lib-apps-common/res/apps-common/edje $(workspace_loc)/lib-common/inc $(workspace_loc)/lib-common/res/common/edje USER_CPP_INC_FILES = USER_INC_DIRS = $(USER_C_INC_DIRS) $(USER_CPP_INC_DIRS) @@ -45,19 +45,18 @@ USER_INC_DIRS = $(USER_C_INC_DIRS) $(USER_CPP_INC_DIRS) USER_LIB_DIRS = $(workspace_loc)/lib-apps-common/${BUILD_CONFIG} $(workspace_loc)/lib-common/${BUILD_CONFIG} # EDC Resource Path -USER_EDCS_IMAGE_DIRS = ${OUTPUT_DIR} edje -USER_EDCS_SOUND_DIRS = ${OUTPUT_DIR} edje -USER_EDCS_FONT_DIRS = ${OUTPUT_DIR} edje +USER_EDCS_IMAGE_DIRS = ${OUTPUT_DIR} edje +USER_EDCS_SOUND_DIRS = ${OUTPUT_DIR} edje +USER_EDCS_FONT_DIRS = ${OUTPUT_DIR} edje # EDC Flags -USER_EXT_EDC_KEYS = EDC0 +USER_EXT_EDC_KEYS = EDC0 USER_EXT_EDC0_EDCS = res/*/edje/*.edc -USER_EXT_EDC0_EDCS_IMAGE_DIRS = ${OUTPUT_DIR} edje -USER_EXT_EDC0_EDCS_SOUND_DIRS = ${OUTPUT_DIR} edje -USER_EXT_EDC0_EDCS_FONT_DIRS = ${OUTPUT_DIR} edje +USER_EXT_EDC0_EDCS_IMAGE_DIRS = ${OUTPUT_DIR} edje +USER_EXT_EDC0_EDCS_SOUND_DIRS = ${OUTPUT_DIR} edje +USER_EXT_EDC0_EDCS_FONT_DIRS = ${OUTPUT_DIR} edje # Resource Filter -USER_RES_INCLUDE = +USER_RES_INCLUDE = USER_RES_EXCLUDE = res/*/edje/*.edc res/*/edje/*.h res/po - diff --git a/alarm-app/res/list/edje/ListPath.h b/alarm-app/res/list/edje/ListPath.h index d9a97e9..a347fcc 100644 --- a/alarm-app/res/list/edje/ListPath.h +++ b/alarm-app/res/list/edje/ListPath.h @@ -17,23 +17,9 @@ #ifndef LIST_PATH_H #define LIST_PATH_H -#define LIST_EDJ_DIR "list/edje/" -#define LIST_IMG_DIR "list/images/" +#define LIST_IMG_DIR "list/images/" -#define PATH_LIST_LAYOUT LIST_EDJ_DIR"list-layout.edj" -#define PATH_ADD_ITEM_STYLE LIST_EDJ_DIR"add-item-style.edj" -#define PATH_ADD_BUTTON_STYLE LIST_EDJ_DIR"add-button-style.edj" - -#define PATH_ICON_NO_ALARM LIST_IMG_DIR"alarm_no_alarm_icon.png" -#define PATH_ICON_ADD_ALARM LIST_IMG_DIR"alarm_add_icon.png" -#define PATH_ICON_ADD_ALARM_BG LIST_IMG_DIR"alarm_add_icon_bg.png" -#define PATH_NO_ALARMS_BG LIST_IMG_DIR"tw_no_item_bg.png" -#define PATH_NO_ALARMS_PRESS_BG LIST_IMG_DIR"b_ic_press_full_circle_bg.png" - -#define LAYOUT_NO_ALARMS "no_alarms" -#define STYLE_BUTTON_NO_ALARMS "no_alarms" - -#define STYLE_ITEM_ADD_ALARM "add_alarm" -#define STYLE_BUTTON_ADD_ALARM "add_alarm" +#define PATH_ICON_NO_ALARM LIST_IMG_DIR"alarm_no_alarm_icon.png" +#define PATH_ICON_ADD_ALARM LIST_IMG_DIR"alarm_add_icon.png" #endif /* LIST_PATH_H */ diff --git a/alarm-app/res/list/edje/add-button-style.edc b/alarm-app/res/list/edje/add-button-style.edc deleted file mode 100644 index 59b415f..0000000 --- a/alarm-app/res/list/edje/add-button-style.edc +++ /dev/null @@ -1,224 +0,0 @@ -/* - * 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 "ListPath.h" - -#define ICON_W 130 -#define ICON_H 110 - -#define TEXT_T 28 -#define TEXT_H 37 -#define TEXT_LR 60 - -#define ADD_ICON_WH 76 -#define ADD_TEXT_L 24 - -styles { - style { - name: "no_alarms"; - base: "font=Tizen:style=Regular font_size=28 align=center color=#fff"; - } - style { - name: "add_alarm"; - base: "font=Tizen:style=Regular font_size=36 align=center color=#ffffff"; - } - style { - name: "add_alarm_disabled"; - base: "font=Tizen:style=Regular font_size=36 align=center color=#4d4d4d"; - } -} - -collections { - base_scale: 1.3; - - group { "elm/button/base/"STYLE_BUTTON_NO_ALARMS; - parts { - image { "image"; scale; - images.image: PATH_ICON_NO_ALARM COMP; - desc { "default"; - fixed: 1 1; - min: ICON_W ICON_H; - align: 0.5 0.0; - rel1.relative: 0.5 0.0; - rel2.relative: 0.5 0.0; - image.normal: PATH_ICON_NO_ALARM; - } - } - spacer { "spacer.text.top"; scale; - desc { "default"; - fixed: 0 1; - min: 0 TEXT_T; - align: 0.5 0.0; - rel1 { relative: 0.0 1.0; to_y: "image"; } - rel2 { relative: 1.0 1.0; to_y: "image"; } - } - } - spacer { "spacer.text.left"; scale; - desc { "default"; - fixed: 1 0; - min: TEXT_LR 0; - align: 0.0 0.5; - rel2.relative: 0.0 1.0; - } - } - spacer { "spacer.text.right"; scale; - desc { "default"; - fixed: 1 0; - min: TEXT_LR 0; - align: 1.0 0.5; - rel1.relative: 1.0 0.0; - } - } - textblock { "elm.text"; scale; - desc { "default"; - min: 0 TEXT_H; - rel1 { relative: 1.0 1.0; to_x: "spacer.text.left"; to_y: "spacer.text.top"; } - rel2 { relative: 0.0 1.0; to_x: "spacer.text.right"; } - text { - min: 1 0; - ellipsis: -1; - style: "no_alarms"; - } - } - } - } - programs { - program { - signal: "mouse,clicked,*"; - source: "*"; - action: SIGNAL_EMIT "elm,action,click" ""; - } - } - } - - group { "elm/button/base/"STYLE_BUTTON_ADD_ALARM; - script { - public is_disabled; - } - parts { - image { "image.bg"; scale; - images.image: PATH_ICON_ADD_ALARM_BG COMP; - desc { "default"; - fixed: 1 1; - min: ADD_ICON_WH ADD_ICON_WH; - align: 0.0 0.5; - rel1.relative: 0.0 0.5; - rel2.relative: 0.0 0.5; - image.normal: PATH_ICON_ADD_ALARM_BG; - color: 156 156 156 255; - } - desc { "pressed"; - inherit: "default"; - color: 156 156 156 128; - } - desc { "disabled"; - inherit: "default"; - color: 156 156 156 102; - } - } - image { "image.icon"; scale; - images.image: PATH_ICON_ADD_ALARM COMP; - desc { "default"; - rel.to: "image.bg"; - image.normal: PATH_ICON_ADD_ALARM; - color: 0 0 0 255; - } - desc { "pressed"; - inherit: "default"; - color: 0 0 0 128; - } - desc { "disabled"; - inherit: "default"; - color: 0 0 0 102; - } - } - spacer { "spacer.text.left"; scale; - desc { "default"; - fixed: 1 0; - min: ADD_TEXT_L 0; - align: 0.0 0.5; - rel1 { relative: 1.0 0.0; to_x: "image.bg"; } - rel2 { relative: 1.0 1.0; to_x: "image.bg"; } - } - } - textblock { "elm.text"; scale; - desc { "default"; - rel1 { relative: 1.0 0.0; to_x: "spacer.text.left"; } - text { - min: 1 0; - ellipsis: -1; - style: "add_alarm"; - } - } - desc { "disabled"; - inherit: "default"; - text.style: "add_alarm_disabled"; - } - } - } - programs { - program { - signal: "mouse,down,*"; - source: "*"; - script { - if (get_int(is_disabled) == 0) { - set_state(PART:"image.bg", "pressed", 0.0); - set_state(PART:"image.icon", "pressed", 0.0); - } - } - } - program { - signal: "mouse,up,*"; - source: "*"; - script { - if (get_int(is_disabled) == 0) { - set_state(PART:"image.bg", "default", 0.0); - set_state(PART:"image.icon", "default", 0.0); - } - } - } - program { - signal: "elm,state,enabled"; - source: "elm"; - script { - set_int(is_disabled, 0); - set_state(PART:"image.bg", "default", 0.0); - set_state(PART:"image.icon", "default", 0.0); - set_state(PART:"elm.text", "default", 0.0); - } - } - program { - signal: "elm,state,disabled"; - source: "elm"; - script { - set_int(is_disabled, 1); - set_state(PART:"image.bg", "disabled", 0.0); - set_state(PART:"image.icon", "disabled", 0.0); - set_state(PART:"elm.text", "disabled", 0.0); - } - } - program { - signal: "mouse,clicked,*"; - source: "*"; - script { - if (get_int(is_disabled) == 0) { - emit("elm,action,click", ""); - } - } - } - } - } -} diff --git a/alarm-app/res/list/edje/add-item-style.edc b/alarm-app/res/list/edje/add-item-style.edc deleted file mode 100644 index fcaac9d..0000000 --- a/alarm-app/res/list/edje/add-item-style.edc +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 "ListPath.h" - -#define ADD_ITEM_H 115 - -collections { - base_scale: 1.3; - - group { "elm/genlist/item/"STYLE_ITEM_ADD_ALARM"/default"; - data.item: "contents" "elm.swallow.content"; - data.item: "vi_effect" "on"; - data.item: "dim" "off"; - - parts { - swallow { "elm.swallow.content"; - desc { "default"; - fixed: 1 0; - min: 0 ADD_ITEM_H; - rel1.relative: 0.5 0.0; - rel2.relative: 0.5 1.0; - } - } - } - } -} diff --git a/alarm-app/res/list/edje/list-layout.edc b/alarm-app/res/list/edje/list-layout.edc deleted file mode 100644 index 31816e8..0000000 --- a/alarm-app/res/list/edje/list-layout.edc +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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 "ListPath.h" - -#define TRANSITION_GLIDE(duration) CUBIC_BEZIER (duration) 0.25 0.46 0.45 1.0 - -#define TITLE_T 51 -#define TITLE_LR 64 -#define TITLE_H 39 - -#define ICON_T 35 - -styles { - style { - name: "no_alarms_title"; - base: "font=Tizen:style=Bold font_size=30 align=center color=#4dcfff"; - } -} - -collections { - base_scale: 1.3; - - group { LAYOUT_NO_ALARMS; - parts { - image { "image.bg"; - images.image: PATH_NO_ALARMS_BG COMP; - desc { "default"; - image.normal: PATH_NO_ALARMS_BG; - color: 94 94 94 76; - } - } - image { "image.press_bg"; - images.image: PATH_NO_ALARMS_PRESS_BG COMP; - desc { "default"; - image.normal: PATH_NO_ALARMS_PRESS_BG; - color: 255 255 255 0; - } - desc { "pressed_effect"; - inherit: "default"; - rel1.relative: 0.05 0.05; - rel2.relative: 0.95 0.95; - color: 255 255 255 33; - } - desc { "pressed"; - inherit: "default"; - color: 255 255 255 33; - } - } - spacer { "spacer.title.top"; scale; - desc { "default"; - fixed: 0 1; - min: 0 TITLE_T; - align: 0.5 0.0; - rel2.relative: 1.0 0.0; - } - } - spacer { "spacer.title.left"; scale; - desc { "default"; - fixed: 1 0; - min: TITLE_LR 0; - align: 0.0 0.5; - rel2.relative: 0.0 1.0; - } - } - spacer { "spacer.title.right"; scale; - desc { "default"; - fixed: 1 0; - min: TITLE_LR 0; - align: 1.0 0.5; - rel1.relative: 1.0 0.0; - } - } - textblock { "elm.text.title"; scale; - desc { "default"; - min: 0 TITLE_H; - align: 0.5 0.0; - rel1 { relative: 1.0 1.0; to_x: "spacer.title.left"; to_y: "spacer.title.top"; } - rel2 { relative: 0.0 1.0; to_x: "spacer.title.right"; to_y: "spacer.title.top"; } - text.style: "no_alarms_title"; - } - } - spacer { "spacer.icon.top"; scale; - desc { "default"; - fixed: 0 1; - min: 0 ICON_T; - align: 0.5 0.0; - rel1 { relative: 0.0 1.0; to_y: "elm.text.title"; } - rel2 { relative: 1.0 1.0; to_y: "elm.text.title"; } - } - } - swallow { "elm.swallow.icon"; scale; - desc { "default"; - fixed: 1 1; - align: 0.5 0.0; - rel1 { relative: 0.5 1.0; to_y: "spacer.icon.top"; } - rel2 { relative: 0.5 1.0; to_y: "spacer.icon.top"; } - } - } - } - programs { - program { - signal: "mouse,down,*"; - source: "elm.swallow.icon"; - sequence { - action: STATE_SET "pressed_effect"; - target: "image.press_bg"; - - action: STATE_SET "pressed"; - target: "image.press_bg"; - transition: TRANSITION_GLIDE(0.3); - } - } - program { - signal: "mouse,up,*"; - source: "elm.swallow.icon"; - action: STATE_SET "default"; - target: "image.press_bg"; - transition: LINEAR 0.2; - } - } - } -} diff --git a/alarm-app/edje/list/images/alarm_add_icon.png b/alarm-app/res/list/images/alarm_add_icon.png Binary files differindex 52b03a4..52b03a4 100644 --- a/alarm-app/edje/list/images/alarm_add_icon.png +++ b/alarm-app/res/list/images/alarm_add_icon.png diff --git a/alarm-app/edje/list/images/alarm_no_alarm_icon.png b/alarm-app/res/list/images/alarm_no_alarm_icon.png Binary files differindex b76e6bb..b76e6bb 100644 --- a/alarm-app/edje/list/images/alarm_no_alarm_icon.png +++ b/alarm-app/res/list/images/alarm_no_alarm_icon.png diff --git a/alarm-app/src/AlarmApp.cpp b/alarm-app/src/AlarmApp.cpp index 14c6325..b1bff4e 100644 --- a/alarm-app/src/AlarmApp.cpp +++ b/alarm-app/src/AlarmApp.cpp @@ -20,6 +20,8 @@ #include "Utils/Logger.h" #include "AlertPath.h" +#include "AppsCommonButtons.h" +#include "AppsCommonList.h" #include "CommonPath.h" #include "DaySelectorPath.h" #include "ListPath.h" @@ -55,8 +57,9 @@ bool AlarmApp::onCreate() textdomain(TEXT_DOMAIN); elm_theme_overlay_add(nullptr, App::getResourcePath(PATH_DAY_SELECTOR_LAYOUT).c_str()); - elm_theme_extension_add(nullptr, App::getResourcePath(PATH_ADD_ITEM_STYLE).c_str()); - elm_theme_extension_add(nullptr, App::getResourcePath(PATH_ADD_BUTTON_STYLE).c_str()); + elm_theme_overlay_add(nullptr, App::getResourcePath(PATH_APPS_COMMON_LIST).c_str()); + + elm_theme_extension_add(nullptr, App::getResourcePath(PATH_APPS_COMMON_BUTTONS).c_str()); elm_theme_extension_add(nullptr, App::getResourcePath(PATH_ALARM_CHECK_STYLE).c_str()); elm_theme_extension_add(nullptr, App::getResourcePath(PATH_ALERT_BUTTON_STYLE).c_str()); diff --git a/alarm-app/src/Input/InputView.cpp b/alarm-app/src/Input/InputView.cpp index a44c778..89c45ee 100644 --- a/alarm-app/src/Input/InputView.cpp +++ b/alarm-app/src/Input/InputView.cpp @@ -17,12 +17,12 @@ #include "Input/InputView.h" #include "Input/SetRepeatView.h" #include "Input/SetTimeView.h" -#include "Common/AlarmDeletedPopup.h" #include "Common/AlarmSetPopup.h" #include "Common/Format.h" #include "Common/Model/AlarmConsumer.h" #include "Ui/PageIndex.h" +#include "Ux/SuccessPopup.h" #include "Utils/Callback.h" #include <app_i18n.h> @@ -181,8 +181,9 @@ void InputView::deleteAlarm() return; } - auto popup = new Common::AlarmDeletedPopup(); + auto popup = new Ux::SuccessPopup(); popup->create(getEvasObject()); + popup->setText("WDS_ALM_TPOP_DELETED_ABB"); popup->show(); getPage()->close(); }); diff --git a/alarm-app/src/List/AddAlarmItem.cpp b/alarm-app/src/List/AddAlarmItem.cpp deleted file mode 100644 index 33779e1..0000000 --- a/alarm-app/src/List/AddAlarmItem.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 "List/AddAlarmItem.h" -#include "ListPath.h" - -using namespace List; - -void AddAlarmItem::setEnabled(bool isEnabled) -{ - Evas_Object *button = elm_object_item_part_content_get(getObjectItem(), "elm.swallow.content"); - elm_object_disabled_set(button, !isEnabled); - elm_object_item_disabled_set(getObjectItem(), !isEnabled); - elm_atspi_accessible_can_highlight_set(getObjectItem(), isEnabled); -} - -Elm_Gen_Item_Class *AddAlarmItem::getItemClass() const -{ - static Elm_Gen_Item_Class itc = createItemClass(STYLE_ITEM_ADD_ALARM); - return &itc; -} - -Evas_Object *AddAlarmItem::getContent(Evas_Object *parent, const char *part) -{ - Evas_Object *button = elm_button_add(parent); - elm_object_style_set(button, STYLE_BUTTON_ADD_ALARM); - elm_object_translatable_text_set(button, "WDS_ALM_BUTTON_ADD_ABB"); - elm_object_disabled_set(button, elm_object_item_disabled_get(getObjectItem())); - - elm_atspi_accessible_relationship_append(button, ELM_ATSPI_RELATION_CONTROLLED_BY, getObjectItem()); - elm_atspi_accessible_relationship_append(getObjectItem(), ELM_ATSPI_RELATION_DESCRIBED_BY, button); - elm_atspi_accessible_relationship_append(getObjectItem(), ELM_ATSPI_RELATION_LABELLED_BY, button); - - return button; -} diff --git a/alarm-app/src/List/AlarmsView.cpp b/alarm-app/src/List/AlarmsView.cpp index 4b6dfd0..33000ae 100644 --- a/alarm-app/src/List/AlarmsView.cpp +++ b/alarm-app/src/List/AlarmsView.cpp @@ -15,7 +15,6 @@ */ #include "Common/Model/AlarmConsumer.h" -#include "List/AddAlarmItem.h" #include "List/AlarmItem.h" #include "List/AlarmsView.h" #include "Input/InputView.h" @@ -30,7 +29,10 @@ #include "Ui/Toast.h" #include "Ui/Window.h" #include "Utils/Callback.h" +#include "Ux/ActionButtonsItem.h" #include "Ux/CircleSelector.h" + +#include "AppsCommonList.h" #include "ListPath.h" #include <app_i18n.h> @@ -111,14 +113,14 @@ void AlarmsView::onSelectModeChanged(Ux::SelectMode selectMode) if (selectMode != Ux::SelectMulti) { elm_layout_signal_emit(m_ContentLayout, "select_mode,button,hide", ""); - m_AddAlarmItem->setEnabled(true); + m_AddAlarmItem->getControl()->setEnabled(true); for (auto &&selectItem : getSelectItems()) { elm_atspi_accessible_relationships_clear(selectItem->getObjectItem()); } } else { elm_layout_signal_emit(m_ContentLayout, "select_mode,button,show", ""); - m_AddAlarmItem->setEnabled(false); + m_AddAlarmItem->getControl()->setEnabled(false); if (auto selector = getMultiSelector().lock()) { for (auto &&selectItem : getSelectItems()) { @@ -193,9 +195,11 @@ Evas_Object *AlarmsView::createContentLayout(Evas_Object *parent) elm_object_content_set(layout, m_Genlist->getEvasObject()); m_Genlist->insert(new Ui::PaddingItem()); - m_Genlist->insert(m_AddAlarmItem = new AddAlarmItem()); + m_Genlist->insert(m_AddAlarmItem = new Ux::ActionButtonsItem()); m_Genlist->insert(new Ui::PaddingItem()); - m_AddAlarmItem->setSelectCallback(std::bind(&AlarmsView::onAddPressed, this)); + + m_AddAlarmItem->getControl()->addButton("WDS_ALM_BUTTON_ADD_ABB", PATH_ICON_ADD_ALARM, + std::bind(&AlarmsView::onAddPressed, this)); return layout; } @@ -203,23 +207,28 @@ Evas_Object *AlarmsView::createContentLayout(Evas_Object *parent) Evas_Object *AlarmsView::createNoContents(Evas_Object *parent) { Evas_Object *layout = elm_layout_add(parent); - elm_layout_file_set(layout, App::getResourcePath(PATH_LIST_LAYOUT).c_str(), LAYOUT_NO_ALARMS); + elm_layout_theme_set(layout, "layout", "nocontents_button", "default"); elm_object_translatable_part_text_set(layout, "elm.text.title", "WDS_ALM_HEADER_ALARM_ABB"); - Ui::createTextAccessObject(layout, "elm.text.title"); - elm_object_part_content_set(layout, "elm.swallow.icon", createAddButton(layout)); + elm_object_translatable_text_set(layout, "WDS_ALM_OPT_ADD_ALARM_ABB"); + elm_layout_signal_callback_add(layout, SIGNAL_CLICKED, "*", + (Edje_Signal_Cb) makeCallback(&AlarmsView::onAddPressed), this); - return layout; -} + Evas_Object *image = elm_image_add(layout); + elm_image_file_set(image, App::getResourcePath(PATH_ICON_NO_ALARM).c_str(), nullptr); + elm_object_part_content_set(layout, "elm.swallow.icon", image); -Evas_Object *AlarmsView::createAddButton(Evas_Object *parent) -{ - Evas_Object *button = elm_button_add(parent); - elm_object_style_set(button, STYLE_BUTTON_NO_ALARMS); - elm_object_translatable_text_set(button, "WDS_ALM_OPT_ADD_ALARM_ABB"); - evas_object_smart_callback_add(button, "clicked", - (Evas_Smart_Cb) makeCallback(&AlarmsView::onAddPressed), this); + Ui::createTextAccessObject(layout, "elm.text.title"); + Evas_Object *icon = Ui::createTextAccessObject(layout, "access.icon", "elm.text"); + elm_atspi_accessible_role_set(icon, ELM_ATSPI_ROLE_PUSH_BUTTON); + elm_atspi_accessible_reading_info_type_set(icon, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | ELM_ACCESSIBLE_READING_INFO_TYPE_ROLE); + elm_access_action_cb_set(icon, ELM_ACCESS_ACTION_ACTIVATE, + [](void *data, Evas_Object *, Elm_Access_Action_Info *) { + auto view = (AlarmsView *) data; + view->onAddPressed(); + return EINA_TRUE; + }, this); - return button; + return layout; } void AlarmsView::updateEmptyState() diff --git a/lib-common/inc/Common/AlarmDeletedPopup.h b/lib-common/inc/Common/AlarmDeletedPopup.h deleted file mode 100644 index ceb8b48..0000000 --- a/lib-common/inc/Common/AlarmDeletedPopup.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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/src/Common/AlarmDeletedPopup.cpp b/lib-common/src/Common/AlarmDeletedPopup.cpp deleted file mode 100644 index d321b9e..0000000 --- a/lib-common/src/Common/AlarmDeletedPopup.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 *icon = elm_layout_add(getEvasObject()); - elm_layout_file_set(icon, App::getResourcePath(PATH_TOAST_CHECK_LAYOUT).c_str(), LAYOUT_TOAST_CHECK); - - setText("WDS_ALM_TPOP_DELETED_ABB"); - setIcon(icon); -} |