From 358b9e182c4d15260883f734062e28630af16129 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Thu, 30 Jul 2015 19:01:35 +0900 Subject: [PATCH 01/16] Update notification display service Change-Id: I38ca85154854a8a5f982e02b6324aebef4aafb3e Signed-off-by: jinwoo.shin --- daemon/notification-display.service | 2 +- daemon/notification_display_service.c | 73 +++++++++++++++++++++++++++++++---- 2 files changed, 66 insertions(+), 9 deletions(-) diff --git a/daemon/notification-display.service b/daemon/notification-display.service index 8dccc65..3907696 100644 --- a/daemon/notification-display.service +++ b/daemon/notification-display.service @@ -1,6 +1,6 @@ [Unit] Description=Notifications Display daemon -Requires=notifications.service display-manager-run.service +Requires=notifications.service display-manager-run.service tizen-system-env.service After=notifications.service display-manager-run.service [Service] diff --git a/daemon/notification_display_service.c b/daemon/notification_display_service.c index fa6d773..09699b3 100644 --- a/daemon/notification_display_service.c +++ b/daemon/notification_display_service.c @@ -14,9 +14,11 @@ SET_TAG(SERVICE_NAME) struct _priv { Evas_Object *win; Evas_Object *popup; + + time_t last_time; }; -static void _timeout(void *data, Evas_Object *obj, void *event_info) +static void _hide(void *data, Evas_Object *obj, void *event_info) { evas_object_hide(data); } @@ -38,10 +40,13 @@ void _show_notification(struct _priv *priv, notification_h noti) void _notification_changed_cb(void *data, notification_type_e notif_type) { struct _priv *priv; - + time_t latest_time; notification_h noti = NULL; notification_list_h noti_list = NULL; + if (notif_type != NOTIFICATION_TYPE_NOTI) + return; + if (!data) { _ERR("failed to get data"); return; @@ -51,15 +56,60 @@ void _notification_changed_cb(void *data, notification_type_e notif_type) notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list); if (noti_list) { noti = notification_list_get_data(noti_list); - if (noti) - _show_notification(priv, noti); + if (noti) { + notification_get_insert_time(noti, &latest_time); + + if (latest_time > priv->last_time) { + _show_notification(priv, noti); + priv->last_time = latest_time; + } + } + } + + notification_free_list(noti_list); +} + +static void _clear_notification(void) +{ + notification_list_h noti_list = NULL; + notification_h noti; + + notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list); + if (!noti_list) + return; + + while (noti_list != NULL) { + noti = notification_list_get_data(noti_list); + notification_delete(noti); + + noti_list = notification_list_remove(noti_list, noti); + notification_free(noti); + } +} + +time_t _get_last_time(void) +{ + time_t last_time = 0; + notification_h noti = NULL; + notification_list_h noti_list = NULL; + + notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list); + if (noti_list) { + noti = notification_list_get_data(noti_list); + if (noti) { + notification_get_insert_time(noti, &last_time); + } } notification_free_list(noti_list); + + return last_time; } int _create_popup(struct _priv *priv) { + Evas_Object *btn; + priv->win = elm_win_add(NULL, "popup", ELM_WIN_BASIC); if (!priv->win) { _ERR("elm_win_add failed"); @@ -74,10 +124,12 @@ int _create_popup(struct _priv *priv) _ERR("elm_win_add failed"); return -1; } - elm_popup_timeout_set(priv->popup, HIDE_TIME); - elm_popup_orient_set(priv->popup, ELM_POPUP_ORIENT_BOTTOM_RIGHT); - evas_object_smart_callback_add(priv->popup, "timeout", - _timeout, priv->win); + elm_popup_orient_set(priv->popup, ELM_POPUP_ORIENT_BOTTOM_LEFT); + + btn = elm_button_add(priv->popup); + elm_object_text_set(btn, "OK"); + elm_object_part_content_set(priv->popup, "button1", btn); + evas_object_smart_callback_add(btn, "clicked", _hide, priv->win); return 0; } @@ -107,6 +159,11 @@ int main(int argc, char **argv) return 0; } + /* NOTE: Odroid specific code to workaround time issue */ + _clear_notification(); + + priv->last_time = _get_last_time(); + error_n = NOTIFICATION_ERROR_SERVICE_NOT_READY; while (error_n != NOTIFICATION_ERROR_NONE) { error_n = notification_resister_changed_cb( -- 2.7.4 From c34ed4684b91fc2bcea4c64227fe2efffbb8e893 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Fri, 31 Jul 2015 13:58:33 +0900 Subject: [PATCH 02/16] Update user message Change-Id: I14f596546f5687e340003f901fa0e691a3174119 Signed-off-by: jinwoo.shin --- include/strings.h | 2 +- src/square_view.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/strings.h b/include/strings.h index 964dc7a..fb210e0 100644 --- a/include/strings.h +++ b/include/strings.h @@ -31,7 +31,7 @@ #define STR_SQUARE_TITLE STR_NOTIFICATION_TITLE #define STR_NOTIFICATION_LIST_TITLE "Recent Notification" -#define STR_DEFAULT_USER_MESSAGE "Good morning !" +#define STR_DEFAULT_USER_MESSAGE "Welcome, %s" #define STR_DEFAULT_TIME_AM_PM "" #define STR_DEFAULT_TIME_HOUR "12" #define STR_DEFAULT_TIME_MINUTE "30" diff --git a/src/square_view.c b/src/square_view.c index 16db8a1..9dbcbf2 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -69,10 +69,20 @@ static input_handler scroller_handler = { static void _print_user_message(struct _priv *priv) { char *message; + uid_t uid; + struct passwd *passwd; + char buf[128]; message = vconf_get_str(KEY_USER_MESSAGE); - if (!message) - message = strdup(STR_DEFAULT_USER_MESSAGE); + if (!message) { + uid = getuid(); + passwd = getpwuid(uid); + if (passwd) { + snprintf(buf, sizeof(buf), + STR_DEFAULT_USER_MESSAGE, passwd->pw_name); + message = buf; + } + } elm_object_part_text_set(priv->base, PART_INFO_USER_MESSAGE, message); } -- 2.7.4 From 04041249787ff63b0aed9ce0906cc80964d0c481 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Fri, 31 Jul 2015 16:53:58 +0900 Subject: [PATCH 03/16] Add notification detail popup Change-Id: Ib02e64bec5f4e34c81989bef69e1c6000c7dc1d3 Signed-off-by: jinwoo.shin --- CMakeLists.txt | 3 +- include/define.h | 2 + include/util.h | 25 ++++++++++ src/notification_view.c | 26 ++--------- src/square_view.c | 41 ++++++++++++++--- src/util.c | 120 ++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 188 insertions(+), 29 deletions(-) create mode 100644 include/util.h create mode 100644 src/util.c diff --git a/CMakeLists.txt b/CMakeLists.txt index eb89b99..a6785e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,8 @@ ENDIF(NOT DEFINED MANIFESTDIR) SET(SRCS src/main.c src/notification_view.c - src/square_view.c) + src/square_view.c + src/util.c) SET(TARGET_EDJ "${PROJECT_NAME}.edj") SET(THEME_EDJ "${PROJECT_NAME}-theme.edj") diff --git a/include/define.h b/include/define.h index aa4ae9e..365faa6 100644 --- a/include/define.h +++ b/include/define.h @@ -41,6 +41,8 @@ #define FONT_LIGHT "TizenSans:style=Light" #define FONT_BOLD "TizenSans:style=Bold" +#define KEY_NOTI "KEY_NOTI" + /* Definitions for notification view */ #define NOTIFICATION_VIEW "NOTIFICATION_VIEW" #define GRP_NOTIFICATION_VIEW "grp.notification.view" diff --git a/include/util.h b/include/util.h new file mode 100644 index 0000000..d2e0553 --- /dev/null +++ b/include/util.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 + +#ifndef __UTIL_H__ +#define __UTIL_H__ + +Evas_Object *util_show_notification_popup(Evas_Object *base, notification_h noti); +void util_clear_notification(void); + +#endif diff --git a/src/notification_view.c b/src/notification_view.c index 24811d6..ebec5bb 100644 --- a/src/notification_view.c +++ b/src/notification_view.c @@ -23,6 +23,7 @@ #include #include "define.h" +#include "util.h" #define STYLE_CATEGORY_TITLE "category_btn" #define STYLE_GRID_ITEM "notification_item" @@ -511,35 +512,18 @@ static void _base_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, } } -static void _clear_notification(void) -{ - notification_list_h noti_list = NULL; - notification_h noti; - - notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list); - if (!noti_list) - return; - - while (noti_list != NULL) { - noti = notification_list_get_data(noti_list); - notification_delete(noti); - - noti_list = notification_list_remove(noti_list, noti); - notification_free(noti); - } -} - static void _clear_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev) { - if (!strcmp(ev->keyname, KEY_ENTER)) - _clear_notification(); + if (!strcmp(ev->keyname, KEY_ENTER) || + !strcmp(ev->keyname, KEY_ENTER_REMOTE)) + util_clear_notification(); } static void _clear_mouse_up_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Up *ev) { - _clear_notification(); + util_clear_notification(); } static void _category_unfocused_cb(int id, void *data, diff --git a/src/square_view.c b/src/square_view.c index 9dbcbf2..b34788a 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -23,9 +23,9 @@ #include #include "define.h" +#include "util.h" #define KEY_USER_MESSAGE "db/setting/user_message" -#define KEY_NOTI "KEY_NOTI" #define CLOCK_UPDATE_DUR 1 #define NOTIFICATION_ITEM_PADDING_X 0 #define NOTIFICATION_ITEM_PADDING_Y 20 @@ -156,6 +156,8 @@ static void _update_list(struct _priv *priv) GRP_NOTIFICATION_ITEM); elm_object_focus_allow_set(item, EINA_TRUE); evas_object_data_set(item, KEY_NOTI, noti); + inputmgr_add_callback(item, BUTTON_NOTIFICATION, + &button_handler, priv); notification_get_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, @@ -247,7 +249,7 @@ static void _create_button(struct _priv *priv) PART_NOTIFICATION_CLEAR, priv->clear_btn); evas_object_show(priv->clear_btn); inputmgr_add_callback(priv->clear_btn, - BUTTON_CLEAR, &button_handler, NULL); + BUTTON_CLEAR, &button_handler, priv); priv->launch_btn = elm_layout_add(priv->base); elm_layout_file_set(priv->launch_btn, @@ -258,7 +260,7 @@ static void _create_button(struct _priv *priv) evas_object_show(priv->launch_btn); elm_object_focus_set(priv->launch_btn, EINA_TRUE); inputmgr_add_callback(priv->launch_btn, - BUTTON_LAUNCH, &button_handler, NULL); + BUTTON_LAUNCH, &button_handler, priv); } static Evas_Object *_create(Evas_Object *win, void *data) @@ -397,16 +399,31 @@ static void _base_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, static void _button_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev) { + struct _priv *priv; + notification_h noti; + switch (id) { case BUTTON_CLEAR: - if (!strcmp(ev->keyname, KEY_ENTER)) - notification_delete_all(NOTIFICATION_TYPE_NOTI); + if (!strcmp(ev->keyname, KEY_ENTER) || + !strcmp(ev->keyname, KEY_ENTER_REMOTE)) + util_clear_notification(); break; case BUTTON_LAUNCH: - if (!strcmp(ev->keyname, KEY_ENTER)) + if (!strcmp(ev->keyname, KEY_ENTER) || + !strcmp(ev->keyname, KEY_ENTER_REMOTE)) viewmgr_push_view(NOTIFICATION_VIEW); break; case BUTTON_NOTIFICATION: + if (!strcmp(ev->keyname, KEY_ENTER) || + !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { + priv = data; + noti = evas_object_data_get(obj, KEY_NOTI); + + if (!priv || !noti) + return; + + util_show_notification_popup(priv->base, noti); + } break; } } @@ -414,14 +431,24 @@ static void _button_key_up_cb(int id, void *data, Evas *e, static void _button_mouse_up_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Up *ev) { + struct _priv *priv; + notification_h noti; + switch (id) { case BUTTON_CLEAR: - notification_delete_all(NOTIFICATION_TYPE_NOTI); + util_clear_notification(); break; case BUTTON_LAUNCH: viewmgr_push_view(NOTIFICATION_VIEW); break; case BUTTON_NOTIFICATION: + priv = data; + noti = evas_object_data_get(obj, KEY_NOTI); + + if (!priv || !noti) + return; + + util_show_notification_popup(priv->base, noti); break; } } diff --git a/src/util.c b/src/util.c new file mode 100644 index 0000000..90fe646 --- /dev/null +++ b/src/util.c @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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 +#include +#include +#include + +#include "define.h" + +enum _button_id { + BUTTON_OK, + BUTTON_CANCEL, +}; + +static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Up *ev); +static void _clicked(int id, void *data, Evas_Object *obj); + +static input_handler popup_handler = { + .key_up = _key_up_cb, + .clicked = _clicked, +}; + +static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Up *ev) +{ + if (!data) + return; + + if (!strcmp(ev->keyname, KEY_BACK) || + !strcmp(ev->keyname, KEY_BACK_REMOTE)) { + inputmgr_remove_callback(data, &popup_handler); + evas_object_del(data); + } +} + +static void _clicked(int id, void *data, Evas_Object *obj) +{ + notification_h noti; + + if (!data) + return; + + switch (id) { + case BUTTON_OK: + noti = evas_object_data_get(data, KEY_NOTI); + if (noti) + notification_delete(noti); + + inputmgr_remove_callback(data, &popup_handler); + evas_object_del(data); + break; + } +} + +Evas_Object *util_show_notification_popup( + Evas_Object *base, notification_h noti) +{ + Evas_Object *popup, *btn1; + char *title = NULL; + char *content = NULL; + + popup = elm_popup_add(base); + if (!popup) { + _ERR("create popup failed"); + return NULL; + } + + notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &title); + elm_object_part_text_set(popup, "title,text", title); + + notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, &content); + elm_object_text_set(popup, content); + + evas_object_data_set(popup, KEY_NOTI, noti); + + btn1 = elm_button_add(popup); + elm_object_text_set(btn1, "OK"); + elm_object_part_content_set(popup, "button1", btn1); + inputmgr_add_callback(btn1, + BUTTON_OK, &popup_handler, popup); + evas_object_show(btn1); + elm_object_focus_set(btn1, EINA_TRUE); + + evas_object_show(popup); + + return popup; +} + +void util_clear_notification(void) +{ + notification_list_h noti_list = NULL; + notification_h noti; + + notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list); + if (!noti_list) + return; + + while (noti_list != NULL) { + noti = notification_list_get_data(noti_list); + notification_delete(noti); + + noti_list = notification_list_remove(noti_list, noti); + notification_free(noti); + } +} -- 2.7.4 From 67aa722c93d712cab61743f5017e0a866d637d49 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Mon, 3 Aug 2015 21:18:25 +0900 Subject: [PATCH 04/16] Fix minor issues Change-Id: I117372a06953dc7733856ae6576a501b8a5b95c0 Signed-off-by: jinwoo.shin --- src/notification_view.c | 1 + src/square_view.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/notification_view.c b/src/notification_view.c index ebec5bb..3224482 100644 --- a/src/notification_view.c +++ b/src/notification_view.c @@ -400,6 +400,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) elm_object_content_set(priv->base, scroller); elm_scroller_step_size_set(scroller, NOTIFICATION_CATEGORY_STEP_SIZE, 0); + elm_object_focus_allow_set(scroller, EINA_FALSE); priv->category_container = elm_box_add(scroller); elm_object_content_set(scroller, priv->category_container); diff --git a/src/square_view.c b/src/square_view.c index b34788a..8518e0f 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -79,7 +79,8 @@ static void _print_user_message(struct _priv *priv) passwd = getpwuid(uid); if (passwd) { snprintf(buf, sizeof(buf), - STR_DEFAULT_USER_MESSAGE, passwd->pw_name); + STR_DEFAULT_USER_MESSAGE, + passwd->pw_name); message = buf; } } @@ -391,9 +392,8 @@ static void _base_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev) { if (!strcmp(ev->keyname, KEY_BACK) || - !strcmp(ev->keyname, KEY_BACK_REMOTE)) { - ui_app_exit(); - } + !strcmp(ev->keyname, KEY_BACK_REMOTE)) + ui_app_exit(); } static void _button_key_up_cb(int id, void *data, Evas *e, -- 2.7.4 From a057d2f534fdee016695eb0162a8d9a96ef3f644 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Thu, 6 Aug 2015 11:11:36 +0900 Subject: [PATCH 05/16] Disable focus highlight Change-Id: If3e57247acb9928906d2ec1e88428ec21fc9b51c Signed-off-by: jinwoo.shin --- data/view/notification_view.edc | 1 + 1 file changed, 1 insertion(+) diff --git a/data/view/notification_view.edc b/data/view/notification_view.edc index 9e1012c..3f4c162 100644 --- a/data/view/notification_view.edc +++ b/data/view/notification_view.edc @@ -17,6 +17,7 @@ #include "../../include/define.h" group { + data.item: "focus_highlight" "on"; name: GRP_NOTIFICATION_VIEW; parts { part { -- 2.7.4 From ab4634229cac3245cb1d6485a7ff9e86c18483ba Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Fri, 7 Aug 2015 18:33:31 +0900 Subject: [PATCH 06/16] Add square view launch Change-Id: Idfb4a2e6db6f3d3f95a5f88ba843938f4fc467e8 Signed-off-by: jinwoo.shin --- src/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index d854735..ea9344a 100644 --- a/src/main.c +++ b/src/main.c @@ -23,6 +23,9 @@ #include "notification_view.h" #include "square_view.h" +#define KEY_LAUNCH_TYPE "launch_type" +#define TYPE_SQUARE "infosquare" + SET_TAG(PACKAGE) struct _appdata { @@ -115,6 +118,8 @@ static void _terminate(void *data) static void _control(app_control_h control, void *data) { struct _appdata *ad; + int r; + char *type = NULL; if (!data) { _ERR("failed to get data"); @@ -126,7 +131,12 @@ static void _control(app_control_h control, void *data) if (ad->win) elm_win_activate(ad->win); - viewmgr_push_view(NOTIFICATION_VIEW); + r = app_control_get_extra_data(control, KEY_LAUNCH_TYPE, &type); + if (r == SERVICE_ERROR_NONE && + type && !strcmp(type, TYPE_SQUARE)) + viewmgr_push_view(SQUARE_VIEW); + else + viewmgr_push_view(NOTIFICATION_VIEW); } int main(int argc, char *argv[]) -- 2.7.4 From 6b0a168b9e63acef66fe0fe1264b63bc6863a51d Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Tue, 11 Aug 2015 14:10:44 +0900 Subject: [PATCH 07/16] Disable focus highlight effect Change-Id: I50069db8ada894a1c253316842ad8d991ffe574c Signed-off-by: jinwoo.shin --- data/view/notification_view.edc | 1 + data/view/square_view.edc | 3 +++ 2 files changed, 4 insertions(+) diff --git a/data/view/notification_view.edc b/data/view/notification_view.edc index 3f4c162..165c641 100644 --- a/data/view/notification_view.edc +++ b/data/view/notification_view.edc @@ -287,6 +287,7 @@ group { } group { + data.item: "focus_highlight" "on"; name: GRP_NOTIFICATION_CLEAR; images { image, "btn_bar_clearall_dis.png" COMP; diff --git a/data/view/square_view.edc b/data/view/square_view.edc index 6929c86..1ac51f1 100644 --- a/data/view/square_view.edc +++ b/data/view/square_view.edc @@ -512,6 +512,7 @@ group { } group { + data.item: "focus_highlight" "on"; name: GRP_NOTIFICATION_ITEM; parts { part { @@ -666,6 +667,7 @@ group { } group { + data.item: "focus_highlight" "on"; name: GRP_NOTIFICATION_LAUNCH; parts { part { @@ -758,6 +760,7 @@ group { } group { + data.item: "focus_highlight" "on"; name: GRP_SQUARE_NOTIFICATION_CLEAR; images { image, "btn_noti_list_clearall_dis.png" COMP; -- 2.7.4 From c5ef910490f5af3a862387a2ba2fe92b9bb0e6ed Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Tue, 11 Aug 2015 14:29:06 +0900 Subject: [PATCH 08/16] fix systemd service file to notification-display Change-Id: I9dc9ff76882deef58f895a8b45aa80aec5765332 Signed-off-by: Minkyu Kang --- daemon/notification-display.path | 5 +++++ daemon/notification-display.service | 3 --- packaging/org.tizen.infosquare.spec | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 daemon/notification-display.path diff --git a/daemon/notification-display.path b/daemon/notification-display.path new file mode 100644 index 0000000..6adbaaa --- /dev/null +++ b/daemon/notification-display.path @@ -0,0 +1,5 @@ +[Unit] +Description=This path will tell you that service is ready to launch + +[Path] +PathExists=/run/.wm_ready diff --git a/daemon/notification-display.service b/daemon/notification-display.service index 3907696..07cfdc6 100644 --- a/daemon/notification-display.service +++ b/daemon/notification-display.service @@ -1,7 +1,5 @@ [Unit] Description=Notifications Display daemon -Requires=notifications.service display-manager-run.service tizen-system-env.service -After=notifications.service display-manager-run.service [Service] Type=simple @@ -11,4 +9,3 @@ Restart=always [Install] WantedBy=default.target - diff --git a/packaging/org.tizen.infosquare.spec b/packaging/org.tizen.infosquare.spec index bc897e2..84b88fd 100644 --- a/packaging/org.tizen.infosquare.spec +++ b/packaging/org.tizen.infosquare.spec @@ -48,7 +48,8 @@ make %{?jobs:-j%jobs} install --directory %{buildroot}/%{_datadir} mkdir -p %{buildroot}/%{_unitdir_user}/default.target.wants install -m 0644 daemon/notification-display.service %{buildroot}/%{_unitdir_user}/notification-display.service -ln -sf ../notification-display.service %{buildroot}/%{_unitdir_user}/default.target.wants/notification-display.service +install -m 0644 daemon/notification-display.path %{buildroot}/%{_unitdir_user}/notification-display.path +ln -sf ../notification-display.path %{buildroot}/%{_unitdir_user}/default.target.wants/notification-display.path %clean rm -rf %{buildroot} @@ -60,5 +61,6 @@ rm -rf %{buildroot} %{_servicedir}/* %{_datadir} %{_manifestdir}/%{name}.xml -%{_unitdir_user}/default.target.wants/notification-display.service +%{_unitdir_user}/default.target.wants/notification-display.path %{_unitdir_user}/notification-display.service +%{_unitdir_user}/notification-display.path -- 2.7.4 From 73735c5f3c9864128bd2fbcfa1c1540411a783fa Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Tue, 25 Aug 2015 13:22:30 +0900 Subject: [PATCH 09/16] Add detail popup Change-Id: I09dc3df16ee3d28a0449a87c18eb82d8a1207287 Signed-off-by: jinwoo.shin --- daemon/notification_display_service.c | 24 +------- data/widget/gengrid.edc | 2 - src/main.c | 1 - src/notification_view.c | 107 ++++++++++++++++++++++++++++++++-- src/square_view.c | 2 + src/util.c | 9 +-- 6 files changed, 106 insertions(+), 39 deletions(-) diff --git a/daemon/notification_display_service.c b/daemon/notification_display_service.c index 09699b3..ebc890b 100644 --- a/daemon/notification_display_service.c +++ b/daemon/notification_display_service.c @@ -69,24 +69,6 @@ void _notification_changed_cb(void *data, notification_type_e notif_type) notification_free_list(noti_list); } -static void _clear_notification(void) -{ - notification_list_h noti_list = NULL; - notification_h noti; - - notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list); - if (!noti_list) - return; - - while (noti_list != NULL) { - noti = notification_list_get_data(noti_list); - notification_delete(noti); - - noti_list = notification_list_remove(noti_list, noti); - notification_free(noti); - } -} - time_t _get_last_time(void) { time_t last_time = 0; @@ -96,9 +78,8 @@ time_t _get_last_time(void) notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list); if (noti_list) { noti = notification_list_get_data(noti_list); - if (noti) { + if (noti) notification_get_insert_time(noti, &last_time); - } } notification_free_list(noti_list); @@ -159,9 +140,6 @@ int main(int argc, char **argv) return 0; } - /* NOTE: Odroid specific code to workaround time issue */ - _clear_notification(); - priv->last_time = _get_last_time(); error_n = NOTIFICATION_ERROR_SERVICE_NOT_READY; diff --git a/data/widget/gengrid.edc b/data/widget/gengrid.edc index b2cc004..6d0483b 100644 --- a/data/widget/gengrid.edc +++ b/data/widget/gengrid.edc @@ -661,14 +661,12 @@ group { source: "elm"; action: STATE_SET "selected" 0.0; target: "map"; - transition: DECELERATE 0.2; after: "after_selected"; } program { name: "after_selected"; action: STATE_SET "default" 0.0; target: "map"; - transition: DECELERATE 0.2; after: "item_selected"; } program { diff --git a/src/main.c b/src/main.c index ea9344a..645931f 100644 --- a/src/main.c +++ b/src/main.c @@ -85,7 +85,6 @@ static bool _create(void *data) return false; } - elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN); viewmgr_add_view(notification_view_get_vclass(), NULL); viewmgr_add_view(square_view_get_vclass(), NULL); diff --git a/src/notification_view.c b/src/notification_view.c index 3224482..7cca825 100644 --- a/src/notification_view.c +++ b/src/notification_view.c @@ -38,6 +38,19 @@ #define NOTIFICATION_ITEM_PADDING 26 #define NOTIFICATION_ITEMS_IN_COL 4.0 +#define SIG_ITEM_FOCUSED "item,focused" +#define SIG_ITEM_UNFOCUSED "item,unfocused" + +enum _update_type { + UPDATE_TYPE_SHOW_POPUP, +}; + +enum _obj_id { + OBJ_CLEAR, + OBJ_TITLE, + OBJ_GRID +}; + enum notification_category { CATEGORY_FIRST = 0, CATEGORY_TODAY = CATEGORY_FIRST, @@ -72,6 +85,8 @@ static void _clear_mouse_up_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Up *ev); static void _category_unfocused_cb(int id, void *data, Evas_Object *obj, Elm_Object_Item *it); +static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Move *ev); static input_handler base_handler = { .key_up = _base_key_up_cb, @@ -83,6 +98,9 @@ static input_handler clear_handler = { static input_handler category_handler = { .unfocused = _category_unfocused_cb, }; +static input_handler focus_handler = { + .mouse_move = _mouse_move, +}; static const char *_get_category_title(int category) { @@ -108,6 +126,23 @@ static const char *_get_category_title(int category) } } +static void _show_popup(void *data) +{ + viewmgr_update_view(NOTIFICATION_VIEW, + UPDATE_TYPE_SHOW_POPUP, data); +} + +static void _grid_select(void *data, Evas_Object *obj, void *event_info) +{ + notification_h noti; + + noti = elm_object_item_data_get(event_info); + if (!noti) + return; + + ecore_job_add(_show_popup, noti); +} + static Evas_Object *_add_category_title(Evas_Object *base, int category) { Evas_Object *btn; @@ -145,6 +180,7 @@ static Evas_Object *_add_category_grid(Evas_Object *base) elm_gengrid_horizontal_set(grid, EINA_TRUE); evas_object_size_hint_weight_set(grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_ALWAYS); elm_object_content_set(base, grid); @@ -194,7 +230,9 @@ static void _draw_category(struct _priv *priv, int category) elm_object_focus_next_object_set(grid, grid, ELM_FOCUS_RIGHT); inputmgr_add_callback(title, category, &category_handler, priv); + inputmgr_add_callback(title, OBJ_TITLE, &focus_handler, NULL); inputmgr_add_callback(grid, category, &category_handler, priv); + inputmgr_add_callback(grid, OBJ_GRID, &focus_handler, NULL); elm_box_pack_end(priv->category_container, ly); evas_object_show(grid); @@ -216,6 +254,7 @@ static void _draw_notification(struct _priv *priv, int category, notification_list_h ongoing_list, notification_list_h noti_list) { notification_h noti; + Elm_Object_Item *it; int count = 0, col, w; if (category < CATEGORY_FIRST || @@ -233,8 +272,9 @@ static void _draw_notification(struct _priv *priv, int category, while (ongoing_list != NULL) { noti = notification_list_get_data(ongoing_list); - elm_gengrid_item_append(priv->category[category]->grid, - priv->grid_class, noti, NULL, noti); + it = elm_gengrid_item_append(priv->category[category]->grid, + priv->grid_class, noti, _grid_select, priv); + elm_object_item_data_set(it, noti); ongoing_list = notification_list_remove(ongoing_list, noti); count++; @@ -242,8 +282,9 @@ static void _draw_notification(struct _priv *priv, int category, while (noti_list != NULL) { noti = notification_list_get_data(noti_list); - elm_gengrid_item_append(priv->category[category]->grid, - priv->grid_class, noti, NULL, noti); + it = elm_gengrid_item_append(priv->category[category]->grid, + priv->grid_class, noti, _grid_select, priv); + elm_object_item_data_set(it, noti); noti_list = notification_list_remove(noti_list, noti); count++; @@ -400,7 +441,6 @@ static Evas_Object *_create(Evas_Object *win, void *data) elm_object_content_set(priv->base, scroller); elm_scroller_step_size_set(scroller, NOTIFICATION_CATEGORY_STEP_SIZE, 0); - elm_object_focus_allow_set(scroller, EINA_FALSE); priv->category_container = elm_box_add(scroller); elm_object_content_set(scroller, priv->category_container); @@ -409,6 +449,8 @@ static Evas_Object *_create(Evas_Object *win, void *data) elm_box_padding_set(priv->category_container, NOTIFICATION_CATEGORY_PADDING_X, NOTIFICATION_CATEGORY_PADDING_Y); + elm_object_focus_allow_set(scroller, EINA_FALSE); + elm_object_focus_allow_set(priv->category_container, EINA_FALSE); priv->clear_btn = elm_layout_add(priv->base); elm_layout_file_set(priv->clear_btn, EDJEFILE, GRP_NOTIFICATION_CLEAR); @@ -417,6 +459,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) PART_NOTIFICATION_CLEAR, priv->clear_btn); evas_object_show(priv->clear_btn); inputmgr_add_callback(priv->clear_btn, 0, &clear_handler, NULL); + inputmgr_add_callback(priv->clear_btn, OBJ_CLEAR, &focus_handler, NULL); priv->grid_class = elm_gengrid_item_class_new(); priv->grid_class->item_style = STYLE_GRID_ITEM; @@ -439,6 +482,8 @@ static void _show(void *view_data) return; } + elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK); + priv = (struct _priv *) view_data; evas_object_show(priv->base); @@ -487,8 +532,12 @@ static void _destroy(void *view_data) if (priv->category[i]) { inputmgr_remove_callback(priv->category[i]->title, &category_handler); + inputmgr_remove_callback(priv->category[i]->title, + &focus_handler); inputmgr_remove_callback(priv->category[i]->grid, &category_handler); + inputmgr_remove_callback(priv->category[i]->grid, + &focus_handler); free(priv->category[i]); } } @@ -496,12 +545,37 @@ static void _destroy(void *view_data) free(priv); } +static void _update(void *view_data, int type, void *data) +{ + struct _priv *priv; + notification_h noti; + + if (!view_data) { + _ERR("failed to get view data"); + return; + } + + priv = view_data; + + switch (type) { + case UPDATE_TYPE_SHOW_POPUP: + noti = data; + + if (!noti) + return; + + util_show_notification_popup(priv->base, noti); + break; + } +} + static view_class vclass = { .view_id = NOTIFICATION_VIEW, .create = _create, .show = _show, .hide = _hide, .destroy = _destroy, + .update = _update, }; static void _base_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, @@ -544,6 +618,29 @@ static void _category_unfocused_cb(int id, void *data, priv->category[id]->title, ELM_FOCUS_DOWN); } +static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Move *ev) +{ + Elm_Object_Item *it; + + switch (id) { + case OBJ_GRID: + it = elm_gengrid_at_xy_item_get(obj, ev->cur.canvas.x, + ev->cur.canvas.y, NULL, NULL); + + if (!it) + return; + + if (!elm_object_item_focus_get(it)) + elm_object_item_focus_set(it, EINA_TRUE); + break; + case OBJ_CLEAR: + case OBJ_TITLE: + elm_object_focus_set(obj, EINA_TRUE); + break; + } +} + view_class *notification_view_get_vclass(void) { return &vclass; diff --git a/src/square_view.c b/src/square_view.c index 8518e0f..6511f63 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -340,6 +340,8 @@ static void _show(void *view_data) return; } + elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN); + priv = (struct _priv *) view_data; _print_info(priv); diff --git a/src/util.c b/src/util.c index 90fe646..587eccf 100644 --- a/src/util.c +++ b/src/util.c @@ -50,17 +50,11 @@ static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, static void _clicked(int id, void *data, Evas_Object *obj) { - notification_h noti; - if (!data) return; switch (id) { case BUTTON_OK: - noti = evas_object_data_get(data, KEY_NOTI); - if (noti) - notification_delete(noti); - inputmgr_remove_callback(data, &popup_handler); evas_object_del(data); break; @@ -79,6 +73,7 @@ Evas_Object *util_show_notification_popup( _ERR("create popup failed"); return NULL; } + evas_object_show(popup); notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &title); elm_object_part_text_set(popup, "title,text", title); @@ -96,8 +91,6 @@ Evas_Object *util_show_notification_popup( evas_object_show(btn1); elm_object_focus_set(btn1, EINA_TRUE); - evas_object_show(popup); - return popup; } -- 2.7.4 From 1c7798b0db97f1b518eb26e4f0f7b45dab95cdf0 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Wed, 26 Aug 2015 16:32:09 +0900 Subject: [PATCH 10/16] Fix info square view bugs - Subsitute layout selection event from key down/mouse down to clicked - Fix focus issues Change-Id: Iafaeb91ac0ecb2a525b67c1d23fbef00163208ee Signed-off-by: jinwoo.shin --- data/view/square_view.edc | 349 --------------------------------------- data/widget/button.edc | 404 ++++++++++++++++++++++++++++++++++++++++++++++ src/main.c | 1 + src/notification_view.c | 2 - src/square_view.c | 120 ++++++++------ 5 files changed, 472 insertions(+), 404 deletions(-) diff --git a/data/view/square_view.edc b/data/view/square_view.edc index 1ac51f1..3b60f2d 100644 --- a/data/view/square_view.edc +++ b/data/view/square_view.edc @@ -510,352 +510,3 @@ group { } } } - -group { - data.item: "focus_highlight" "on"; - name: GRP_NOTIFICATION_ITEM; - parts { - part { - name, "border_bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - min, 490 112; - color, 51 51 51 255; - visible, 1; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - color, 64 171 233 255; - } - } - part { - name, "bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "border_bg"; - relative, 0.5 0.5; - } - rel2 { - to, "border_bg"; - relative, 0.5 0.5; - } - min, 486 108; - color, 0 0 0 255; - align, 0.5 0.5; - fixed, 1 1; - visible, 1; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - min, 482 104; - color, 46 46 46 255; - } - } - part { - name, "padding.icon"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 0.0 0.0; - rel2.relative, 0.0 0.0; - min, 28 0; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, PART_ICON; - type, SWALLOW; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to_x, "padding.icon"; - relative, 1.0 0.5; - } - rel2 { - to_x, "padding.icon"; - relative, 1.0 0.5; - } - color, 255 255 255 153; - align, 0.0 0.5; - min, 54 54; - fixed, 1 1; - visible, 1; - } - } - part { - name, "padding.text"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to_x, PART_ICON; - relative, 1.0 0.5; - } - rel2 { - to_x, PART_ICON; - relative, 1.0 0.5; - } - min, 26 0; - align, 0.0 0.0; - fixed, 1 1; - } - } - part { - name, PART_TITLE; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.text"; - relative, 1.0 0.5; - } - rel2 { - to, "padding.text"; - relative, 1.0 0.5; - } - text { - font, FONT_LIGHT; - size, 28; - align, 0.0 0.5; - } - color, 255 255 255 128; - min, 356 0; - align, 0.0 0.5; - fixed, 1 1; - visible, 1; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - color, 255 255 255 255; - text.font, FONT_REGULAR; - } - } - } - programs { - program { - name, "focused"; - signal, SIGNAL_FOCUSED; - source, SOURCE_ELM; - action, STATE_SET "focused" 0.0; - target, "border_bg"; - target, "bg"; - target, PART_TITLE; - } - program { - name, "unfocused"; - signal, SIGNAL_UNFOCUSED; - source, SOURCE_ELM; - action, STATE_SET "default" 0.0; - target, "border_bg"; - target, "bg"; - target, PART_TITLE; - } - } -} - -group { - data.item: "focus_highlight" "on"; - name: GRP_NOTIFICATION_LAUNCH; - parts { - part { - name, "border_bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - color, 48 48 48 255; - align, 0.5 0.5; - min, 376 66; - fixed, 1 1; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - color, 64 171 233 255; - } - } - part { - name, "bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "border_bg"; - relative, 0.5 0.5; - } - rel2 { - to, "border_bg"; - relative, 0.5 0.5; - } - color, 48 48 48 255; - align, 0.5 0.5; - min, 368 58; - fixed, 1 1; - } - } - part { - name, PART_TITLE; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - text { - font, FONT_LIGHT; - text, STR_SQUARE_TITLE; - size, 36; - align, 0.5 0.5; - min, 1 1; - ellipsis, -1; - } - color, 255 255 255 179; - align, 0.0 0.0; - fixed, 1 1; - visible, 1; - } - } - } - programs { - program { - name, "disabled"; - signal, SIGNAL_DISABLED; - source, SOURCE_ELM; - action, STATE_SET "disabled" 0.0; - target, "border_bg"; - target, "bg"; - target, PART_TITLE; - } - program { - name, "focused"; - signal, SIGNAL_FOCUSED; - source, SOURCE_ELM; - action, STATE_SET "focused" 0.0; - target, "border_bg"; - target, "bg"; - target, PART_TITLE; - } - program { - name, "unfocused"; - signal, SIGNAL_UNFOCUSED; - source, SOURCE_ELM; - action, STATE_SET "default" 0.0; - target, "border_bg"; - target, "bg"; - target, PART_TITLE; - } - } -} - -group { - data.item: "focus_highlight" "on"; - name: GRP_SQUARE_NOTIFICATION_CLEAR; - images { - image, "btn_noti_list_clearall_dis.png" COMP; - image, "btn_noti_list_clearall_foc.png" COMP; - image, "btn_noti_list_clearall_nor.png" COMP; - } - parts { - part { - name, "border_bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - color, 48 48 48 255; - align, 0.5 0.5; - min, 98 66; - fixed, 1 1; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - color, 64 171 233 255; - } - } - part { - name, "bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "border_bg"; - relative, 0.5 0.5; - } - rel2 { - to, "border_bg"; - relative, 0.5 0.5; - } - color, 48 48 48 255; - align, 0.5 0.5; - min, 90 58; - fixed, 1 1; - } - } - part { - name, PART_ICON; - type, IMAGE; - scale, 1; - description { - state, "default" 0.0; - image.normal, "btn_noti_list_clearall_nor.png"; - align, 0.0 0.0; - fixed, 1 1; - visible, 1; - } - description { - state, "disabled" 0.0; - inherit, "default" 0.0; - image.normal, "btn_noti_list_clearall_dis.png"; - } - description { - state, "focused" 0.0; - inherit, "default" 0.0; - image.normal, "btn_noti_list_clearall_foc.png"; - } - } - } - programs { - program { - name, "disabled"; - signal, SIGNAL_DISABLED; - source, SOURCE_ELM; - action, STATE_SET "disabled" 0.0; - target, "border_bg"; - target, "bg"; - target, PART_ICON; - } - program { - name, "focused"; - signal, SIGNAL_FOCUSED; - source, SOURCE_ELM; - action, STATE_SET "focused" 0.0; - target, "border_bg"; - target, "bg"; - target, PART_ICON; - } - program { - name, "unfocused"; - signal, SIGNAL_UNFOCUSED; - source, SOURCE_ELM; - action, STATE_SET "default" 0.0; - target, "border_bg"; - target, "bg"; - target, PART_ICON; - } - } -} - diff --git a/data/widget/button.edc b/data/widget/button.edc index 4b2ec61..51baf19 100644 --- a/data/widget/button.edc +++ b/data/widget/button.edc @@ -102,6 +102,14 @@ group { color: COLOR_TEXT_FOCUS; } } + part { + name: "event"; + type: RECT; + description { + state: "default" 0.0; + color: 0 0 0 0; + } + } } programs { program { @@ -122,5 +130,401 @@ group { target: "elm.text"; transition: LINEAR TRANSITION_TIME; } + program { + name, "mouse_unclick_after"; + signal, "mouse,clicked,1"; + source, "event"; + action, SIGNAL_EMIT "elm,action,click" ""; + } + } +} + +group { + data.item: "focus_highlight" "on"; + name: "elm/button/base/square/notification_item"; + parts { + part { + name, "border_bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + min, 490 112; + color, 51 51 51 255; + visible, 1; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + color, 64 171 233 255; + } + } + part { + name, "bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "border_bg"; + relative, 0.5 0.5; + } + rel2 { + to, "border_bg"; + relative, 0.5 0.5; + } + min, 486 108; + color, 0 0 0 255; + align, 0.5 0.5; + fixed, 1 1; + visible, 1; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + min, 482 104; + color, 46 46 46 255; + } + } + part { + name, "padding.icon"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + rel1.relative, 0.0 0.0; + rel2.relative, 0.0 0.0; + min, 28 0; + align, 0.0 0.0; + fixed, 1 1; + } + } + part { + name, PART_ICON; + type, SWALLOW; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to_x, "padding.icon"; + relative, 1.0 0.5; + } + rel2 { + to_x, "padding.icon"; + relative, 1.0 0.5; + } + color, 255 255 255 153; + align, 0.0 0.5; + min, 54 54; + fixed, 1 1; + visible, 1; + } + } + part { + name, "padding.text"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to_x, PART_ICON; + relative, 1.0 0.5; + } + rel2 { + to_x, PART_ICON; + relative, 1.0 0.5; + } + min, 26 0; + align, 0.0 0.0; + fixed, 1 1; + } + } + part { + name, PART_TITLE; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "padding.text"; + relative, 1.0 0.5; + } + rel2 { + to, "padding.text"; + relative, 1.0 0.5; + } + text { + font, FONT_LIGHT; + size, 28; + align, 0.0 0.5; + } + color, 255 255 255 128; + min, 356 0; + align, 0.0 0.5; + fixed, 1 1; + visible, 1; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + color, 255 255 255 255; + text.font, FONT_REGULAR; + } + } + part { + name: "event"; + type: RECT; + description { + state: "default" 0.0; + color: 0 0 0 0; + } + } + } + programs { + program { + name, "focused"; + signal, SIGNAL_FOCUSED; + source, SOURCE_ELM; + action, STATE_SET "focused" 0.0; + target, "border_bg"; + target, "bg"; + target, PART_TITLE; + } + program { + name, "unfocused"; + signal, SIGNAL_UNFOCUSED; + source, SOURCE_ELM; + action, STATE_SET "default" 0.0; + target, "border_bg"; + target, "bg"; + target, PART_TITLE; + } + program { + name, "mouse_unclick_after"; + signal, "mouse,clicked,1"; + source, "event"; + action, SIGNAL_EMIT "elm,action,click" ""; + } + } +} + +group { + data.item: "focus_highlight" "on"; + name: "elm/button/base/square/notification_launch"; + parts { + part { + name, "border_bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 48 48 48 255; + align, 0.5 0.5; + min, 376 66; + fixed, 1 1; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + color, 64 171 233 255; + } + } + part { + name, "bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "border_bg"; + relative, 0.5 0.5; + } + rel2 { + to, "border_bg"; + relative, 0.5 0.5; + } + color, 48 48 48 255; + align, 0.5 0.5; + min, 368 58; + fixed, 1 1; + } + } + part { + name, PART_TITLE; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + text { + font, FONT_LIGHT; + text, STR_SQUARE_TITLE; + size, 36; + align, 0.5 0.5; + min, 1 1; + ellipsis, -1; + } + color, 255 255 255 179; + align, 0.0 0.0; + fixed, 1 1; + visible, 1; + } + } + part { + name: "event"; + type: RECT; + description { + state: "default" 0.0; + color: 0 0 0 0; + } + } + } + programs { + program { + name, "disabled"; + signal, SIGNAL_DISABLED; + source, SOURCE_ELM; + action, STATE_SET "disabled" 0.0; + target, "border_bg"; + target, "bg"; + target, PART_TITLE; + } + program { + name, "focused"; + signal, SIGNAL_FOCUSED; + source, SOURCE_ELM; + action, STATE_SET "focused" 0.0; + target, "border_bg"; + target, "bg"; + target, PART_TITLE; + } + program { + name, "unfocused"; + signal, SIGNAL_UNFOCUSED; + source, SOURCE_ELM; + action, STATE_SET "default" 0.0; + target, "border_bg"; + target, "bg"; + target, PART_TITLE; + } + program { + name, "mouse_unclick_after"; + signal, "mouse,clicked,1"; + source, "event"; + action, SIGNAL_EMIT "elm,action,click" ""; + } + } +} + +group { + data.item: "focus_highlight" "on"; + name: "elm/button/base/square/notification_clear"; + images { + image, "btn_noti_list_clearall_dis.png" COMP; + image, "btn_noti_list_clearall_foc.png" COMP; + image, "btn_noti_list_clearall_nor.png" COMP; + } + parts { + part { + name, "border_bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 48 48 48 255; + align, 0.5 0.5; + min, 98 66; + fixed, 1 1; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + color, 64 171 233 255; + } + } + part { + name, "bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "border_bg"; + relative, 0.5 0.5; + } + rel2 { + to, "border_bg"; + relative, 0.5 0.5; + } + color, 48 48 48 255; + align, 0.5 0.5; + min, 90 58; + fixed, 1 1; + } + } + part { + name, PART_ICON; + type, IMAGE; + scale, 1; + description { + state, "default" 0.0; + image.normal, "btn_noti_list_clearall_nor.png"; + align, 0.0 0.0; + fixed, 1 1; + visible, 1; + } + description { + state, "disabled" 0.0; + inherit, "default" 0.0; + image.normal, "btn_noti_list_clearall_dis.png"; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + image.normal, "btn_noti_list_clearall_foc.png"; + } + } + part { + name: "event"; + type: RECT; + description { + state: "default" 0.0; + color: 0 0 0 0; + } + } + } + programs { + program { + name, "disabled"; + signal, SIGNAL_DISABLED; + source, SOURCE_ELM; + action, STATE_SET "disabled" 0.0; + target, "border_bg"; + target, "bg"; + target, PART_ICON; + } + program { + name, "focused"; + signal, SIGNAL_FOCUSED; + source, SOURCE_ELM; + action, STATE_SET "focused" 0.0; + target, "border_bg"; + target, "bg"; + target, PART_ICON; + } + program { + name, "unfocused"; + signal, SIGNAL_UNFOCUSED; + source, SOURCE_ELM; + action, STATE_SET "default" 0.0; + target, "border_bg"; + target, "bg"; + target, PART_ICON; + } + program { + name, "mouse_unclick_after"; + signal, "mouse,clicked,1"; + source, "event"; + action, SIGNAL_EMIT "elm,action,click" ""; + } } } diff --git a/src/main.c b/src/main.c index 645931f..d704b39 100644 --- a/src/main.c +++ b/src/main.c @@ -72,6 +72,7 @@ static bool _create(void *data) ad = data; elm_theme_overlay_add(NULL, THEMEFILE); + elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK); win = _add_win(ad->name); if (!win) { diff --git a/src/notification_view.c b/src/notification_view.c index 7cca825..7fa9c39 100644 --- a/src/notification_view.c +++ b/src/notification_view.c @@ -482,8 +482,6 @@ static void _show(void *view_data) return; } - elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK); - priv = (struct _priv *) view_data; evas_object_show(priv->base); diff --git a/src/square_view.c b/src/square_view.c index 6511f63..883b068 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -30,13 +30,17 @@ #define NOTIFICATION_ITEM_PADDING_X 0 #define NOTIFICATION_ITEM_PADDING_Y 20 #define SIG_CHILD_REMOVED "child,removed" +#define STYLE_LAUNCH "square/notification_launch" +#define STYLE_CLEAR "square/notification_clear" +#define STYLE_ITEM "square/notification_item" static void _base_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev); -static void _button_key_up_cb(int id, void *data, - Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev); -static void _button_mouse_up_cb(int id, void *data, - Evas *e, Evas_Object *obj, Evas_Event_Mouse_Up *ev); +static void _button_clicked_cb(int id, void *data, Evas_Object *obj); +static void _button_focused_cb(int id, void *data, + Evas_Object *obj, Elm_Object_Item *it); +static void _button_mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Move *ev); static void _scroller_focused_cb(int id, void *data, Evas_Object *obj, Elm_Object_Item *it); static void _child_removed_cb(void *data, Evas_Object *obj, void *ei); @@ -46,6 +50,7 @@ struct _priv { Evas_Object *list; Evas_Object *clear_btn; Evas_Object *launch_btn; + Evas_Object *last_focused; Ecore_Timer *clock_timer; }; @@ -59,8 +64,9 @@ static input_handler base_handler = { .key_up = _base_key_up_cb, }; static input_handler button_handler = { - .key_up = _button_key_up_cb, - .mouse_up = _button_mouse_up_cb + .clicked = _button_clicked_cb, + .focused = _button_focused_cb, + .mouse_move = _button_mouse_move_cb }; static input_handler scroller_handler = { .focused = _scroller_focused_cb @@ -142,6 +148,7 @@ static void _update_list(struct _priv *priv) char *title = NULL, *icon_path = NULL; elm_box_clear(priv->list); + priv->last_focused = NULL; notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list); if (noti_list) { @@ -152,9 +159,8 @@ static void _update_list(struct _priv *priv) while (noti_list != NULL) { noti = notification_list_get_data(noti_list); - item = elm_layout_add(priv->list); - elm_layout_file_set(item, EDJEFILE, - GRP_NOTIFICATION_ITEM); + item = elm_button_add(priv->list); + elm_object_style_set(item, STYLE_ITEM); elm_object_focus_allow_set(item, EINA_TRUE); evas_object_data_set(item, KEY_NOTI, noti); inputmgr_add_callback(item, BUTTON_NOTIFICATION, @@ -182,6 +188,9 @@ static void _update_list(struct _priv *priv) evas_object_show(item); noti_list = notification_list_remove(noti_list, noti); + + if (!priv->last_focused) + priv->last_focused = item; } } else { elm_object_signal_emit(priv->base, @@ -242,9 +251,8 @@ static void _noti_changed_cb(void *data, notification_type_e type) static void _create_button(struct _priv *priv) { - priv->clear_btn = elm_layout_add(priv->base); - elm_layout_file_set(priv->clear_btn, - EDJEFILE, GRP_SQUARE_NOTIFICATION_CLEAR); + priv->clear_btn = elm_button_add(priv->base); + elm_object_style_set(priv->clear_btn, STYLE_CLEAR); elm_object_focus_allow_set(priv->clear_btn, EINA_TRUE); elm_object_part_content_set(priv->base, PART_NOTIFICATION_CLEAR, priv->clear_btn); @@ -252,9 +260,8 @@ static void _create_button(struct _priv *priv) inputmgr_add_callback(priv->clear_btn, BUTTON_CLEAR, &button_handler, priv); - priv->launch_btn = elm_layout_add(priv->base); - elm_layout_file_set(priv->launch_btn, - EDJEFILE, GRP_NOTIFICATION_LAUNCH); + priv->launch_btn = elm_button_add(priv->base); + elm_object_style_set(priv->launch_btn, STYLE_LAUNCH); elm_object_focus_allow_set(priv->launch_btn, EINA_TRUE); elm_object_part_content_set(priv->base, PART_NOTIFICATION_LAUNCH, priv->launch_btn); @@ -300,7 +307,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) elm_object_part_content_set(priv->base, PART_NOTIFICATION_LIST, scroller); evas_object_show(scroller); - inputmgr_add_callback(scroller, 0, &scroller_handler, NULL); + inputmgr_add_callback(scroller, 0, &scroller_handler, priv); priv->list = elm_box_add(priv->base); if (!priv->list) { @@ -340,8 +347,6 @@ static void _show(void *view_data) return; } - elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN); - priv = (struct _priv *) view_data; _print_info(priv); @@ -382,6 +387,8 @@ static void _destroy(void *view_data) priv = (struct _priv *) view_data; stop_clock_timer(priv); + evas_object_smart_callback_del(priv->list, SIG_CHILD_REMOVED, + _child_removed_cb); inputmgr_remove_callback(priv->clear_btn, &button_handler); inputmgr_remove_callback(priv->launch_btn, &button_handler); @@ -398,40 +405,7 @@ static void _base_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, ui_app_exit(); } -static void _button_key_up_cb(int id, void *data, Evas *e, - Evas_Object *obj, Evas_Event_Key_Up *ev) -{ - struct _priv *priv; - notification_h noti; - - switch (id) { - case BUTTON_CLEAR: - if (!strcmp(ev->keyname, KEY_ENTER) || - !strcmp(ev->keyname, KEY_ENTER_REMOTE)) - util_clear_notification(); - break; - case BUTTON_LAUNCH: - if (!strcmp(ev->keyname, KEY_ENTER) || - !strcmp(ev->keyname, KEY_ENTER_REMOTE)) - viewmgr_push_view(NOTIFICATION_VIEW); - break; - case BUTTON_NOTIFICATION: - if (!strcmp(ev->keyname, KEY_ENTER) || - !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { - priv = data; - noti = evas_object_data_get(obj, KEY_NOTI); - - if (!priv || !noti) - return; - - util_show_notification_popup(priv->base, noti); - } - break; - } -} - -static void _button_mouse_up_cb(int id, void *data, Evas *e, - Evas_Object *obj, Evas_Event_Mouse_Up *ev) +static void _button_clicked_cb(int id, void *data, Evas_Object *obj) { struct _priv *priv; notification_h noti; @@ -455,10 +429,48 @@ static void _button_mouse_up_cb(int id, void *data, Evas *e, } } +static void _button_focused_cb(int id, void *data, + Evas_Object *obj, Elm_Object_Item *it) +{ + struct _priv *priv; + + if (!data) + return; + + priv = data; + + if (id == BUTTON_NOTIFICATION) + priv->last_focused = obj; +} + +static void _button_mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Move *ev) +{ + struct _priv *priv; + + if (!data || !obj) + return; + + priv = data; + + if (id == BUTTON_NOTIFICATION) + priv->last_focused = obj; + + elm_object_focus_set(obj, EINA_TRUE); +} + static void _scroller_focused_cb(int id, void *data, Evas_Object *obj, Elm_Object_Item *it) { - elm_object_focus_next(obj, ELM_FOCUS_DOWN); + struct _priv *priv; + + if (!data) + return; + + priv = data; + + if (priv->last_focused) + elm_object_focus_set(priv->last_focused, EINA_TRUE); } static void _child_removed_cb(void *data, Evas_Object *obj, void *ei) @@ -472,6 +484,8 @@ static void _child_removed_cb(void *data, Evas_Object *obj, void *ei) noti = evas_object_data_del(item, KEY_NOTI); if (noti) notification_free(noti); + + inputmgr_remove_callback(obj, &button_handler); } static view_class vclass = { -- 2.7.4 From 209b1453e7118ccfcea735cf0fc5446a580a610a Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Fri, 28 Aug 2015 13:51:20 +0900 Subject: [PATCH 11/16] Add action menu Change-Id: Ide6971531fa7a0d4009be3ba226c33c9dbf0c3b8 Signed-off-by: jinwoo.shin --- CMakeLists.txt | 1 + data/infosquare.edc | 1 + data/view/action_menu_view.edc | 177 ++++++++ data/widget/button.edc | 995 +++++++++++++++++++++++++++++++++++++++++ images/btn_menu_clear_dis.png | Bin 0 -> 1574 bytes images/btn_menu_clear_foc.png | Bin 0 -> 1528 bytes images/btn_menu_clear_nor.png | Bin 0 -> 1598 bytes images/btn_menu_clear_sel.png | Bin 0 -> 1608 bytes include/action_menu_view.h | 22 + include/define.h | 24 + include/strings.h | 3 + include/util.h | 4 + src/action_menu_view.c | 536 ++++++++++++++++++++++ src/main.c | 3 + src/notification_view.c | 80 +++- src/square_view.c | 6 +- src/util.c | 57 +++ 17 files changed, 1895 insertions(+), 14 deletions(-) create mode 100644 data/view/action_menu_view.edc create mode 100644 images/btn_menu_clear_dis.png create mode 100644 images/btn_menu_clear_foc.png create mode 100644 images/btn_menu_clear_nor.png create mode 100644 images/btn_menu_clear_sel.png create mode 100644 include/action_menu_view.h create mode 100644 src/action_menu_view.c diff --git a/CMakeLists.txt b/CMakeLists.txt index a6785e6..399f7f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ ENDIF(NOT DEFINED MANIFESTDIR) SET(SRCS src/main.c src/notification_view.c src/square_view.c + src/action_menu_view.c src/util.c) SET(TARGET_EDJ "${PROJECT_NAME}.edj") diff --git a/data/infosquare.edc b/data/infosquare.edc index d8587fa..b400846 100644 --- a/data/infosquare.edc +++ b/data/infosquare.edc @@ -19,4 +19,5 @@ collections { #include "view/notification_view.edc" #include "view/square_view.edc" + #include "view/action_menu_view.edc" } diff --git a/data/view/action_menu_view.edc b/data/view/action_menu_view.edc new file mode 100644 index 0000000..03867a3 --- /dev/null +++ b/data/view/action_menu_view.edc @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + */ + +group { + name, GRP_VIEW_ACTION_MENU; + parts { + part { + name, "bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 0 0 0 150; + } + } + part { + name, "menu_area"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 255 255 255 255; + rel1.relative, 1.0 0.0; + min, 500 0; + align, 1.0 0.0; + fixed, 1 1; + } + } + + part { + name, "view.divider"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 0 0 0 25; + rel1.to, "menu_area"; + rel2 { + to, "menu_area"; + relative, 0.0 1.0; + } + min, 1 0; + align, 1.0 0.5; + fixed, 1 0; + } + } + + part { + name, "padding.livetv.btn"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + rel1.to, "menu_area"; + rel2 { + to, "menu_area"; + relative, 1.0 0.0; + } + min, 0 118; + align, 0.5 0.0; + fixed, 0 1; + } + } + + part { + name, PART_TOP_BUTTON; + type, SWALLOW; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "padding.livetv.btn"; + relative, 0.5 0.5; + } + rel2 { + to, "padding.livetv.btn"; + relative, 0.5 0.5; + } + min, 327 64; + align, 0.5 0.5; + fixed, 1 1; + } + } + + part { + name, "padding.menu.divider.up"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 224 224 224 255; + rel1 { + to, "padding.livetv.btn"; + relative, 0.0 1.0; + } + rel2.to, "padding.livetv.btn"; + min, 0 1; + align, 0.5 1.0; + fixed, 0 1; + } + } + + part { + name, "part.menu.bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, PART_MENU; + relative, 0.0 0.0; + } + rel2 { + to, PART_MENU; + relative, 1.0 1.0; + } + align, 0.0 0.0; + fixed, 1 1; + color, 224 224 224 255; + } + } + + part { + name, PART_MENU; + type, SWALLOW; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "padding.menu.divider.up"; + relative, 0.0 1.0; + } + rel2 { + to, "padding.menu.divider.up"; + relative, 0.0 1.0; + } + min, 500 0; + align, 0.0 0.0; + fixed, 1 1; + } + } + + part { + name, "padding.menu.divider.down"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 224 224 224 255; + rel1 { + to, PART_MENU; + relative, 0.0 1.0; + } + rel2 { + to, PART_MENU; + relative, 0.0 1.0; + } + min, 500 1; + align, 0.0 0.0; + fixed, 1 1; + } + } + } +} diff --git a/data/widget/button.edc b/data/widget/button.edc index 51baf19..e81b05e 100644 --- a/data/widget/button.edc +++ b/data/widget/button.edc @@ -528,3 +528,998 @@ group { } } } + +group { + name, "elm/button/base/style.livetv.button"; + data.item, "focus_highlight" "on"; + parts { + part { + name, "part.bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + min, 0 64; + } + description { + state: "focused" 0.0; + inherit: "default" 0.0; + color: 0 119 246 255; + } + } + + part { + name, "padding.text.left"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 20 0; + rel1.to, "part.bg"; + rel2 { + to, "part.bg"; + relative, 0.0 1.0; + } + align, 0.0 0.5; + fixed, 1 0; + } + } + + part { + name, "padding.text.right"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 20 0; + rel1 { + to, "part.bg"; + relative, 1.0 0.0; + } + rel2.to, "part.bg"; + align, 1.0 0.5; + fixed, 1 0; + } + } + + part { + name, "elm.text"; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + color, 87 87 87 255; + rel1 { + to, "padding.text.left"; + relative, 1.0 0.0; + } + rel2 { + to, "padding.text.right"; + relative, 0.0 1.0; + } + text { + font, FONT_LIGHT; + size, 28; + align, 0.5 0.5; + } + } + description { + state: "focused" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + } + description { + state: "disabled" 0.0; + inherit: "default" 0.0; + color: 87 87 87 128; + } + } + + part { + name, "part.inside.line.up"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 194 194 194 255; + rel1.to, "part.bg"; + rel2 { + to, "part.bg"; + relative, 1.0 0.0; + } + min, 0 1; + align, 0.5 0.0; + fixed, 0 1; + } + } + + part { + name, "part.inside.line.left"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 194 194 194 255; + rel1 { + to, "part.inside.line.up"; + relative, 0.0 1.0; + } + rel2 { + to, "part.bg"; + relative, 0.0 1.0; + } + min, 1 0; + align, 0.0 0.5; + fixed, 1 0; + } + } + + part { + name, "part.inside.line.down"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 194 194 194 255; + rel1 { + to, "part.inside.line.left"; + relative, 1.0 1.0; + } + rel2.to, "part.bg"; + min, 0 1; + align, 0.5 1.0; + fixed, 0 1; + } + } + + part { + name, "part.inside.line.right"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 194 194 194 255; + rel1 { + to, "part.inside.line.up"; + relative, 1.0 1.0; + } + rel2 { + to, "part.inside.line.down"; + relative, 1.0 0.0; + } + min, 1 0; + align, 1.0 0.5; + fixed, 1 0; + } + } + } + programs { + program { + name: "disabled"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "part.bg"; + target: "elm.text"; + } + program { + name: "focused"; + signal: "elm,action,focus"; + source: "elm"; + action: STATE_SET "focused" 0.0; + target: "part.bg"; + target: "elm.text"; + } + program { + name: "unfocused"; + signal: "elm,action,unfocus"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "part.bg"; + target: "elm.text"; + } + } +} + +#define DEFAULT 1 +#define SELECTED 2 +#define FOCUSED 3 +#define DISABLED 4 + +group { + name, "elm/button/base/style.action.menu.button"; + data.item, "focus_highlight" "on"; + script { + public is_toggle, is_selected, is_enabled, is_focused, is_init, cur_state; + + public init_values() { + if(get_int(is_init)==0) + { + set_int(is_toggle, 0); + set_int(is_enabled, 1); + set_int(is_focused, 0); + set_int(is_init, 1); + set_int(cur_state, -1); + } + } + public set_states() { + new togg; + new enab; + new foc; + new sel; + new c_state; + togg = get_int(is_toggle); + enab = get_int(is_enabled); + foc = get_int(is_focused); + sel = get_int(is_selected); + c_state = get_int(cur_state); + + if(enab == 0) + { + if(c_state != DISABLED) + { + if (togg == 0) + { + run_program(PROGRAM:"do_disable"); + run_program(PROGRAM:"do_hide.1"); + } + else { + run_program(PROGRAM:"do_disable.1"); + run_program(PROGRAM:"do_hide"); + } + } + } + else + { + if(foc == 1) + { + if(c_state != FOCUSED) + { + if (togg == 0) + { + run_program(PROGRAM:"do_focus"); + run_program(PROGRAM:"do_hide.1"); + } + else { + run_program(PROGRAM:"do_focus.1"); + run_program(PROGRAM:"do_hide"); + } + } + } + else if(sel == 1) + { + if(c_state != SELECTED) + { + if (togg == 0) + { + run_program(PROGRAM:"do_select"); + run_program(PROGRAM:"do_hide.1"); + } + else { + run_program(PROGRAM:"do_select.1"); + run_program(PROGRAM:"do_hide"); + } + } + } + else + { + if(c_state != DEFAULT) + { + if (togg == 0) + { + run_program(PROGRAM:"do_default"); + run_program(PROGRAM:"do_hide.1"); + } + else { + run_program(PROGRAM:"do_default.1"); + run_program(PROGRAM:"do_hide"); + } + } + } + } + } + } + parts { + part { + name, "part.bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + min, 124 124; + color, 255 255 255 255; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + color, 0 119 246 255; + } + } + + part { + name, "padding.icon1"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + rel1.to, "part.bg"; + rel2 { + to, "part.bg"; + relative, 1.0 0.0; + } + min, 0 14; + align, 0.5 0.0; + fixed, 0 1; + } + } + + part { + name, "padding.icon2"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "part.bg"; + relative, 0.0 1.0; + } + rel2.to, "part.bg"; + min, 0 50; + align, 0.5 1.0; + fixed, 0 1; + } + } + + part { + name, "part.icon.bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "padding.icon1"; + relative, 0.0 1.0; + } + rel2 { + to, "padding.icon2"; + relative, 1.0 0.0; + } + align, 0.5 0.5; + min, 60 60; + } + } + + part { + name, "elm.swallow.icon"; + type, SWALLOW; + scale, 1; + clip_to: "part.icon.bg"; + description { + state, "default" 0.0; + aspect, 1.0 1.0; + aspect_preference, BOTH; + rel1 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + rel2 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + align, 0.5 0.5; + fixed, 1 1; + min, 60 60; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "selected" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "disabled" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "invisible" 0.0; + inherit, "default" 0.0; + visible, 0; + } + } + part { + name, "elm.swallow.icon.focus"; + type, SWALLOW; + scale, 1; + clip_to: "part.icon.bg"; + description { + state, "default" 0.0; + aspect: 1.0 1.0; + aspect_preference: BOTH; + rel1 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + rel2 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + align, 0.5 0.5; + fixed, 1 1; + min, 60 60; + visible, 0; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + visible, 1; + } + description { + state, "selected" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "disabled" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "invisible" 0.0; + inherit, "default" 0.0; + visible, 0; + } + } + part { + name, "elm.swallow.icon.select"; + type, SWALLOW; + scale, 1; + clip_to: "part.icon.bg"; + description { + state, "default" 0.0; + aspect: 1.0 1.0; + aspect_preference: BOTH; + rel1 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + rel2 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + align, 0.5 0.5; + fixed, 1 1; + min, 60 60; + visible, 0; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "selected" 0.0; + inherit, "default" 0.0; + visible, 1; + } + description { + state, "disabled" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "invisible" 0.0; + inherit, "default" 0.0; + visible, 0; + } + } + part { + name, "elm.swallow.icon.disable"; + type, SWALLOW; + scale, 1; + clip_to: "part.icon.bg"; + description { + state, "default" 0.0; + aspect: 1.0 1.0; + aspect_preference: BOTH; + rel1 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + rel2 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + align, 0.5 0.5; + fixed, 1 1; + min, 60 60; + visible, 0; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "selected" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "disabled" 0.0; + inherit, "default" 0.0; + visible, 1; + } + description { + state, "invisible" 0.0; + inherit, "default" 0.0; + visible, 0; + } + } + + part { + name, "elm.swallow.icon.1"; + type, SWALLOW; + scale, 1; + clip_to: "part.icon.bg"; + description { + state, "default" 0.0; + aspect, 1.0 1.0; + aspect_preference, BOTH; + rel1 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + rel2 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + align, 0.5 0.5; + fixed, 1 1; + min, 60 60; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "selected" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "disabled" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "invisible" 0.0; + inherit, "default" 0.0; + visible, 0; + } + } + part { + name, "elm.swallow.icon.1.focus"; + type, SWALLOW; + scale, 1; + clip_to: "part.icon.bg"; + description { + state, "default" 0.0; + aspect: 1.0 1.0; + aspect_preference: BOTH; + rel1 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + rel2 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + align, 0.5 0.5; + fixed, 1 1; + min, 60 60; + visible, 0; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + visible, 1; + } + description { + state, "selected" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "disabled" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "invisible" 0.0; + inherit, "default" 0.0; + visible, 0; + } + } + part { + name, "elm.swallow.icon.1.select"; + type, SWALLOW; + scale, 1; + clip_to: "part.icon.bg"; + description { + state, "default" 0.0; + aspect: 1.0 1.0; + aspect_preference: BOTH; + rel1 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + rel2 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + align, 0.5 0.5; + fixed, 1 1; + min, 60 60; + visible, 0; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "selected" 0.0; + inherit, "default" 0.0; + visible, 1; + } + description { + state, "disabled" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "invisible" 0.0; + inherit, "default" 0.0; + visible, 0; + } + } + part { + name, "elm.swallow.icon.1.disable"; + type, SWALLOW; + scale, 1; + clip_to: "part.icon.bg"; + description { + state, "default" 0.0; + aspect: 1.0 1.0; + aspect_preference: BOTH; + rel1 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + rel2 { + to, "part.icon.bg"; + relative, 0.5 0.5; + } + align, 0.5 0.5; + fixed, 1 1; + min, 60 60; + visible, 0; + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "selected" 0.0; + inherit, "default" 0.0; + visible, 0; + } + description { + state, "disabled" 0.0; + inherit, "default" 0.0; + visible, 1; + } + description { + state, "invisible" 0.0; + inherit, "default" 0.0; + visible, 0; + } + } + + part { + name, "padding.text"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "part.bg"; + relative, 0.0 1.0; + } + rel2.to, "part.bg"; + min, 0 24; + align, 0.5 1.0; + fixed, 0 1; + } + } + + part { + name, "elm.text"; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + color, 104 104 104 255; + rel1.to, "padding.text"; + rel2 { + to, "padding.text"; + relative, 1.0 0.0; + } + min, 0 20; + align, 0.5 1.0; + fixed, 0 1; + text { + font, FONT_LIGHT; + size, 20; + align, 0.5 0.5; + } + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + color, 255 255 255 255; + } + description { + state, "selected" 0.0; + inherit, "default" 0.0; + color, 64 136 211 255; + } + description { + state: "disabled" 0.0; + inherit: "default" 0.0; + color: 104 104 104 128; + } + description { + state, "invisible" 0.0; + inherit, "default" 0.0; + visible, 0; + } + } + + part { + name, "elm.text.1"; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + color, 104 104 104 255; + rel1.to, "padding.text"; + rel2 { + to, "padding.text"; + relative, 1.0 0.0; + } + min, 0 20; + align, 0.5 1.0; + fixed, 0 1; + text { + font, FONT_LIGHT; + size, 20; + align, 0.5 0.5; + } + } + description { + state, "focused" 0.0; + inherit, "default" 0.0; + color, 255 255 255 255; + } + description { + state, "selected" 0.0; + inherit, "default" 0.0; + color, 64 136 211 255; + } + description { + state: "disabled" 0.0; + inherit: "default" 0.0; + color: 104 104 104 128; + } + description { + state, "invisible" 0.0; + inherit, "default" 0.0; + visible, 0; + } + } + } + programs { + program { + name: "go_toggle"; + signal: "elm,state,toggle"; + source: "elm"; + script { + init_values(); + set_int(is_toggle, 1); + set_states(); + } + } + program { + name: "go_untoggle"; + signal: "elm,state,untoggle"; + source: "elm"; + script { + init_values(); + set_int(is_toggle, 0); + set_states(); + } + } + program { + name: "go_focused"; + signal: "elm,action,focus"; + source: "elm"; + script { + init_values(); + set_int(is_focused, 1); + set_states(); + } + } + program { + name: "go_unfocused"; + signal: "elm,action,unfocus"; + source: "elm"; + script { + init_values(); + set_int(is_focused, 0); + set_states(); + } + } + program { + name: "go_active"; + signal: "elm,state,selected"; + source: "elm"; + script { + init_values(); + set_int(is_selected, 1); + set_states(); + } + } + program { + name: "go_passive"; + signal: "elm,state,unselected"; + source: "elm"; + script { + init_values(); + set_int(is_selected, 0); + set_states(); + } + } + program { + name: "go_disabled"; + signal: "elm,state,disabled"; + source: "elm"; + script { + init_values(); + set_int(is_enabled, 0); + set_states(); + } + } + program { + name: "go_enabled"; + signal: "elm,state,enabled"; + source: "elm"; + script { + init_values(); + set_int(is_enabled, 1); + set_states(); + } + } + program { + name: "do_hide"; + action: STATE_SET "invisible" 0.0; + target: "elm.text"; + target: "elm.swallow.icon"; + target: "elm.swallow.icon.focus"; + target: "elm.swallow.icon.select"; + target: "elm.swallow.icon.disable"; + } + program { + name: "do_default"; + action: STATE_SET "default" 0.0; + target: "part.bg"; + target: "elm.text"; + target: "elm.swallow.icon"; + target: "elm.swallow.icon.focus"; + target: "elm.swallow.icon.select"; + target: "elm.swallow.icon.disable"; + } + program { + name: "do_focus"; + action: STATE_SET "focused" 0.0; + target: "part.bg"; + target: "elm.text"; + target: "elm.swallow.icon"; + target: "elm.swallow.icon.focus"; + target: "elm.swallow.icon.select"; + target: "elm.swallow.icon.disable"; + } + + program { + name: "do_select"; + action: STATE_SET "selected" 0.0; + target: "part.bg"; + target: "elm.text"; + target: "elm.swallow.icon"; + target: "elm.swallow.icon.focus"; + target: "elm.swallow.icon.select"; + target: "elm.swallow.icon.disable"; + } + + program { + name: "do_disable"; + action: STATE_SET "disabled" 0.0; + target: "part.bg"; + target: "elm.text"; + target: "elm.swallow.icon"; + target: "elm.swallow.icon.focus"; + target: "elm.swallow.icon.select"; + target: "elm.swallow.icon.disable"; + } + + program { + name: "do_hide.1"; + action: STATE_SET "invisible" 0.0; + target: "elm.text.1"; + target: "elm.swallow.icon.1"; + target: "elm.swallow.icon.1.focus"; + target: "elm.swallow.icon.1.select"; + target: "elm.swallow.icon.1.disable"; + } + + program { + name: "do_default.1"; + action: STATE_SET "default" 0.0; + target: "part.bg"; + target: "elm.text.1"; + target: "elm.swallow.icon.1"; + target: "elm.swallow.icon.1.focus"; + target: "elm.swallow.icon.1.select"; + target: "elm.swallow.icon.1.disable"; + } + program { + name: "do_focus.1"; + action: STATE_SET "focused" 0.0; + target: "part.bg"; + target: "elm.text.1"; + target: "elm.swallow.icon.1"; + target: "elm.swallow.icon.1.focus"; + target: "elm.swallow.icon.1.select"; + target: "elm.swallow.icon.1.disable"; + } + + program { + name: "do_select.1"; + action: STATE_SET "selected" 0.0; + target: "part.bg"; + target: "elm.text.1"; + target: "elm.swallow.icon.1"; + target: "elm.swallow.icon.1.focus"; + target: "elm.swallow.icon.1.select"; + target: "elm.swallow.icon.1.disable"; + } + + program { + name: "do_disable.1"; + action: STATE_SET "disabled" 0.0; + target: "part.bg"; + target: "elm.text.1"; + target: "elm.swallow.icon.1"; + target: "elm.swallow.icon.1.focus"; + target: "elm.swallow.icon.1.select"; + target: "elm.swallow.icon.1.disable"; + } + } +} diff --git a/images/btn_menu_clear_dis.png b/images/btn_menu_clear_dis.png new file mode 100644 index 0000000000000000000000000000000000000000..c8b4c46a3fbae897e6e43cdd69650e72c550ef30 GIT binary patch literal 1574 zcmb7EeNfY87%y`o;;|2%dZ5k_rc9wt(l%`qsa)HnYlVUq2Cd2@v?o5}lJPq5-pq zDyFS8<*ZoULyL?Fc}%WNuvs#32j`Jd5sWP0@rrCwEIr_*93`{>6w$>Ds|9ZzI|%}e zQw!#!7TDr7&~C<5$-d!Sb+*iSzpqa0zvy6JmVD@ zjs+r$R1sGuXhAX3kt2A#7R$IW>l;m!m@+6pc_BmwLmp4$T*GLeV5J|2@l>=gx57(9 zR@%pv@eZ*buB0)tn7d~?iU7rE@NAwDi$awWoTJP`vx1q>f`}0#R7xERBL=m>K&a&g zOkp&r5tu|ZFpBENxKDCKHJOuf;zkVBE0qW$M+pOhkf;vUAsUqqQ)-M#jMOW}xMtQT zP^^QF_=|9v$6WZCT-?CZl)&-199KG4`K4}7;Cyb*3m9@#!0Y)8>*V~t1(C9hoRXk< zrkr*fdCmh2=M`t3;vY7sQ4Oj#D8&d!6hSnE&WMq66ee_H24Dmn5CwQlyL-;2@iV@Wgh zUu=1Q0;a(hzBUOuqA9(%wsZFJMds_yogebvq$a{NIoO?%O23_%&bv)&b5)VO;JnG(n_`*=J1sXn3ML1sFXt*4V4c;~WdoeA;e)dsBJJoC~D`=iA}9fw1;CqgJw(H=4> zE?Um-4`~!Hq{PbRl_tuwuUs1Xc5kn>4J^D$Phx6z+};$Hl5VJc>->eDjI;AwXV@Q5 zRUd5HS~orFb6|7#Rp{4leMVQ^x{?M(|IeH6RPAmoBu~Bbb*1Uf%4Hq$eKG&UFX-ue zn0aAIJJ{#De_qOec_8U5kdaZA`PO_3x(X+h&O9XnU}y#5Q&LtUMvu zxC{CrdthFFLED;JH%>>}Gv@YcX2)z`gZ5QZR0C{nekIwqX6}U-|J*w*#gU#`Ro<2Q z@5ZK!wT)%9$+|A#sJg2@(ah1I69r#Y$F9x)?d8jsdw#p8V}It2o8KHt89XS=mDld* ztv;Ra`pYztU!NL^K0SHSCGr|rV4Ac41a|Y{y`wuSKN)zt`{ep7XL{-!?z2Z`g}}S@ jfhnDZ<3LBNw`J7Hd|-(qPB@;J99C2ko7AhbW(cCIN}OASpv>V%HZcL5lPrEr7xwWMsrrX8+2!uuk37HM z^Sr<3dET0w>@0;mNiLJg6xL;w9gG=~FK!a}6Qe&1V3;kLol-96mIAcE%19Si$U;^h zUBud1+Eupx5(^M-<#`=W$!YtLU^t(Oj@YPzJ|3U}*^(enGsUa~6|zNMzY!j3?}Q<* z%LuQ+Y-$^CVm;nvJaXqRrYfXAgr!{9ru~xq* z(SC-F_={k@FR{8eVhNML(h?^)IIbj``5X@?aiWLgAyY06&0pp9ySRY3Ad;5nr=(cH zyMc9C1kMMI=}LHC<6mvkVIWFVx>|#oF%;EPq{U#?U}}m43aC+d9P9c&S|K0^BvK5o z6i0LmR9s~GqSV3SMYFJe&>;e7g~Zlfr83z>y_F&z!T$UGoy)^HGrHElO*|_~Sa}b+ zIxFD_(oh*U)qkpe=+3=6Up*k6%ChY-vr(bER3st9Qb3#a?-b3 zT#+bFTqoaeUwjwu_%pGo$0Hpb=G*NX<~z^H^Nv@%^Yt%MWp&T${IdpWTd2El%j7vF z@sAtf{Jl$y3b)pix@L=~dhPG;y4&Who_gzW>fN@{TjU2jMwlCYgI%#{RdpBZww$YN z7^rFsg;M$!5-rZ+Aw6@fVIah2rB1k9n=P+X)X!Tqh45a_lXi8Bn{WT7QO0DiM3gZt zu`}Nr@XWl`n0Dzx<>`~thLUaaANwjY$sMlE@khR!^ep*yQ)A!A!%fG+H+IdvNS_HaLyG#teoJc{K6E~1=i;22cx9F1 zn~X&X#QnX8K0RNxX4>HF?vdTjkYa0tN4tGp&yjg`#a&^ff6v^D_^BXa-q`wmZOrA4 znxCix*RC$T@$c$|=!92Uej{rWVqKsJ5)nmtz!VDWNuE^Ap+C*AULBaW@Flgr*mdeCrsumOvi$5S6=#uG1=vN_j}~~`F!73 zy*@K7BzRdchrdEP4d6o0QQSa4AShflu0!*S(Jq-!D)h{GE)TvpmE?5qcah7R{0+dtA7wkYIoU!b&<7{ClT5`2cBF@N;0T zSnEOw8<}246Io@M*`~5WlibWtUJWF95SG9}FgW0G*qv^~qu@{SBJAFOE#d={Domk* zKjoBByB%N57=%P(RwM#20f8k5Bn74)K5LCOTM!+l zp0>rF6nq=QxDb)3q@+Yx5-+4^s|b|K<$ewb60jNqcd3)XJp!jYYK8$L+$NfIF(l;# z{ET=3Rm3Rxtfx~UI9yuoEV0u)ohUYCA`k8ofkLs!;qb>bsqJQT#4|TusO`=!brB*R z;iigc6I%~U)C`!--OCO66a_q3CRivd>h0y^Ufhw~cZEXqE(s&LN#B`RFUwSv7(tW8 zgjr2f4q!5`2>Am0VpIytU@4j)hTv2f1Z9{?El-7DF{WZOAO`umbm8X zQ5~mqTYdd4n+4$Hi4IzTKv#pJlgz<(A=k-PB8h60k!@^9pjg_~If7%w!^%~l_ zL5A?$ZQMI)TX|#D$}g8pbfxSI{p_270}IFBU+y~Aa_%m#K0QA4*rGwDb64?AQGc1N zzjevjg<7%q$diGrW>suw_;H});`|Qj2T21}`UU-q4Z;V=q43)$TVvY8yurr2S|fJ2 z&Tt(}B)NM&bf7)5gAI!L5u5S%e6@W$^mDeR3F}VeJi1cZw^Kjo_~q)SPivo4G}Y$o z&(LQOk!z#A9rOnOz4%Z}!Pexms;{=+tI*FmIP!U{)sVCMO4rd<@!!Vmw#P-SsIikl zkxI+RSQpDw5|w?^X4kXi@#{t6`Qu4X)bh`}(Jf zkdwI|39hZXmZ&#B&fA|nygM}fHSdm|h_-+0-puqiXCws;h50((C=NZ*O%0~3$Z6SM zxvy|UpQ|13OxxLWbxT~y$mw@JZ7jD(%GG@~<>5zrn~Qp*64O@*l&4$XCj`8=F3Nnn zq>q11+v3}H>-%>vK$~v!&}&yOtvVI>GyiV2C$KnwR?xqq&v3rm*x#R+HoV&ZN7tlg KV$CV}75@Ps1ydpb literal 0 HcmV?d00001 diff --git a/images/btn_menu_clear_sel.png b/images/btn_menu_clear_sel.png new file mode 100644 index 0000000000000000000000000000000000000000..b2cf37f1de35651fb695a30c61300b4dd7af5a98 GIT binary patch literal 1608 zcmb7EdrT8|9Iqlc>T5h40};<-KE~|hO0O?lu->(`(=vowx(p3%?|`FRuUrpXUQ-%0 ziYAELjB`Gs5mBb3CR9ZyikS?zMW`d{7#f|jffxmKY)*~4f~bEOlU?ra_sIA2`F?+& z@Av!Ln4YGa!j0o{IGic^C1?gaDudrUVeDV=^jDf4Vi}E@$)s`_w}r+zYK*etfS$DE z;TgCED=E5wvxpEAVKg&l!!m`9BKek}4c|jLSu{(Q>Tz0ZcANpMcpl+Uf%i|H0RaM2 zfmyIYXmBEUKCz^f#xqOPjJ8s{O^$)7DS*c;j(BV>eRNx4&f}IDq1t2hD z!q`>dXi#QDI)G3#4#50mo=pfrfJDNF#IQsHEdWG9NF)%luY?DQ6|h7hk^(Otko87m zxrz)_`@$EyQi1sl<5UO)ZnvB7PUcf|o&b`|jvP1#&bhugOk5YFtt3n^>f*+=D}X?!`!xxo+tNqmig0@zS{S&t6-n&a`fSx(2vZm zT$8hRM^Q!P#Y0r1AW)T!tm;-a%Pw#IHloE_zG&N){(?Q1s(4^b?WdS=JSkdxdR@6@ z`2CePS_;nU?z%Ot+}wbxs%`kuF|j%FGe=f!0v7ccl++FNM-E42 z)HH=#`h7R1(~Hh5E;@|su&UUliDi|kCuUbZ`)igNTZsj#EkxY$#EN!Vs&Yd-9$^m+ zJ63zN>HNSSME33<_ja!G9jX`mn7E<%X4Kr1I#jmW+d8dwUP8S){H zy)R+#cmM5h-g +#include +#include +#include +#include +#include + +#include "define.h" +#include "util.h" + +#define BUF_MAX 128 +#define BUTTON_MAX 16 +#define BUTTON_BORDER 1 +#define ITEMS_IN_ROW 4 + +#define STYLE_LIVETV_BTN "style.livetv.button" +#define STYLE_ACTION_MENU_BTN "style.action.menu.button" + +#define UNTOGGLE 0 +#define TOGGLE 1 + +enum _button_id { + BUTTON_INVALID = -1, + BUTTON_CLEAR, + BUTTON_LIVETV = BUTTON_MAX, +}; + +enum _button_state { + STATE_INVALID = -1, + STATE_UNTOGGLE, + STATE_TOGGLE, + STATE_DISABLED, +}; + +struct _priv { + Evas_Object *win; + Evas_Object *base; + Evas_Object *table; + Evas_Object *live; + Evas_Object *menu_btn[BUTTON_MAX]; + + notification_h noti; +}; + +struct _button_data { + const char *text; + const char *normal; + const char *focused; + const char *selected; + const char *disabled; +}; + +static void _livetv_clicked(void *data) +{ + app_control_h app_ctrl; + int r; + + r = app_control_create(&app_ctrl); + if (r != APP_CONTROL_ERROR_NONE) { + _ERR("failed to create app control handle"); + return; + } + + r = app_control_set_operation(app_ctrl, APP_CONTROL_OPERATION_DEFAULT); + if (r != APP_CONTROL_ERROR_NONE) { + _ERR("failed to set app control operation"); + app_control_destroy(app_ctrl); + return; + } + + r = app_control_set_app_id(app_ctrl, APP_ID_LIVETV); + if (r != APP_CONTROL_ERROR_NONE) { + _ERR("failed to set app control app id"); + app_control_destroy(app_ctrl); + return; + } + + r = app_control_send_launch_request(app_ctrl, NULL, NULL); + if (r != APP_CONTROL_ERROR_NONE) { + _ERR("failed to send app control launch request"); + app_control_destroy(app_ctrl); + return; + } + + app_control_destroy(app_ctrl); + + viewmgr_hide_view(ACTION_MENU_VIEW); +} + +static void _clear_clicked(void *data) +{ + struct _priv *priv; + + if (!data) { + _ERR("Get data failed."); + return; + } + + priv = data; + + notification_delete(priv->noti); + + viewmgr_hide_view(ACTION_MENU_VIEW); +} + +static int _clear_state(void *data) +{ + struct _priv *priv; + int noti_err = NOTIFICATION_ERROR_NONE; + notification_type_e type; + + if (!data) { + _ERR("Get data failed."); + return STATE_INVALID; + } + + priv = data; + + if (!priv->noti) + return STATE_DISABLED; + + noti_err = notification_get_type(priv->noti, &type); + if (noti_err != NOTIFICATION_ERROR_NONE || + type == NOTIFICATION_TYPE_ONGOING) + return STATE_DISABLED; + + return STATE_UNTOGGLE; +} + +struct _button { + int id; + struct _button_data data[2]; + + void (*clicked)(void *data); + int (*state)(void *data); +}; + +static struct _button buttons[] = { + { + .id = BUTTON_CLEAR, + .data[UNTOGGLE] = { + .text = STR_BUTTON_CLEAR, + .normal = IMAGE_CLEAR_NOR, + .focused = IMAGE_CLEAR_FOC, + .selected = IMAGE_CLEAR_SEL, + .disabled = IMAGE_CLEAR_DIS + }, + .clicked = _clear_clicked, + .state = _clear_state + }, + { + .id = BUTTON_INVALID + } +}; + +static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Up *ev) +{ + if (!strcmp(ev->keyname, KEY_BACK) || + !strcmp(ev->keyname, KEY_BACK_REMOTE)) + viewmgr_hide_view(ACTION_MENU_VIEW); +} + +static input_handler key_handler = { + .key_up = _key_up_cb, +}; + +static void _update_button_state(Evas_Object *obj, + struct _button *button, void *data) +{ + int state; + + if (!obj || !button->state) { + _ERR("failed to get button state"); + return; + } + + state = button->state(data); + + switch (state) { + case STATE_UNTOGGLE: + elm_object_signal_emit(obj, SIGNAL_UNTOGGLE, SOURCE_ELM); + break; + case STATE_TOGGLE: + elm_object_signal_emit(obj, SIGNAL_TOGGLE, SOURCE_ELM); + break; + case STATE_DISABLED: + elm_object_disabled_set(obj, EINA_TRUE); + break; + case STATE_INVALID: + break; + } +} + +static void _button_clicked(Evas_Object *obj, int id, void *data) +{ + struct _button *button; + + switch (id) { + case BUTTON_LIVETV: + _livetv_clicked(data); + break; + case BUTTON_CLEAR: + button = evas_object_data_get(obj, KEY_BUTTON); + + if (!button) { + _ERR("failed to get button"); + return; + } + + if (button->clicked) + button->clicked(data); + + _update_button_state(obj, button, data); + + break; + } +} + +static void _button_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Up *ev) +{ + if (strcmp(ev->keyname, KEY_ENTER) && + strcmp(ev->keyname, KEY_ENTER_REMOTE)) + return; + + _button_clicked(obj, id, data); +} + +static void _button_mouse_up_cb(int id, void *data, Evas *e, + Evas_Object *obj, Evas_Event_Mouse_Up *ev) +{ + _button_clicked(obj, id, data); +} + +static void _button_mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Move *ev) +{ + if (!obj) + return; + + if (!elm_object_focus_get(obj)) + elm_object_focus_set(obj, EINA_TRUE); +} + +static input_handler button_handler = { + .key_up = _button_key_up_cb, + .mouse_up = _button_mouse_up_cb, + .mouse_move = _button_mouse_move_cb +}; + +static void _child_removed_cb(void *data, Evas_Object *obj, void *ei) +{ + if (obj) + inputmgr_remove_callback(obj, &button_handler); +} + + +static bool _draw_top_area(struct _priv *priv) +{ + Evas_Object *btn; + + btn = util_add_button(priv->base, + PART_TOP_BUTTON, STR_LIVETV, STYLE_LIVETV_BTN); + if (!btn) { + _ERR("Add button failed."); + return false; + } + inputmgr_add_callback(btn, BUTTON_LIVETV, + &button_handler, NULL); + + priv->live = btn; + + return true; +} + +static void _update_menu_area(struct _priv *priv) +{ + Evas_Object *btn; + int i, row, col; + + elm_table_clear(priv->table, EINA_TRUE); + + i = 0; + while (buttons[i].id != BUTTON_INVALID && i < BUTTON_MAX) { + btn = util_add_button(priv->base, NULL, + buttons[i].data[UNTOGGLE].text, + STYLE_ACTION_MENU_BTN); + if (!btn) { + _ERR("Add button failed."); + return; + } + + evas_object_data_set(btn, KEY_BUTTON, &buttons[i]); + util_add_icon(btn, buttons[i].data[UNTOGGLE].normal, + PART_ICON); + util_add_icon(btn, buttons[i].data[UNTOGGLE].focused, + PART_ICON_FOCUSED); + util_add_icon(btn, buttons[i].data[UNTOGGLE].selected, + PART_ICON_SELECTED); + util_add_icon(btn, buttons[i].data[UNTOGGLE].disabled, + PART_ICON_DISABLED); + elm_object_part_text_set(btn, PART_TEXT_1, + buttons[i].data[TOGGLE].text); + util_add_icon(btn, buttons[i].data[TOGGLE].normal, + PART_ICON_1); + util_add_icon(btn, buttons[i].data[TOGGLE].focused, + PART_ICON_1_FOCUSED); + util_add_icon(btn, buttons[i].data[TOGGLE].selected, + PART_ICON_1_SELECTED); + util_add_icon(btn, buttons[i].data[TOGGLE].disabled, + PART_ICON_1_DISABLED); + inputmgr_add_callback(btn, buttons[i].id, + &button_handler, priv); + + _update_button_state(btn, &buttons[i], priv); + + col = i % ITEMS_IN_ROW; + row = i / ITEMS_IN_ROW; + elm_table_pack(priv->table, btn, col, row, 1, 1); + + priv->menu_btn[i] = btn; + + i++; + } + + elm_object_focus_next_object_set(priv->menu_btn[0], + priv->menu_btn[i - 1], ELM_FOCUS_LEFT); + elm_object_focus_next_object_set(priv->menu_btn[i - 1], + priv->menu_btn[0], ELM_FOCUS_RIGHT); + + while (col + 1 != ITEMS_IN_ROW) { + btn = util_add_button(priv->base, NULL, NULL, + STYLE_ACTION_MENU_BTN); + if (!btn) { + _ERR("Add button failed."); + return; + } + + elm_object_disabled_set(btn, EINA_TRUE); + + col = i % ITEMS_IN_ROW; + + elm_table_pack(priv->table, btn, col, row, 1, 1); + + i++; + } +} + +static bool _draw_menu_area(struct _priv *priv) +{ + Evas_Object *table; + + table = elm_table_add(priv->base); + if (!table) { + _ERR("Add table failed."); + return false; + } + elm_table_padding_set(table, BUTTON_BORDER, BUTTON_BORDER); + evas_object_show(table); + elm_object_part_content_set(priv->base, PART_MENU, table); + evas_object_smart_callback_add(priv->table, SIGNAL_CHILD_REMOVED, + _child_removed_cb, NULL); + + priv->table = table; + + return true; +} + +static void _draw_view_content(struct _priv *priv) +{ + if (!_draw_top_area(priv)) { + _ERR("Draw top area failed."); + return; + } + + if (!_draw_menu_area(priv)) { + _ERR("Draw menu area failed."); + return; + } +} + +static Evas_Object *_create(Evas_Object *win, void *data) +{ + struct _priv *priv; + Evas_Object *base; + + if (!win) { + _ERR("Get window object failed."); + return NULL; + } + + priv = calloc(1, sizeof(*priv)); + if (!priv) { + _ERR("Calloc failed."); + return NULL; + } + + base = elm_layout_add(win); + if (!base) { + _ERR("failed to create base object"); + free(priv); + return NULL; + } + elm_layout_file_set(base, EDJEFILE, GRP_VIEW_ACTION_MENU); + evas_object_size_hint_weight_set(base, + EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, base); + + priv->base = base; + priv->win = win; + + if (!viewmgr_set_view_data(ACTION_MENU_VIEW, priv)) { + _ERR("Set view data failed."); + evas_object_del(base); + free(priv); + return NULL; + } + + _draw_view_content(priv); + + inputmgr_add_callback(priv->base, 0, &key_handler, priv); + + return base; +} + +static void _show(void *data) +{ + struct _priv *priv; + + if (!data) { + _ERR("Get data failed."); + return; + } + priv = data; + + _update_menu_area(priv); + + evas_object_show(priv->base); + + elm_object_focus_set(priv->menu_btn[0], EINA_TRUE); +} + +static void _hide(void *data) +{ + struct _priv *priv; + + if (!data) { + _ERR("Get data failed."); + return; + } + priv = data; + + evas_object_hide(priv->base); +} + +static void _destroy(void *data) +{ + struct _priv *priv; + int i; + + if (!data) { + _ERR("Get data failed."); + return; + } + priv = data; + + inputmgr_remove_callback(priv->base, &key_handler); + inputmgr_remove_callback(priv->live, &button_handler); + + i = 0; + while (priv->menu_btn[i] && i < BUTTON_MAX) { + inputmgr_remove_callback(priv->menu_btn[i], &button_handler); + i++; + } + + evas_object_smart_callback_del(priv->table, SIGNAL_CHILD_REMOVED, + _child_removed_cb); + + evas_object_del(priv->base); + + free(priv); +} + +static void _update(void *view_data, int type, void *data) +{ + struct _priv *priv; + + if (!view_data) { + _ERR("failed to get view data"); + return; + } + + priv = view_data; + + switch (type) { + case UPDATE_TYPE_SET_NOTIFICATION: + if (!data) { + _ERR("failed to get data"); + return; + } + + priv->noti = data; + break; + } +} + +static view_class _vclass = { + .view_id = ACTION_MENU_VIEW, + .create = _create, + .show = _show, + .hide = _hide, + .destroy = _destroy, + .update = _update +}; + +view_class *action_menu_view_get_vclass(void) +{ + return &_vclass; +} diff --git a/src/main.c b/src/main.c index d704b39..c70fc51 100644 --- a/src/main.c +++ b/src/main.c @@ -22,6 +22,7 @@ #include "define.h" #include "notification_view.h" #include "square_view.h" +#include "action_menu_view.h" #define KEY_LAUNCH_TYPE "launch_type" #define TYPE_SQUARE "infosquare" @@ -88,6 +89,7 @@ static bool _create(void *data) viewmgr_add_view(notification_view_get_vclass(), NULL); viewmgr_add_view(square_view_get_vclass(), NULL); + viewmgr_add_view(action_menu_view_get_vclass(), NULL); ad->win = win; @@ -107,6 +109,7 @@ static void _terminate(void *data) viewmgr_remove_view(NOTIFICATION_VIEW); viewmgr_remove_view(SQUARE_VIEW); + viewmgr_remove_view(ACTION_MENU_VIEW); viewmgr_destroy(); if (ad->win) { diff --git a/src/notification_view.c b/src/notification_view.c index 7fa9c39..cd81959 100644 --- a/src/notification_view.c +++ b/src/notification_view.c @@ -38,13 +38,6 @@ #define NOTIFICATION_ITEM_PADDING 26 #define NOTIFICATION_ITEMS_IN_COL 4.0 -#define SIG_ITEM_FOCUSED "item,focused" -#define SIG_ITEM_UNFOCUSED "item,unfocused" - -enum _update_type { - UPDATE_TYPE_SHOW_POPUP, -}; - enum _obj_id { OBJ_CLEAR, OBJ_TITLE, @@ -73,6 +66,7 @@ struct _priv { Evas_Object *base; Evas_Object *clear_btn; Evas_Object *category_container; + Elm_Object_Item *current_it; Elm_Gengrid_Item_Class *grid_class; struct _category *category[CATEGORY_MAX]; }; @@ -87,6 +81,12 @@ static void _category_unfocused_cb(int id, void *data, Evas_Object *obj, Elm_Object_Item *it); static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev); +static void _focus_key_up_cb(int id, void *data, + Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev); +static void _focus_focused_cb(int id, void *data, + Evas_Object *obj, Elm_Object_Item *it); +static void _focus_unfocused_cb(int id, void *data, + Evas_Object *obj, Elm_Object_Item *it); static input_handler base_handler = { .key_up = _base_key_up_cb, @@ -100,6 +100,9 @@ static input_handler category_handler = { }; static input_handler focus_handler = { .mouse_move = _mouse_move, + .key_up = _focus_key_up_cb, + .focused = _focus_focused_cb, + .unfocused = _focus_unfocused_cb }; static const char *_get_category_title(int category) @@ -230,9 +233,9 @@ static void _draw_category(struct _priv *priv, int category) elm_object_focus_next_object_set(grid, grid, ELM_FOCUS_RIGHT); inputmgr_add_callback(title, category, &category_handler, priv); - inputmgr_add_callback(title, OBJ_TITLE, &focus_handler, NULL); + inputmgr_add_callback(title, OBJ_TITLE, &focus_handler, priv); inputmgr_add_callback(grid, category, &category_handler, priv); - inputmgr_add_callback(grid, OBJ_GRID, &focus_handler, NULL); + inputmgr_add_callback(grid, OBJ_GRID, &focus_handler, priv); elm_box_pack_end(priv->category_container, ly); evas_object_show(grid); @@ -459,7 +462,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) PART_NOTIFICATION_CLEAR, priv->clear_btn); evas_object_show(priv->clear_btn); inputmgr_add_callback(priv->clear_btn, 0, &clear_handler, NULL); - inputmgr_add_callback(priv->clear_btn, OBJ_CLEAR, &focus_handler, NULL); + inputmgr_add_callback(priv->clear_btn, OBJ_CLEAR, &focus_handler, priv); priv->grid_class = elm_gengrid_item_class_new(); priv->grid_class->item_style = STYLE_GRID_ITEM; @@ -639,6 +642,63 @@ static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj, } } +static void _focus_key_up_cb(int id, void *data, Evas *e, + Evas_Object *obj, Evas_Event_Key_Up *ev) +{ + struct _priv *priv; + void *noti; + + priv = data; + + switch (id) { + case OBJ_GRID: + if (!strcmp(ev->keyname, KEY_MENU) || + !strcmp(ev->keyname, KEY_MENU_REMOTE)) { + if (!priv || !priv->current_it) + return; + + noti = elm_object_item_data_get(priv->current_it); + if (!noti) + return; + + viewmgr_update_view(ACTION_MENU_VIEW, + UPDATE_TYPE_SET_NOTIFICATION, noti); + viewmgr_show_view(ACTION_MENU_VIEW); + } + break; + case OBJ_CLEAR: + case OBJ_TITLE: + break; + } +} + +static void _focus_focused_cb(int id, void *data, + Evas_Object *obj, Elm_Object_Item *it) +{ + struct _priv *priv; + + if (!data || !it) + return; + + priv = data; + + priv->current_it = it; +} + +static void _focus_unfocused_cb(int id, void *data, + Evas_Object *obj, Elm_Object_Item *it) +{ + struct _priv *priv; + + if (!data || !it) + return; + + priv = data; + + if (priv->current_it == it) + priv->current_it = NULL; +} + view_class *notification_view_get_vclass(void) { return &vclass; diff --git a/src/square_view.c b/src/square_view.c index 883b068..5baa108 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -29,7 +29,6 @@ #define CLOCK_UPDATE_DUR 1 #define NOTIFICATION_ITEM_PADDING_X 0 #define NOTIFICATION_ITEM_PADDING_Y 20 -#define SIG_CHILD_REMOVED "child,removed" #define STYLE_LAUNCH "square/notification_launch" #define STYLE_CLEAR "square/notification_clear" #define STYLE_ITEM "square/notification_item" @@ -161,7 +160,6 @@ static void _update_list(struct _priv *priv) item = elm_button_add(priv->list); elm_object_style_set(item, STYLE_ITEM); - elm_object_focus_allow_set(item, EINA_TRUE); evas_object_data_set(item, KEY_NOTI, noti); inputmgr_add_callback(item, BUTTON_NOTIFICATION, &button_handler, priv); @@ -320,7 +318,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) NOTIFICATION_ITEM_PADDING_Y); evas_object_show(priv->list); elm_object_content_set(scroller, priv->list); - evas_object_smart_callback_add(priv->list, SIG_CHILD_REMOVED, + evas_object_smart_callback_add(priv->list, SIGNAL_CHILD_REMOVED, _child_removed_cb, NULL); _create_button(priv); @@ -387,7 +385,7 @@ static void _destroy(void *view_data) priv = (struct _priv *) view_data; stop_clock_timer(priv); - evas_object_smart_callback_del(priv->list, SIG_CHILD_REMOVED, + evas_object_smart_callback_del(priv->list, SIGNAL_CHILD_REMOVED, _child_removed_cb); inputmgr_remove_callback(priv->clear_btn, &button_handler); inputmgr_remove_callback(priv->launch_btn, &button_handler); diff --git a/src/util.c b/src/util.c index 587eccf..e51da3a 100644 --- a/src/util.c +++ b/src/util.c @@ -111,3 +111,60 @@ void util_clear_notification(void) notification_free(noti); } } + +Evas_Object *util_add_icon(Evas_Object *parent, const char *file, + const char *part) +{ + Evas_Object *ic; + + if (!parent) { + _ERR("failed to get parent"); + return NULL; + } + + ic = elm_icon_add(parent); + if (!ic) { + _ERR("failed to create icon"); + return NULL; + } + + if (file) + elm_image_file_set(ic, file, NULL); + + if (part) + elm_object_part_content_set(parent, part, ic); + + elm_image_fill_outside_set(ic, EINA_TRUE); + + evas_object_show(ic); + + return ic; +} + +Evas_Object *util_add_button(Evas_Object *parent, const char *part, + const char *text, const char *style) +{ + Evas_Object *btn; + + if (!parent) { + _ERR("Invalid argument."); + return NULL; + } + + btn = elm_button_add(parent); + if (!btn) { + _ERR("elm_button_add failed."); + return NULL; + } + + if (part) + elm_object_part_content_set(parent, part, btn); + if (text) + elm_object_text_set(btn, text); + if (style) + elm_object_style_set(btn, style); + + evas_object_show(btn); + + return btn; +} -- 2.7.4 From 530255c68466aab4e856b06b4b3fd81b99ac069b Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Fri, 28 Aug 2015 17:03:13 +0900 Subject: [PATCH 12/16] Add action menu on info square Change-Id: I13163d6c84dfe951f7cde5f355d2fecbc38dc648 Signed-off-by: jinwoo.shin --- data/view/square_view.edc | 460 ++++++++++++++++++++++++---------------------- src/square_view.c | 26 ++- 2 files changed, 261 insertions(+), 225 deletions(-) diff --git a/data/view/square_view.edc b/data/view/square_view.edc index 3b60f2d..f1b7566 100644 --- a/data/view/square_view.edc +++ b/data/view/square_view.edc @@ -247,244 +247,258 @@ group { fixed, 0 1; visible, 0; } - part { - name, PART_INFO_USER_MESSAGE; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 1.0 0.0; - rel2.relative, 1.0 0.0; - text { - font, FONT_LIGHT; - text, STR_DEFAULT_USER_MESSAGE; - size, 56; - align, 1.0 0.0; - min, 1 1; - ellipsis, -1; - } - min, 0 56; + } + part { + name, PART_INFO_USER_MESSAGE; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, PART_INFO; + relative, 1.0 0.0; + } + rel2 { + to, PART_INFO; + relative, 1.0 0.0; + } + text { + font, FONT_LIGHT; + text, STR_DEFAULT_USER_MESSAGE; + size, 56; align, 1.0 0.0; - fixed, 1 1; - visible, 1; + min, 1 1; + ellipsis, -1; } + min, 0 56; + align, 1.0 0.0; + fixed, 1 1; + visible, 1; } - part { - name, "padding.info.time"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to_y, PART_INFO_USER_MESSAGE; - relative, 0.0 1.0; - } - rel2 { - to_y, PART_INFO_USER_MESSAGE; - relative, 1.0 1.0; - } - min, 0 24; - align, 1.0 0.0; - fixed, 1 1; + } + part { + name, "padding.info.time"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to_x, PART_INFO; + to_y, PART_INFO_USER_MESSAGE; + relative, 0.0 1.0; + } + rel2 { + to_x, PART_INFO; + to_y, PART_INFO_USER_MESSAGE; + relative, 1.0 1.0; } + min, 0 24; + align, 1.0 0.0; + fixed, 1 1; } - part { - name, PART_INFO_TIME; - type, RECT; - scale, 1; - description { - rel1 { - to_y, "padding.info.time"; - relative, 0.0 1.0; - } - rel2 { - to_y, "padding.info.time"; - relative, 1.0 1.0; - } - min, 0 120; - align, 0.0 0.0; - fixed, 1 1; - visible, 0; + } + part { + name, PART_INFO_TIME; + type, RECT; + scale, 1; + description { + rel1 { + to, "padding.info.time"; + relative, 0.0 1.0; } - part { - name, PART_INFO_TIME_MINUTE; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1.relative, 1.0 0.0; - rel2.relative, 1.0 0.0; - text { - font, FONT_LIGHT; - size, 120; - align, 0.0 1.0; - min, 1 0; - ellipsis, -1; - } - min, 0 120; - align, 1.0 0.0; - fixed, 1 1; - visible, 1; - } + rel2 { + to, "padding.info.time"; + relative, 1.0 1.0; } - part { - name, "padding_right.info.time_separator"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to_x, PART_INFO_TIME_MINUTE; - relative, 0.0 0.0; - } - rel2 { - to_x, PART_INFO_TIME_MINUTE; - relative, 0.0 1.0; - } - min, 28 120; - align, 1.0 0.0; - fixed, 1 1; - } + min, 0 120; + align, 0.0 0.0; + fixed, 1 1; + visible, 0; + } + } + part { + name, PART_INFO_TIME_MINUTE; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, PART_INFO_TIME; + relative, 1.0 0.0; } - part { - name, PART_INFO_TIME_SEPARATOR; - type, IMAGE; - scale, 1; - description { - image.normal, "ic_info_time.png"; - rel1 { - to_x, "padding_right.info.time_separator"; - relative, 0.0 0.0; - } - rel2 { - to_x, "padding_right.info.time_separator"; - relative, 0.0 1.0; - } - min, 14 120; - align, 1.0 0.0; - fixed, 1 1; - visible, 1; - } + rel2 { + to, PART_INFO_TIME; + relative, 1.0 0.0; } - part { - name, "padding_left.info.time_separator"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to_x, PART_INFO_TIME_SEPARATOR; - relative, 0.0 0.0; - } - rel2 { - to_x, PART_INFO_TIME_SEPARATOR; - relative, 0.0 1.0; - } - min, 20 0; - align, 1.0 0.0; - fixed, 1 1; - } + text { + font, FONT_LIGHT; + size, 120; + align, 0.0 1.0; + min, 1 0; + ellipsis, -1; } - part { - name, PART_INFO_TIME_HOUR; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to_x, "padding_left.info.time_separator"; - relative, 0.0 0.0; - } - rel2 { - to_x, "padding_left.info.time_separator"; - relative, 0.0 0.0; - } - text { - font, FONT_LIGHT; - size, 120; - align, 0.0 1.0; - min, 1 0; - ellipsis, -1; - } - min, 0 120; - align, 1.0 0.0; - fixed, 1 1; - visible, 1; - } + min, 0 120; + align, 1.0 0.0; + fixed, 1 1; + visible, 1; + } + } + part { + name, "padding_right.info.time_separator"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, PART_INFO_TIME_MINUTE; + relative, 0.0 0.0; } - part { - name, "padding.info.time_am_pm"; - type, SPACER; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to_x, PART_INFO_TIME_HOUR; - relative, 0.0 0.0; - } - rel2 { - to_x, PART_INFO_TIME_HOUR; - relative, 0.0 0.0; - } - min, 10 8; - align, 1.0 0.0; - fixed, 1 1; - } + rel2 { + to, PART_INFO_TIME_MINUTE; + relative, 0.0 1.0; } - part { - name, PART_INFO_TIME_AM_PM; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "padding.info.time_am_pm"; - relative, 0.0 1.0; - } - rel2 { - to, "padding.info.time_am_pm"; - relative, 0.0 1.0; - } - text { - font, FONT_LIGHT; - size, 30; - align, 1.0 1.0; - min, 1 0; - ellipsis, -1; - } - min, 0 30; - align, 1.0 0.0; - fixed, 1 1; - visible, 1; - } + min, 28 120; + align, 1.0 0.0; + fixed, 1 1; + } + } + part { + name, PART_INFO_TIME_SEPARATOR; + type, IMAGE; + scale, 1; + description { + image.normal, "ic_info_time.png"; + rel1 { + to, "padding_right.info.time_separator"; + relative, 0.0 0.0; + } + rel2 { + to, "padding_right.info.time_separator"; + relative, 0.0 1.0; } + min, 14 120; + align, 1.0 0.0; + fixed, 1 1; + visible, 1; } - part { - name, PART_INFO_DATE; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to_y, PART_INFO_TIME; - relative, 0.0 1.0; - } - rel2 { - to_y, PART_INFO_TIME; - relative, 1.0 1.0; - } - text { - font, FONT_LIGHT; - size, 30; - align, 1.0 1.0; - min, 1 1; - ellipsis, -1; - } - min, 0 46; - align, 1.0 0.0; - fixed, 1 1; - visible, 1; + } + part { + name, "padding_left.info.time_separator"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, PART_INFO_TIME_SEPARATOR; + relative, 0.0 0.0; + } + rel2 { + to, PART_INFO_TIME_SEPARATOR; + relative, 0.0 1.0; + } + min, 20 0; + align, 1.0 0.0; + fixed, 1 1; + } + } + part { + name, PART_INFO_TIME_HOUR; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "padding_left.info.time_separator"; + relative, 0.0 0.0; + } + rel2 { + to, "padding_left.info.time_separator"; + relative, 0.0 0.0; + } + text { + font, FONT_LIGHT; + size, 120; + align, 0.0 1.0; + min, 1 0; + ellipsis, -1; + } + min, 0 120; + align, 1.0 0.0; + fixed, 1 1; + visible, 1; + } + } + part { + name, "padding.info.time_am_pm"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, PART_INFO_TIME_HOUR; + relative, 0.0 0.0; + } + rel2 { + to, PART_INFO_TIME_HOUR; + relative, 0.0 0.0; } + min, 10 8; + align, 1.0 0.0; + fixed, 1 1; + } + } + part { + name, PART_INFO_TIME_AM_PM; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "padding.info.time_am_pm"; + relative, 0.0 1.0; + } + rel2 { + to, "padding.info.time_am_pm"; + relative, 0.0 1.0; + } + text { + font, FONT_LIGHT; + size, 30; + align, 1.0 1.0; + min, 1 0; + ellipsis, -1; + } + min, 0 30; + align, 1.0 0.0; + fixed, 1 1; + visible, 1; + } + } + part { + name, PART_INFO_DATE; + type, TEXT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, PART_INFO_TIME; + relative, 0.0 1.0; + } + rel2 { + to, PART_INFO_TIME; + relative, 1.0 1.0; + } + text { + font, FONT_LIGHT; + size, 30; + align, 1.0 1.0; + min, 1 1; + ellipsis, -1; + } + min, 0 46; + align, 1.0 0.0; + fixed, 1 1; + visible, 1; } } } diff --git a/src/square_view.c b/src/square_view.c index 5baa108..ce54462 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -40,6 +40,8 @@ static void _button_focused_cb(int id, void *data, Evas_Object *obj, Elm_Object_Item *it); static void _button_mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Move *ev); +static void _button_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Up *ev); static void _scroller_focused_cb(int id, void *data, Evas_Object *obj, Elm_Object_Item *it); static void _child_removed_cb(void *data, Evas_Object *obj, void *ei); @@ -65,7 +67,8 @@ static input_handler base_handler = { static input_handler button_handler = { .clicked = _button_clicked_cb, .focused = _button_focused_cb, - .mouse_move = _button_mouse_move_cb + .mouse_move = _button_mouse_move_cb, + .key_up = _button_key_up_cb, }; static input_handler scroller_handler = { .focused = _scroller_focused_cb @@ -187,8 +190,10 @@ static void _update_list(struct _priv *priv) noti_list = notification_list_remove(noti_list, noti); - if (!priv->last_focused) + if (!priv->last_focused) { + elm_object_focus_set(item, EINA_TRUE); priv->last_focused = item; + } } } else { elm_object_signal_emit(priv->base, @@ -457,6 +462,23 @@ static void _button_mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, elm_object_focus_set(obj, EINA_TRUE); } +static void _button_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Key_Up *ev) +{ + void *noti; + + if (!strcmp(ev->keyname, KEY_MENU) || + !strcmp(ev->keyname, KEY_MENU_REMOTE)) { + noti = evas_object_data_get(obj, KEY_NOTI); + if (!noti) + return; + + viewmgr_update_view(ACTION_MENU_VIEW, + UPDATE_TYPE_SET_NOTIFICATION, noti); + viewmgr_show_view(ACTION_MENU_VIEW); + } +} + static void _scroller_focused_cb(int id, void *data, Evas_Object *obj, Elm_Object_Item *it) { -- 2.7.4 From bc5cf34863009de78a24864551c093921ff139e6 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Mon, 31 Aug 2015 20:47:52 +0900 Subject: [PATCH 13/16] Add to store notification readed time Change-Id: I7440895ea29041203c2af2a9d5163d0c2c764747 Signed-off-by: jinwoo.shin --- CMakeLists.txt | 3 +-- include/util.h | 1 + packaging/org.tizen.infosquare.spec | 1 - src/notification_view.c | 2 ++ src/util.c | 10 ++++++++++ 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 399f7f3..cb2efd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,8 +61,7 @@ pkg_check_modules(PKGS REQUIRED edje capi-appfw-application app-utils - notification - vconf) + notification) FOREACH(flag ${PKGS_CFLAGS}) SET(EXTRA_CFLGAS "${EXTRA_CFLGAS} ${flag}") diff --git a/include/util.h b/include/util.h index f48ef25..97dc643 100644 --- a/include/util.h +++ b/include/util.h @@ -25,5 +25,6 @@ Evas_Object *util_add_icon(Evas_Object *parent, const char *file, const char *part); Evas_Object *util_add_button(Evas_Object *parent, const char *part, const char *text, const char *style); +void util_set_last_viewed(void); #endif diff --git a/packaging/org.tizen.infosquare.spec b/packaging/org.tizen.infosquare.spec index 84b88fd..634693c 100644 --- a/packaging/org.tizen.infosquare.spec +++ b/packaging/org.tizen.infosquare.spec @@ -13,7 +13,6 @@ BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(edje) BuildRequires: pkgconfig(app-utils) BuildRequires: pkgconfig(notification) -BuildRequires: pkgconfig(vconf) BuildRequires: gettext-devel BuildRequires: edje-bin diff --git a/src/notification_view.c b/src/notification_view.c index cd81959..395cd87 100644 --- a/src/notification_view.c +++ b/src/notification_view.c @@ -336,6 +336,8 @@ static void _update_list(struct _priv *priv) if (it) elm_object_item_focus_set(it, EINA_TRUE); } + + util_set_last_viewed(); } static char *_grid_label_get(void *data, diff --git a/src/util.c b/src/util.c index e51da3a..3c7b615 100644 --- a/src/util.c +++ b/src/util.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "define.h" @@ -168,3 +169,12 @@ Evas_Object *util_add_button(Evas_Object *parent, const char *part, return btn; } + +void util_set_last_viewed(void) +{ + int r; + + r = app_contents_set_basis_time(CONTENTS_NOTI); + if (r != APP_CONTENTS_ERROR_NONE) + _ERR("failed to set basis time"); +} -- 2.7.4 From 49f956a58e7bbbb13256f003dcbe6a8383543ee5 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Wed, 9 Sep 2015 09:06:52 +0900 Subject: [PATCH 14/16] add appmanager.launch privileage Change-Id: I41abd10ec0ae29a0d0354bacbc3eadc6f919f3ff Signed-off-by: Minkyu Kang --- org.tizen.infosquare.xml.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/org.tizen.infosquare.xml.in b/org.tizen.infosquare.xml.in index 6c3f516..dfa81c7 100644 --- a/org.tizen.infosquare.xml.in +++ b/org.tizen.infosquare.xml.in @@ -7,4 +7,7 @@ @DESKTOP_ICON@ + + http://tizen.org/privilege/appmanager.launch + -- 2.7.4 From a2cea6a5487ab69a6175b7df0723b4950f487e77 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Wed, 9 Sep 2015 13:13:02 +0900 Subject: [PATCH 15/16] Fix build error Change-Id: Ife11b0c1582398d6c0a3cabec620aa307908fcfd Signed-off-by: jinwoo.shin --- CMakeLists.txt | 3 ++- packaging/org.tizen.infosquare.spec | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb2efd5..399f7f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,7 +61,8 @@ pkg_check_modules(PKGS REQUIRED edje capi-appfw-application app-utils - notification) + notification + vconf) FOREACH(flag ${PKGS_CFLAGS}) SET(EXTRA_CFLGAS "${EXTRA_CFLGAS} ${flag}") diff --git a/packaging/org.tizen.infosquare.spec b/packaging/org.tizen.infosquare.spec index 634693c..84b88fd 100644 --- a/packaging/org.tizen.infosquare.spec +++ b/packaging/org.tizen.infosquare.spec @@ -13,6 +13,7 @@ BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(edje) BuildRequires: pkgconfig(app-utils) BuildRequires: pkgconfig(notification) +BuildRequires: pkgconfig(vconf) BuildRequires: gettext-devel BuildRequires: edje-bin -- 2.7.4 From 0e4c27fabfdccca93683b1eddae88ccf16e7d67e Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Wed, 9 Sep 2015 20:00:01 +0900 Subject: [PATCH 16/16] add manifest file to avoid smack error this patch will fix systemd service file's label "system" to "_" Change-Id: Ief3dddb50a256900bb50aa945cb3026f7420ce2f Signed-off-by: Minkyu Kang --- packaging/org.tizen.infosquare.manifest | 5 +++++ packaging/org.tizen.infosquare.spec | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 packaging/org.tizen.infosquare.manifest diff --git a/packaging/org.tizen.infosquare.manifest b/packaging/org.tizen.infosquare.manifest new file mode 100644 index 0000000..97e8c31 --- /dev/null +++ b/packaging/org.tizen.infosquare.manifest @@ -0,0 +1,5 @@ + + + + + diff --git a/packaging/org.tizen.infosquare.spec b/packaging/org.tizen.infosquare.spec index 84b88fd..85220d2 100644 --- a/packaging/org.tizen.infosquare.spec +++ b/packaging/org.tizen.infosquare.spec @@ -5,6 +5,7 @@ Release: 1 Group: Applications License: Apache-2.0 Source0: %{name}-%{version}.tar.gz +Source1: %{name}.manifest BuildRequires: cmake BuildRequires: pkgconfig(capi-appfw-application) @@ -30,6 +31,7 @@ Info. Square application for Tizen TV. %prep %setup -q +cp %{SOURCE1} . %build cmake \ @@ -55,6 +57,7 @@ ln -sf ../notification-display.path %{buildroot}/%{_unitdir_user}/default.target rm -rf %{buildroot} %files +%manifest %{name}.manifest %defattr(-,root,root,-) %{_bindir}/* %{_resdir}/* -- 2.7.4