From 209b1453e7118ccfcea735cf0fc5446a580a610a Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Fri, 28 Aug 2015 13:51:20 +0900 Subject: [PATCH 01/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 02/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 03/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 04/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 05/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 06/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 From 4499ff2effa4755d3d3acbaca6521aecc96ca10b Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Wed, 16 Sep 2015 14:24:30 +0900 Subject: [PATCH 07/16] modify key values as key_define Change-Id: Ie2457525c1cfc25aafffa15b83cb77db9a193b79 Signed-off-by: Minkyu Kang --- src/action_menu_view.c | 9 +++------ src/notification_view.c | 7 +++---- src/square_view.c | 4 ++-- src/util.c | 2 +- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/action_menu_view.c b/src/action_menu_view.c index 18907d0..16a03d3 100644 --- a/src/action_menu_view.c +++ b/src/action_menu_view.c @@ -173,7 +173,7 @@ 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)) + !strcmp(ev->keyname, KEY_ESC)) viewmgr_hide_view(ACTION_MENU_VIEW); } @@ -236,11 +236,8 @@ static void _button_clicked(Evas_Object *obj, int id, void *data) 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); + if (!strcmp(ev->keyname, KEY_ENTER)) + _button_clicked(obj, id, data); } static void _button_mouse_up_cb(int id, void *data, Evas *e, diff --git a/src/notification_view.c b/src/notification_view.c index 395cd87..7a3d05c 100644 --- a/src/notification_view.c +++ b/src/notification_view.c @@ -585,7 +585,7 @@ 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)) { + !strcmp(ev->keyname, KEY_ESC)) { ui_app_exit(); } } @@ -593,8 +593,7 @@ static void _base_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, 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) || - !strcmp(ev->keyname, KEY_ENTER_REMOTE)) + if (!strcmp(ev->keyname, KEY_ENTER)) util_clear_notification(); } @@ -655,7 +654,7 @@ static void _focus_key_up_cb(int id, void *data, Evas *e, switch (id) { case OBJ_GRID: if (!strcmp(ev->keyname, KEY_MENU) || - !strcmp(ev->keyname, KEY_MENU_REMOTE)) { + !strcmp(ev->keyname, KEY_CONTEXT_MENU)) { if (!priv || !priv->current_it) return; diff --git a/src/square_view.c b/src/square_view.c index ce54462..924b8ea 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -404,7 +404,7 @@ 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)) + !strcmp(ev->keyname, KEY_ESC)) ui_app_exit(); } @@ -468,7 +468,7 @@ static void _button_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, void *noti; if (!strcmp(ev->keyname, KEY_MENU) || - !strcmp(ev->keyname, KEY_MENU_REMOTE)) { + !strcmp(ev->keyname, KEY_CONTEXT_MENU)) { noti = evas_object_data_get(obj, KEY_NOTI); if (!noti) return; diff --git a/src/util.c b/src/util.c index 3c7b615..64d7e9e 100644 --- a/src/util.c +++ b/src/util.c @@ -43,7 +43,7 @@ static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj, return; if (!strcmp(ev->keyname, KEY_BACK) || - !strcmp(ev->keyname, KEY_BACK_REMOTE)) { + !strcmp(ev->keyname, KEY_ESC)) { inputmgr_remove_callback(data, &popup_handler); evas_object_del(data); } -- 2.7.4 From 395bbef8c4259b011b57844f28ee844a4f382e47 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Thu, 17 Sep 2015 08:36:44 +0900 Subject: [PATCH 08/16] version update: m1 Change-Id: I426aaf00d35f77dd39dc76959642bef25b2f8a45 Signed-off-by: Minkyu Kang --- packaging/org.tizen.infosquare.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/org.tizen.infosquare.spec b/packaging/org.tizen.infosquare.spec index 85220d2..9ca3548 100644 --- a/packaging/org.tizen.infosquare.spec +++ b/packaging/org.tizen.infosquare.spec @@ -1,6 +1,6 @@ Name: org.tizen.infosquare Summary: Info. Square application for Tizen TV -Version: 0.1 +Version: 0.2 Release: 1 Group: Applications License: Apache-2.0 -- 2.7.4 From 9c075d5d49e2d34a2668830037121d6aff770f3a Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Mon, 21 Sep 2015 20:08:52 +0900 Subject: [PATCH 09/16] Change font to BreezeSans Change-Id: I4bc2abe2fe3e315be6328969dab595ac8449aa64 Signed-off-by: jinwoo.shin --- data/view/square_view.edc | 2 +- include/define.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/view/square_view.edc b/data/view/square_view.edc index f1b7566..5a73920 100644 --- a/data/view/square_view.edc +++ b/data/view/square_view.edc @@ -128,7 +128,7 @@ group { relative, 1.0 1.0; } text { - font, "TizenSans"; + font, FONT_REGULAR; text, STR_NOTIFICATION_LIST_TITLE; size, 36; align, 0.0 0.5; diff --git a/include/define.h b/include/define.h index 434c6f1..a5e552b 100644 --- a/include/define.h +++ b/include/define.h @@ -48,9 +48,9 @@ #define SIGNAL_UNTOGGLE "elm,state,untoggle" #define SIGNAL_CHILD_REMOVED "child,removed" -#define FONT_REGULAR "TizenSans" -#define FONT_LIGHT "TizenSans:style=Light" -#define FONT_BOLD "TizenSans:style=Bold" +#define FONT_REGULAR "BreezeSans" +#define FONT_LIGHT "BreezeSans:style=Light" +#define FONT_BOLD "BreezeSans:style=Bold" #define KEY_NOTI "KEY_NOTI" #define KEY_BUTTON "KEY_BUTTON" -- 2.7.4 From f30ae52ccebbcfba7ed75d5e8ee1367b4630044a Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Mon, 21 Sep 2015 21:28:45 +0900 Subject: [PATCH 10/16] Correct group index font weight Change-Id: Ibc0dc2404668acb24b4317bad2a89a74b2177ad2 Signed-off-by: jinwoo.shin --- data/widget/button.edc | 1 - 1 file changed, 1 deletion(-) diff --git a/data/widget/button.edc b/data/widget/button.edc index e81b05e..c645cc9 100644 --- a/data/widget/button.edc +++ b/data/widget/button.edc @@ -98,7 +98,6 @@ group { description { state: "focused" 0.0; inherit: "default" 0.0; - text.font: FONT_REGULAR; color: COLOR_TEXT_FOCUS; } } -- 2.7.4 From 71846dd7d8d2c96e4f17b5f6259d366baba55121 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Fri, 2 Oct 2015 15:14:14 +0900 Subject: [PATCH 11/16] Add action menu show/hide animation Change-Id: I5d5c2fe64b24afec7867019d0119194494194589 Signed-off-by: jinwoo.shin --- data/view/action_menu_view.edc | 27 ++++++++++++++++++++++++++- include/define.h | 6 ++++++ src/action_menu_view.c | 19 ++++++++++++++++++- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/data/view/action_menu_view.edc b/data/view/action_menu_view.edc index 03867a3..6c23d53 100644 --- a/data/view/action_menu_view.edc +++ b/data/view/action_menu_view.edc @@ -35,9 +35,14 @@ group { color, 255 255 255 255; rel1.relative, 1.0 0.0; min, 500 0; - align, 1.0 0.0; + align, 0.0 0.0; fixed, 1 1; } + description { + state, "show" 0.0; + inherit, "default" 0.0; + align, 1.0 0.0; + } } part { @@ -174,4 +179,24 @@ group { } } } + programs { + program { + signal, SIGNAL_SHOW; + action, STATE_SET "show" 0.0; + target, "menu_area"; + transition, CUBIC_BEZIER 0.667 TRANSITION_EASE_IN_OUT; + } + program { + signal, SIGNAL_HIDE; + source, SOURCE_ELM; + action, STATE_SET "default" 0.0; + target, "menu_area"; + transition, CUBIC_BEZIER 0.334 TRANSITION_EASE_OUT; + after, "hide_finished"; + } + program { + name, "hide_finished"; + action, SIGNAL_EMIT SIGNAL_HIDE_FINISHED SOURCE_ELM; + } + } } diff --git a/include/define.h b/include/define.h index a5e552b..7a6cec6 100644 --- a/include/define.h +++ b/include/define.h @@ -47,6 +47,12 @@ #define SIGNAL_TOGGLE "elm,state,toggle" #define SIGNAL_UNTOGGLE "elm,state,untoggle" #define SIGNAL_CHILD_REMOVED "child,removed" +#define SIGNAL_SHOW "show" +#define SIGNAL_HIDE "hide" +#define SIGNAL_HIDE_FINISHED "elm,action,hide,finished" + +#define TRANSITION_EASE_IN_OUT 0.45 0.03 0.41 1.0 +#define TRANSITION_EASE_OUT 0.25 0.46 0.45 1.0 #define FONT_REGULAR "BreezeSans" #define FONT_LIGHT "BreezeSans:style=Light" diff --git a/src/action_menu_view.c b/src/action_menu_view.c index 16a03d3..ad29e40 100644 --- a/src/action_menu_view.c +++ b/src/action_menu_view.c @@ -393,6 +393,19 @@ static void _draw_view_content(struct _priv *priv) } } +static void _hide_finished_cb(void *data, Evas_Object *obj, + const char *emission, const char *source) +{ + struct _priv *priv; + + if (!data) + return; + + priv = data; + + evas_object_hide(priv->base); +} + static Evas_Object *_create(Evas_Object *win, void *data) { struct _priv *priv; @@ -433,6 +446,8 @@ static Evas_Object *_create(Evas_Object *win, void *data) _draw_view_content(priv); inputmgr_add_callback(priv->base, 0, &key_handler, priv); + elm_layout_signal_callback_add(priv->base, SIGNAL_HIDE_FINISHED, + SOURCE_ELM, _hide_finished_cb, priv); return base; } @@ -464,7 +479,7 @@ static void _hide(void *data) } priv = data; - evas_object_hide(priv->base); + elm_layout_signal_emit(priv->base, SIGNAL_HIDE, SOURCE_ELM); } static void _destroy(void *data) @@ -489,6 +504,8 @@ static void _destroy(void *data) evas_object_smart_callback_del(priv->table, SIGNAL_CHILD_REMOVED, _child_removed_cb); + elm_layout_signal_callback_del(priv->base, SIGNAL_HIDE_FINISHED, + SOURCE_ELM, _hide_finished_cb); evas_object_del(priv->base); -- 2.7.4 From dd85e644924f25c943727e15170d8fa2b9208d0d Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Mon, 12 Oct 2015 18:51:04 +0900 Subject: [PATCH 12/16] Fix prevent issues CIDs : 473724 Change-Id: I8a9ac5d4e55c1c1ad7afae43a6b78688fb680ffa Signed-off-by: jinwoo.shin --- src/action_menu_view.c | 9 +-------- src/notification_view.c | 8 ++++++++ src/square_view.c | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/action_menu_view.c b/src/action_menu_view.c index ad29e40..063c431 100644 --- a/src/action_menu_view.c +++ b/src/action_menu_view.c @@ -295,7 +295,7 @@ static void _update_menu_area(struct _priv *priv) elm_table_clear(priv->table, EINA_TRUE); i = 0; - while (buttons[i].id != BUTTON_INVALID && i < BUTTON_MAX) { + while (i < BUTTON_MAX && buttons[i].id != BUTTON_INVALID) { btn = util_add_button(priv->base, NULL, buttons[i].data[UNTOGGLE].text, STYLE_ACTION_MENU_BTN); @@ -485,7 +485,6 @@ static void _hide(void *data) static void _destroy(void *data) { struct _priv *priv; - int i; if (!data) { _ERR("Get data failed."); @@ -496,12 +495,6 @@ static void _destroy(void *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); elm_layout_signal_callback_del(priv->base, SIGNAL_HIDE_FINISHED, diff --git a/src/notification_view.c b/src/notification_view.c index 7a3d05c..bfcd6b1 100644 --- a/src/notification_view.c +++ b/src/notification_view.c @@ -467,6 +467,12 @@ static Evas_Object *_create(Evas_Object *win, void *data) inputmgr_add_callback(priv->clear_btn, OBJ_CLEAR, &focus_handler, priv); priv->grid_class = elm_gengrid_item_class_new(); + if (!priv->grid_class) { + _ERR("failed to create gengrid item class"); + free(priv->base); + free(priv); + return NULL; + } priv->grid_class->item_style = STYLE_GRID_ITEM; priv->grid_class->func.text_get = _grid_label_get; priv->grid_class->func.content_get = _grid_content_get; @@ -524,6 +530,8 @@ static void _destroy(void *view_data) priv = (struct _priv *) view_data; + notification_unresister_changed_cb(_notification_changed_cb); + inputmgr_remove_callback(priv->clear_btn, &clear_handler); inputmgr_remove_callback(priv->base, &base_handler); diff --git a/src/square_view.c b/src/square_view.c index 924b8ea..9fd29e5 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -390,6 +390,7 @@ static void _destroy(void *view_data) priv = (struct _priv *) view_data; stop_clock_timer(priv); + notification_unresister_changed_cb(_noti_changed_cb); evas_object_smart_callback_del(priv->list, SIGNAL_CHILD_REMOVED, _child_removed_cb); inputmgr_remove_callback(priv->clear_btn, &button_handler); -- 2.7.4 From 6d8f274edc773425d2ef0693aabf0479cfc10336 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Mon, 12 Oct 2015 19:44:07 +0900 Subject: [PATCH 13/16] Fix prevent issues CIDs : 458538 Change-Id: I96f1637cb446a24a6f01886437f59a8b66f50866 Signed-off-by: jinwoo.shin --- src/square_view.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/square_view.c b/src/square_view.c index 9fd29e5..76f99e6 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -78,19 +78,23 @@ static void _print_user_message(struct _priv *priv) { char *message; uid_t uid; - struct passwd *passwd; - char buf[128]; + struct passwd pwd, *result; + char buf[128], str[128]; message = vconf_get_str(KEY_USER_MESSAGE); if (!message) { uid = getuid(); - passwd = getpwuid(uid); - if (passwd) { - snprintf(buf, sizeof(buf), + getpwuid_r(uid, &pwd, buf, sizeof(buf), &result); + if (result) + snprintf(str, sizeof(str), STR_DEFAULT_USER_MESSAGE, - passwd->pw_name); - message = buf; - } + pwd.pw_name); + else + snprintf(str, sizeof(str), + STR_DEFAULT_USER_MESSAGE, + ""); + + message = str; } elm_object_part_text_set(priv->base, PART_INFO_USER_MESSAGE, message); -- 2.7.4 From fcc3a1eb020c9c3fe3949778fd6c633f9a7ca2ae Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Wed, 14 Oct 2015 15:03:45 +0900 Subject: [PATCH 14/16] Fix memory leak and delete unnecessary inputmgr_remove_callback Change-Id: Id7f4b7de4d09beae397487de68d15711406947ea Signed-off-by: jinwoo.shin --- src/notification_view.c | 14 +------------- src/square_view.c | 7 +++---- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/notification_view.c b/src/notification_view.c index bfcd6b1..3f9e622 100644 --- a/src/notification_view.c +++ b/src/notification_view.c @@ -532,25 +532,13 @@ static void _destroy(void *view_data) notification_unresister_changed_cb(_notification_changed_cb); - inputmgr_remove_callback(priv->clear_btn, &clear_handler); - inputmgr_remove_callback(priv->base, &base_handler); - evas_object_del(priv->base); elm_gengrid_item_class_free(priv->grid_class); for (i = CATEGORY_FIRST; i < CATEGORY_MAX; i++) { - 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); + if (priv->category[i]) free(priv->category[i]); - } } free(priv); diff --git a/src/square_view.c b/src/square_view.c index 76f99e6..4f3a24a 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -393,12 +393,13 @@ static void _destroy(void *view_data) priv = (struct _priv *) view_data; + elm_box_clear(priv->list); + stop_clock_timer(priv); + notification_unresister_changed_cb(_noti_changed_cb); 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); evas_object_del(priv->base); @@ -509,8 +510,6 @@ 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 7f0dc6086e839d93e8f192332b73033a32421d09 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Wed, 14 Oct 2015 15:14:00 +0900 Subject: [PATCH 15/16] Delete notification when user press ok on popup Change-Id: I0de70bbf90191d3617cd907596b62babb047db90 Signed-off-by: jinwoo.shin --- include/util.h | 3 ++- src/notification_view.c | 2 +- src/square_view.c | 2 +- src/util.c | 20 ++++++++++++++++---- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/include/util.h b/include/util.h index 97dc643..d6053e0 100644 --- a/include/util.h +++ b/include/util.h @@ -19,7 +19,8 @@ #ifndef __UTIL_H__ #define __UTIL_H__ -Evas_Object *util_show_notification_popup(Evas_Object *base, notification_h noti); +Evas_Object *util_show_notification_popup(Evas_Object *base, + notification_h noti, bool noti_del); void util_clear_notification(void); Evas_Object *util_add_icon(Evas_Object *parent, const char *file, const char *part); diff --git a/src/notification_view.c b/src/notification_view.c index 3f9e622..c65b2ab 100644 --- a/src/notification_view.c +++ b/src/notification_view.c @@ -563,7 +563,7 @@ static void _update(void *view_data, int type, void *data) if (!noti) return; - util_show_notification_popup(priv->base, noti); + util_show_notification_popup(priv->base, noti, false); break; } } diff --git a/src/square_view.c b/src/square_view.c index 4f3a24a..0d36bf2 100644 --- a/src/square_view.c +++ b/src/square_view.c @@ -433,7 +433,7 @@ static void _button_clicked_cb(int id, void *data, Evas_Object *obj) if (!priv || !noti) return; - util_show_notification_popup(priv->base, noti); + util_show_notification_popup(priv->base, noti, true); break; } } diff --git a/src/util.c b/src/util.c index 64d7e9e..faf99a4 100644 --- a/src/util.c +++ b/src/util.c @@ -24,6 +24,7 @@ enum _button_id { BUTTON_OK, + BUTTON_OK_NOTI_DEL, BUTTON_CANCEL, }; @@ -51,19 +52,24 @@ 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_DEL: + noti = evas_object_data_get(data, KEY_NOTI); + if (noti) + notification_delete(noti); case BUTTON_OK: - 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 *base, notification_h noti, bool noti_del) { Evas_Object *popup, *btn1; char *title = NULL; @@ -87,8 +93,14 @@ Evas_Object *util_show_notification_popup( 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); + + if (noti_del) + inputmgr_add_callback(btn1, + BUTTON_OK_NOTI_DEL, &popup_handler, popup); + else + inputmgr_add_callback(btn1, + BUTTON_OK, &popup_handler, popup); + evas_object_show(btn1); elm_object_focus_set(btn1, EINA_TRUE); -- 2.7.4 From 200587ed1894e51e1e35d2f2ca96c93d6ed74c17 Mon Sep 17 00:00:00 2001 From: "jinwoo.shin" Date: Tue, 17 Nov 2015 19:18:27 +0900 Subject: [PATCH 16/16] Remove notification display service Change-Id: I7cc17e3294543fa6469a017294d4421af6917cb3 Signed-off-by: jinwoo.shin --- CMakeLists.txt | 1 - daemon/CMakeLists.txt | 41 --------- daemon/notification-display.path | 5 -- daemon/notification-display.service | 11 --- daemon/notification_display_service.c | 161 ---------------------------------- packaging/org.tizen.infosquare.spec | 10 --- 6 files changed, 229 deletions(-) delete mode 100644 daemon/CMakeLists.txt delete mode 100644 daemon/notification-display.path delete mode 100644 daemon/notification-display.service delete mode 100644 daemon/notification_display_service.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 399f7f3..ff778cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,4 +78,3 @@ INSTALL(FILES ${PACKAGE_NAME}.xml DESTINATION ${MANIFESTDIR}) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/images DESTINATION ${RESDIR}) ADD_SUBDIRECTORY(data) -ADD_SUBDIRECTORY(daemon) diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt deleted file mode 100644 index 7d8c765..0000000 --- a/daemon/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) 2014 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. -# - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT("notification-display" C) - -MESSAGE(STATUS "PREFIX: " ${CMAKE_INSTALL_PREFIX}) - -INCLUDE(FindPkgConfig) -pkg_check_modules(SERVICE_PKGS REQUIRED - glib-2.0 - notification - app-utils) - -SET(SERVICE_SRCS - notification_display_service.c) - -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../include) - -FOREACH(flag ${SERVICE_PKGS_CFLAGS}) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") -ENDFOREACH(flag) - -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") - -ADD_EXECUTABLE(${PROJECT_NAME} ${SERVICE_SRCS}) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SERVICE_PKGS_LDFLAGS}) -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${SERVICEDIR}) diff --git a/daemon/notification-display.path b/daemon/notification-display.path deleted file mode 100644 index 6adbaaa..0000000 --- a/daemon/notification-display.path +++ /dev/null @@ -1,5 +0,0 @@ -[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 deleted file mode 100644 index 07cfdc6..0000000 --- a/daemon/notification-display.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Notifications Display daemon - -[Service] -Type=simple -EnvironmentFile=/run/tizen-system-env -ExecStart=/usr/bin/notification-display -Restart=always - -[Install] -WantedBy=default.target diff --git a/daemon/notification_display_service.c b/daemon/notification_display_service.c deleted file mode 100644 index ebc890b..0000000 --- a/daemon/notification_display_service.c +++ /dev/null @@ -1,161 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#define SERVICE_NAME "notification-display" -#define HIDE_TIME 3.0 - -SET_TAG(SERVICE_NAME) - -struct _priv { - Evas_Object *win; - Evas_Object *popup; - - time_t last_time; -}; - -static void _hide(void *data, Evas_Object *obj, void *event_info) -{ - evas_object_hide(data); -} - -void _show_notification(struct _priv *priv, notification_h noti) -{ - char *title = NULL; - char *content = NULL; - - notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &title); - notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, &content); - - elm_object_text_set(priv->popup, content); - elm_object_part_text_set(priv->popup, "title,text", title); - evas_object_show(priv->popup); - evas_object_show(priv->win); -} - -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; - } - priv = data; - - 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, &latest_time); - - if (latest_time > priv->last_time) { - _show_notification(priv, noti); - priv->last_time = latest_time; - } - } - } - - notification_free_list(noti_list); -} - -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"); - return -1; - } - elm_win_autodel_set(priv->win, EINA_TRUE); - elm_win_alpha_set(priv->win, EINA_TRUE); - - priv->popup = elm_popup_add(priv->win); - if (!priv->popup) { - evas_object_del(priv->win); - _ERR("elm_win_add failed"); - return -1; - } - 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; -} - -void _destroy_popup(struct _priv *priv) -{ - evas_object_del(priv->popup); - evas_object_del(priv->win); -} - -int main(int argc, char **argv) -{ - struct _priv *priv; - notification_error_e error_n; - - elm_init(0, NULL); - - priv = calloc(1, sizeof(*priv)); - if (!priv) { - _ERR("failed to allocate priv"); - return 0; - } - - if (_create_popup(priv) < 0) { - _ERR("failed to create popup"); - free(priv); - return 0; - } - - 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( - _notification_changed_cb, priv); - _DBG("Could not register with notifications server"); - sleep(5); - } - - elm_run(); - - _destroy_popup(priv); - free(priv); - - elm_shutdown(); - - return 0; -} diff --git a/packaging/org.tizen.infosquare.spec b/packaging/org.tizen.infosquare.spec index 9ca3548..cb7f9da 100644 --- a/packaging/org.tizen.infosquare.spec +++ b/packaging/org.tizen.infosquare.spec @@ -23,7 +23,6 @@ BuildRequires: edje-bin %define _resdir %{_pkgdir}/res %define _datadir %{_pkgdir}/data %define _edjedir %{_resdir}/edje -%define _servicedir %{_prefix}/bin %define _manifestdir %{_datarootdir}/packages %description @@ -40,7 +39,6 @@ cmake \ -DBINDIR=%{_bindir} \ -DEDJEDIR=%{_edjedir} \ -DMANIFESTDIR=%{_manifestdir} \ - -DSERVICEDIR=%{_servicedir} \ -DVERSION=%{version} make %{?jobs:-j%jobs} @@ -48,10 +46,6 @@ make %{?jobs:-j%jobs} %install %make_install 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 -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} @@ -61,9 +55,5 @@ rm -rf %{buildroot} %defattr(-,root,root,-) %{_bindir}/* %{_resdir}/* -%{_servicedir}/* %{_datadir} %{_manifestdir}/%{name}.xml -%{_unitdir_user}/default.target.wants/notification-display.path -%{_unitdir_user}/notification-display.service -%{_unitdir_user}/notification-display.path -- 2.7.4