View: Added the number of contents 08/43708/1
authorHyojung Jo <hj903.jo@samsung.com>
Mon, 13 Jul 2015 10:59:32 +0000 (19:59 +0900)
committerHyojung Jo <hj903.jo@samsung.com>
Mon, 13 Jul 2015 10:59:32 +0000 (19:59 +0900)
Change-Id: I55266730b5195e4020f5145a98d6637bc7506a94
Signed-off-by: Hyojung Jo <hj903.jo@samsung.com>
include/define.h
res/favorite.edc
src/view/view_base.c

index ddc3d9c..4371e93 100644 (file)
@@ -27,6 +27,8 @@
 #define PART_TOP_TITLE "part.top.title"
 #define PART_TOP_MENU "part.top.menu"
 #define PART_GENGRID "part.gengrid"
+#define PART_NO_CONTENTS "part.no.contents"
+#define PART_CONTENTS_COUNT "part.contents.count"
 
 /* Style */
 #define STYLE_MENU_BTN "style.menu.button"
 /* Text */
 #define STR_FAVORITE "Favorite"
 #define STR_NULL "(NULL)"
+#define STR_NO_CONTENTS "No Contents"
+#define STR_CNT_TV "channels"
+#define STR_CNT_MOVIE "movies"
+#define STR_CNT_GALLERY "files"
+#define STR_CNT_MUSIC "songs"
+#define STR_CNT_APPS "apps"
+#define STR_CNT_WEBS "bookmark"
 
 /* Font */
 #define FONT_TIZENSANS_REGULAR "TizenSans"
@@ -47,6 +56,7 @@
 /* Size */
 #define SIZE_BOX_PAD_H (40 + 40)
 #define SIZE_BOX_PAD_V 0
+#define SIZE_STR 1024
 
 /* Count */
 #define COUNT_MENU 6
index eefdf41..e233a6d 100644 (file)
@@ -139,6 +139,96 @@ collections {
                                        }
                                }
                        }
+
+                       part {
+                               name, "padding.contents.count";
+                               type, SPACER;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       min, 62 148;
+                                       rel1.relative, 0.0 1.0;
+                                       rel2.relative, 0.0 1.0;
+                                       align, 0.0 1.0;
+                                       fixed, 1 1;
+                               }
+                       }
+
+                       part {
+                               name, PART_CONTENTS_COUNT;
+                               type, TEXT;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       color, 77 77 77 255;
+                                       min, 1184 148;
+                                       rel1 {
+                                               to, "padding.contents.count";
+                                               relative, 1.0 0.0;
+                                       }
+                                       rel2 {
+                                               to, "padding.contents.count";
+                                               relative, 1.0 0.0;
+                                       }
+                                       align, 0.0 0.0;
+                                       fixed, 1 1;
+                                       text {
+                                               font, FONT_TIZENSANS_LIGHT;
+                                               size, 28;
+                                               align, 0.0 0.5;
+                                       }
+                               }
+                       }
+
+                       part {
+                               name, "padding.no.contents1";
+                               type, SPACER;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       min, 0 318;
+                                       rel2.relative, 0.0 0.0;
+                                       align, 0.5 0.0;
+                                       fixed, 0 1;
+
+                               }
+                       }
+
+                       part {
+                               name, "padding.no.contents2";
+                               type, SPACER;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       min, 0 148;
+                                       rel1.relative, 1.0 1.0;
+                                       align, 0.5 1.0;
+                                       fixed, 0 1;
+                               }
+                       }
+
+                       part {
+                               name, PART_NO_CONTENTS;
+                               type, TEXT;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       color, 0 0 0 178;
+                                       rel1 {
+                                               to, "padding.no.contents1";
+                                               relative, 1.0 1.0;
+                                       }
+                                       rel2 {
+                                               to, "padding.no.contents2";
+                                               relative, 0.0 0.0;
+                                       }
+                                       text {
+                                               font, FONT_TIZENSANS_LIGHT;
+                                               size, 32;
+                                               align, 0.5 0.5;
+                                       }
+                               }
+                       }
                }
        }
 }
index 6a29010..7b96953 100644 (file)
 #include "data/app.h"
 #include "grid.h"
 
+const char *str_count[] = {
+       STR_CNT_TV,
+       STR_CNT_MOVIE,
+       STR_CNT_GALLERY,
+       STR_CNT_MUSIC,
+       STR_CNT_APPS,
+       STR_CNT_WEBS,
+       NULL
+};
+
 struct _priv {
        struct gridmgr *gmgr;
        Evas_Object *win;
@@ -45,6 +55,19 @@ static struct grid_data *(*_get_grid_data[COUNT_MENU])(void) = {
        get_webs_grid_data
 };
 
+static void _draw_content_count(Evas_Object *base, int count, int id)
+{
+       char str[SIZE_STR];
+
+       if (!base) {
+               _ERR("Invalid argument.");
+               return;
+       }
+
+       snprintf(str, sizeof(str), "%d %s", count, str_count[id]);
+       elm_object_part_text_set(base, PART_CONTENTS_COUNT, str);
+}
+
 static bool _load_current_grid(struct _priv *priv, int id)
 {
        struct grid_data *gdata;
@@ -60,13 +83,17 @@ static bool _load_current_grid(struct _priv *priv, int id)
        if (!gdata || !gdata->id || !gdata->grid)
                return false;
 
+       elm_object_part_text_set(priv->base, PART_NO_CONTENTS, "");
        prev_grid = elm_object_part_content_unset(priv->base, PART_GENGRID);
        evas_object_hide(prev_grid);
 
        if (!gdata->list) {
                list = gdata->create_item_list();
                if (!list) {
-                       /* 'No contents' should be displayed. */
+                       elm_object_part_text_set(priv->base, PART_NO_CONTENTS,
+                                       STR_NO_CONTENTS);
+                       _draw_content_count(priv->base, 0, id);
+
                        return true;
                }
 
@@ -81,6 +108,8 @@ static bool _load_current_grid(struct _priv *priv, int id)
        elm_object_part_content_set(priv->base, PART_GENGRID, gdata->grid);
        evas_object_show(gdata->grid);
 
+       _draw_content_count(priv->base, eina_list_count(gdata->list), id);
+
        return true;
 }