From 9dea3b329d76d1f0c6e3c3cfeba26132a50d9047 Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Tue, 28 Jul 2015 17:16:15 +0900 Subject: [PATCH 01/16] modify photo view according to v0.4 GUI doc - decrease swallow size to 3 line of grid Change-Id: I852e2d4accf2af18b3533684fb0f4ac692b1a9d7 Signed-off-by: Soohye Shin --- edje/view/photo.edc | 52 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/edje/view/photo.edc b/edje/view/photo.edc index b52550c..e3953d2 100644 --- a/edje/view/photo.edc +++ b/edje/view/photo.edc @@ -48,33 +48,51 @@ group { } } part { - name, "bottom"; + name, "bg"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "title"; + relative, 0.0 1.0; + } + fixed, 1 1; + color, 244 244 244 255; + } + } + part { + name, "pad.list.up"; type, RECT; scale, 1; description { state, "default" 0.0; - rel1.relative, 0.0 1.0; - min, 0 157; + rel1.to, "bg"; + rel2 { + to, "bg"; + relative, 1.0 0.0; + } + align, 0.5 0.0; fixed, 0 1; - align, 0.5 1.0; + min, 0 196; + visible, 0; } } part { - name, "bg"; + name, "pad.list.down"; type, RECT; scale, 1; description { state, "default" 0.0; rel1 { - to, "title"; + to, "bg"; relative, 0.0 1.0; } - rel2 { - to, "bottom"; - relative, 1.0 0.0; - } - fixed, 1 1; - color, 244 244 244 255; + rel2.to, "bg"; + fixed, 0 1; + min, 0 148; + align, 0.5 1.0; + visible, 0; } } part { @@ -83,8 +101,14 @@ group { scale, 1; description { state, "default" 0.0; - rel1.to, "bg"; - rel2.to, "bg"; + rel1 { + to, "pad.list.up"; + relative, 0.0 1.0; + } + rel2 { + to, "pad.list.down"; + relative, 1.0 0.0; + } fixed, 1 1; } } -- 2.7.4 From 5df81a5387b0b8990fa46866aa5300f7071e93d0 Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Tue, 28 Jul 2015 19:07:16 +0900 Subject: [PATCH 02/16] bug fix - load default icon file when icon is null Change-Id: I8bfbc6513be78df851919fd8b2d04340fddffe9a Signed-off-by: Soohye Shin --- src/data/data_home.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/data/data_home.c b/src/data/data_home.c index 8c6ecf1..b6b9789 100644 --- a/src/data/data_home.c +++ b/src/data/data_home.c @@ -123,6 +123,10 @@ static void _get_login_user(char **name, char **icon, char **focus_icon) g_object_get(G_OBJECT(user), GUM_ATTR_NAME, name, GUM_ATTR_ICON, icon, NULL); + + if (!*icon || strlen(*icon) == 0) + *icon = IMAGE_USER_DEFAULT; + *focus_icon = (char *)utils_get_focus_icon_from_icon(*icon); g_object_unref(user); -- 2.7.4 From 376c897b1f50ac37d876a44de4d9bacc88bb696e Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Tue, 28 Jul 2015 20:25:20 +0900 Subject: [PATCH 03/16] bug fix - clear recent data when pressed enter key Change-Id: I132057cc1972d1f25b2e4933525ff543365536fd Signed-off-by: Soohye Shin --- src/data/data_recent.c | 2 +- src/view/view_recent.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/data_recent.c b/src/data/data_recent.c index 3d231b0..e497e8d 100644 --- a/src/data/data_recent.c +++ b/src/data/data_recent.c @@ -184,7 +184,7 @@ static void _select(struct datamgr_item *di) } } -void _clear(struct datamgr *dm) +static void _clear(struct datamgr *dm) { int r; diff --git a/src/view/view_recent.c b/src/view/view_recent.c index 9afbb96..73e1ed3 100644 --- a/src/view/view_recent.c +++ b/src/view/view_recent.c @@ -122,8 +122,8 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, case INPUT_HANDLER_TYPE_DELETE: priv = data; - if (!strcmp(ev->keyname, KEY_ENTER) || - !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { + if (!strcmp(ev->keyname, KEY_BACK) || + !strcmp(ev->keyname, KEY_BACK_REMOTE)) { elm_object_signal_emit(priv->base, SIG_HIDE_RECENT, SRC_PROG); } else if (!strcmp(ev->keyname, KEY_ENTER) || -- 2.7.4 From cf1073abea575dfbcaf4dc857329091b8b8835e6 Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Tue, 28 Jul 2015 21:00:44 +0900 Subject: [PATCH 04/16] set focus move policy from CLICK to IN Change-Id: Ifdf8be7ee67fb96900ac9e3dd0b9aed148046a73 Signed-off-by: Soohye Shin --- src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 9338fed..8e734d1 100644 --- a/src/main.c +++ b/src/main.c @@ -57,7 +57,7 @@ static bool _create(void *user_data) ad = user_data; elm_theme_overlay_add(NULL, THEMEFILE); - elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK); + elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN); win = _add_win(ad->name); if (!win) { -- 2.7.4 From 1daf973cb81b9eaf0d5dd3604b4ad3bb97758dc2 Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Wed, 29 Jul 2015 16:54:30 +0900 Subject: [PATCH 05/16] add transition animation between home and user view Change-Id: I6d77ac5bcbea45a9c3b4ebdf5109507fdaa8875a Signed-off-by: Soohye Shin --- edje/view/home.edc | 45 ++++++++++++++++++++++++++++++++++++++++- edje/view/user.edc | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++-- include/defs.h | 3 +++ src/view/view_home.c | 21 ++++++++++++++++++-- src/view/view_user.c | 24 ++++++++++++++++++++-- 5 files changed, 142 insertions(+), 7 deletions(-) diff --git a/edje/view/home.edc b/edje/view/home.edc index e8df094..b72d4e2 100644 --- a/edje/view/home.edc +++ b/edje/view/home.edc @@ -104,8 +104,23 @@ group { } } part { + name, "clip"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 0 0 0 0; + } + description { + state, "show" 0.0; + inherit, "default" 0.0; + color, 255 255 255 255; + } + } + part { name, PART_HOME_MENU_BAR; type, SWALLOW; + clip_to, "clip"; scale, 1; description { state, "default" 0.0; @@ -117,14 +132,42 @@ group { relative, 0.0 0.0; to, "pad.list"; } - fixed, 1 1; align, 0.5 1.0; + fixed, 1 1; + min, 0 158; + } + description { + state, "show" 0.0; + inherit, "default" 0.0; min, 948 158; } } } programs { program { + name, "sig,show"; + signal, SIG_SHOW; + source, SRC_PROG; + action, STATE_SET "show" 0.0; + transition, DECEL 0.3; + target, "clip"; + target, PART_HOME_MENU_BAR; + } + program { + name, "sig,hide"; + signal, SIG_HIDE; + source, SRC_PROG; + action, STATE_SET "default" 0.0; + transition, DECEL 0.3; + target, "clip"; + target, PART_HOME_MENU_BAR; + after, "sig,hide,done"; + } + program { + name, "sig,hide,done"; + action, SIGNAL_EMIT SIG_HIDE_DONE SRC_EDJE; + } + program { name, "sig,show,navigation"; signal, SIG_SHOW_NAVIGATION; source, SRC_PROG; diff --git a/edje/view/user.edc b/edje/view/user.edc index 8bcd7e3..0566560 100644 --- a/edje/view/user.edc +++ b/edje/view/user.edc @@ -51,9 +51,14 @@ group { font, "TizenSans"; size, 34; } - color, 255 255 255 178; + color, 0 0 0 0; color2, 0 0 0 255; } + description { + state, "show" 0.0; + inherit, "default" 0.0; + color, 255 255 255 178; + } } part { name, "pad.list"; @@ -76,9 +81,24 @@ group { } } part { + name, "clip"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + color, 0 0 0 0; + } + description { + state, "show" 0.0; + inherit, "default" 0.0; + color, 255 255 255 255; + } + } + part { name, PART_USER_BAR; type, SWALLOW; scale, 1; + clip_to, "clip"; description { state, "default" 0.0; rel1 { @@ -89,10 +109,42 @@ group { to, "pad.list"; relative, 1.0 1.0; } - min, 1422 228; + min, 0 228; align, 0.5 0.0; fixed, 1 1; } + description { + state, "show" 0.0; + inherit, "default" 0.0; + min, 1422 228; + } + } + } + programs { + program { + name, "sig,show"; + signal, SIG_SHOW; + source, SRC_PROG; + action, STATE_SET "show" 0.0; + transition, DECEL 0.3; + target, "clip"; + target, PART_USER_BAR; + target, "text"; + } + program { + name, "sig,hide"; + signal, SIG_HIDE; + source, SRC_PROG; + action, STATE_SET "default" 0.0; + transition, DECEL 0.3; + target, "clip"; + target, PART_USER_BAR; + target, "text"; + after, "sig,hide,done"; + } + program { + name, "sig,hide,done"; + action, SIGNAL_EMIT SIG_HIDE_DONE SRC_EDJE; } } } diff --git a/include/defs.h b/include/defs.h index dcb2a0e..bc98de7 100644 --- a/include/defs.h +++ b/include/defs.h @@ -115,6 +115,9 @@ #define SIG_HIDE_RECENT_DONE "sig.hide.recent.done" #define SIG_DISABLE "sig.disable" #define SIG_SHOW_MASK "sig.show.mask" +#define SIG_SHOW "sig.show" +#define SIG_HIDE "sig.hide" +#define SIG_HIDE_DONE "sig.hide.done" #define TITLE_WIDTH "title.width" diff --git a/src/view/view_home.c b/src/view/view_home.c index 3c06565..11dd94d 100644 --- a/src/view/view_home.c +++ b/src/view/view_home.c @@ -107,7 +107,10 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, viewmgr_push_view(VIEW_RECENT); } else if (!strcmp(ev->keyname, KEY_ENTER) || !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { - datamgr_select_item(priv->dm, priv->foc->di); + if (priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) + elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG); + else + datamgr_select_item(priv->dm, priv->foc->di); } else if (!strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_BACK_REMOTE)) { /* It should be implemented later */ @@ -127,7 +130,10 @@ static void _mouse_down(int id, void *data, Evas *e, Evas_Object *obj, bi = data; priv = bi->priv; - datamgr_select_item(priv->dm, priv->foc->di); + if (priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) + elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG); + else + datamgr_select_item(priv->dm, priv->foc->di); break; case INPUT_HANDLER_TYPE_DOWN: viewmgr_push_view(VIEW_RECENT); @@ -290,6 +296,14 @@ static bool _add_home_menu(struct _priv *priv, Evas_Object *base) return true; } +static void _hide_done(void *data, Evas_Object *obj, const char *emission, + const char *source) +{ + struct _priv *priv = data; + + datamgr_select_item(priv->dm, priv->foc->di); +} + static Evas_Object *_create(Evas_Object *win, void *data) { struct _priv *priv; @@ -334,6 +348,8 @@ static Evas_Object *_create(Evas_Object *win, void *data) viewmgr_set_view_data(VIEW_HOME, priv); inputmgr_add_callback(base, INPUT_HANDLER_TYPE_BASE, &handler, priv); + elm_object_signal_callback_add(base, SIG_HIDE_DONE, SRC_EDJE, + _hide_done, priv); return base; } @@ -353,6 +369,7 @@ static void _show(void *data) evas_object_show(priv->base); elm_object_signal_emit(priv->base, SIG_SHOW_NAVIGATION, SRC_PROG); + elm_object_signal_emit(priv->base, SIG_SHOW, SRC_PROG); if (!priv->foc) priv->foc = eina_list_data_get(priv->list); diff --git a/src/view/view_user.c b/src/view/view_user.c index d13782e..22ad054 100644 --- a/src/view/view_user.c +++ b/src/view/view_user.c @@ -135,19 +135,24 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, priv = data; if (!strcmp(ev->keyname, KEY_ENTER) || !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { + if (priv->foc->di->action == ITEM_SELECT_ACTION_POP) { + elm_object_signal_emit(priv->base, SIG_HIDE, + SRC_PROG); + return; + } + if ((priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) && (eina_list_count(priv->list) >= MAX_USER_COUNT)) { _add_popup(priv); return; } - viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_EDIT, NULL); datamgr_select_item(priv->dm, priv->foc->di); } else if (!strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_BACK_REMOTE)) { - viewmgr_pop_view(); + elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG); } else if (!strcmp(ev->keyname, KEY_DOWN)) { if (priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) return; @@ -175,6 +180,12 @@ static void _mouse_down(int id, void *data, Evas *e, Evas_Object *obj, switch (id) { case INPUT_HANDLER_TYPE_BASE: priv = data; + if (priv->foc->di->action == ITEM_SELECT_ACTION_POP) { + elm_object_signal_emit(priv->base, SIG_HIDE, + SRC_PROG); + return; + } + if ((priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) && (eina_list_count(priv->list) >= MAX_USER_COUNT)) { @@ -195,6 +206,12 @@ static void _mouse_down(int id, void *data, Evas *e, Evas_Object *obj, } } +static void _hide_done(void *data, Evas_Object *obj, const char *emission, + const char *source) +{ + viewmgr_pop_view(); +} + static Evas_Object *_create(Evas_Object *win, void *data) { struct _priv *priv; @@ -237,6 +254,8 @@ static Evas_Object *_create(Evas_Object *win, void *data) viewmgr_set_view_data(VIEW_USER, priv); viewmgr_add_view(view_user_edit_get_vclass(), dm); inputmgr_add_callback(base, INPUT_HANDLER_TYPE_BASE, &handler, priv); + elm_object_signal_callback_add(base, SIG_HIDE_DONE, SRC_EDJE, + _hide_done, NULL); return base; } @@ -369,6 +388,7 @@ static void _show(void *data) priv = data; evas_object_show(priv->base); + elm_object_signal_emit(priv->base, SIG_SHOW, SRC_PROG); _add_user(priv); -- 2.7.4 From e676149d7fd56ad16d78c47a34daed2ed246ba74 Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Wed, 29 Jul 2015 19:13:00 +0900 Subject: [PATCH 06/16] support mouse handling to enter user edit view from user list Change-Id: I1a79ee5f841cb0e76af35be3f7ee19f647d8c01c Signed-off-by: Soohye Shin --- edje/view/baritem.edc | 18 +++++++++++++++++ edje/view/user.edc | 6 ++++++ include/defs.h | 2 ++ src/view/view_user.c | 56 ++++++++++++++++++++++++++++++++------------------- 4 files changed, 61 insertions(+), 21 deletions(-) diff --git a/edje/view/baritem.edc b/edje/view/baritem.edc index 5cf3693..805ec34 100644 --- a/edje/view/baritem.edc +++ b/edje/view/baritem.edc @@ -158,6 +158,18 @@ group { visible, 1; } } + part { + name, "click_item"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + rel1.to, "pad"; + rel2.to, "pad"; + fixed, 1 1; + color, 0 0 0 0; + } + } } programs { program { @@ -256,5 +268,11 @@ group { set_state(PART:"mask_focus", "show", 0.0); } } + program { + name, "item,clicked"; + source, "click_item"; + signal, "mouse,clicked,1"; + action, SIGNAL_EMIT SIG_CLICK_ITEM SRC_EDJE; + } } } diff --git a/edje/view/user.edc b/edje/view/user.edc index 0566560..b7a8c1e 100644 --- a/edje/view/user.edc +++ b/edje/view/user.edc @@ -363,5 +363,11 @@ group { target, "text"; target, "arrow"; } + program { + name, "arrow,clicked"; + source, "arrow"; + signal, "mouse,clicked,1"; + action, SIGNAL_EMIT SIG_CLICK_ARROW SRC_EDJE; + } } } diff --git a/include/defs.h b/include/defs.h index bc98de7..73d131a 100644 --- a/include/defs.h +++ b/include/defs.h @@ -118,6 +118,8 @@ #define SIG_SHOW "sig.show" #define SIG_HIDE "sig.hide" #define SIG_HIDE_DONE "sig.hide.done" +#define SIG_CLICK_ITEM "sig.click.item" +#define SIG_CLICK_ARROW "sig.click.arrow" #define TITLE_WIDTH "title.width" diff --git a/src/view/view_user.c b/src/view/view_user.c index 22ad054..2557852 100644 --- a/src/view/view_user.c +++ b/src/view/view_user.c @@ -170,33 +170,12 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, static void _mouse_down(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Down *ev) { - struct _priv *priv; - if (!data) { _ERR("Invalid argument"); return; } switch (id) { - case INPUT_HANDLER_TYPE_BASE: - priv = data; - if (priv->foc->di->action == ITEM_SELECT_ACTION_POP) { - elm_object_signal_emit(priv->base, SIG_HIDE, - SRC_PROG); - return; - } - - if ((priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) - && (eina_list_count(priv->list) - >= MAX_USER_COUNT)) { - _add_popup(priv); - return; - } - - viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_EDIT, - NULL); - datamgr_select_item(priv->dm, priv->foc->di); - break; case INPUT_HANDLER_TYPE_BUTTON: inputmgr_remove_callback(obj, &handler); evas_object_del(data); @@ -260,6 +239,38 @@ static Evas_Object *_create(Evas_Object *win, void *data) return base; } +static void _arrow_clicked(void *data, Evas_Object *obj, const char *emission, + const char *source) +{ + struct _priv *priv = data; + + if (priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) + return; + + viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_EDIT, priv->foc->di); + viewmgr_push_view(VIEW_USER_EDIT); +} + +static void _item_clicked(void *data, Evas_Object *obj, const char *emission, + const char *source) +{ + struct _priv *priv = data; + + if (priv->foc->di->action == ITEM_SELECT_ACTION_POP) { + elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG); + return; + } + + if ((priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) + && (eina_list_count(priv->list) >= MAX_USER_COUNT)) { + _add_popup(priv); + return; + } + + viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_EDIT, NULL); + datamgr_select_item(priv->dm, priv->foc->di); +} + static struct _bar_item *_pack_bar_item(struct _priv *priv, Evas_Object *box, struct datamgr_item *di) { @@ -289,6 +300,8 @@ static struct _bar_item *_pack_bar_item(struct _priv *priv, Evas_Object *box, PART_BAR_ITEM_TITLE_FOCUS); if (!focus_lbl) goto err; + + elm_object_signal_callback_add(eo, SIG_CLICK_ARROW, SRC_EDJE, _arrow_clicked, priv); } else { eo = utils_add_layout(box, GRP_BAR_ITEM, true, NULL); if (!eo) { @@ -317,6 +330,7 @@ static struct _bar_item *_pack_bar_item(struct _priv *priv, Evas_Object *box, evas_object_size_hint_align_set(eo, 0.5, 0.0); inputmgr_add_callback(eo, INPUT_HANDLER_TYPE_EO, &handler, bi); + elm_object_signal_callback_add(eo, SIG_CLICK_ITEM, SRC_EDJE, _item_clicked, priv); elm_box_pack_end(box, eo); evas_object_show(eo); -- 2.7.4 From 6abc6143c9af31243c71f6e8b537f58eb31f8c2c Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Wed, 29 Jul 2015 21:23:19 +0900 Subject: [PATCH 07/16] modify settings pkg name in json file Change-Id: I2f576fc6f986d6d7d16d05773c80e63e11297769 Signed-off-by: Soohye Shin --- config/home.json.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/home.json.in b/config/home.json.in index 67d77c8..2bd542f 100644 --- a/config/home.json.in +++ b/config/home.json.in @@ -45,7 +45,7 @@ "icon": "@IMAGEDIR@/btn_menu_setting_nor.png", "focus_icon": "@IMAGEDIR@/btn_menu_setting_foc.png", "select_action": "launch", - "parameter": "org.tizen.settings", + "parameter": "org.tizen.settings-tv-ref", "notification": false } ] -- 2.7.4 From b9c76a47bb951ba047803b1f132d59b7f22c152a Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Wed, 29 Jul 2015 22:03:09 +0900 Subject: [PATCH 08/16] modify transition speed - DECEL 0.3 - LINEAR 0.2 Change-Id: Icf065e28e1900db072641704d496e0185226b013 Signed-off-by: Soohye Shin --- edje/view/baritem.edc | 12 ++++++------ edje/view/home.edc | 12 ++++++------ edje/view/recent.edc | 16 ++++++++-------- edje/view/user.edc | 4 ++-- edje/view/useredit.edc | 20 ++++++++++---------- edje/widget/gengrid.edc | 4 ++-- include/defs.h | 3 +++ 7 files changed, 37 insertions(+), 34 deletions(-) diff --git a/edje/view/baritem.edc b/edje/view/baritem.edc index 805ec34..32e8f0d 100644 --- a/edje/view/baritem.edc +++ b/edje/view/baritem.edc @@ -185,7 +185,7 @@ group { signal, SIG_FOCUS; source, SRC_PROG; action, STATE_SET "focus" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_DECEL; target, "clip"; } program { @@ -193,7 +193,7 @@ group { signal, SIG_UNFOCUS; source, SRC_PROG; action, STATE_SET "default" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_DECEL; target, "clip"; } program { @@ -201,7 +201,7 @@ group { signal, SIG_FOCUS_TO_UP; source, SRC_PROG; action, STATE_SET "up" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_DECEL; target, "clip"; } program { @@ -209,7 +209,7 @@ group { signal, SIG_FOCUS_TO_DOWN; source, SRC_PROG; action, STATE_SET "down" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_DECEL; target, "clip"; } program { @@ -217,7 +217,7 @@ group { signal, SIG_FOCUS_TO_RIGHT; source, SRC_PROG; action, STATE_SET "right" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_DECEL; target, "clip"; } program { @@ -233,7 +233,7 @@ group { signal, SIG_FOCUS_TO_LEFT; source, SRC_PROG; action, STATE_SET "left" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_DECEL; target, "clip"; } program { diff --git a/edje/view/home.edc b/edje/view/home.edc index b72d4e2..837fe49 100644 --- a/edje/view/home.edc +++ b/edje/view/home.edc @@ -149,7 +149,7 @@ group { signal, SIG_SHOW; source, SRC_PROG; action, STATE_SET "show" 0.0; - transition, DECEL 0.3; + transition, TRANSITION_DECEL; target, "clip"; target, PART_HOME_MENU_BAR; } @@ -158,7 +158,7 @@ group { signal, SIG_HIDE; source, SRC_PROG; action, STATE_SET "default" 0.0; - transition, DECEL 0.3; + transition, TRANSITION_DECEL; target, "clip"; target, PART_HOME_MENU_BAR; after, "sig,hide,done"; @@ -174,7 +174,7 @@ group { action, STATE_SET "show" 0.0; target, "clip.up.arrow"; target, "clip.down.arrow"; - transition, DECEL 0.5; + transition, TRANSITION_DECEL; } program { name, "sig,hide,navigation"; @@ -183,7 +183,7 @@ group { action, STATE_SET "default" 0.0; target, "clip.up.arrow"; target, "clip.down.arrow"; - transition, DECEL 0.5; + transition, TRANSITION_DECEL; } } } @@ -316,7 +316,7 @@ group { signal, SIG_FOCUS; source, SRC_PROG; action, STATE_SET "focus" 0.0; - transition, DECEL 0.5; + transition, TRANSITION_DECEL; target, "focus"; target, "bounce.arrow"; } @@ -325,7 +325,7 @@ group { signal, SIG_UNFOCUS; source, SRC_PROG; action, STATE_SET "default" 0.0; - transition, DECEL 0.2; + transition, TRANSITION_DECEL; target, "focus"; target, "bounce.arrow"; } diff --git a/edje/view/recent.edc b/edje/view/recent.edc index 5f9fff9..a26d02b 100644 --- a/edje/view/recent.edc +++ b/edje/view/recent.edc @@ -221,7 +221,7 @@ group { signal, SIG_SHOW_RECENT; source, SRC_PROG; action, STATE_SET "show" 0.0; - transition, DECEL 0.5; + transition, TRANSITION_DECEL; target, "clip"; target, "guide"; } @@ -230,7 +230,7 @@ group { signal, SIG_HIDE_RECENT; source, SRC_PROG; action, STATE_SET "default" 0.0; - transition, DECEL 0.5; + transition, TRANSITION_DECEL; target, "clip"; target, "guide"; after, "sig.hide.recent.done"; @@ -307,7 +307,7 @@ group { signal, SIG_FOCUS; source, SRC_PROG; action, STATE_SET "focus" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_LINEAR; target, "bg"; target, "clip"; } @@ -316,7 +316,7 @@ group { signal, SIG_UNFOCUS; source, SRC_PROG; action, STATE_SET "default" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_LINEAR; target, "bg"; target, "clip"; } @@ -550,7 +550,7 @@ group { signal, SIG_FOCUS; source, SRC_PROG; action, STATE_SET "focus" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_DECEL; target, "bg"; } program { @@ -558,7 +558,7 @@ group { signal, SIG_UNFOCUS; source, SRC_PROG; action, STATE_SET "default" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_DECEL; target, "bg"; } } @@ -791,7 +791,7 @@ group { signal, SIG_FOCUS; source, SRC_PROG; action, STATE_SET "focus" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_DECEL; target, "bg"; } program { @@ -799,7 +799,7 @@ group { signal, SIG_UNFOCUS; source, SRC_PROG; action, STATE_SET "default" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_DECEL; target, "bg"; } } diff --git a/edje/view/user.edc b/edje/view/user.edc index b7a8c1e..9fc884f 100644 --- a/edje/view/user.edc +++ b/edje/view/user.edc @@ -126,7 +126,7 @@ group { signal, SIG_SHOW; source, SRC_PROG; action, STATE_SET "show" 0.0; - transition, DECEL 0.3; + transition, TRANSITION_DECEL; target, "clip"; target, PART_USER_BAR; target, "text"; @@ -136,7 +136,7 @@ group { signal, SIG_HIDE; source, SRC_PROG; action, STATE_SET "default" 0.0; - transition, DECEL 0.3; + transition, TRANSITION_DECEL; target, "clip"; target, PART_USER_BAR; target, "text"; diff --git a/edje/view/useredit.edc b/edje/view/useredit.edc index b114ac1..4aa17b7 100644 --- a/edje/view/useredit.edc +++ b/edje/view/useredit.edc @@ -781,7 +781,7 @@ group { program { name, "sig,focus,1"; action, STATE_SET "focus" 0.0; - transition, LINEAR 0.2; + transition, TRANSITION_LINEAR; target, "pad"; } program { @@ -795,7 +795,7 @@ group { program { name, "sig,unfocus,1"; action, STATE_SET "default" 0.0; - transition, LINEAR 0.2; + transition, TRANSITION_LINEAR; target, "bg.photo"; target, "clip"; } @@ -848,7 +848,7 @@ group { signal, SIG_FOCUS; source, SRC_PROG; action, STATE_SET "focus" 0.0; - transition, LINEAR 0.1; + transition, TRANSITION_LINEAR; target, "clip"; } program { @@ -856,7 +856,7 @@ group { signal, SIG_UNFOCUS; source, SRC_PROG; action, STATE_SET "default" 0.0; - transition, LINEAR 0.1; + transition, TRANSITION_LINEAR; target, "clip"; } } @@ -915,7 +915,7 @@ group { signal, SIG_FOCUS; source, SRC_PROG; action, STATE_SET "focus"; - transition, LINEAR 0.5; + transition, TRANSITION_LINEAR; target, "bg"; } program { @@ -923,7 +923,7 @@ group { signal, SIG_UNFOCUS; source, SRC_PROG; action, STATE_SET "default" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_LINEAR; target, "bg"; } program { @@ -980,7 +980,7 @@ group { signal, SIG_FOCUS; source, SRC_PROG; action, STATE_SET "focus" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_LINEAR; target, "bg"; } program { @@ -988,7 +988,7 @@ group { signal, SIG_UNFOCUS; source, SRC_PROG; action, STATE_SET "default" 0.0; - transition, LINEAR 0.5; + transition, TRANSITION_LINEAR; target, "bg"; } program { @@ -1089,7 +1089,7 @@ group { signal, SIG_FOCUS; source, SRC_PROG; action, STATE_SET "focus" 0.0; - transition, LINEAR 0.3; + transition, TRANSITION_DECEL; target, "clip"; target, "bg"; } @@ -1098,7 +1098,7 @@ group { signal, SIG_UNFOCUS; source, SRC_PROG; action, STATE_SET "default" 0.0; - transition, LINEAR 0.3; + transition, TRANSITION_DECEL; target, "clip"; target, "bg"; } diff --git a/edje/widget/gengrid.edc b/edje/widget/gengrid.edc index 31efaa4..fab6192 100644 --- a/edje/widget/gengrid.edc +++ b/edje/widget/gengrid.edc @@ -103,7 +103,7 @@ group { signal, "elm,state,focused"; source, "elm"; action, STATE_SET "focus" 0.0; - transition, LINEAR 0.1; + transition, TRANSITION_LINEAR; target, "clip"; } program { @@ -111,7 +111,7 @@ group { signal, "elm,state,unfocused"; source, "elm"; action, STATE_SET "default" 0.0; - transition, LINEAR 0.1; + transition, TRANSITION_LINEAR; target, "clip"; } } diff --git a/include/defs.h b/include/defs.h index 73d131a..ad6dec3 100644 --- a/include/defs.h +++ b/include/defs.h @@ -193,4 +193,7 @@ #define GUM_LIST_USERTYPE_NORMAL "normal" #define GUM_LIST_USERTYPE_ADMIN "admin" +#define TRANSITION_DECEL DECEL 0.3 +#define TRANSITION_LINEAR LINEAR 0.2 + #endif /* __AIR_HOME_DEFS_H__ */ -- 2.7.4 From db2d3dd2e5908fb38ff76a92accf0afdeddcb90c Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Fri, 31 Jul 2015 10:55:46 +0900 Subject: [PATCH 09/16] block to edit and delete user by user authority - owner is possible to edit and delete all users except for itself - normal is possible to edit only itself Change-Id: I332819dc821fdb80f5aa072cb12a1553d5901563 Signed-off-by: Soohye Shin --- edje/view/user.edc | 4 ++-- edje/view/useredit.edc | 12 ------------ include/defs.h | 2 ++ include/view.h | 3 ++- src/view/view_user.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- src/view/view_user_edit.c | 21 ++++++++------------- 6 files changed, 59 insertions(+), 30 deletions(-) diff --git a/edje/view/user.edc b/edje/view/user.edc index 9fc884f..574b5eb 100644 --- a/edje/view/user.edc +++ b/edje/view/user.edc @@ -349,7 +349,7 @@ group { programs { program { name, "sig,show,arrow"; - signal, SIG_FOCUS; + signal, SIG_SHOW_ARROW; source, SRC_PROG; action, STATE_SET "focus"; target, "text"; @@ -357,7 +357,7 @@ group { } program { name, "sig,hide,arrow"; - signal, SIG_UNFOCUS; + signal, SIG_HIDE_ARROW; source, SRC_PROG; action, STATE_SET "default"; target, "text"; diff --git a/edje/view/useredit.edc b/edje/view/useredit.edc index 4aa17b7..6e6889e 100644 --- a/edje/view/useredit.edc +++ b/edje/view/useredit.edc @@ -953,11 +953,6 @@ group { inherit, "default" 0.0; color, 0 119 246 255; } - description { - state, "disable" 0.0; - inherit, "default" 0.0; - color, 87 87 87 125; - } } part { name, "text.delete"; @@ -991,13 +986,6 @@ group { transition, TRANSITION_LINEAR; target, "bg"; } - program { - name, "sig,disable"; - signal, SIG_DISABLE; - source, SRC_PROG; - action, STATE_SET "disable" 0.0; - target, "bg"; - } } } diff --git a/include/defs.h b/include/defs.h index ad6dec3..4a57ebb 100644 --- a/include/defs.h +++ b/include/defs.h @@ -120,6 +120,8 @@ #define SIG_HIDE_DONE "sig.hide.done" #define SIG_CLICK_ITEM "sig.click.item" #define SIG_CLICK_ARROW "sig.click.arrow" +#define SIG_SHOW_ARROW "sig.show.arrow" +#define SIG_HIDE_ARROW "sig.hide.arrow" #define TITLE_WIDTH "title.width" diff --git a/include/view.h b/include/view.h index a981f18..b4559a5 100644 --- a/include/view.h +++ b/include/view.h @@ -20,7 +20,8 @@ enum update_type { UPDATE_TYPE_EDIT, UPDATE_TYPE_PHOTO, - UPDATE_TYPE_NOTI + UPDATE_TYPE_NOTI, + UPDATE_TYPE_USER }; view_class *view_home_get_vclass(void); diff --git a/src/view/view_user.c b/src/view/view_user.c index 2557852..37f54d2 100644 --- a/src/view/view_user.c +++ b/src/view/view_user.c @@ -1,5 +1,4 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the License); @@ -34,6 +33,13 @@ enum input_handler_type { INPUT_HANDLER_TYPE_BUTTON }; +enum user_item_type { + USER_ITEM_NONE = 0x00, + USER_ITEM_ADD = 0x01, + USER_ITEM_ADMIN = 0x02, + USER_ITEM_NORMAL = 0x08 +}; + struct _priv { Evas_Object *win; Evas_Object *base; @@ -43,6 +49,8 @@ struct _priv { struct datamgr *dm; struct _bar_item *foc; + + enum user_item_type user_type; }; struct _bar_item { @@ -52,6 +60,27 @@ struct _bar_item { struct _priv *priv; }; +static bool _check_editable_user(struct _priv *priv) +{ + struct _bar_item *bi; + bool r = false; + + switch (priv->user_type) { + case USER_ITEM_NORMAL: + bi = eina_list_data_get(priv->list); + if (priv->foc == bi) + r = true; + break; + case USER_ITEM_ADMIN: + r = true; + break; + default: + break; + } + + return r; +} + static void _focused(int id, void *data, Evas_Object *obj, Elm_Object_Item *item) { @@ -66,6 +95,9 @@ static void _focused(int id, void *data, Evas_Object *obj, priv->foc = bi; elm_object_signal_emit(obj, SIG_FOCUS, SRC_PROG); + + if (_check_editable_user(priv)) + elm_object_signal_emit(obj, SIG_SHOW_ARROW, SRC_PROG); } static void _unfocused(int id, void *data, Evas_Object *obj, @@ -75,6 +107,7 @@ static void _unfocused(int id, void *data, Evas_Object *obj, return; elm_object_signal_emit(obj, SIG_UNFOCUS, SRC_PROG); + elm_object_signal_emit(obj, SIG_HIDE_ARROW, SRC_PROG); } static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, @@ -154,9 +187,12 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, !strcmp(ev->keyname, KEY_BACK_REMOTE)) { elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG); } else if (!strcmp(ev->keyname, KEY_DOWN)) { - if (priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) + if (priv->foc->di->action == ITEM_SELECT_ACTION_PUSH || + !_check_editable_user(priv)) return; + viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_USER, + (void *)priv->user_type); viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_EDIT, priv->foc->di); viewmgr_push_view(VIEW_USER_EDIT); @@ -247,6 +283,7 @@ static void _arrow_clicked(void *data, Evas_Object *obj, const char *emission, if (priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) return; + viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_USER, (void *)priv->user_type); viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_EDIT, priv->foc->di); viewmgr_push_view(VIEW_USER_EDIT); } @@ -353,6 +390,7 @@ static void _add_user(struct _priv *priv) Evas_Object *scr, *box; struct _bar_item *bi; struct datamgr_item *di; + int i; scr = utils_add_scroller(priv->base); if (!scr) { @@ -378,11 +416,16 @@ static void _add_user(struct _priv *priv) return; } + i = 0; EINA_LIST_FOREACH(list, l, di) { bi = _pack_bar_item(priv, box, di); if (!bi) continue; + if (i == 0) { + priv->user_type = di->type; + i++; + } priv->list = eina_list_append(priv->list, bi); } diff --git a/src/view/view_user_edit.c b/src/view/view_user_edit.c index cbdf2fa..4140ef3 100644 --- a/src/view/view_user_edit.c +++ b/src/view/view_user_edit.c @@ -85,6 +85,8 @@ struct _priv { struct datamgr *dm; struct datamgr_item *di; + + enum user_item_type user_type; }; static void _focused(int id, void *data, Evas_Object *obj, @@ -663,18 +665,6 @@ static void _load_del_btn(struct _priv *priv) { Evas_Object *btn; - if (priv->di->type == USER_ITEM_ADMIN) { - btn = utils_add_layout(priv->ly, GRP_USER_EDIT_DELETE, false, - PART_USER_EDIT_CONTENTS_DELETE); - if (!btn) { - _ERR("failed to add delete button"); - return; - } - elm_object_signal_emit(btn, SIG_DISABLE, SRC_PROG); - return; - } - - btn = utils_add_layout(priv->ly, GRP_USER_EDIT_DELETE, true, PART_USER_EDIT_CONTENTS_DELETE); if (!btn) { @@ -711,7 +701,9 @@ static void _show(void *data) focus_photo = utils_get_focus_photo_from_photo(photo); _load_user_icon(priv, photo, focus_photo); } - _load_del_btn(priv); + if (priv->user_type == USER_ITEM_ADMIN && + priv->di->type !=USER_ITEM_ADMIN) + _load_del_btn(priv); } else { elm_object_part_text_set(priv->base, PART_USER_EDIT_TITLE, MESSAGE_ADD_USER); @@ -793,6 +785,9 @@ static void _update(void *view_data, int update_type, void *data) case UPDATE_TYPE_PHOTO: priv->selected_photo = data; break; + case UPDATE_TYPE_USER: + priv->user_type = (enum user_item_type) data; + break; default: _ERR("Invalid type"); return; -- 2.7.4 From d8fc6f9b23bac338a0fa72c5aa16433f92ca8885 Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Fri, 31 Jul 2015 17:12:13 +0900 Subject: [PATCH 10/16] bug fix - key handling in home view - block the enter key when focus is in recent arrow - move focus to list when focus is in recent arrow Change-Id: Ic0ef5b8a1f0ad4ce20c475c1d5f373d3276c96f3 Signed-off-by: Soohye Shin --- src/view/view_home.c | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/src/view/view_home.c b/src/view/view_home.c index 11dd94d..2256c9f 100644 --- a/src/view/view_home.c +++ b/src/view/view_home.c @@ -27,7 +27,6 @@ #include "utils.h" enum input_handler_type { - INPUT_HANDLER_TYPE_BASE, INPUT_HANDLER_TYPE_EO, INPUT_HANDLER_TYPE_DOWN }; @@ -92,29 +91,36 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev) { struct _priv *priv; + struct bar_item *bi; - if (id != INPUT_HANDLER_TYPE_BASE) + if (!data) return; - if (!data) { - _ERR("Invalid argument"); + switch (id) { + case INPUT_HANDLER_TYPE_EO: + bi = data; + priv = bi->priv; + if (!strcmp(ev->keyname, KEY_DOWN)) { + viewmgr_push_view(VIEW_RECENT); + } else if (!strcmp(ev->keyname, KEY_ENTER) || + !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { + if (priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) + elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG); + else + datamgr_select_item(priv->dm, priv->foc->di); + } + break; + case INPUT_HANDLER_TYPE_DOWN: + priv = data; + if (!strcmp(ev->keyname, KEY_UP)) + elm_object_focus_set(priv->foc->eo, EINA_TRUE); + else if (!strcmp(ev->keyname, KEY_ENTER) || + !strcmp(ev->keyname, KEY_ENTER_REMOTE)) + viewmgr_push_view(VIEW_RECENT); + break; + default: return; } - - priv = data; - - if (!strcmp(ev->keyname, KEY_DOWN)) { - viewmgr_push_view(VIEW_RECENT); - } else if (!strcmp(ev->keyname, KEY_ENTER) || - !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { - if (priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) - elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG); - else - datamgr_select_item(priv->dm, priv->foc->di); - } else if (!strcmp(ev->keyname, KEY_BACK) || - !strcmp(ev->keyname, KEY_BACK_REMOTE)) { - /* It should be implemented later */ - } } static void _mouse_down(int id, void *data, Evas *e, Evas_Object *obj, @@ -347,7 +353,6 @@ static Evas_Object *_create(Evas_Object *win, void *data) } viewmgr_set_view_data(VIEW_HOME, priv); - inputmgr_add_callback(base, INPUT_HANDLER_TYPE_BASE, &handler, priv); elm_object_signal_callback_add(base, SIG_HIDE_DONE, SRC_EDJE, _hide_done, priv); -- 2.7.4 From e23f61cefc8c8817654bd089924e7964f6ab5c7d Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Sat, 1 Aug 2015 13:56:21 +0900 Subject: [PATCH 11/16] fix checkpatch error Change-Id: I078d12117937cbd6f46149ed6bf82d707db34080 Signed-off-by: Soohye Shin --- include/defs.h | 4 ++++ src/data/data_recent.c | 6 ++---- src/view/view_home.c | 3 ++- src/view/view_recent.c | 4 ++-- src/view/view_user.c | 9 ++++++--- src/view/view_user_edit.c | 9 ++------- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/include/defs.h b/include/defs.h index 4a57ebb..4f47793 100644 --- a/include/defs.h +++ b/include/defs.h @@ -186,6 +186,10 @@ #define MESSAGE_OK "OK" #define MESSAGE_DONE "Done" #define MESSAGE_DISCARD "Discard" +#define MESSAGE_DELETE_CONTENTS "If you delete this user, their data will also be deleted." +#define MESSAGE_DISCARD_CONTENTS "Discard all entered data?
If you are out of this screen, data won't be saved" +#define MESSAGE_ENTRY_NAME "User Name" +#define MESSAGE_ENTRY_PIN "Pin code" #define GUM_ATTR_NAME "username" #define GUM_ATTR_USERTYPE "usertype" diff --git a/src/data/data_recent.c b/src/data/data_recent.c index e497e8d..7259ba1 100644 --- a/src/data/data_recent.c +++ b/src/data/data_recent.c @@ -77,14 +77,12 @@ static void _app_list_foreach(gpointer data, gpointer user_data) } r = pkgmgrinfo_appinfo_get_label(handle, &label); - if (r != PMINFO_R_OK) { + if (r != PMINFO_R_OK) _ERR("failed to get app label"); - } r = pkgmgrinfo_appinfo_get_effectimage(handle, &thumb, &thumb_land); - if (r != PMINFO_R_OK) { + if (r != PMINFO_R_OK) _ERR("failed to get app icon"); - } if (!strcmp(thumb_land, "")) thumb_land = THUMB_DEFAULT; diff --git a/src/view/view_home.c b/src/view/view_home.c index 2256c9f..22058d0 100644 --- a/src/view/view_home.c +++ b/src/view/view_home.c @@ -105,7 +105,8 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, } else if (!strcmp(ev->keyname, KEY_ENTER) || !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { if (priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) - elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG); + elm_object_signal_emit(priv->base, SIG_HIDE, + SRC_PROG); else datamgr_select_item(priv->dm, priv->foc->di); } diff --git a/src/view/view_recent.c b/src/view/view_recent.c index 73e1ed3..54bad0b 100644 --- a/src/view/view_recent.c +++ b/src/view/view_recent.c @@ -142,7 +142,7 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, if (!strcmp(ev->keyname, KEY_DOWN) || !strcmp(ev->keyname, KEY_BACK) || - !strcmp(ev->keyname, KEY_BACK_REMOTE)){ + !strcmp(ev->keyname, KEY_BACK_REMOTE)) { elm_object_signal_emit(priv->base, SIG_HIDE_RECENT, SRC_PROG); } @@ -327,7 +327,7 @@ static struct _bar_item *_pack_item(struct _priv *priv, Evas_Object *box, return NULL; } - if(di->subtitle) { + if (di->subtitle) { sub_lbl = utils_add_label(eo, di->subtitle, STYLE_LABEL_RECENT_SUBTITLE, PART_RECENT_SUBTITLE); diff --git a/src/view/view_user.c b/src/view/view_user.c index 37f54d2..60f811f 100644 --- a/src/view/view_user.c +++ b/src/view/view_user.c @@ -283,7 +283,8 @@ static void _arrow_clicked(void *data, Evas_Object *obj, const char *emission, if (priv->foc->di->action == ITEM_SELECT_ACTION_PUSH) return; - viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_USER, (void *)priv->user_type); + viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_USER, + (void *)priv->user_type); viewmgr_update_view(VIEW_USER_EDIT, UPDATE_TYPE_EDIT, priv->foc->di); viewmgr_push_view(VIEW_USER_EDIT); } @@ -338,7 +339,8 @@ static struct _bar_item *_pack_bar_item(struct _priv *priv, Evas_Object *box, if (!focus_lbl) goto err; - elm_object_signal_callback_add(eo, SIG_CLICK_ARROW, SRC_EDJE, _arrow_clicked, priv); + elm_object_signal_callback_add(eo, SIG_CLICK_ARROW, SRC_EDJE, + _arrow_clicked, priv); } else { eo = utils_add_layout(box, GRP_BAR_ITEM, true, NULL); if (!eo) { @@ -367,7 +369,8 @@ static struct _bar_item *_pack_bar_item(struct _priv *priv, Evas_Object *box, evas_object_size_hint_align_set(eo, 0.5, 0.0); inputmgr_add_callback(eo, INPUT_HANDLER_TYPE_EO, &handler, bi); - elm_object_signal_callback_add(eo, SIG_CLICK_ITEM, SRC_EDJE, _item_clicked, priv); + elm_object_signal_callback_add(eo, SIG_CLICK_ITEM, SRC_EDJE, + _item_clicked, priv); elm_box_pack_end(box, eo); evas_object_show(eo); diff --git a/src/view/view_user_edit.c b/src/view/view_user_edit.c index 4140ef3..6794072 100644 --- a/src/view/view_user_edit.c +++ b/src/view/view_user_edit.c @@ -25,11 +25,6 @@ #include "datamgr.h" #include "utils.h" -#define MESSAGE_DELETE_CONTENTS "If you delete this user, their data will also be deleted." -#define MESSAGE_DISCARD_CONTENTS "Discard all entered data?
If you are out of this screen, data won't be saved" - -#define MESSAGE_ENTRY_NAME "User Name" -#define MESSAGE_ENTRY_PIN "Pin code" #define KEY_ICON "icon" #define KEY_FOCUS_ICON "focusicon" @@ -642,7 +637,7 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, default: return; } - } else if(!strcmp(ev->keyname, KEY_ENTER) || + } else if (!strcmp(ev->keyname, KEY_ENTER) || !strcmp(ev->keyname, KEY_ENTER_REMOTE)) _select(priv, id, obj); } @@ -702,7 +697,7 @@ static void _show(void *data) _load_user_icon(priv, photo, focus_photo); } if (priv->user_type == USER_ITEM_ADMIN && - priv->di->type !=USER_ITEM_ADMIN) + priv->di->type != USER_ITEM_ADMIN) _load_del_btn(priv); } else { elm_object_part_text_set(priv->base, PART_USER_EDIT_TITLE, -- 2.7.4 From 41726613d2443889ba919e2266bde111ec770a29 Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Sat, 1 Aug 2015 19:04:55 +0900 Subject: [PATCH 12/16] bug fix - user edit view - support back key - remove pin entry - modify name entry to focus/unfocus - diable name entry when edit user Change-Id: Ie6e485ca853231fe08ca4891da9e3570f8e5ccf2 Signed-off-by: Soohye Shin --- edje/images/search_searchbar_small_bg_nor.png | Bin 0 -> 209 bytes edje/view/useredit.edc | 353 ++++++++++---------------- include/defs.h | 6 +- src/utils.c | 31 +-- src/view/view_user_edit.c | 146 +++++------ 5 files changed, 198 insertions(+), 338 deletions(-) create mode 100644 edje/images/search_searchbar_small_bg_nor.png diff --git a/edje/images/search_searchbar_small_bg_nor.png b/edje/images/search_searchbar_small_bg_nor.png new file mode 100644 index 0000000000000000000000000000000000000000..74848b3bca1b3fa523d0ac55d7cecc63e5155f73 GIT binary patch literal 209 zcmeAS@N?(olHy`uVBq!ia0vp^+#t-s0wkH2?q3U}7>k44ofy`glX(f`FeQ1ryDe+xGddG!C5Y46*;wUk@lTmxYybp;gj2yE+ t?tk$x{6$vo(HRnP*{2qAtMku!ODlf<(44$rjF6*2UngI4MLOcKf literal 0 HcmV?d00001 diff --git a/edje/view/useredit.edc b/edje/view/useredit.edc index 6e6889e..67b2b02 100644 --- a/edje/view/useredit.edc +++ b/edje/view/useredit.edc @@ -140,7 +140,7 @@ group { to, "contents"; relative, 0.5 0.5; } - min, 1128 408; + min, 1128 378; fixed, 1 1; } } @@ -153,6 +153,7 @@ group { image, "ic_user_require_01.png" COMP; image, "ic_user_require_02.png" COMP; image, "btn_user_del.png" COMP; + image, "search_searchbar_small_bg_nor.png" COMP; } parts { part { @@ -161,7 +162,7 @@ group { scale, 1; description { state, "default" 0.0; - min, 1128 408; + min, 1128 378; visible, 0; } } @@ -284,90 +285,6 @@ group { } } part { - name, "pad.require"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, PART_USER_EDIT_CONTENTS_PHOTO; - relative, 0.0 1.0; - } - rel2 { - to, PART_USER_EDIT_CONTENTS_PHOTO; - relative, 0.0 1.0; - } - min, 0 22; - fixed, 1 1; - align, 0.0 0.0; - visible, 0; - } - } - part { - name, "icon.require"; - type, IMAGE; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "pad.require"; - relative, 1.0 1.0; - } - rel2.to, "pad.require"; - min, 12 24; - fixed, 1 1; - align, 0.0 0.0; - image.normal, "ic_user_require_02.png"; - } - } - part { - name, "pad.require.text"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "icon.require"; - relative, 1.0 0.0; - } - rel2 { - to, "icon.require"; - relative, 1.0 0.0; - } - min, 6 0; - align, 0.0 0.0; - fixed, 1 1; - visible, 0; - } - } - part { - name, "require"; - type, TEXT; - scale, 1; - description { - state, "default" 0.0; - rel1 { - to, "pad.require.text"; - relative, 1.0 1.0; - } - rel2 { - to, "pad.require.text"; - relative, 1.0 1.0; - } - min, 294 24; - fixed, 1 1; - align, 0.0 0.0; - text { - font, "TizenSans"; - size, 24; - align, 0.0 0.5; - text, "Required fields"; - } - color, 64 136 211 255; - } - } - - part { name, "pad.profile"; type, RECT; scale, 1; @@ -450,12 +367,11 @@ group { min, 0 22; fixed, 1 1; align, 0.0 0.0; - visible, 0; } } part { - name, PART_USER_EDIT_CONTENTS_NAME; - type, SWALLOW; + name, "border.name"; + type, IMAGE; scale, 1; description { state, "default" 0.0; @@ -468,10 +384,56 @@ group { fixed, 1 1; align, 0.0 0.0; fixed, 1 1; + image { + normal, "search_searchbar_small_bg_nor.png"; + border, 4 4 4 4; + border_scale, 1; + } + visible, 1; + } + description { + state, "focus"; + inherit, "default" 0.0; + visible, 0; + } + } + part { + name, PART_USER_EDIT_CONTENTS_NAME; + type, SWALLOW; + scale, 1; + description { + state, "default" 0.0; + rel1 { + to, "border.name"; + relative, 0.5 0.5; + } + rel2 { + to, "border.name"; + relative, 0.5 0.5; + } + min, 432 60; + fixed, 1 1; + } + } + part { + name, "disable.name"; + type, RECT; + scale, 1; + description { + state, "default" 0.0; + rel1.to, PART_USER_EDIT_CONTENTS_NAME; + rel2.to, PART_USER_EDIT_CONTENTS_NAME; + color, 200 200 200 100; + visible, 0; + } + description { + state, "disable"; + inherit, "default" 0.0; + visible, 1; } } part { - name, "pad.pin"; + name, "pad.lock"; type, RECT; scale, 1; description { @@ -484,157 +446,154 @@ group { to, PART_USER_EDIT_CONTENTS_NAME; relative, 0.0 1.0; } - min, 0 32; + min, 0 42; fixed, 1 1; align, 0.0 0.0; visible, 0; } } part { - name, "pin"; + name, "lock"; type, TEXT; scale, 1; description { state, "default" 0.0; rel1 { - to, "pad.pin"; - relative, 0.0 1.0; - } - rel2 { - to, "pad.pin"; - relative, 0.0 1.0; + to, "pad.lock"; + relative, 1.0 1.0; } + rel2.to, "pad.lock"; min, 436 32; fixed, 1 1; align, 0.0 0.0; text { - text, "Pin code"; font, "TizenSans"; size, 32; + text, "Privacy lock"; align, 0.0 0.5; } color, 77 77 77 255; } } part { - name, "pad.pin.down"; + name, "pad.lock.down"; type, RECT; scale, 1; description { state, "default" 0.0; rel1 { - to, "pin"; + to, "lock"; relative, 0.0 1.0; } rel2 { - to, "pin"; + to, "lock"; relative, 0.0 1.0; } min, 0 22; - align, 0.0 0.0; fixed, 1 1; + align, 0.0 0.0; visible, 0; } } part { - name, PART_USER_EDIT_CONTENTS_PIN; + name, PART_USER_EDIT_CONTENTS_LOCK; type, SWALLOW; scale, 1; description { state, "default" 0.0; rel1 { - to, "pad.pin.down"; - relative, 1.0 1.0; - } - rel2 { - to, "pad.pin.down"; + to, "pad.lock.down"; relative, 1.0 1.0; } - min, 436 64; + rel2.to, "pad.lock.down"; + min, 104 54; fixed, 1 1; align, 0.0 0.0; } } part { - name, "pad.lock"; + name, "pad.require"; type, RECT; scale, 1; description { state, "default" 0.0; rel1 { - to, PART_USER_EDIT_CONTENTS_PIN; + to, PART_USER_EDIT_CONTENTS_LOCK; relative, 0.0 1.0; } rel2 { - to, PART_USER_EDIT_CONTENTS_PIN; + to, PART_USER_EDIT_CONTENTS_LOCK; relative, 0.0 1.0; } - min, 0 32; + min, 0 52; fixed, 1 1; align, 0.0 0.0; visible, 0; } } part { - name, "lock"; - type, TEXT; + name, "icon.require"; + type, IMAGE; scale, 1; description { state, "default" 0.0; rel1 { - to, "pad.lock"; + to, "pad.require"; relative, 1.0 1.0; } - rel2.to, "pad.lock"; - min, 436 32; + rel2.to, "pad.require"; + min, 12 24; fixed, 1 1; align, 0.0 0.0; - text { - font, "TizenSans"; - size, 32; - text, "Privacy lock"; - align, 0.0 0.5; - } - color, 77 77 77 255; + image.normal, "ic_user_require_02.png"; } } part { - name, "pad.lock.down"; + name, "pad.require.text"; type, RECT; scale, 1; description { state, "default" 0.0; rel1 { - to, "lock"; - relative, 0.0 1.0; + to, "icon.require"; + relative, 1.0 0.0; } rel2 { - to, "lock"; - relative, 0.0 1.0; + to, "icon.require"; + relative, 1.0 0.0; } - min, 0 22; - fixed, 1 1; + min, 6 0; align, 0.0 0.0; + fixed, 1 1; visible, 0; } } part { - name, PART_USER_EDIT_CONTENTS_LOCK; - type, SWALLOW; + name, "require"; + type, TEXT; scale, 1; description { state, "default" 0.0; rel1 { - to, "pad.lock.down"; + to, "pad.require.text"; relative, 1.0 1.0; } - rel2.to, "pad.lock.down"; - min, 104 54; + rel2 { + to, "pad.require.text"; + relative, 1.0 1.0; + } + min, 294 24; fixed, 1 1; align, 0.0 0.0; + text { + font, "TizenSans"; + size, 24; + align, 0.0 0.5; + text, "Required fields"; + } + color, 64 136 211 255; } } - part { name, "pad.delete"; type, RECT; @@ -643,15 +602,15 @@ group { state, "default" 0.0; rel1 { to, PART_USER_EDIT_CONTENTS_NAME; - relative, 1.0 0.0; + relative, 1.0 0.5; } rel2 { to, PART_USER_EDIT_CONTENTS_NAME; - relative, 1.0 0.0; + relative, 1.0 0.5; } min, 14 0; fixed, 1 1; - align, 0.0 0.0; + align, 0.0 0.5; visible, 0; } } @@ -663,18 +622,48 @@ group { state, "default" 0.0; rel1 { to, "pad.delete"; - relative, 1.0 0.0; + relative, 1.0 0.5; } rel2 { to, "pad.delete"; - relative, 1.0 0.0; + relative, 1.0 0.5; } min, 174 64; fixed, 1 1; - align, 0.0 0.0; + align, 0.0 0.5; } } } + programs { + program { + name, "sig,focus"; + signal, SIG_FOCUS; + source, SRC_PROG; + action, STATE_SET "focus" 0.0; + target, "border.name"; + } + program { + name, "sig,unfocus"; + signal, SIG_UNFOCUS; + source, SRC_PROG; + action, STATE_SET "default" 0.0; + target, "border.name"; + } + program { + name, "sig,disable"; + signal, SIG_DISABLE; + source, SRC_PROG; + action, STATE_SET "disable" 0.0; + target, "disable.name"; + } + program { + name, "sig,enable"; + signal, SIG_ENABLE; + source, SRC_PROG; + action, STATE_SET "default" 0.0; + target, "disable.name"; + } + } } group { @@ -863,80 +852,6 @@ group { } group { - name, GRP_USER_EDIT_ENTRY; - parts { - part { - name, "bg"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - min, 436 64; - color, 194 194 194 255; - } - description { - state, "focus" 0.0; - inherit, "default" 0.0; - color, 0 119 246 255; - } - description { - state, "disable" 0.0; - inherit, "default" 0.0; - color, 194 194 194 120; - } - } - part { - name, "bg.entry"; - type, RECT; - scale, 1; - description { - state, "default" 0.0; - min, 432 60; - rel1.relative, 0.5 0.5; - rel2.relative, 0.5 0.5; - fixed, 1 1; - } - } - part { - name, PART_USER_EDIT_ENTRY; - type, SWALLOW; - scale, 1; - description { - state, "default" 0.0; - rel1.to, "bg.entry"; - rel2.to, "bg.entry"; - fixed, 1 1; - } - } - } - programs { - program { - name, "sig,focus"; - signal, SIG_FOCUS; - source, SRC_PROG; - action, STATE_SET "focus"; - transition, TRANSITION_LINEAR; - target, "bg"; - } - program { - name, "sig,unfocus"; - signal, SIG_UNFOCUS; - source, SRC_PROG; - action, STATE_SET "default" 0.0; - transition, TRANSITION_LINEAR; - target, "bg"; - } - program { - name, "sig,disable"; - signal, SIG_DISABLE; - source, SRC_PROG; - action, STATE_SET "disable" 0.0; - target, "bg"; - } - } -} - -group { name, GRP_USER_EDIT_DELETE; parts { part { diff --git a/include/defs.h b/include/defs.h index 4f47793..752c66c 100644 --- a/include/defs.h +++ b/include/defs.h @@ -25,6 +25,7 @@ #define SRC_PROG "prog" #define SRC_EDJE "edje" +#define SRC_ELM "elm" #define ICON_ADD "add" #define GRP_HOME "group.home" @@ -114,6 +115,7 @@ #define SIG_HIDE_RECENT "sig.hide.recent" #define SIG_HIDE_RECENT_DONE "sig.hide.recent.done" #define SIG_DISABLE "sig.disable" +#define SIG_ENABLE "sig.enable" #define SIG_SHOW_MASK "sig.show.mask" #define SIG_SHOW "sig.show" #define SIG_HIDE "sig.hide" @@ -122,6 +124,8 @@ #define SIG_CLICK_ARROW "sig.click.arrow" #define SIG_SHOW_ARROW "sig.show.arrow" #define SIG_HIDE_ARROW "sig.hide.arrow" +#define SIG_SELECT "elm,state,selected" +#define SIG_UNSELECT "elm,state,unselected" #define TITLE_WIDTH "title.width" @@ -188,8 +192,6 @@ #define MESSAGE_DISCARD "Discard" #define MESSAGE_DELETE_CONTENTS "If you delete this user, their data will also be deleted." #define MESSAGE_DISCARD_CONTENTS "Discard all entered data?
If you are out of this screen, data won't be saved" -#define MESSAGE_ENTRY_NAME "User Name" -#define MESSAGE_ENTRY_PIN "Pin code" #define GUM_ATTR_NAME "username" #define GUM_ATTR_USERTYPE "usertype" diff --git a/src/utils.c b/src/utils.c index cb24df5..aadb952 100644 --- a/src/utils.c +++ b/src/utils.c @@ -18,7 +18,6 @@ #include #include #include -#include #include "utils.h" #include "defs.h" @@ -313,35 +312,12 @@ Evas_Object *utils_add_button(Evas_Object *base, char *text, const char *part) return btn; } -static void _entry_focused(int id, void *data, Evas_Object *obj, - Elm_Object_Item *item) -{ - elm_object_signal_emit(data, SIG_FOCUS, SRC_PROG); -} - -static void _entry_unfocused(int id, void *data, Evas_Object *obj, - Elm_Object_Item *item) -{ - elm_object_signal_emit(data, SIG_UNFOCUS, SRC_PROG); -} - -static input_handler entry_handle = { - .focused = _entry_focused, - .unfocused = _entry_unfocused -}; - Evas_Object *utils_add_entry(Evas_Object *base, char *text, bool password, const char *part) { - Evas_Object *ly, *entry; - - ly = utils_add_layout(base, GRP_USER_EDIT_ENTRY, false, part); - if (!ly) { - _ERR("failed to add entry layout"); - return NULL; - } + Evas_Object *entry; - entry = elm_entry_add(ly); + entry = elm_entry_add(base); if (!entry) { _ERR("failed to add entry"); return NULL; @@ -362,9 +338,8 @@ Evas_Object *utils_add_entry(Evas_Object *base, char *text, bool password, ELM_SCROLLER_POLICY_OFF); if (text) elm_entry_entry_set(entry, text); - elm_object_part_content_set(ly, PART_USER_EDIT_ENTRY, entry); + elm_object_part_content_set(base, part, entry); - inputmgr_add_callback(entry, 0, &entry_handle, ly); evas_object_show(entry); return entry; diff --git a/src/view/view_user_edit.c b/src/view/view_user_edit.c index 6794072..0ef6b49 100644 --- a/src/view/view_user_edit.c +++ b/src/view/view_user_edit.c @@ -34,7 +34,6 @@ enum input_handler_type { INPUT_HANDLER_TYPE_PHOTO, - INPUT_HANDLER_TYPE_LOCK, INPUT_HANDLER_TYPE_DELETE, INPUT_HANDLER_TYPE_EO, INPUT_HANDLER_TYPE_BTN_DONE, @@ -42,7 +41,8 @@ enum input_handler_type { INPUT_HANDLER_TYPE_POPUP_BTN_DISCARD, INPUT_HANDLER_TYPE_POPUP_BTN_CANCEL, INPUT_HANDLER_TYPE_DELETE_POPUP_BTN_DELETE, - INPUT_HANDLER_TYPE_DELETE_POPUP_BTN_CANCEL + INPUT_HANDLER_TYPE_DELETE_POPUP_BTN_CANCEL, + INPUT_HANDLER_TYPE_ENTRY }; enum user_item_type { @@ -65,8 +65,6 @@ struct _priv { Evas_Object *ly; Evas_Object *photo; Evas_Object *name; - Evas_Object *pin; - Evas_Object *lock; Evas_Object *icon; Evas_Object *focus_icon; Evas_Object *done; @@ -74,7 +72,6 @@ struct _priv { Evas_Object *ctxpopup; Evas_Object *del; Evas_Object *popup; - Evas_Object *lock_icon; char *selected_photo; @@ -87,13 +84,19 @@ struct _priv { static void _focused(int id, void *data, Evas_Object *obj, Elm_Object_Item *item) { + struct _priv *priv; + switch (id) { case INPUT_HANDLER_TYPE_PHOTO: - case INPUT_HANDLER_TYPE_LOCK: case INPUT_HANDLER_TYPE_DELETE: case INPUT_HANDLER_TYPE_EO: elm_object_signal_emit(obj, SIG_FOCUS, SRC_PROG); break; + case INPUT_HANDLER_TYPE_ENTRY: + priv = data; + elm_object_signal_emit(obj, SIG_SELECT, SRC_ELM); + elm_object_signal_emit(priv->ly, SIG_FOCUS, SRC_PROG); + break; default: return; } @@ -102,13 +105,19 @@ static void _focused(int id, void *data, Evas_Object *obj, static void _unfocused(int id, void *data, Evas_Object *obj, Elm_Object_Item *item) { + struct _priv *priv; + switch (id) { case INPUT_HANDLER_TYPE_PHOTO: - case INPUT_HANDLER_TYPE_LOCK: case INPUT_HANDLER_TYPE_DELETE: case INPUT_HANDLER_TYPE_EO: elm_object_signal_emit(obj, SIG_UNFOCUS, SRC_PROG); break; + case INPUT_HANDLER_TYPE_ENTRY: + priv = data; + elm_object_signal_emit(obj, SIG_UNSELECT, SRC_ELM); + elm_object_signal_emit(priv->ly, SIG_UNFOCUS, SRC_PROG); + break; default: return; } @@ -128,10 +137,9 @@ static input_handler handler = { }; static void _get_profile(struct _priv *priv, const char **name, - const char **photo, const char **pin) + const char **photo) { *name = elm_entry_entry_get(priv->name); - *pin = elm_entry_entry_get(priv->pin); elm_image_file_get(priv->icon, photo, NULL); *photo = utils_get_icon_from_photo(*photo); } @@ -179,18 +187,15 @@ static void _add_discard_popup(struct _priv *priv) static bool _check_changed_input(struct _priv *priv) { - const char *photo, *name, *pin; + const char *photo, *name; - _get_profile(priv, &name, &photo, &pin); + _get_profile(priv, &name, &photo); if (priv->di) { - if (!strcmp(name, priv->di->title) && !strcmp(pin, "") && - !strcmp(photo, priv->di->icon)) + if (!strcmp(photo, priv->di->icon)) return false; } else { - if (!strcmp(name, MESSAGE_ENTRY_NAME) && - !strcmp(pin, MESSAGE_ENTRY_PIN) && - !strcmp(photo, IMAGE_USER_DEFAULT)) + if (!strcmp(name, "") && !strcmp(photo, IMAGE_USER_DEFAULT)) return false; } @@ -334,51 +339,9 @@ static void _add_icon_list(struct _priv *priv) priv->ctxpopup = ctxpopup; } -static void _change_entry_status(Evas_Object *pin, Eina_Bool disable, - const char *signal) -{ - Evas_Object *parent; - - elm_entry_editable_set(pin, disable); - parent = elm_object_parent_widget_get(pin); - if (parent) - elm_object_signal_emit(parent, signal, SRC_PROG); - - elm_object_focus_allow_set(pin, disable); -} - -static void _load_lock_icon(struct _priv *priv) -{ - const char *file = NULL; - - if (!priv->lock_icon) { - priv->lock_icon = utils_add_icon(priv->lock, IMAGE_SWITCH_ON, - PART_USER_EDIT_SWITCH); - _change_entry_status(priv->pin, EINA_TRUE, SIG_UNFOCUS); - return; - } - - elm_image_file_get(priv->lock_icon, &file, NULL); - elm_object_part_content_unset(priv->lock, PART_USER_EDIT_SWITCH); - evas_object_del(priv->lock_icon); - - if (!file || !strcmp(file, IMAGE_SWITCH_OFF)) { - file = IMAGE_SWITCH_ON; - _change_entry_status(priv->pin, EINA_TRUE, SIG_UNFOCUS); - elm_entry_entry_set(priv->pin, MESSAGE_ENTRY_PIN); - } else { - file = IMAGE_SWITCH_OFF; - _change_entry_status(priv->pin, EINA_FALSE, SIG_DISABLE); - elm_entry_entry_set(priv->pin, ""); - } - - priv->lock_icon = utils_add_icon(priv->lock, file, - PART_USER_EDIT_SWITCH); -} - static Evas_Object *_add_layout(struct _priv *priv) { - Evas_Object *ly, *photo, *name, *pin, *lock; + Evas_Object *ly, *photo, *name, *lock; ly = utils_add_layout(priv->base, GRP_USER_EDIT_CONTENTS, false, PART_USER_EDIT_CONTENTS); @@ -397,23 +360,18 @@ static Evas_Object *_add_layout(struct _priv *priv) if (!name) goto err; - pin = utils_add_entry(ly, MESSAGE_ENTRY_PIN, false, - PART_USER_EDIT_CONTENTS_PIN); - if (!pin) - goto err; - - lock = utils_add_layout(ly, GRP_USER_EDIT_SWITCH, true, + lock = utils_add_layout(ly, GRP_USER_EDIT_SWITCH, false, PART_USER_EDIT_CONTENTS_LOCK); if (!lock) goto err; - inputmgr_add_callback(lock, INPUT_HANDLER_TYPE_LOCK, &handler, priv); + utils_add_icon(lock, IMAGE_SWITCH_OFF, PART_USER_EDIT_SWITCH); + inputmgr_add_callback(photo, INPUT_HANDLER_TYPE_PHOTO, &handler, priv); + inputmgr_add_callback(name, INPUT_HANDLER_TYPE_ENTRY, &handler, priv); - priv->lock = lock; priv->photo = photo; priv->name = name; - priv->pin = pin; return ly; err: @@ -438,8 +396,6 @@ static bool _add_user_edit(struct _priv *priv) return false; } - /* It should be implemented later about function btn */ - priv->ly = ly; return true; @@ -545,18 +501,17 @@ static void _select_eo(struct _priv *priv, Evas_Object *obj) static void _select_btn_done(struct _priv *priv) { - const char *name, *pin, *photo; + const char *name, *photo; - _get_profile(priv, &name, &photo, &pin); + _get_profile(priv, &name, &photo); if (priv->di) { priv->di->action = ITEM_SELECT_ACTION_UPDATE; priv->di->title = strdup(name ? name : ""); priv->di->icon = strdup(photo ? photo : IMAGE_USER_DEFAULT); - priv->di->parameter = strdup(pin ? pin : ""); datamgr_select_item(priv->dm, priv->di); } else - datamgr_add_item(priv->dm, name, photo, pin); + datamgr_add_item(priv->dm, name, photo, ""); priv->di = NULL; viewmgr_pop_view(); @@ -568,9 +523,6 @@ static void _select(struct _priv *priv, int id, Evas_Object *obj) case INPUT_HANDLER_TYPE_PHOTO: _add_icon_list(priv); break; - case INPUT_HANDLER_TYPE_LOCK: - _load_lock_icon(priv); - break; case INPUT_HANDLER_TYPE_DELETE: _add_delete_popup(priv); break; @@ -620,6 +572,17 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, if (!strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_BACK_REMOTE)) { switch (id) { + case INPUT_HANDLER_TYPE_PHOTO: + case INPUT_HANDLER_TYPE_BTN_DONE: + case INPUT_HANDLER_TYPE_BTN_CANCEL: + case INPUT_HANDLER_TYPE_DELETE: + case INPUT_HANDLER_TYPE_ENTRY: + if (_check_changed_input(priv)) { + _add_discard_popup(priv); + return; + } + viewmgr_pop_view(); + break; case INPUT_HANDLER_TYPE_EO: evas_object_del(priv->ctxpopup); priv->ctxpopup = NULL; @@ -638,8 +601,12 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, return; } } else if (!strcmp(ev->keyname, KEY_ENTER) || - !strcmp(ev->keyname, KEY_ENTER_REMOTE)) + !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { _select(priv, id, obj); + } else if (!strcmp(ev->keyname, KEY_RIGHT)) { + if (id == INPUT_HANDLER_TYPE_PHOTO && priv->del) + elm_object_focus_set(priv->del, EINA_TRUE); + } } static void _mouse_down(int id, void *data, Evas *e, Evas_Object *obj, @@ -671,6 +638,15 @@ static void _load_del_btn(struct _priv *priv) priv->del = btn; } +static void _change_entry(Evas_Object *name, Evas_Object *ly, Eina_Bool disable, + const char *text, const char *signal) +{ + elm_entry_entry_set(name, text); + elm_object_focus_allow_set(name, disable); + elm_entry_editable_set(name, disable); + elm_object_signal_emit(ly, signal, SRC_PROG); +} + static void _show(void *data) { struct _priv *priv; @@ -686,8 +662,8 @@ static void _show(void *data) if (priv->di) { elm_object_part_text_set(priv->base, PART_USER_EDIT_TITLE, MESSAGE_EDIT_USER); - elm_entry_entry_set(priv->name, priv->di->title); - elm_entry_entry_set(priv->pin, ""); + _change_entry(priv->name, priv->ly, EINA_FALSE, priv->di->title, + SIG_DISABLE); if (priv->selected_photo) { _load_user_icon(priv, priv->selected_photo, priv->selected_photo); @@ -702,8 +678,7 @@ static void _show(void *data) } else { elm_object_part_text_set(priv->base, PART_USER_EDIT_TITLE, MESSAGE_ADD_USER); - elm_entry_entry_set(priv->name, MESSAGE_ENTRY_NAME); - elm_entry_entry_set(priv->pin, MESSAGE_ENTRY_PIN); + _change_entry(priv->name, priv->ly, EINA_TRUE, "", SIG_ENABLE); if (priv->selected_photo) _load_user_icon(priv, priv->selected_photo, priv->selected_photo); @@ -712,7 +687,6 @@ static void _show(void *data) IMAGE_USER_CURRENT_DEFAULT_FOCUS); } - _load_lock_icon(priv); evas_object_show(priv->base); elm_object_focus_set(priv->cancel, EINA_TRUE); } @@ -733,11 +707,6 @@ static void _hide(void *data) priv->del = NULL; } - if (priv->lock_icon) { - evas_object_del(priv->lock_icon); - priv->lock_icon = NULL; - } - priv->selected_photo = NULL; evas_object_hide(priv->base); } @@ -754,7 +723,6 @@ static void _destroy(void *data) priv = data; inputmgr_remove_callback(priv->photo, &handler); - inputmgr_remove_callback(priv->lock, &handler); inputmgr_remove_callback(priv->done, &handler); inputmgr_remove_callback(priv->cancel, &handler); viewmgr_remove_view(VIEW_PHOTO); -- 2.7.4 From faa6a76578cd96d2f8e4b5eb87b0b714ee134568 Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Mon, 3 Aug 2015 10:04:18 +0900 Subject: [PATCH 13/16] bug fix - build error Change-Id: I05750c2c75f1ca3bde80026f4ae74c4169c5cde3 Signed-off-by: Soohye Shin --- src/view/view_user_edit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/view/view_user_edit.c b/src/view/view_user_edit.c index 0ef6b49..6ce8a13 100644 --- a/src/view/view_user_edit.c +++ b/src/view/view_user_edit.c @@ -355,8 +355,7 @@ static Evas_Object *_add_layout(struct _priv *priv) if (!photo) goto err; - name = utils_add_entry(ly, MESSAGE_ENTRY_NAME, false, - PART_USER_EDIT_CONTENTS_NAME); + name = utils_add_entry(ly, "", false, PART_USER_EDIT_CONTENTS_NAME); if (!name) goto err; -- 2.7.4 From dc973a407b661e2b3d8c33173fda964578df6bb2 Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Mon, 3 Aug 2015 16:26:26 +0900 Subject: [PATCH 14/16] set focus move policy form IN to CLICK Change-Id: I5d725f45937f96bb52a91f645230dd7703d823fb Signed-off-by: Soohye Shin --- edje/view/home.edc | 5 +++++ edje/view/recent.edc | 23 ++++++++++++-------- edje/view/user.edc | 5 +++++ include/defs.h | 4 +--- src/main.c | 2 +- src/view/view_home.c | 34 ++++++++++++++++++++++++----- src/view/view_photo.c | 34 ++++++++++++++++++++++++----- src/view/view_recent.c | 55 ++++++++++++++++++++++++++++------------------- src/view/view_user.c | 29 +++++++++++++++++++------ src/view/view_user_edit.c | 40 ++++++++++++++++++++++++++++------ 10 files changed, 172 insertions(+), 59 deletions(-) diff --git a/edje/view/home.edc b/edje/view/home.edc index 837fe49..c2fd4b6 100644 --- a/edje/view/home.edc +++ b/edje/view/home.edc @@ -152,6 +152,11 @@ group { transition, TRANSITION_DECEL; target, "clip"; target, PART_HOME_MENU_BAR; + after, "sig,show,done"; + } + program { + name, "sig,show,done"; + action, SIGNAL_EMIT SIG_SHOW_DONE SRC_EDJE; } program { name, "sig,hide"; diff --git a/edje/view/recent.edc b/edje/view/recent.edc index a26d02b..4a60d10 100644 --- a/edje/view/recent.edc +++ b/edje/view/recent.edc @@ -217,33 +217,38 @@ group { } programs { program { - name, "sig,show,recent"; - signal, SIG_SHOW_RECENT; + name, "sig,show"; + signal, SIG_SHOW; source, SRC_PROG; action, STATE_SET "show" 0.0; transition, TRANSITION_DECEL; target, "clip"; target, "guide"; + after, "sig,show,done"; } program { - name, "sig,hide,recent"; - signal, SIG_HIDE_RECENT; + name, "sig,show,done"; + action, SIGNAL_EMIT SIG_SHOW_DONE SRC_EDJE; + } + program { + name, "sig,hide"; + signal, SIG_HIDE; source, SRC_PROG; action, STATE_SET "default" 0.0; transition, TRANSITION_DECEL; target, "clip"; target, "guide"; - after, "sig.hide.recent.done"; + after, "sig,hide,done"; } program { - name, "sig.hide.recent.done"; - action, SIGNAL_EMIT SIG_HIDE_RECENT_DONE SRC_EDJE; + name, "sig,hide,done"; + action, SIGNAL_EMIT SIG_HIDE_DONE SRC_EDJE; } program { - name, "outside.up.clicked"; + name, "outside,up,clicked"; source, "outside.up"; signal, "mouse,clicked,1"; - action, SIGNAL_EMIT SIG_HIDE_RECENT SRC_PROG; + action, SIGNAL_EMIT SIG_HIDE SRC_PROG; } } } diff --git a/edje/view/user.edc b/edje/view/user.edc index 574b5eb..b7cddcf 100644 --- a/edje/view/user.edc +++ b/edje/view/user.edc @@ -130,6 +130,11 @@ group { target, "clip"; target, PART_USER_BAR; target, "text"; + after, "sig,show,done"; + } + program { + name, "sig,show,done"; + action, SIGNAL_EMIT SIG_SHOW_DONE SRC_EDJE; } program { name, "sig,hide"; diff --git a/include/defs.h b/include/defs.h index 752c66c..23a7573 100644 --- a/include/defs.h +++ b/include/defs.h @@ -111,13 +111,11 @@ #define SIG_UNFOCUS "sig.unfocus" #define SIG_UNFOCUS_TO_RIGHT "sig.unfocus.to.right" #define SIG_UNFOCUS_TO_LEFT "sig.unfocus.to.left" -#define SIG_SHOW_RECENT "sig.show.recent" -#define SIG_HIDE_RECENT "sig.hide.recent" -#define SIG_HIDE_RECENT_DONE "sig.hide.recent.done" #define SIG_DISABLE "sig.disable" #define SIG_ENABLE "sig.enable" #define SIG_SHOW_MASK "sig.show.mask" #define SIG_SHOW "sig.show" +#define SIG_SHOW_DONE "sig.show.done" #define SIG_HIDE "sig.hide" #define SIG_HIDE_DONE "sig.hide.done" #define SIG_CLICK_ITEM "sig.click.item" diff --git a/src/main.c b/src/main.c index 8e734d1..9338fed 100644 --- a/src/main.c +++ b/src/main.c @@ -57,7 +57,7 @@ static bool _create(void *user_data) ad = user_data; elm_theme_overlay_add(NULL, THEMEFILE); - elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN); + elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK); win = _add_win(ad->name); if (!win) { diff --git a/src/view/view_home.c b/src/view/view_home.c index 22058d0..e65161d 100644 --- a/src/view/view_home.c +++ b/src/view/view_home.c @@ -150,11 +150,26 @@ static void _mouse_down(int id, void *data, Evas *e, Evas_Object *obj, } } +static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Move *ev) +{ + switch (id) { + case INPUT_HANDLER_TYPE_DOWN: + case INPUT_HANDLER_TYPE_EO: + if (!elm_object_focus_get(obj)) + elm_object_focus_set(obj, EINA_TRUE); + break; + default: + return; + } +} + static input_handler handler = { .focused = _focused, .unfocused = _unfocused, .key_down = _key_down, - .mouse_down = _mouse_down + .mouse_down = _mouse_down, + .mouse_move = _mouse_move }; static bool _add_navigations(struct _priv *priv, Evas_Object *base) @@ -311,6 +326,17 @@ static void _hide_done(void *data, Evas_Object *obj, const char *emission, datamgr_select_item(priv->dm, priv->foc->di); } +static void _show_done(void *data, Evas_Object *obj, const char *emission, + const char *source) +{ + struct _priv *priv = data; + + if (!priv->foc) + priv->foc = eina_list_data_get(priv->list); + + elm_object_focus_set(priv->foc->eo, EINA_TRUE); +} + static Evas_Object *_create(Evas_Object *win, void *data) { struct _priv *priv; @@ -356,6 +382,8 @@ static Evas_Object *_create(Evas_Object *win, void *data) viewmgr_set_view_data(VIEW_HOME, priv); elm_object_signal_callback_add(base, SIG_HIDE_DONE, SRC_EDJE, _hide_done, priv); + elm_object_signal_callback_add(base, SIG_SHOW_DONE, SRC_EDJE, + _show_done, priv); return base; } @@ -376,10 +404,6 @@ static void _show(void *data) evas_object_show(priv->base); elm_object_signal_emit(priv->base, SIG_SHOW_NAVIGATION, SRC_PROG); elm_object_signal_emit(priv->base, SIG_SHOW, SRC_PROG); - - if (!priv->foc) - priv->foc = eina_list_data_get(priv->list); - elm_object_focus_set(priv->foc->eo, EINA_TRUE); } static void _unload_home(struct _priv *priv) diff --git a/src/view/view_photo.c b/src/view/view_photo.c index 1360ce4..f417d54 100644 --- a/src/view/view_photo.c +++ b/src/view/view_photo.c @@ -50,12 +50,37 @@ struct _priv { static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev); -static void _mouse_up(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Mouse_Up *ev); +static void _clicked(int id, void *data, Evas_Object *obj); + +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 INPUT_HANDLER_TYPE_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 INPUT_HANDLER_TYPE_DONE: + case INPUT_HANDLER_TYPE_CANCEL: + if (!elm_object_focus_get(obj)) + elm_object_focus_set(obj, EINA_TRUE); + break; + default: + return; + } +} static input_handler handler = { .key_down = _key_down, - .mouse_up = _mouse_up + .clicked = _clicked, + .mouse_move = _mouse_move }; static void _delete_popup(struct _priv *priv, Evas_Object *obj) @@ -126,8 +151,7 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, } } -static void _mouse_up(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Mouse_Up *ev) +static void _clicked(int id, void *data, Evas_Object *obj) { struct _priv *priv; diff --git a/src/view/view_recent.c b/src/view/view_recent.c index 54bad0b..f1445b1 100644 --- a/src/view/view_recent.c +++ b/src/view/view_recent.c @@ -112,8 +112,7 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, if (!strcmp(ev->keyname, KEY_DOWN) || !strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_BACK_REMOTE)) { - elm_object_signal_emit(priv->base, SIG_HIDE_RECENT, - SRC_PROG); + elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG); } else if (!strcmp(ev->keyname, KEY_ENTER) || !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { datamgr_select_item(priv->dm, bi->di); @@ -124,13 +123,11 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, if (!strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_BACK_REMOTE)) { - elm_object_signal_emit(priv->base, SIG_HIDE_RECENT, - SRC_PROG); + elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG); } else if (!strcmp(ev->keyname, KEY_ENTER) || !strcmp(ev->keyname, KEY_ENTER_REMOTE)) { datamgr_clear_item(priv->dm); - elm_object_signal_emit(priv->base, SIG_HIDE_RECENT, - SRC_PROG); + elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG); } else if (!strcmp(ev->keyname, KEY_DOWN)) { if (!priv->cur) priv->cur = eina_list_data_get(priv->list); @@ -143,8 +140,7 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, if (!strcmp(ev->keyname, KEY_DOWN) || !strcmp(ev->keyname, KEY_BACK) || !strcmp(ev->keyname, KEY_BACK_REMOTE)) { - elm_object_signal_emit(priv->base, SIG_HIDE_RECENT, - SRC_PROG); + elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG); } break; default: @@ -174,19 +170,26 @@ static void _mouse_down(int id, void *data, Evas *e, Evas_Object *obj, priv = data; datamgr_clear_item(priv->dm); - elm_object_signal_emit(priv->base, SIG_HIDE_RECENT, - SRC_PROG); + elm_object_signal_emit(priv->base, SIG_HIDE, SRC_PROG); break; default: return; } } +static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Move *ev) +{ + if (!elm_object_focus_get(obj)) + elm_object_focus_set(obj, EINA_TRUE); +} + static input_handler handler = { .focused = _focused, .unfocused = _unfocused, .key_down = _key_down, - .mouse_down = _mouse_down + .mouse_down = _mouse_down, + .mouse_move = _mouse_move }; static void _hide_done(void *data, Evas_Object *obj, const char *emission, @@ -228,6 +231,20 @@ static void _add_delete_btn(struct _priv *priv, const char *ic_image, priv->del_btn = btn; } +static void _show_done(void *data, Evas_Object *obj, const char *emission, + const char *source) +{ + struct _priv *priv = data; + struct _bar_item *bi; + + if (!priv->list) { + elm_object_focus_set(priv->del_btn, EINA_TRUE); + } else { + bi = eina_list_data_get(priv->list); + elm_object_focus_set(bi->eo, EINA_TRUE); + } +} + static Evas_Object *_create(Evas_Object *win, void *data) { struct _priv *priv; @@ -268,8 +285,10 @@ static Evas_Object *_create(Evas_Object *win, void *data) priv->dm = dm; viewmgr_set_view_data(VIEW_RECENT, priv); - elm_object_signal_callback_add(base, SIG_HIDE_RECENT_DONE, SRC_EDJE, + elm_object_signal_callback_add(base, SIG_HIDE_DONE, SRC_EDJE, _hide_done, NULL); + elm_object_signal_callback_add(base, SIG_SHOW_DONE, SRC_EDJE, + _show_done, priv); return base; } @@ -397,7 +416,6 @@ static void _load_recent(struct _priv *priv) static void _show(void *data) { struct _priv *priv; - struct _bar_item *bi; if (!data) { _ERR("Invalid argument"); @@ -406,17 +424,10 @@ static void _show(void *data) priv = data; - evas_object_show(priv->base); - elm_object_signal_emit(priv->base, SIG_SHOW_RECENT, SRC_PROG); - _load_recent(priv); - if (!priv->list) { - elm_object_focus_set(priv->del_btn, EINA_TRUE); - } else { - bi = eina_list_data_get(priv->list); - elm_object_focus_set(bi->eo, EINA_TRUE); - } + evas_object_show(priv->base); + elm_object_signal_emit(priv->base, SIG_SHOW, SRC_PROG); } static void _unload_recent(struct _priv *priv) diff --git a/src/view/view_user.c b/src/view/view_user.c index 60f811f..4ff15ff 100644 --- a/src/view/view_user.c +++ b/src/view/view_user.c @@ -116,11 +116,19 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, static void _mouse_down(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Mouse_Down *ev); +static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Move *ev) +{ + if (!elm_object_focus_get(obj)) + elm_object_focus_set(obj, EINA_TRUE); +} + static input_handler handler = { .focused = _focused, .unfocused = _unfocused, .key_down = _key_down, - .mouse_down = _mouse_down + .mouse_down = _mouse_down, + .mouse_move = _mouse_move }; static void _add_popup(struct _priv *priv) @@ -227,6 +235,17 @@ static void _hide_done(void *data, Evas_Object *obj, const char *emission, viewmgr_pop_view(); } +static void _show_done(void *data, Evas_Object *obj, const char *emission, + const char *source) +{ + struct _priv *priv = data; + + if (!priv->foc) + priv->foc = eina_list_data_get(priv->list); + + elm_object_focus_set(priv->foc->eo, EINA_TRUE); +} + static Evas_Object *_create(Evas_Object *win, void *data) { struct _priv *priv; @@ -271,7 +290,8 @@ static Evas_Object *_create(Evas_Object *win, void *data) inputmgr_add_callback(base, INPUT_HANDLER_TYPE_BASE, &handler, priv); elm_object_signal_callback_add(base, SIG_HIDE_DONE, SRC_EDJE, _hide_done, NULL); - + elm_object_signal_callback_add(base, SIG_SHOW_DONE, SRC_EDJE, + _show_done, priv); return base; } @@ -451,11 +471,6 @@ static void _show(void *data) elm_object_signal_emit(priv->base, SIG_SHOW, SRC_PROG); _add_user(priv); - - if (!priv->foc) - priv->foc = eina_list_data_get(priv->list); - - elm_object_focus_set(priv->foc->eo, EINA_TRUE); } static void _unload_user(struct _priv *priv) diff --git a/src/view/view_user_edit.c b/src/view/view_user_edit.c index 6ce8a13..2496098 100644 --- a/src/view/view_user_edit.c +++ b/src/view/view_user_edit.c @@ -126,14 +126,22 @@ static void _unfocused(int id, void *data, Evas_Object *obj, static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev); -static void _mouse_down(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Mouse_Down *ev); +static void _mouse_up(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Up *ev); + +static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Move *ev) +{ + if (!elm_object_focus_get(obj)) + elm_object_focus_set(obj, EINA_TRUE); +} static input_handler handler = { .focused = _focused, .unfocused = _unfocused, .key_down = _key_down, - .mouse_down = _mouse_down + .mouse_up = _mouse_up, + .mouse_move = _mouse_move }; static void _get_profile(struct _priv *priv, const char **name, @@ -282,6 +290,13 @@ static Evas_Object *_pack_icon(Evas_Object *table, struct icon_info *_icon_info, return eo; } +static void _dismissed(void *data, Evas_Object *obj, void *ei) +{ + struct _priv *priv = data; + + elm_object_focus_allow_set(priv->photo, EINA_TRUE); +} + static void _add_icon_list(struct _priv *priv) { Evas_Coord x, y, w, h; @@ -296,6 +311,7 @@ static void _add_icon_list(struct _priv *priv) } elm_ctxpopup_horizontal_set(ctxpopup, EINA_TRUE); elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE); + evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, priv); ly = utils_add_layout(ctxpopup, GRP_USER_EDIT_ICON_LIST, false, NULL); if (!ly) { @@ -336,6 +352,7 @@ static void _add_icon_list(struct _priv *priv) elm_object_focus_set(eo, EINA_TRUE); } + elm_object_focus_allow_set(priv->photo, EINA_FALSE); priv->ctxpopup = ctxpopup; } @@ -479,6 +496,8 @@ static void _add_delete_popup(struct _priv *priv) inputmgr_add_callback(cancel_btn, INPUT_HANDLER_TYPE_DELETE_POPUP_BTN_CANCEL, &handler, priv); + + elm_object_focus_allow_set(priv->del, EINA_FALSE); elm_object_focus_set(cancel_btn, EINA_TRUE); } @@ -488,13 +507,15 @@ static void _select_eo(struct _priv *priv, Evas_Object *obj) evas_object_del(priv->ctxpopup); priv->ctxpopup = NULL; + elm_object_focus_allow_set(priv->photo, EINA_TRUE); file = evas_object_data_get(obj, KEY_ICON); focus_file = utils_get_focus_photo_from_photo(file); - if (!strcmp(file, ICON_ADD) || !strcmp(focus_file, ICON_ADD)) + if (!strcmp(file, ICON_ADD) || !strcmp(focus_file, ICON_ADD)) { viewmgr_push_view(VIEW_PHOTO); - else + elm_object_focus_allow_set(obj, EINA_FALSE); + } else _load_user_icon(priv, file, focus_file); } @@ -540,6 +561,7 @@ static void _select(struct _priv *priv, int id, Evas_Object *obj) break; case INPUT_HANDLER_TYPE_DELETE_POPUP_BTN_DELETE: _delete_popup(priv, obj); + elm_object_focus_allow_set(priv->del, EINA_TRUE); priv->di->action = ITEM_SELECT_ACTION_DELETE; datamgr_select_item(priv->dm, priv->di); viewmgr_pop_view(); @@ -549,6 +571,7 @@ static void _select(struct _priv *priv, int id, Evas_Object *obj) viewmgr_pop_view(); break; case INPUT_HANDLER_TYPE_DELETE_POPUP_BTN_CANCEL: + elm_object_focus_allow_set(priv->del, EINA_TRUE); case INPUT_HANDLER_TYPE_POPUP_BTN_CANCEL: _delete_popup(priv, obj); break; @@ -585,14 +608,17 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, case INPUT_HANDLER_TYPE_EO: evas_object_del(priv->ctxpopup); priv->ctxpopup = NULL; + elm_object_focus_allow_set(priv->photo, EINA_TRUE); break; case INPUT_HANDLER_TYPE_DELETE_POPUP_BTN_DELETE: _delete_popup(priv, obj); + elm_object_focus_allow_set(priv->del, EINA_TRUE); break; case INPUT_HANDLER_TYPE_POPUP_BTN_DISCARD: _delete_popup(priv, obj); break; case INPUT_HANDLER_TYPE_DELETE_POPUP_BTN_CANCEL: + elm_object_focus_allow_set(priv->del, EINA_TRUE); case INPUT_HANDLER_TYPE_POPUP_BTN_CANCEL: _delete_popup(priv, obj); break; @@ -608,8 +634,8 @@ static void _key_down(int id, void *data, Evas *e, Evas_Object *obj, } } -static void _mouse_down(int id, void *data, Evas *e, Evas_Object *obj, - Evas_Event_Mouse_Down *ev) +static void _mouse_up(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Up *ev) { struct _priv *priv; -- 2.7.4 From 017fa6a34321782232f595e7dace311fe6dc15b3 Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Mon, 3 Aug 2015 23:16:50 +0900 Subject: [PATCH 15/16] integrate tv-service for recent channel Change-Id: Ic32649fdbdc54f3ec6dd86816864eba3d0899435 Signed-off-by: Soohye Shin --- CMakeLists.txt | 1 + include/defs.h | 5 +++ packaging/org.tizen.home.spec | 1 + src/data/data_recent.c | 82 +++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 87 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 18cd8d8..c19a6b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,7 @@ pkg_check_modules(PKGS REQUIRED app-utils pkgmgr-info notification + tv-service capi-appfw-application) FOREACH(flag ${PKGS_CFLAGS}) diff --git a/include/defs.h b/include/defs.h index 23a7573..816d66d 100644 --- a/include/defs.h +++ b/include/defs.h @@ -176,6 +176,11 @@ #define IMAGE_RECENT_DELETE_FOC IMAGEDIR"/btn_bar_clearall_foc.png" #define IMAGE_RECENT_DELETE_DIS IMAGEDIR"/btn_bar_clearall_dis.png" #define IMAGE_RECENT_APP IMAGEDIR"/ic_thumbnail_app.png" +#define IMAGE_RECENT_CHANNEL IMAGEDIR"/ic_thumbnail_tv.png" +#define IMAGE_RECENT_MOVIE IMAGEDIR"/ic_thumbnail_movie.png" +#define IMAGE_RECENT_GALLERY IMAGEDIR"/ic_thumbnail_gallery.png" +#define IMAGE_RECENT_MUSIC IMAGEDIR"/ic_thumbnail_music.png" +#define IMAGE_RECENT_WEB IMAGEDIR"/ic_thumbnail_web.png" #define MAX_ITEM_COUNT 8 #define MAX_USER_COUNT 9 diff --git a/packaging/org.tizen.home.spec b/packaging/org.tizen.home.spec index c2b9785..4a5f5b0 100644 --- a/packaging/org.tizen.home.spec +++ b/packaging/org.tizen.home.spec @@ -17,6 +17,7 @@ BuildRequires: pkgconfig(gio-2.0) BuildRequires: pkgconfig(libgum) BuildRequires: pkgconfig(app-utils) BuildRequires: pkgconfig(pkgmgr-info) +BuildRequires: pkgconfig(tv-service) BuildRequires: pkgconfig(notification) BuildRequires: edje-bin BuildRequires: gettext-devel diff --git a/src/data/data_recent.c b/src/data/data_recent.c index 7259ba1..b923ec9 100644 --- a/src/data/data_recent.c +++ b/src/data/data_recent.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "data_recent.h" #include "datamgr.h" @@ -29,6 +30,8 @@ /* FIXME: change default thumbnail */ #define THUMB_DEFAULT "/usr/share/icons/default/small/apps_img_app_default_4x2.png" +#define BUF_TITLE_MAX 128 + static struct datamgr_item *_new_datamgr_item(char *title, char *thumb, char *parameter, char *icon, int type) { @@ -84,7 +87,7 @@ static void _app_list_foreach(gpointer data, gpointer user_data) if (r != PMINFO_R_OK) _ERR("failed to get app icon"); - if (!strcmp(thumb_land, "")) + if (!thumb_land || !strcmp(thumb_land, "")) thumb_land = THUMB_DEFAULT; di = _new_datamgr_item(label, thumb_land, rdata->id, IMAGE_RECENT_APP, @@ -113,11 +116,71 @@ static bool _load_recent_app(struct datamgr *dm) return true; } +static void _channel_list_foreach(gpointer data, gpointer user_data) +{ + struct recent_data *rdata; + struct datamgr_item *di; + struct datamgr *dm; + TvServiceChannel channel; + int r; + char buf[BUF_TITLE_MAX]; + + if (!data || !user_data) { + _ERR("Invalid argument"); + return; + } + + rdata = data; + dm = user_data; + + r = tv_service_get_channel(atoi(rdata->id), &channel); + if (r != TVS_ERROR_OK) { + _ERR("failed to get channel"); + return; + } + + if (channel.minor > 0) + snprintf(buf, sizeof(buf), "%ld-%ld %s", + channel.major, channel.minor, + channel.program_name ? + channel.program_name : ""); + else + snprintf(buf, sizeof(buf), "%ld %s", channel.major, + channel.program_name ? + channel.program_name : ""); + + di = _new_datamgr_item(buf, THUMB_DEFAULT, rdata->id, + IMAGE_RECENT_CHANNEL, 1); + if (di) + dm->list = eina_list_append(dm->list, di); +} + +static bool _load_recent_channel(struct datamgr *dm) +{ + GList *channel_list = NULL; + int r; + + r = app_contents_get_recent_list(CONTENTS_CHANNEL, 1, &channel_list); + if (r != APP_CONTENTS_ERROR_NONE) { + _ERR("failed to get recent channel list"); + return false; + } + + g_list_foreach(channel_list, _channel_list_foreach, dm); + + app_contents_free_recent_list(channel_list); + + return true; +} + static bool _load_recent(struct datamgr *dm) { if (!_load_recent_app(dm)) _ERR("failed to load recent app"); + if (!_load_recent_channel(dm)) + _ERR("failed to load recent channel"); + /* It should be implemented later about media contents */ return true; @@ -129,8 +192,8 @@ static void _unload_recent(struct datamgr *dm) EINA_LIST_FREE(dm->list, di) { free(di->title); - free(di->subtitle); free(di->icon); + free(di->focus_icon); free(di->parameter); free(di); @@ -160,10 +223,25 @@ static void _fini(struct datamgr *dm) } _unload_recent(dm); + + tv_service_channel_info_destroy(); } static bool _init(struct datamgr *dm) { + int r; + + if (!dm) { + _ERR("Invalid argument"); + return false; + } + + r = tv_service_channel_info_create(); + if (r != TVS_ERROR_OK) { + _ERR("failed to create tv service"); + return false; + } + return _load_recent(dm); } -- 2.7.4 From 0a6fce5ce18910e1ea4e0d3584e94a15722579d3 Mon Sep 17 00:00:00 2001 From: Soohye Shin Date: Tue, 4 Aug 2015 21:29:46 +0900 Subject: [PATCH 16/16] integrate media-content for recent movie/gallery/music - modify launch utils func for passing the param to application - add default recent thumbnail files Change-Id: I90fa5bcebdbd8d817423593817c70738a2312ade Signed-off-by: Soohye Shin --- images/ic_default_app.png | Bin 0 -> 1539 bytes images/ic_default_setting.png | Bin 0 -> 3382 bytes images/ic_default_tv.png | Bin 0 -> 1402 bytes include/datamgr.h | 2 + include/defs.h | 22 +++- include/utils.h | 2 +- src/data/data_home.c | 2 +- src/data/data_photo.c | 15 --- src/data/data_recent.c | 284 +++++++++++++++++++++++++++++++++--------- src/utils.c | 4 +- 10 files changed, 250 insertions(+), 81 deletions(-) create mode 100644 images/ic_default_app.png create mode 100644 images/ic_default_setting.png create mode 100644 images/ic_default_tv.png diff --git a/images/ic_default_app.png b/images/ic_default_app.png new file mode 100644 index 0000000000000000000000000000000000000000..82c7956f0ef55d11c8e0f59d650a41742adef5dc GIT binary patch literal 1539 zcmbVMZ%h+s81Ilc#)7b5=IETeo{l-w_IlS|+bb4r@7me9A}LMa!?Jkvu5iHp@$P`a zGR7P*mMw}gE>R&Hj=2Oj=G+)=!;mO*LCvx(5ITk$s{s**VKIs`z}_Ndejt9>{g9tRhSDFsYU+R9U+l7(s3JOgqMJ~MzeKWM506GtO^ygC7j@d zZ~xQ}LmcCT3vs{6FOh61x1&~O3u^O%q1y5g!NA*cp{)@I2*9%{4Mq40L2*Q!@M2sC zn8&vf7+N$@%boB;QbqoJh!kZO!i{D_$b_Ph)oMg7xYdg4A!wkT}pwtK|9We;X#zX{) zRYEc+shlW4@rZP>SgAT;!1Q4XyyW*U2Nskip@3vagq9H0XhL{Cp4Xzaq6XOiXsl?h z1ZyM~39yP-DThEk!W$FLK)c5S#SH-)$1a%zMWHJwF;vO3g6gB3F!*9*IL1L*?QXM+ zLM>j8$74ZJm&Jm5Fpt+ukY?QM@+M-e-dcEU#5Z5GUu z@bw9bN(&)2fy)8hC12vPz7A4mX;qYiqF9mWfc#QX6_rv^g2)0Zw7HNI7_nM;C0?F~ z*;1^`Rk4g$7I|n4 z@#c7>SrS{I1LM=>)(4B_!@~;T#K_=iTq(%DuhAr#eUvL08NK!Am9nAjYwKqQhW|;q zdFX~&*xCO1-IqGw#tqREr+>>mQ)Zh?o`Ch6=IL;&p+9|1GUg->iU-?_$|(JucId3R zw>~4oosyzUZpcV-r#zv98kX04ztA%mYo3iM&A9_D_8&7|){Qo5NA1TiNOQTr{-wV# z_q>hRv@e~^+PALEZVaAfZ$20aM=Sq!4s<2$x;H!dPOmi0zpI@l`|=K(-f!W~Oz5hf zQeJF~p1U?P{LPW9-lKhaZ#K;yIMFn7B>kEwlh_;m`<0yi%2#!tt^e{Q zkO4qlFN+drNi3Go5^r&^u1YD-3-lb#UTSEuD~Z_NgtjI&<3n2nLOyETQU`1Cujk(~H%+2_fly4}0?{tG%UDS7|^ literal 0 HcmV?d00001 diff --git a/images/ic_default_setting.png b/images/ic_default_setting.png new file mode 100644 index 0000000000000000000000000000000000000000..d69354a658e656fa257e4421e4029affc3d33dd0 GIT binary patch literal 3382 zcmbVPc{r478y`c;mJ|`CF=dNc&5SWjHD-xIVzLxv%)HFREX~589FuI78rk`D5;7G< zrAQ(w6|yFkiV|87b)@Cw8=X4m`=jgp@x9mcKF{;s@BRDT>+@dMo8sxQK}XYA69fY3 zxVlihlq+lQUZAd=1L>Q*hlnE?LI6Z!@q+<~E0+-pcmWJn)b2Zg69}Xl z!lC<#{oLIMOg1#fEW@CgmQR9=tONj6vAN+;)>()Y?qy!}a7Z5WbQf@d;M354p-+2kj{hSy9g?v{LhY_KF zIpyc>2_f@^00axSgE5gP6a0JP_|esARrKtk&*C7J2+n$ia!3Ls(% zIRY_<&x6b{GJ^RMF%hct^sf-O0(bYniFu+QiBhHvA!P^4oX zcKPGpdOq`OZ2d`y?p=k2CwPl;{A&6xPNvI>!P`MExF^#WglmuRPqMpL7dho5fkGL5iLVZMopW2y!=U$!eQ=&9;PD;t~t|rB$2K!;E1L`4^rEJYLT) z1G|;#1Q3Y2ppeSQ?Q$K9wvwrG#^C(AW8~h7b4A&kOsdNFy}zCe!R?xvEm8|T&~}j| zxpL@FKhtMXMAq)dmrR-(ZT2BsAKh7Lupiy~GHOVX4R!_QIlOSDrpJx=nKErp+WEZe zJUuFKsI=b^5=EcfweXZVdt-t6y?L2dUv-h)!Gx9Q`?SR+Z&r7F-IGIn@W;l-EwH`K z0gGHBmmX8U8iFc-4!BMCHzk}G76hF31*b3v^NM!~7IXcjC2be4F$QsPqkbNiDX zk6me+h0BS*Lk;da4fy0|QmSsun@(uvOgnk+DfY5%()Rp>Yw6R&FPKsLVuVOvW7&QN zn9x#*xKsW040qKNR#q=3$ztcV^$OOig2V5|!%?@u=HR><+ZDCPMq&Ho9eujka9e)o zLiCEh-cu3cu9M@If86kHScv(ZJybK9dlOS*6PnmI1*o|^Xa%z``MiCi$X~WCt(>(9 z-`De4i&#>SfH5^3PP@Cb#mlwB>cb^DZ8Pai{y43+=9Og1MxYln&NoYa`DixQOM&@M zc%`j(4smufLu0w^XRTxChl8V%#`bODlJ&cjr1x20A0*5WZL?m;m&P{ienLb z3$JKKJMO)Cez`+M{OO)Iue(KSPfg8sEPwmigQ>aXmWT2CRV1S;Q7UglamTi#PMvKP z-5z7@q7K|yB{nA(Qcd$Znum)%=^Ysf%&1HfguZ#N*JDQ+s<@JQpSRX_O{VfoYAOqL zewyqla|>R%^X%}zB&T%VzS@E8zV}vbQD3SaR438L3AZ{b%>P)c7HA{M-soi7u~-TR z@86PuE4e~$S~C{XZe;E2pIn*?>e#@6r&bMW+s^vB8A*o$DSoUcChVsD^yvESw_42U zmzI@Jyl~O0$=6ThsXWOt?yAR=CW`)~K-#ljHH1F&s4ES5hP58LOP!>7b{gmh!Y$LW z9ivk%nec$Bq}n&`DjD+TJF!QtZsbC)+FJ*VnW6SwxxV>c_u4CUV|4kWNB$AIjh?Fz z+UWYGhP6W%Y>caiYoan7^?kzzc+=a1Ea$4eWdBFOr{sGQ_Q-n2jgE|`BoS}tK^x;% ztueC|^TsA=k0hn?DNnJAK}$_u;+l`+AsT63XPp9toc;0QvlOR^w2+|53(>J#E*7;S z@xLXBTaZ~7+* zbMT}4Eo$?tu)^@==f+#m2k9qQIhN0x_0{RnKE4wgr<1R^Bl6$o68YNW#p>;W=3(|R z=@}L-ycVmBx)X!YMeD|jB_FiWroZv|czRE1g6=i-!$ru?O!xZ-j-)Xrtb<|_rRO&n zr=dNY&kGc+>Q=J_7w-a`-i5QXRO8TBe28Z0I?aeI`sXulWnCQ_j1-@@lYYmelWPZ> zyqt7=eHDZ46@#{Ai|&C_Tom<8h1!YZYA1d*{UaX0e_Ij+(m2pvP{)popZk+>rFu}# IItT6hFOEF34FCWD literal 0 HcmV?d00001 diff --git a/images/ic_default_tv.png b/images/ic_default_tv.png new file mode 100644 index 0000000000000000000000000000000000000000..71db0879dfb873112f305bc0e27044d962c19c0a GIT binary patch literal 1402 zcmeAS@N?(olHy`uVBq!ia0vp^DImc-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxSU1_g&``n5OwZ87 z)XdCKN5ROz&`93^h|F{iO{`4Ktc=VRpg;*|TTx1yRgjAt)Gi>;Rw<*Tq`*pFzr4I$ zuiRKKzbIYb(9+TpWQLKEE>MMTab;dfVufyAu`kBtHuNWFoz#!AFNG#Ad)HBe}%?0@jth%@)C>7xhtg4GcDhpEegHnt0 zON)|$@sXws(+mtd{1$-}0$pR}Uz7=ql*AmD{N&Qy)VvZ;7h5Huj9yA+ij}jOg_E(P zi=l~|tE;Ptp`oLRiJ_~JtDBppv$3hMqZ`Z&Y@aoL${q zjGfIK-JH#hO`KtRJ@bl767!N%VfJPM?FH*~a&yD0*UGslHL)bWC?r2W2bKZ?GV)9E zi!<^I6r6+26g0v!^HTE5i#0*f1M#g(YEfocYKmJ?ey##Ie62FE*bj84sgs4NfuW0$ zv#Tl4-)5$cE~X}qj!wpwP8P0)N>IHi?JgIrW z98(0$8Vsl8gcukYS9!WPhE&{obJx-Dkb^|S#ju?{7pH#I%Im3Oi+Raga$GiM$AQ&5 zjHE1hB9^BmaUEoNdF0%K-;?Y$IVCUKNo^2VF?-p{DgNwyi~@{|N(v4vEFBFDg2?O% zZ+CGUd+vzaeJ%H#waqD+$NP$Zt1%w4$h)2>H%IaIb-4|f&%G@?Z@jcS@aWdpI^XyF zl?Yg7%w?P#Hv7$nb1AvKnK9O<|DKanVf6}>P;L0)sL8ijWI}8}*AWfQC*~SQlcun3 z;`O>H@%G7|`V-5<67?Q^t9-6nxHa*&<-PL2OMKT_>wfL6Rj@4$xTY9AvZdx_!?7)b@}0`fM#8 zoBl7htxVC|D-ZP}2M5BB#IQ5AUWs4(aQSj$3+HEikIOg9IOrYT6IT6&)xdg7&+!MV u-aBoT-|>Bk9y|mUm=K|9gj8N<&XqKbLh*2~7Yu)Y-NG literal 0 HcmV?d00001 diff --git a/include/datamgr.h b/include/datamgr.h index f2c5e90..8278688 100644 --- a/include/datamgr.h +++ b/include/datamgr.h @@ -43,6 +43,8 @@ struct datamgr_item { char *focus_icon; char *thumbnail; char *parameter; + char *key; + char *value; bool noti; enum datamgr_item_select_action action; int type; diff --git a/include/defs.h b/include/defs.h index 816d66d..560dae6 100644 --- a/include/defs.h +++ b/include/defs.h @@ -175,12 +175,15 @@ #define IMAGE_RECENT_DELETE_NOR IMAGEDIR"/btn_bar_clearall_nor.png" #define IMAGE_RECENT_DELETE_FOC IMAGEDIR"/btn_bar_clearall_foc.png" #define IMAGE_RECENT_DELETE_DIS IMAGEDIR"/btn_bar_clearall_dis.png" -#define IMAGE_RECENT_APP IMAGEDIR"/ic_thumbnail_app.png" -#define IMAGE_RECENT_CHANNEL IMAGEDIR"/ic_thumbnail_tv.png" -#define IMAGE_RECENT_MOVIE IMAGEDIR"/ic_thumbnail_movie.png" -#define IMAGE_RECENT_GALLERY IMAGEDIR"/ic_thumbnail_gallery.png" -#define IMAGE_RECENT_MUSIC IMAGEDIR"/ic_thumbnail_music.png" -#define IMAGE_RECENT_WEB IMAGEDIR"/ic_thumbnail_web.png" +#define IMAGE_RECENT_ICON_APP IMAGEDIR"/ic_thumbnail_app.png" +#define IMAGE_RECENT_ICON_CHANNEL IMAGEDIR"/ic_thumbnail_tv.png" +#define IMAGE_RECENT_ICON_MOVIE IMAGEDIR"/ic_thumbnail_movie.png" +#define IMAGE_RECENT_ICON_GALLERY IMAGEDIR"/ic_thumbnail_gallery.png" +#define IMAGE_RECENT_ICON_MUSIC IMAGEDIR"/ic_thumbnail_music.png" +#define IMAGE_RECENT_ICON_WEB IMAGEDIR"/ic_thumbnail_web.png" +#define IMAGE_RECENT_THUMB_APP IMAGEDIR"/ic_default_app.png" +#define IMAGE_RECENT_THUMB_CHANNEL IMAGEDIR"/ic_default_tv.png" +#define IMAGE_RECENT_THUMB_SETTING IMAGEDIR"/ic_default_setting" #define MAX_ITEM_COUNT 8 #define MAX_USER_COUNT 9 @@ -196,6 +199,13 @@ #define MESSAGE_DELETE_CONTENTS "If you delete this user, their data will also be deleted." #define MESSAGE_DISCARD_CONTENTS "Discard all entered data?
If you are out of this screen, data won't be saved" +#define KEY_MEDIA "Recent" +#define KEY_CHANNEL "service_id" + +#define PACKAGE_LIVETV "org.tizen.live-tv" +#define PACKAGE_MEDIAHUB "org.tizen.mediahub" +#define PACKAGE_SETTINGS "org.tizen.settings-tv-ref" + #define GUM_ATTR_NAME "username" #define GUM_ATTR_USERTYPE "usertype" #define GUM_ATTR_UID "uid" diff --git a/include/utils.h b/include/utils.h index f8127f2..7c6c3d5 100644 --- a/include/utils.h +++ b/include/utils.h @@ -48,6 +48,6 @@ Evas_Object *utils_add_button(Evas_Object *base, char *text, const char *part); Evas_Object *utils_add_entry(Evas_Object *base, char *text, bool password, const char *part); Evas_Object *utils_add_popup(Evas_Object *base, char *title, char *message); -bool utils_launch_app(const char *pkg); +bool utils_launch_app(const char *pkg, const char *key, const char *value); #endif /* __AIR_HOME_UTILS_H__ */ diff --git a/src/data/data_home.c b/src/data/data_home.c index b6b9789..e55a0a4 100644 --- a/src/data/data_home.c +++ b/src/data/data_home.c @@ -349,7 +349,7 @@ static void _select(struct datamgr_item *di) switch (di->action) { case ITEM_SELECT_ACTION_LAUNCH: - utils_launch_app(di->parameter); + utils_launch_app(di->parameter, NULL, NULL); break; case ITEM_SELECT_ACTION_PUSH: viewmgr_push_view(di->parameter); diff --git a/src/data/data_photo.c b/src/data/data_photo.c index a1ec25f..d1228b6 100644 --- a/src/data/data_photo.c +++ b/src/data/data_photo.c @@ -91,19 +91,6 @@ static Eina_List *_get_items(struct datamgr *dm) static bool _init(struct datamgr *dm) { - int r; - - if (!dm) { - _ERR("Invalid argument"); - return false; - } - - r = media_content_connect(); - if (r != MEDIA_CONTENT_ERROR_NONE) { - _ERR("failed to connect media content"); - return false; - } - return true; } @@ -115,8 +102,6 @@ static void _fini(struct datamgr *dm) } _unload_photo(dm); - - media_content_disconnect(); } static struct data_class dclass = { diff --git a/src/data/data_recent.c b/src/data/data_recent.c index b923ec9..dc38493 100644 --- a/src/data/data_recent.c +++ b/src/data/data_recent.c @@ -21,19 +21,19 @@ #include #include #include +#include +#include #include "data_recent.h" #include "datamgr.h" #include "utils.h" #include "defs.h" -/* FIXME: change default thumbnail */ -#define THUMB_DEFAULT "/usr/share/icons/default/small/apps_img_app_default_4x2.png" - #define BUF_TITLE_MAX 128 static struct datamgr_item *_new_datamgr_item(char *title, char *thumb, - char *parameter, char *icon, int type) + char *subtitle, char *parameter, char *key, char *value, + char *icon, int type) { struct datamgr_item *di; @@ -49,6 +49,12 @@ static struct datamgr_item *_new_datamgr_item(char *title, char *thumb, di->type = type; di->parameter = strdup(parameter); di->action = ITEM_SELECT_ACTION_LAUNCH; + if (subtitle) + di->subtitle = strdup(subtitle); + if (key) + di->key = strdup(key); + if (value) + di->value = strdup(value); return di; } @@ -56,7 +62,7 @@ static struct datamgr_item *_new_datamgr_item(char *title, char *thumb, static void _app_list_foreach(gpointer data, gpointer user_data) { struct recent_data *rdata; - char *label, *thumb, *thumb_land; + char *label, *thumb; pkgmgrinfo_appinfo_h handle; int r; struct datamgr_item *di; @@ -79,43 +85,27 @@ static void _app_list_foreach(gpointer data, gpointer user_data) return; } + label = NULL; + thumb = NULL; r = pkgmgrinfo_appinfo_get_label(handle, &label); if (r != PMINFO_R_OK) _ERR("failed to get app label"); - r = pkgmgrinfo_appinfo_get_effectimage(handle, &thumb, &thumb_land); + r = pkgmgrinfo_appinfo_get_icon(handle, &thumb); if (r != PMINFO_R_OK) _ERR("failed to get app icon"); - if (!thumb_land || !strcmp(thumb_land, "")) - thumb_land = THUMB_DEFAULT; + if (!thumb || !strcmp(thumb, "")) + thumb = IMAGE_RECENT_THUMB_APP; - di = _new_datamgr_item(label, thumb_land, rdata->id, IMAGE_RECENT_APP, - 0); + di = _new_datamgr_item(label, thumb, NULL, rdata->id, NULL, NULL, + IMAGE_RECENT_ICON_APP, 0); if (di) dm->list = eina_list_append(dm->list, di); pkgmgrinfo_appinfo_destroy_appinfo(handle); } -static bool _load_recent_app(struct datamgr *dm) -{ - GList *app_list = NULL; - int r; - - r = app_contents_get_recent_list(CONTENTS_APP, -1, &app_list); - if (r != APP_CONTENTS_ERROR_NONE) { - _ERR("failed to get recent app list"); - return false; - } - - g_list_foreach(app_list, _app_list_foreach, dm); - - app_contents_free_recent_list(app_list); - - return true; -} - static void _channel_list_foreach(gpointer data, gpointer user_data) { struct recent_data *rdata; @@ -149,39 +139,200 @@ static void _channel_list_foreach(gpointer data, gpointer user_data) channel.program_name ? channel.program_name : ""); - di = _new_datamgr_item(buf, THUMB_DEFAULT, rdata->id, - IMAGE_RECENT_CHANNEL, 1); + di = _new_datamgr_item(buf, IMAGE_RECENT_THUMB_CHANNEL, NULL, + PACKAGE_LIVETV, KEY_CHANNEL, rdata->id, + IMAGE_RECENT_ICON_CHANNEL, 1); if (di) dm->list = eina_list_append(dm->list, di); } -static bool _load_recent_channel(struct datamgr *dm) +static void _gallery_list_foreach(gpointer data, gpointer user_data) { - GList *channel_list = NULL; + struct recent_data *rdata; + struct datamgr_item *di; + struct datamgr *dm; + app_media *am; + app_media_info *aminfo; + media_info_h media; int r; - r = app_contents_get_recent_list(CONTENTS_CHANNEL, 1, &channel_list); - if (r != APP_CONTENTS_ERROR_NONE) { - _ERR("failed to get recent channel list"); - return false; + if (!data || !user_data) { + _ERR("Invalid arguement"); + return; } - g_list_foreach(channel_list, _channel_list_foreach, dm); + rdata = data; + dm = user_data; - app_contents_free_recent_list(channel_list); + r = media_info_get_media_from_db(rdata->id, &media); + if (r != MEDIA_CONTENT_ERROR_NONE) { + _ERR("failed to get media"); + return; + } - return true; + am = app_media_create(media); + if (!am) { + _ERR("failed to create media"); + media_info_destroy(media); + return; + } + + aminfo = app_media_get_info(am); + if (!aminfo) { + _ERR("failed to get media info"); + app_media_destroy(am); + media_info_destroy(media); + return; + } + + di = _new_datamgr_item(aminfo->title, aminfo->thumbnail_path, NULL, + PACKAGE_MEDIAHUB, KEY_MEDIA, rdata->id, + IMAGE_RECENT_ICON_GALLERY, 1); + + if (di) + dm->list = eina_list_append(dm->list, di); + + app_media_destroy(am); + media_info_destroy(media); } -static bool _load_recent(struct datamgr *dm) +static void _get_duration(int duration, char **str) { - if (!_load_recent_app(dm)) - _ERR("failed to load recent app"); + char buf[BUF_TITLE_MAX]; + int h, m, s, sec; + + sec = duration / 1000; + h = sec / 3600; + m = (sec % 3600) / 60; + s = sec % 60; + + if (h) + snprintf(buf, sizeof(buf), "%d:%02d:%02d", h, m, s); + else + snprintf(buf, sizeof(buf), "%d:%02d", m, s); + + *str = buf; +} + +static void _movie_list_foreach(gpointer data, gpointer user_data) +{ + struct recent_data *rdata; + struct datamgr_item *di; + struct datamgr *dm; + app_media *am; + app_media_info *aminfo; + media_info_h media; + int r; + char *dur = NULL; + + if (!data || !user_data) { + _ERR("Invalid arguement"); + return; + } - if (!_load_recent_channel(dm)) - _ERR("failed to load recent channel"); + rdata = data; + dm = user_data; - /* It should be implemented later about media contents */ + r = media_info_get_media_from_db(rdata->id, &media); + if (r != MEDIA_CONTENT_ERROR_NONE) { + _ERR("failed to get media"); + return; + } + + am = app_media_create(media); + if (!am) { + _ERR("failed to create media"); + media_info_destroy(media); + return; + } + + aminfo = app_media_get_info(am); + if (!aminfo) { + _ERR("failed to get media info"); + app_media_destroy(am); + media_info_destroy(media); + return; + } + + if (aminfo->video && aminfo->video->duration) + _get_duration(aminfo->video->duration, &dur); + + di = _new_datamgr_item(aminfo->title, aminfo->thumbnail_path, + dur ? dur : NULL, PACKAGE_MEDIAHUB, KEY_MEDIA, + rdata->id, IMAGE_RECENT_ICON_MOVIE, 1); + + if (di) + dm->list = eina_list_append(dm->list, di); + + app_media_destroy(am); + media_info_destroy(media); +} + +static void _music_list_foreach(gpointer data, gpointer user_data) +{ + struct recent_data *rdata; + struct datamgr_item *di; + struct datamgr *dm; + app_media *am; + app_media_info *aminfo; + media_info_h media; + int r; + + if (!data || !user_data) { + _ERR("Invalid arguement"); + return; + } + + rdata = data; + dm = user_data; + + r = media_info_get_media_from_db(rdata->id, &media); + if (r != MEDIA_CONTENT_ERROR_NONE) { + _ERR("failed to get media"); + return; + } + + am = app_media_create(media); + if (!am) { + _ERR("failed to create media"); + media_info_destroy(media); + return; + } + + aminfo = app_media_get_info(am); + if (!aminfo) { + _ERR("failed to get media info"); + app_media_destroy(am); + media_info_destroy(media); + return; + } + + di = _new_datamgr_item(aminfo->title, aminfo->thumbnail_path, + aminfo->audio->artist, PACKAGE_MEDIAHUB, KEY_MEDIA, + rdata->id, IMAGE_RECENT_ICON_MUSIC, 1); + + if (di) + dm->list = eina_list_append(dm->list, di); + + app_media_destroy(am); + media_info_destroy(media); +} + +static bool _load_recent(struct datamgr *dm, enum app_contents_type type, + int count, GFunc func) +{ + GList *rlist = NULL; + int r; + + r = app_contents_get_recent_list(type, count, &rlist); + if (r != APP_CONTENTS_ERROR_NONE) { + _ERR("failed to get recent list"); + return false; + } + + g_list_foreach(rlist, func, dm); + + app_contents_free_recent_list(rlist); return true; } @@ -192,9 +343,12 @@ static void _unload_recent(struct datamgr *dm) EINA_LIST_FREE(dm->list, di) { free(di->title); + free(di->subtitle); free(di->icon); free(di->focus_icon); free(di->parameter); + free(di->key); + free(di->value); free(di); } @@ -210,7 +364,23 @@ static Eina_List *_get_items(struct datamgr *dm) } _unload_recent(dm); - _load_recent(dm); + + if (!_load_recent(dm, CONTENTS_APP, -1, _app_list_foreach)) + _ERR("failed to load recent app contents"); + + if (!_load_recent(dm, CONTENTS_CHANNEL, 1, _channel_list_foreach)) + _ERR("failed to load recent channel contents"); + + if (!_load_recent(dm, CONTENTS_GALLERY, 1, _gallery_list_foreach)) + _ERR("failed to load recent gallery contents"); + + if (!_load_recent(dm, CONTENTS_MOVIE, 1, _movie_list_foreach)) + _ERR("failed to load recent movie contents"); + + if (!_load_recent(dm, CONTENTS_MUSIC, 1, _music_list_foreach)) + _ERR("failed to load recent music contents"); + + /* TODO: Sort for contents list */ return dm->list; } @@ -224,6 +394,7 @@ static void _fini(struct datamgr *dm) _unload_recent(dm); + media_content_disconnect(); tv_service_channel_info_destroy(); } @@ -242,7 +413,14 @@ static bool _init(struct datamgr *dm) return false; } - return _load_recent(dm); + r = media_content_connect(); + if (r != MEDIA_CONTENT_ERROR_NONE) { + tv_service_channel_info_destroy(); + _ERR("failed to connect media content"); + return false; + } + + return true; } static void _select(struct datamgr_item *di) @@ -252,7 +430,7 @@ static void _select(struct datamgr_item *di) switch (di->action) { case ITEM_SELECT_ACTION_LAUNCH: - utils_launch_app(di->parameter); + utils_launch_app(di->parameter, di->key, di->value); break; default: _ERR("Invalid state"); @@ -262,15 +440,7 @@ static void _select(struct datamgr_item *di) static void _clear(struct datamgr *dm) { - int r; - - r = app_contents_recent_clear(CONTENTS_APP); - if (r != APP_CONTENTS_ERROR_NONE) { - _ERR("failed to clear app recent"); - return; - } - - /* It should be implemeted later about media contents */ + /* It should be implemented later */ } static struct data_class dclass = { diff --git a/src/utils.c b/src/utils.c index aadb952..36c6fa6 100644 --- a/src/utils.c +++ b/src/utils.c @@ -371,7 +371,7 @@ Evas_Object *utils_add_popup(Evas_Object *base, char *title, char *message) return popup; } -bool utils_launch_app(const char *pkg) +bool utils_launch_app(const char *pkg, const char *key, const char *value) { app_control_h app_control; int r; @@ -383,6 +383,8 @@ bool utils_launch_app(const char *pkg) app_control_create(&app_control); app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT); + if (key && value) + app_control_add_extra_data(app_control, key, value); app_control_set_app_id(app_control, pkg); r = app_control_send_launch_request(app_control, NULL, NULL); -- 2.7.4