Movie grid: Fixed the grid thumbnail text background color 23/44023/1
authorHyojung Jo <hj903.jo@samsung.com>
Thu, 16 Jul 2015 08:15:46 +0000 (17:15 +0900)
committerHyojung Jo <hj903.jo@samsung.com>
Thu, 16 Jul 2015 08:15:46 +0000 (17:15 +0900)
Change-Id: Iae2b57b66e85b98d9570e1be39e3b2962a87cec9
Signed-off-by: Hyojung Jo <hj903.jo@samsung.com>
src/grid/grid_movie.c

index 83b5551..d5d952d 100644 (file)
 #define ITEM_MOVIE_X (378 + 26)
 #define ITEM_MOVIE_Y (294 + 26)
 
+/* It is temporarily used. */
+#define COUNT_COLOR 5
+
+struct color {
+       int r;
+       int g;
+       int b;
+       int a;
+};
+
+static struct color colors[] =
+{
+       {73, 68, 62, 255},
+       {55, 74, 97, 255},
+       {75, 102, 163, 255},
+       {55, 143, 162, 255},
+       {86, 98, 113, 255}
+};
+
 static char *_text_get(void *data, Evas_Object *obj, const char *part)
 {
        app_media *am;
@@ -43,8 +62,9 @@ static char *_text_get(void *data, Evas_Object *obj, const char *part)
 static Evas_Object *_content_get(void *data, Evas_Object *obj, const char *part)
 {
        app_media *am;
-       Evas_Object *icon, *img;
+       Evas_Object *icon, *img, *text_bg;
        char *thumbnail;
+       int idx;
 
        if (!data || !obj) {
                _ERR("Invalid argument.");
@@ -52,32 +72,51 @@ static Evas_Object *_content_get(void *data, Evas_Object *obj, const char *part)
        }
        am = data;
 
-       thumbnail = get_media_thumbnail(am);
+       if (!strcmp(part, PART_THUMB_ICON)) {
+               thumbnail = get_media_thumbnail(am);
+
+               if (!thumbnail) {
+                       icon = elm_icon_add(obj);
+                       if (!icon) {
+                               _ERR("elm_icon_add failed.");
+                               return NULL;
+                       }
+
+                       elm_icon_thumb_set(icon, get_media_path(am), NULL);
+                       elm_image_aspect_fixed_set(icon, EINA_FALSE);
+
+                       return icon;
+               }
+
+               img = elm_image_add(obj);
+               if (!img) {
+                       _ERR("elm_image_add failed.");
+                       return NULL;
+               }
 
-       if (!thumbnail) {
-               icon = elm_icon_add(obj);
-               if (!icon) {
-                       _ERR("elm_icon_add failed.");
+               elm_image_file_set(img, thumbnail, NULL);
+               elm_image_aspect_fixed_set(img, EINA_FALSE);
+               evas_object_show(img);
+
+               return img;
+       } else if (!strcmp(part, PART_THUMB_TEXT_BG)) {
+               text_bg = evas_object_rectangle_add(obj);
+               if (!text_bg) {
+                       _ERR("evas_object_rectangle_add failed.");
                        return NULL;
                }
 
-               elm_icon_thumb_set(icon, get_media_path(am), NULL);
-               elm_image_aspect_fixed_set(icon, EINA_FALSE);
+               idx = rand() % COUNT_COLOR;
 
-               return icon;
-       }
+               evas_object_color_set(text_bg, colors[idx].r, colors[idx].g,
+                               colors[idx].b, colors[idx].a);
 
-       img = elm_image_add(obj);
-       if (!img) {
-               _ERR("elm_image_add failed.");
-               return NULL;
-       }
+               evas_object_show(text_bg);
 
-       elm_image_file_set(img, thumbnail, NULL);
-       elm_image_aspect_fixed_set(img, EINA_FALSE);
-       evas_object_show(img);
+               return text_bg;
+       }
 
-       return img;
+       return NULL;
 }
 
 static struct grid_class _gclass = {