From c661dcbac8ed9ef252a29d706daf260bd6a2162c Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Thu, 10 Dec 2015 19:16:24 +0900 Subject: movie: set default thumbnail bg color for recently watched item Change-Id: I3e6ba7f5e81b454f7e5f2c8b470772bcf83e5843 Signed-off-by: Jehun Lim --- include/layout/movie.h | 1 + res/edc/widgets/button.edc | 10 ++++++++++ src/layout/movie.c | 31 +++++++++++++++++++++++-------- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/include/layout/movie.h b/include/layout/movie.h index 2de9449..7feba61 100644 --- a/include/layout/movie.h +++ b/include/layout/movie.h @@ -28,6 +28,7 @@ #define PART_CONTENT "part.content" #define PART_NOCONTENT "part.nocontent" #define PART_RECENT_CONTENT_TEXTBG "part.recent_content_textbg" +#define PART_RECENT_CONTENT_IMGBG "part.recent_content_imgbg" #define PART_RECENT_CONTENT_THUMBNAIL "part.recent_content_thumbnail" #define PART_RECENT_CONTENT_FAVORITE "part.recent_content_favorite" #define PART_RECENT_CONTENT_TITLE "part.recent_content_title" diff --git a/res/edc/widgets/button.edc b/res/edc/widgets/button.edc index dbeb890..c9a2648 100644 --- a/res/edc/widgets/button.edc +++ b/res/edc/widgets/button.edc @@ -2000,6 +2000,16 @@ group { inherit: "default" 0.0; } } + part { + name: PART_RECENT_CONTENT_IMGBG; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1.to: PART_RECENT_CONTENT_THUMBNAIL; + rel2.to: PART_RECENT_CONTENT_THUMBNAIL; + } + } part { name: "default_image"; type: IMAGE; diff --git a/src/layout/movie.c b/src/layout/movie.c index 59a6249..efefa0c 100644 --- a/src/layout/movie.c +++ b/src/layout/movie.c @@ -71,27 +71,35 @@ struct _priv { static bool _update_recent_info(Evas_Object *base, app_media_info *info) { - Evas_Object *image, *text_bg; + Evas_Object *img, *img_bg, *text_bg; struct color_data bg; struct tm tm; char buf[32]; - image = elm_object_part_content_get(base, + img = elm_object_part_content_get(base, PART_RECENT_CONTENT_THUMBNAIL); - if (!image) { - _ERR("failed to get image object"); + img_bg = elm_object_part_content_get(base, + PART_RECENT_CONTENT_IMGBG); + + if (!img || !img_bg) { + _ERR("failed to get object"); return false; } + if (info->thumbnail_path) { + elm_image_file_set(img, info->thumbnail_path, NULL); + elm_image_aspect_fixed_set(img, EINA_FALSE); + + evas_object_color_set(img_bg, 0, 0, 0, 0); + } else + evas_object_color_set(img_bg, 0, 0, 0, 255); + text_bg = elm_object_part_content_get(base, PART_RECENT_CONTENT_TEXTBG); if (!text_bg) { _ERR("failed to get textbg part"); return false; } - elm_image_file_set(image, info->thumbnail_path, NULL); - elm_image_aspect_fixed_set(image, EINA_FALSE); - app_contents_get_color(info->title, NULL, &bg); evas_object_color_set(text_bg, bg.r, bg.g, bg.b, bg.a); @@ -170,7 +178,7 @@ static bool _draw_recent_title(Evas_Object *base) static bool _draw_recent_content(struct _priv *priv, Evas_Object *base) { - Evas_Object *btn, *image, *text_bg; + Evas_Object *btn, *image, *img_bg, *text_bg; struct progressbar *prog; btn = elm_button_add(base); @@ -187,6 +195,12 @@ static bool _draw_recent_content(struct _priv *priv, Evas_Object *base) return false; } + img_bg = evas_object_rectangle_add(btn); + if (!img_bg) { + _ERR("failed to create rectangle object"); + return false; + } + text_bg = evas_object_rectangle_add(btn); if (!text_bg) { _ERR("failed to create rectangle object"); @@ -194,6 +208,7 @@ static bool _draw_recent_content(struct _priv *priv, Evas_Object *base) } elm_object_part_content_set(btn, PART_RECENT_CONTENT_THUMBNAIL, image); + elm_object_part_content_set(btn, PART_RECENT_CONTENT_IMGBG, img_bg); elm_object_part_content_set(btn, PART_RECENT_CONTENT_TEXTBG, text_bg); elm_object_part_content_set(base, PART_ITEM_CONTENT, btn); -- cgit v1.2.3