set recent item bg color 86/45586/2
authorSoohye Shin <soohye.shin@samsung.com>
Fri, 7 Aug 2015 14:09:21 +0000 (23:09 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Fri, 7 Aug 2015 14:16:41 +0000 (23:16 +0900)
- modify recent app default image file
- add utils_add_rectangle

Change-Id: I595d6bbadb79cf68066801489e3f295b38e5d969
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
edje/view/recent.edc
edje/widget/label.edc
images/ic_default_app.png
images/ic_thumbnail_app.png
include/defs.h
include/utils.h
src/utils.c
src/view/view_recent.c

index 60a7755..5437578 100644 (file)
@@ -347,17 +347,12 @@ group {
                        description {
                                state, "default" 0.0;
                                min, 378 294;
-                               color, 113 128 147 255;
-                       }
-                       description {
-                               state, "focus" 0.0;
-                               inherit, "default" 0.0;
-                               color, 0 119 246 255;
+                               visible, 0;
                        }
                }
                part {
-                       name, "thumbnail";
-                       type, RECT;
+                       name, PART_RECENT_THUMBNAIL_BG;
+                       type, SWALLOW;
                        scale, 1;
                        description {
                                state, "default" 0.0;
@@ -369,7 +364,43 @@ group {
                                min, 0 198;
                                fixed, 0 1;
                                align, 0.5 0.0;
-                               color, 132 147 166 255;
+                       }
+               }
+               part {
+                       name, PART_RECENT_TEXT_BG;
+                       type, SWALLOW;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, PART_RECENT_THUMBNAIL_BG;
+                                       relative, 0.0 1.0;
+                               }
+                               rel2.to, "bg";
+                               fixed, 1 1;
+                               visible, 1;
+                       }
+                       description {
+                               state, "focus" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 0;
+                       }
+               }
+               part {
+                       name, "text.bg";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1.to, PART_RECENT_TEXT_BG;
+                               rel2.to, PART_RECENT_TEXT_BG;
+                               fixed, 1 1;
+                               color, 0 0 0 0;
+                       }
+                       description {
+                               state, "focus" 0.0;
+                               inherit, "default" 0.0;
+                               color, 0 119 246 255;
                        }
                }
                part {
@@ -378,8 +409,8 @@ group {
                        scale, 1;
                        description {
                                state, "default" 0.0;
-                               rel1.to, "thumbnail";
-                               rel2.to, "thumbnail";
+                               rel1.to, PART_RECENT_THUMBNAIL_BG;
+                               rel2.to, PART_RECENT_THUMBNAIL_BG;
                                min, 100 100;
                                fixed, 1 1;
                        }
@@ -390,9 +421,9 @@ group {
                        scale, 1;
                        description {
                                state, "default" 0.0;
-                               rel1.to, "thumbnail";
+                               rel1.to, PART_RECENT_THUMBNAIL_BG;
                                rel2 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 1.0 0.0;
                                }
                                min, 0 3;
@@ -417,7 +448,7 @@ group {
                                        relative, 0.0 1.0;
                                }
                                rel2 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 0.0 1.0;
                                }
                                min, 3 0;
@@ -441,7 +472,7 @@ group {
                                        to, "border.up";
                                        relative, 1.0 1.0;
                                }
-                               rel2.to, "thumbnail";
+                               rel2.to, PART_RECENT_THUMBNAIL_BG;
                                min, 3 0;
                                fixed, 1 0;
                                align, 1.0 0.5;
@@ -460,11 +491,11 @@ group {
                        description {
                                state, "default" 0.0;
                                rel1 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 0.0 0.0;
                                }
                                rel2 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 0.0 0.0;
                                }
                                min, 4 4;
@@ -500,11 +531,11 @@ group {
                                state, "default" 0.0;
                                min, 15 18;
                                rel1 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 0.0 1.0;
                                }
                                rel2 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 0.0 1.0;
                                }
                                fixed, 1 1;
@@ -520,11 +551,11 @@ group {
                                state, "default" 0.0;
                                min, 15 18;
                                rel1 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 1.0 1.0;
                                }
                                rel2 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 1.0 1.0;
                                }
                                fixed, 1 1;
@@ -578,7 +609,7 @@ group {
                        source, SRC_PROG;
                        action, STATE_SET "focus" 0.0;
                        transition, TRANSITION_DECEL;
-                       target, "bg";
+                       target, "text.bg";
                        target, "border.up";
                        target, "border.right";
                        target, "border.left";
@@ -589,7 +620,7 @@ group {
                        source, SRC_PROG;
                        action, STATE_SET "default" 0.0;
                        transition, TRANSITION_DECEL;
-                       target, "bg";
+                       target, "text.bg";
                        target, "border.up";
                        target, "border.right";
                        target, "border.left";
@@ -607,17 +638,12 @@ group {
                        description {
                                state, "default" 0.0;
                                min, 236 294;
-                               color, 113 128 147 255;
-                       }
-                       description {
-                               state, "focus" 0.0;
-                               inherit, "default" 0.0;
-                               color, 0 119 246 255;
+                               visible, 0;
                        }
                }
                part {
-                       name, "thumbnail";
-                       type, RECT;
+                       name, PART_RECENT_THUMBNAIL_BG;
+                       type, SWALLOW;
                        scale, 1;
                        description {
                                state, "default" 0.0;
@@ -629,7 +655,37 @@ group {
                                min, 0 198;
                                fixed, 0 1;
                                align, 0.5 0.0;
-                               color, 132 147 166 255;
+                       }
+               }
+               part {
+                       name, PART_RECENT_TEXT_BG;
+                       type, SWALLOW;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1 {
+                                       to, PART_RECENT_THUMBNAIL_BG;
+                                       relative, 0.0 1.0;
+                               }
+                               rel2.to, "bg";
+                               fixed, 1 1;
+                       }
+               }
+               part {
+                       name, "text.bg";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1.to, PART_RECENT_TEXT_BG;
+                               rel2.to, PART_RECENT_TEXT_BG;
+                               fixed, 1 1;
+                               color, 0 0 0 0;
+                       }
+                       description {
+                               state, "focus" 0.0;
+                               inherit, "default" 0.0;
+                               color, 0 119 246 255;
                        }
                }
                part {
@@ -639,11 +695,11 @@ group {
                        description {
                                state, "default" 0.0;
                                rel1 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 0.5 0.5;
                                }
                                rel2 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 0.5 0.5;
                                }
                                min, 100 100;
@@ -656,9 +712,9 @@ group {
                        scale, 1;
                        description {
                                state, "default" 0.0;
-                               rel1.to, "thumbnail";
+                               rel1.to, PART_RECENT_THUMBNAIL_BG;
                                rel2 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 1.0 0.0;
                                }
                                min, 0 3;
@@ -683,7 +739,7 @@ group {
                                        relative, 0.0 1.0;
                                }
                                rel2 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 0.0 1.0;
                                }
                                min, 3 0;
@@ -707,7 +763,7 @@ group {
                                        to, "border.up";
                                        relative, 1.0 1.0;
                                }
-                               rel2.to, "thumbnail";
+                               rel2.to, PART_RECENT_THUMBNAIL_BG;
                                min, 3 0;
                                fixed, 1 0;
                                align, 1.0 0.5;
@@ -726,11 +782,11 @@ group {
                        description {
                                state, "default" 0.0;
                                rel1 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 0.0 0.0;
                                }
                                rel2 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 0.0 0.0;
                                }
                                min, 4 4;
@@ -766,11 +822,11 @@ group {
                                state, "default" 0.0;
                                min, 15 18;
                                rel1 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 0.0 1.0;
                                }
                                rel2 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 0.0 1.0;
                                }
                                fixed, 1 1;
@@ -786,11 +842,11 @@ group {
                                state, "default" 0.0;
                                min, 15 18;
                                rel1 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 1.0 1.0;
                                }
                                rel2 {
-                                       to, "thumbnail";
+                                       to, PART_RECENT_THUMBNAIL_BG;
                                        relative, 1.0 1.0;
                                }
                                fixed, 1 1;
@@ -844,7 +900,7 @@ group {
                        source, SRC_PROG;
                        action, STATE_SET "focus" 0.0;
                        transition, TRANSITION_DECEL;
-                       target, "bg";
+                       target, "text.bg";
                        target, "border.up";
                        target, "border.right";
                        target, "border.left";
@@ -855,7 +911,7 @@ group {
                        source, SRC_PROG;
                        action, STATE_SET "default" 0.0;
                        transition, TRANSITION_DECEL;
-                       target, "bg";
+                       target, "text.bg";
                        target, "border.up";
                        target, "border.right";
                        target, "border.left";
index 26cdc24..f29473d 100644 (file)
@@ -29,7 +29,7 @@ styles {
        }
        style {
                name, "recent_label_subtitle";
-               base, "font=TizenSans font_size=20 color=#999999 align=left";
+               base, "font=TizenSans font_size=20 color=#cdcdcd align=left";
        }
 }
 
index 63c2a8c..c8c5b68 100644 (file)
Binary files a/images/ic_default_app.png and b/images/ic_default_app.png differ
index 02a5102..88721aa 100644 (file)
Binary files a/images/ic_thumbnail_app.png and b/images/ic_thumbnail_app.png differ
index 698f276..57f84d8 100644 (file)
@@ -60,6 +60,8 @@
 #define PART_RECENT_TITLE "part.recent.title"
 #define PART_RECENT_SUBTITLE "part.recent.subtitle"
 #define PART_RECENT_THUMBNAIL "part.recent.thumbnail"
+#define PART_RECENT_THUMBNAIL_BG "part.recent.thumbnail.bg"
+#define PART_RECENT_TEXT_BG "part.recent.text.bg"
 #define PART_RECENT_ICON "part.recent.icon"
 #define PART_RECENT_FAVORITE "part.recent.favorite"
 #define PART_RECENT_DELETE "part.recent.delete"
index 7c6c3d5..b69e716 100644 (file)
@@ -48,6 +48,7 @@ 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);
+Evas_Object *utils_add_rectangle(Evas_Object *base, int r, int g, int b, int a);
 bool utils_launch_app(const char *pkg, const char *key, const char *value);
 
 #endif /* __AIR_HOME_UTILS_H__ */
index 36c6fa6..d938bd1 100644 (file)
@@ -167,7 +167,11 @@ Evas_Object *utils_add_icon(Evas_Object *base, const char *file,
                return NULL;
        }
 
-       elm_image_file_set(ic, file, NULL);
+       if (!elm_image_file_set(ic, file, NULL)) {
+               _ERR("failed to set image file");
+               evas_object_del(ic);
+               return NULL;
+       }
 
        if (part)
                elm_object_part_content_set(base, part, ic);
@@ -371,6 +375,26 @@ Evas_Object *utils_add_popup(Evas_Object *base, char *title, char *message)
        return popup;
 }
 
+Evas_Object *utils_add_rectangle(Evas_Object *base, int r, int g, int b, int a)
+{
+       Evas_Object *rect;
+
+       if (!base) {
+               _ERR("Invalid argument");
+               return NULL;
+       }
+
+       rect = evas_object_rectangle_add(evas_object_evas_get(base));
+       if (!rect) {
+               _ERR("failed to add rectangle");
+               return NULL;
+       }
+
+       evas_object_color_set(rect, r, g, b, a);
+
+       return rect;
+}
+
 bool utils_launch_app(const char *pkg, const char *key, const char *value)
 {
        app_control_h app_control;
index 2f9d743..5319f3a 100644 (file)
@@ -19,6 +19,7 @@
 #include <app_debug.h>
 #include <viewmgr.h>
 #include <inputmgr.h>
+#include <app_contents.h>
 
 #include "defs.h"
 #include "view.h"
@@ -293,12 +294,26 @@ static Evas_Object *_create(Evas_Object *win, void *data)
        return base;
 }
 
+static void _set_item_bg(struct color_data bg, Evas_Object *eo,
+               const char *part)
+{
+       Evas_Object *rect = utils_add_rectangle(eo, bg.r, bg.g, bg.b, bg.a);
+
+       if (!rect) {
+               _ERR("failed to set item bg");
+               return;
+       }
+
+       elm_object_part_content_set(eo, part, rect);
+}
+
 static struct _bar_item *_pack_item(struct _priv *priv, Evas_Object *box,
                struct datamgr_item *di)
 {
        Evas_Object *eo, *lbl, *sub_lbl, *thumb, *ic;
        struct _bar_item *bi;
        const char *group;
+       struct color_data bright_bg, dark_bg;
 
        switch (di->type) {
        case RECENT_ITEM_PREVIEW:
@@ -342,9 +357,13 @@ static struct _bar_item *_pack_item(struct _priv *priv, Evas_Object *box,
                thumb = utils_add_icon(eo, di->icon, PART_RECENT_THUMBNAIL);
                if (!thumb) {
                        _ERR("failed to add thumb");
-                       evas_object_del(eo);
-                       free(bi);
-                       return NULL;
+                       thumb = utils_add_icon(eo, IMAGE_RECENT_THUMB_APP,
+                                       PART_RECENT_THUMBNAIL);
+                       if (!thumb) {
+                               evas_object_del(eo);
+                               free(bi);
+                               return NULL;
+                       }
                }
        }
 
@@ -356,6 +375,10 @@ static struct _bar_item *_pack_item(struct _priv *priv, Evas_Object *box,
                        _ERR("failed to add sub title");
        }
 
+       app_contents_get_color(di->title, &bright_bg, &dark_bg);
+       _set_item_bg(bright_bg, eo, PART_RECENT_THUMBNAIL_BG);
+       _set_item_bg(dark_bg, eo, PART_RECENT_TEXT_BG);
+
        elm_object_focus_next_object_set(eo, priv->del_btn, ELM_FOCUS_UP);
        inputmgr_add_callback(eo, INPUT_HANDLER_TYPE_EO, &handler, bi);
        elm_box_pack_end(box, eo);