diff options
-rw-r--r-- | include/define.h | 1 | ||||
-rw-r--r-- | include/layout/movie.h | 1 | ||||
-rw-r--r-- | res/edc/widgets/button.edc | 44 | ||||
-rw-r--r-- | res/edc/widgets/gengrid.edc | 53 | ||||
-rw-r--r-- | src/layout/movie.c | 98 |
5 files changed, 110 insertions, 87 deletions
diff --git a/include/define.h b/include/define.h index 4359270..f2fe159 100644 --- a/include/define.h +++ b/include/define.h @@ -63,6 +63,7 @@ #define PART_ELM_SWALLOW_THUMBNAIL "elm.swallow.thumbnail" #define PART_ELM_SWALLOW_VIDEO "elm.swallow.video" #define PART_ELM_SWALLOW_FAVORITE "elm.swallow.favorite" +#define PART_ELM_SWALLOW_TEXTBG "elm.swallow.textbg" /* signal */ #define SIG_BTN_CLICKED "btn,clicked" diff --git a/include/layout/movie.h b/include/layout/movie.h index 2712ba6..f6f6145 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_CONTENT_INFO "part.content_info" +#define PART_RECENT_CONTENT_TEXTBG "part.recent_content_textbg" #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 b896e15..c70891d 100644 --- a/res/edc/widgets/button.edc +++ b/res/edc/widgets/button.edc @@ -1310,7 +1310,7 @@ group { state: "default" 0.0; rel1.to: "bg"; rel2 { - to: "bg_text"; + to: PART_RECENT_CONTENT_TEXTBG; relative: 1.0 0.0; } map { @@ -1455,7 +1455,7 @@ group { relative: 0.0 1.0; } rel2 { - to: "bg_text"; + to: PART_RECENT_CONTENT_TEXTBG; relative: 0.0 0.0; } min: 6 0; @@ -1493,7 +1493,7 @@ group { relative: 1.0 1.0; } rel2 { - to: "bg_text"; + to: PART_RECENT_CONTENT_TEXTBG; relative: 1.0 0.0; } min: 6 0; @@ -1520,8 +1520,8 @@ group { } } part { - name: "defaultbg_text"; - type: RECT; + name: PART_RECENT_CONTENT_TEXTBG; + type: SWALLOW; scale: 1; description { state: "default" 0.0; @@ -1535,29 +1535,22 @@ group { } min: 0 198; align: 0.5 1.0; - color: COLOR_TEXT_BG; fixed: 0 1; map { perspective_on: 1; perspective: "map"; } } - description { - state: "selected" 0.0; - inherit: "default" 0.0; - color: COLOR_ITEM_FOCUS; - map.on: 1; - } } part { - name: "bg_text"; + name: "defaultbg_text"; type: RECT; scale: 1; description { state: "default" 0.0; - rel1.to: "defaultbg_text"; - rel2.to: "defaultbg_text"; - color: COLOR_TEXT_BG; + rel1.to: PART_RECENT_CONTENT_TEXTBG; + rel2.to: PART_RECENT_CONTENT_TEXTBG; + visible: 0; map { perspective_on: 1; perspective: "map"; @@ -1566,6 +1559,7 @@ group { description { state: "selected" 0.0; inherit: "default" 0.0; + visible: 1; color: COLOR_ITEM_FOCUS; map.on: 1; } @@ -1581,9 +1575,9 @@ group { scale: 1; description { state: "default" 0.0; - rel1.to: "bg_text"; + rel1.to: PART_RECENT_CONTENT_TEXTBG; rel2 { - to: "bg_text"; + to: PART_RECENT_CONTENT_TEXTBG; relative: 0.0 0.0; } min: 26 28; @@ -1598,11 +1592,11 @@ group { description { state: "default" 0.0; rel1 { - to: "bg_text"; + to: PART_RECENT_CONTENT_TEXTBG; relative: 1.0 0.0; } rel2 { - to: "bg_text"; + to: PART_RECENT_CONTENT_TEXTBG; relative: 1.0 0.0; } min: 26 28; @@ -1847,7 +1841,7 @@ group { target: "part_focus1"; target: "part_focus2"; target: "part_focus3"; - target: "bg_text"; + target: "defaultbg_text"; target: PART_RECENT_CONTENT_TITLE; target: PART_RECENT_CONTENT_DATE; after: "focus,in,anim"; @@ -1863,7 +1857,7 @@ group { target: "part_focus1"; target: "part_focus2"; target: "part_focus3"; - target: "bg_text"; + target: "defaultbg_text"; transition: TRANSITION_FOCUS; after: "focus,in,anim,2"; } @@ -1879,7 +1873,6 @@ group { set_state(PART:PART_RECENT_CONTENT_FAVORITE, "default,selected", 0.0); } - set_state(PART:"defaultbg_text", "selected", 0.0); } } program { @@ -1904,7 +1897,6 @@ group { action: STATE_SET "default" 0.0; target: PART_RECENT_CONTENT_TITLE; target: PART_RECENT_CONTENT_DATE; - target: "defaultbg_text"; after: "focus,out,anim"; } program { @@ -1913,7 +1905,7 @@ group { target: "part_focus1"; target: "part_focus2"; target: "part_focus3"; - target: "bg_text"; + target: "defaultbg_text"; transition: TRANSITION_FOCUS; after: "focus,out,anim,2"; } @@ -1928,7 +1920,7 @@ group { target: "part_focus1"; target: "part_focus2"; target: "part_focus3"; - target: "bg_text"; + target: "defaultbg_text"; } program { name: "button_clicked"; diff --git a/res/edc/widgets/gengrid.edc b/res/edc/widgets/gengrid.edc index 31e5db4..403168d 100644 --- a/res/edc/widgets/gengrid.edc +++ b/res/edc/widgets/gengrid.edc @@ -18,7 +18,7 @@ group { name: "elm/gengrid/item/movie_item/default"; data.item: "selectraise" "on"; data.item: "texts" "elm.text.title"; - data.item: "contents" "elm.swallow.thumbnail elm.swallow.favorite"; + data.item: "contents" "elm.swallow.thumbnail elm.swallow.favorite elm.swallow.textbg"; data.item: "focus_highlight" "on"; images { image: IMAGE_PREVIEW_PLAY COMP; @@ -76,7 +76,7 @@ group { state: "default" 0.0; rel1.to: "bg"; rel2 { - to: "elm.bg.text"; + to: PART_ELM_SWALLOW_TEXTBG; relative: 1.0 0.0; } color: 0 0 0 115; @@ -232,7 +232,7 @@ group { relative: 0.0 1.0; } rel2 { - to: "elm.bg.text"; + to: PART_ELM_SWALLOW_TEXTBG; relative: 0.0 0.0; } min: 6 0; @@ -270,7 +270,7 @@ group { relative: 1.0 1.0; } rel2 { - to: "elm.bg.text"; + to: PART_ELM_SWALLOW_TEXTBG; relative: 1.0 0.0; } min: 6 0; @@ -297,9 +297,8 @@ group { } } part { - name: "defaultbg_text"; - type: RECT; - mouse_events: 0; + name: PART_ELM_SWALLOW_TEXTBG; + type: SWALLOW; scale: 1; description { state: "default" 0.0; @@ -310,29 +309,23 @@ group { rel2.to: "bg"; min: 0 82; align: 0.5 1.0; - color: COLOR_TEXT_BG; fixed: 0 1; map { perspective_on: 1; perspective: "map"; } } - description { - state: "selected" 0.0; - inherit: "default" 0.0; - color: COLOR_ITEM_FOCUS; - map.on: 1; - } } part { - name: "elm.bg.text"; + name: "defaultbg_text"; type: RECT; + mouse_events: 0; scale: 1; description { state: "default" 0.0; - rel1.to: "defaultbg_text"; - rel2.to: "defaultbg_text"; - color: COLOR_TEXT_BG; + rel1.to: PART_ELM_SWALLOW_TEXTBG; + rel2.to: PART_ELM_SWALLOW_TEXTBG; + visible: 0; map { perspective_on: 1; perspective: "map"; @@ -341,6 +334,7 @@ group { description { state: "selected" 0.0; inherit: "default" 0.0; + visible: 1; color: COLOR_ITEM_FOCUS; map.on: 1; } @@ -356,9 +350,9 @@ group { scale: 1; description { state: "default" 0.0; - rel1.to: "elm.bg.text"; + rel1.to: PART_ELM_SWALLOW_TEXTBG; rel2 { - to: "elm.bg.text"; + to: PART_ELM_SWALLOW_TEXTBG; relative: 0.0 0.0; } min: 18 82; @@ -373,11 +367,11 @@ group { description { state: "default" 0.0; rel1 { - to: "elm.bg.text"; + to: PART_ELM_SWALLOW_TEXTBG; relative: 1.0 0.0; } rel2 { - to: "elm.bg.text"; + to: PART_ELM_SWALLOW_TEXTBG; relative: 1.0 0.0; } min: 18 82; @@ -431,7 +425,7 @@ group { target: "part_focus1"; target: "part_focus2"; target: "part_focus3"; - target: "elm.bg.text"; + target: "defaultbg_text"; target: PART_ELM_TEXT_TITLE; after: "focus,in,anim"; } @@ -445,14 +439,8 @@ group { target: "part_focus1"; target: "part_focus2"; target: "part_focus3"; - target: "elm.bg.text"; - transition: TRANSITION_FOCUS; - after: "focus,in,anim,2"; - } - program { - name: "focus,in,anim,2"; - action: STATE_SET "selected" 0.0; target: "defaultbg_text"; + transition: TRANSITION_FOCUS; } program { name: "go_passive"; @@ -460,7 +448,6 @@ group { source: "elm"; action: STATE_SET "default" 0.0; target: PART_ELM_TEXT_TITLE; - target: "defaultbg_text"; after: "focus,out,anim"; } program { @@ -469,7 +456,7 @@ group { target: "part_focus1"; target: "part_focus2"; target: "part_focus3"; - target: "elm.bg.text"; + target: "defaultbg_text"; transition: TRANSITION_FOCUS; after: "focus,out,anim,2"; } @@ -483,7 +470,7 @@ group { target: "part_focus1"; target: "part_focus2"; target: "part_focus3"; - target: "elm.bg.text"; + target: "defaultbg_text"; } } } 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); |