From 62d4e69593ccbe170c1ff706733683001983a4bc Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Fri, 21 Aug 2015 14:49:34 +0900 Subject: [PATCH] action_menu: add no favorite content area Change-Id: Ic6dec7c882023d7d769fc13ec06a7dfe56c6f5f1 Signed-off-by: Jehun Lim --- include/define.h | 1 + include/view/action_menu.h | 9 ++++ res/edc/view/action_menu.edc | 120 ++++++++++++++++++++++++++++++++++++++++--- src/view/action_menu.c | 58 +++++++++++++++++---- 4 files changed, 171 insertions(+), 17 deletions(-) diff --git a/include/define.h b/include/define.h index ec9b141..dc8da71 100644 --- a/include/define.h +++ b/include/define.h @@ -55,6 +55,7 @@ #define COLOR_ITEM_BORDER 194 194 194 255 #define COLOR_ITEM_DIVIDER 224 224 224 255 #define COLOR_LIST_BG 244 244 244 255 +#define COLOR_NO_CONTENT_BG 229 229 229 255 #define SHOW_VIEW_INTERVAL 0.1 diff --git a/include/view/action_menu.h b/include/view/action_menu.h index 7b0e8d9..ee4b687 100644 --- a/include/view/action_menu.h +++ b/include/view/action_menu.h @@ -22,12 +22,21 @@ /* group */ #define GRP_ACTION_MENU_VIEW "group.action_menu_view" +#define GRP_ACTION_NO_CONTENT "group.action_no_content" /* part */ #define PART_ACTION_TV_BTN "part.action_tv_btn" #define PART_ACTION_MENU_AREA "part.action_menu_area" #define PART_ACTION_FAVORITE_TITLE "part.action_favorite_title" #define PART_ACTION_FAVORITE_AREA "part.action_favorite_area" +#define PART_ACTION_NO_CONTENT_BG "part.action_no_content_bg" + +#define PART_NO_CONTENT_BG "part.no_content_bg" +#define PART_NO_CONTENT_TEXT "part.no_content_text" + +/* signal */ +#define SIG_SHOW_NO_CONTENT "show,no_content" +#define SIG_HIDE_NO_CONTENT "hide,no_content" /* style */ #define STYLE_BTN_LIVETV "action_btn_livetv" diff --git a/res/edc/view/action_menu.edc b/res/edc/view/action_menu.edc index 7514ebf..d5f594b 100644 --- a/res/edc/view/action_menu.edc +++ b/res/edc/view/action_menu.edc @@ -170,7 +170,7 @@ group { relative: 1.0 1.0; } rel2.to: PART_ACTION_MENU_AREA; - min: 10 40; + min: 30 40; align: 1.0 0.0; fixed: 1 1; } @@ -201,7 +201,7 @@ group { } } part { - name: "padding_favorite_area"; + name: "padding_favorite_area_left_top"; type: SPACER; scale: 1; description { @@ -210,10 +210,26 @@ group { to: PART_ACTION_FAVORITE_TITLE; relative: 0.0 1.0; } - rel2.to: PART_ACTION_FAVORITE_TITLE; + rel2 { + to: PART_ACTION_FAVORITE_TITLE; + relative: 0.0 1.0; + } min: 0 30; - align: 0.5 0.0; - fixed: 0 1; + align: 0.0 0.0; + fixed: 1 1; + } + } + part { + name: "padding_favorite_area_right_bottom"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1.relative: 1.0 1.0; + rel2.relative: 1.0 1.0; + min: 10 0; + align: 1.0 1.0; + fixed: 1 1; } } part { @@ -223,14 +239,102 @@ group { description { state: "default" 0.0; rel1 { - to: "padding_favorite_area"; + to: "padding_favorite_area_left_top"; + relative: 0.0 1.0; + } + rel2 { + to: "padding_favorite_area_right_bottom"; + relative: 0.0 0.0; + } + } + } + part { + name: "padding_bg_no_content_right_bottom"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1.relative: 1.0 1.0; + rel2.relative: 1.0 1.0; + min: 30 32; + align: 1.0 1.0; + fixed: 1 1; + } + } + part { + name: PART_ACTION_NO_CONTENT_BG; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding_favorite_area_left_top"; relative: 0.0 1.0; } rel2 { - to_x: "padding_favorite_area"; - to_y: "bg"; + to: "padding_bg_no_content_right_bottom"; + relative: 0.0 0.0; + } + } + } + } +} + +group { + name: GRP_ACTION_NO_CONTENT; + parts { + part { + name: PART_NO_CONTENT_BG; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: COLOR_NO_CONTENT_BG; + visible: 0; + } + description { + state: "show" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + part { + name: PART_NO_CONTENT_TEXT; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + text { + font: FONT_LIGHT; + size: 32; + align: 0.5 0.5; } + color: COLOR_TEXT_INDEX; + visible: 0; + } + description { + state: "show" 0.0; + inherit: "default" 0.0; + visible: 1; } } } + programs { + program { + name: SIG_SHOW_NO_CONTENT; + signal: SIG_SHOW_NO_CONTENT; + source: SIG_SOURCE_SRC; + action: STATE_SET "show" 0.0; + target: PART_NO_CONTENT_BG; + target: PART_NO_CONTENT_TEXT; + } + program { + name: SIG_HIDE_NO_CONTENT; + signal: SIG_HIDE_NO_CONTENT; + source: SIG_SOURCE_SRC; + action: STATE_SET "default" 0.0; + target: PART_NO_CONTENT_BG; + target: PART_NO_CONTENT_TEXT; + } + } } diff --git a/src/view/action_menu.c b/src/view/action_menu.c index b8b899a..1560753 100644 --- a/src/view/action_menu.c +++ b/src/view/action_menu.c @@ -58,6 +58,7 @@ struct _priv { Evas_Object *menu_btn[NUM_MENU_BTN]; Evas_Object *table; + Evas_Object *ly; Evas_Object *grid; Elm_Object_Item *selected_it; @@ -80,6 +81,8 @@ struct _content_info { const char *style; int app_contents_type; + + const char *no_content; }; static struct _menu_info menu_info[] = { @@ -114,19 +117,22 @@ struct _content_info content_info[] = { .grid_x = GRID_ITEM_X_MOVIE, .grid_y = GRID_ITEM_Y_MOVIE, .style = STYLE_GRID_MOVIE_ITEM_FAVORITE, - .app_contents_type = CONTENTS_MOVIE + .app_contents_type = CONTENTS_MOVIE, + .no_content = "No favorite Movies" }, { .grid_x = GRID_ITEM_X_GALLERY, .grid_y = GRID_ITEM_Y_GALLERY, .style = STYLE_GRID_GALLERY_ITEM_FAVORITE, - .app_contents_type = CONTENTS_GALLERY + .app_contents_type = CONTENTS_GALLERY, + .no_content = "No favorite Contents" }, { .grid_x = GRID_ITEM_X_MUSIC, .grid_y = GRID_ITEM_Y_MUSIC, .style = STYLE_GRID_SONG_ITEM_FAVORITE, - .app_contents_type = CONTENTS_MUSIC + .app_contents_type = CONTENTS_MUSIC, + .no_content = "No favorite Songs" } }; @@ -561,14 +567,25 @@ static bool _draw_menu_area(struct _priv *priv) static bool _draw_favorite_area(struct _priv *priv) { - Evas_Object *grid; + Evas_Object *ly, *grid; elm_object_part_text_set(priv->base, PART_ACTION_FAVORITE_TITLE, TEXT_FAVORITE); + ly = elm_layout_add(priv->base); + if (!ly) { + _ERR("failed to create layout object"); + return false; + } + + elm_layout_file_set(ly, EDJEFILE, GRP_ACTION_NO_CONTENT); + + elm_object_part_content_set(priv->base, PART_ACTION_NO_CONTENT_BG, ly); + grid = util_add_gengrid(priv->base, 0, 0, EINA_FALSE); if (!grid) { _ERR("failed to create gengrid object"); + evas_object_del(ly); return false; } @@ -580,6 +597,7 @@ static bool _draw_favorite_area(struct _priv *priv) elm_object_part_content_set(priv->base, PART_ACTION_FAVORITE_AREA, grid); + priv->ly = ly; priv->grid = grid; return true; @@ -656,12 +674,30 @@ static void _update_menu_area(struct _priv *priv) ELM_FOCUS_RIGHT); } +static void _update_no_content_area(struct _priv *priv) +{ + if (!priv->favorite_list) { + elm_object_signal_emit(priv->ly, SIG_SHOW_NO_CONTENT, + SIG_SOURCE_SRC); + elm_object_part_text_set(priv->ly, PART_NO_CONTENT_TEXT, + content_info[priv->content_type]. + no_content); + + elm_object_focus_allow_set(priv->grid, EINA_FALSE); + } else { + elm_object_signal_emit(priv->ly, SIG_HIDE_NO_CONTENT, + SIG_SOURCE_SRC); + + elm_object_focus_allow_set(priv->grid, EINA_TRUE); + } +} + static void _update_favorite_area(struct _priv *priv) { Elm_Gengrid_Item_Class *ic; Elm_Object_Item *it; - Eina_List *favorite_l, *l; + Eina_List *l; app_media *am; int type; @@ -669,15 +705,19 @@ static void _update_favorite_area(struct _priv *priv) type = priv->content_type; + if (priv->favorite_list) + _free_favorite_list(priv->favorite_list); + + priv->favorite_list = _get_favorite_list( + content_info[type].app_contents_type); + elm_gengrid_item_size_set(priv->grid, elm_config_scale_get() * content_info[type].grid_x, elm_config_scale_get() * content_info[type].grid_y); ic = _get_grid_item_class(type); - favorite_l = _get_favorite_list(content_info[type].app_contents_type); - - EINA_LIST_FOREACH(favorite_l, l, am) { + EINA_LIST_FOREACH(priv->favorite_list, l, am) { it = elm_gengrid_item_append(priv->grid, ic, am, NULL, NULL); elm_object_item_data_set(it, am); @@ -685,7 +725,7 @@ static void _update_favorite_area(struct _priv *priv) elm_gengrid_item_class_free(ic); - priv->favorite_list = favorite_l; + _update_no_content_area(priv); } static bool _draw_items(struct _priv *priv) -- 2.7.4