diff options
Diffstat (limited to 'src/layout/movie.c')
-rw-r--r-- | src/layout/movie.c | 98 |
1 files changed, 70 insertions, 28 deletions
diff --git a/src/layout/movie.c b/src/layout/movie.c index 202e8c4..28f49f4 100644 --- a/src/layout/movie.c +++ b/src/layout/movie.c @@ -90,8 +90,10 @@ static Evas_Object *_grid_content_get(void *data, Evas_Object *obj, const char *part) { Evas_Object *image; + Evas_Object *text_bg; app_media *am; app_media_info *info; + struct color_data bg; if (!data) return NULL; @@ -103,7 +105,6 @@ static Evas_Object *_grid_content_get(void *data, return NULL; } - image = NULL; if (!strcmp(part, PART_ELM_SWALLOW_THUMBNAIL)) { image = util_add_image(obj, info->thumbnail_path); if (!image) { @@ -112,6 +113,7 @@ static Evas_Object *_grid_content_get(void *data, } evas_object_show(image); + return image; } else if (!strcmp(part, PART_ELM_SWALLOW_FAVORITE)) { if (!info->favorite) return NULL; @@ -123,9 +125,20 @@ static Evas_Object *_grid_content_get(void *data, } evas_object_show(image); + return image; + } else if (!strcmp(part, PART_ELM_SWALLOW_TEXTBG)) { + text_bg = evas_object_rectangle_add(obj); + if (!text_bg) { + _ERR("failed to create rectangle object"); + return NULL; + } + + app_contents_get_color(info->title, NULL, &bg); + evas_object_color_set(text_bg, bg.r, bg.g, bg.b, bg.a); + return text_bg; } - return image; + return NULL; } static struct grid_class _gclass = { @@ -134,57 +147,79 @@ static struct grid_class _gclass = { .content_get = _grid_content_get }; -static bool _update_recent(void *data, Evas_Object *base) +static bool _update_recent_info(Evas_Object *base, app_media_info *info) { - Evas_Object *recent, *image; - app_media_info *info; + Evas_Object *image, *text_bg; + struct color_data bg; struct tm tm; - struct _priv *priv; char buf[32]; - if (!data || !base) { - _ERR("invalid argument"); - return false; - } - - priv = data; - - recent = elm_object_part_content_get(base, PART_ITEM_CONTENT); - if (!recent) { - _ERR("failed to get recent content part"); - return false; - } - - image = elm_object_part_content_get(recent, + image = elm_object_part_content_get(base, PART_RECENT_CONTENT_THUMBNAIL); if (!image) { _ERR("failed to get image object"); return false; } - info = app_media_get_info(priv->recent_info); - if (!info) { - _ERR("failed to get app media info"); + 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); - elm_object_part_text_set(recent, PART_RECENT_CONTENT_TITLE, + app_contents_get_color(info->title, NULL, &bg); + evas_object_color_set(text_bg, bg.r, bg.g, bg.b, bg.a); + + elm_object_part_text_set(base, PART_RECENT_CONTENT_TITLE, info->title); localtime_r(&info->played_time, &tm); strftime(buf, sizeof(buf), "%Y.%m.%d", &tm); - elm_object_part_text_set(recent, PART_RECENT_CONTENT_DATE, buf); + elm_object_part_text_set(base, PART_RECENT_CONTENT_DATE, buf); if (info->favorite) - elm_object_signal_emit(recent, SIG_RECENT_SHOW_FAV, + elm_object_signal_emit(base, SIG_RECENT_SHOW_FAV, SIG_SOURCE_SRC); else - elm_object_signal_emit(recent, SIG_RECENT_HIDE_FAV, + elm_object_signal_emit(base, SIG_RECENT_HIDE_FAV, SIG_SOURCE_SRC); + return true; +} + +static bool _update_recent(void *data, Evas_Object *base) +{ + Evas_Object *recent; + app_media_info *info; + struct _priv *priv; + + if (!data || !base) { + _ERR("invalid argument"); + return false; + } + + priv = data; + + recent = elm_object_part_content_get(base, PART_ITEM_CONTENT); + if (!recent) { + _ERR("failed to get recent content part"); + return false; + } + + info = app_media_get_info(priv->recent_info); + if (!info) { + _ERR("failed to get app media info"); + return false; + } + + if (!_update_recent_info(recent, info)) { + _ERR("failed to update recent info"); + return false; + } + progressbar_reset(priv->prog, info->video->position, info->video->duration); @@ -213,7 +248,7 @@ static bool _draw_recent_title(Evas_Object *base) static bool _draw_recent_content(struct _priv *priv, Evas_Object *base) { - Evas_Object *btn, *image; + Evas_Object *btn, *image, *text_bg; struct progressbar *prog; btn = elm_button_add(base); @@ -230,7 +265,14 @@ static bool _draw_recent_content(struct _priv *priv, Evas_Object *base) return false; } + text_bg = evas_object_rectangle_add(btn); + if (!text_bg) { + _ERR("failed to create rectangle object"); + return false; + } + elm_object_part_content_set(btn, PART_RECENT_CONTENT_THUMBNAIL, image); + elm_object_part_content_set(btn, PART_RECENT_CONTENT_TEXTBG, text_bg); elm_object_part_content_set(base, PART_ITEM_CONTENT, btn); |