From 387651053ee860f7827722a7ca7edec1b3b4546e Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Tue, 7 Jul 2015 10:46:29 +0900 Subject: [PATCH 01/16] mediadata: add function to create list with media modified time Change-Id: I3ef1500a380bccfb49f06f40dc57f073d9767031 Signed-off-by: Jehun Lim --- include/data/mediadata.h | 1 + src/data/mediadata.c | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/include/data/mediadata.h b/include/data/mediadata.h index 006eaac..557c85f 100644 --- a/include/data/mediadata.h +++ b/include/data/mediadata.h @@ -36,6 +36,7 @@ enum sort_type { enum list_type { E_LIST_NAME = 0, + E_LIST_DATE, E_LIST_MAX }; diff --git a/src/data/mediadata.c b/src/data/mediadata.c index 04556b0..16504bb 100644 --- a/src/data/mediadata.c +++ b/src/data/mediadata.c @@ -29,6 +29,8 @@ static int _compare_cb_name(const void *, const void *); static int _compare_title(struct group_info *, app_media_info *); static char *_get_title(app_media_info *); +static int _compare_modified_time(struct group_info *, app_media_info *); +static char *_get_modified_time(app_media_info *); enum _filter_type { E_FILTER_FOLDER = 0, @@ -77,6 +79,10 @@ static struct _list_info g_list_info[E_LIST_MAX] = { [E_LIST_NAME] = { .media_cmp = _compare_title, .name_get = _get_title, + }, + [E_LIST_DATE] = { + .media_cmp = _compare_modified_time, + .name_get = _get_modified_time, } }; @@ -115,6 +121,17 @@ static bool _create_filter(struct _data *data, filter_h *filter, int type) return true; } +static char *_get_date_string(time_t time) +{ + struct tm tm; + char buf[32]; + + localtime_r(&time, &tm); + strftime(buf, sizeof(buf), "%Y.%m.%d", &tm); + + return strdup(buf); +} + static int _compare_title(struct group_info *gi, app_media_info *info) { if (!gi || !gi->name || !info->title) @@ -131,6 +148,28 @@ static char *_get_title(app_media_info *info) return strndup(info->title, 1); } +static int _compare_modified_time(struct group_info *gi, app_media_info *info) +{ + char *date; + int r; + + if (!gi || !gi->name) + return -1; + + date = _get_date_string(info->modified_time); + + r = strcasecmp(gi->name, date); + + free(date); + + return r; +} + +static char *_get_modified_time(app_media_info *info) +{ + return _get_date_string(info->modified_time); +} + static int _compare_cb_date(const void *data1, const void *data2) { app_media *am1, *am2; @@ -145,7 +184,7 @@ static int _compare_cb_date(const void *data1, const void *data2) if (!info1 || !info2) return -1; - if (info1->modified_time > info2->modified_time) + if (info1->modified_time < info2->modified_time) return 1; return -1; -- 2.7.4 From 1d50394f81d736ba0076c9cb970e3c159bafc425 Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Mon, 6 Jul 2015 21:43:42 +0900 Subject: [PATCH 02/16] gallery: draw content list area Change-Id: I7c8b100d699b9c0e48337b0418a738b7fe0414fd Signed-off-by: Jehun Lim --- include/layout/movie.h | 4 -- include/util/util.h | 1 + include/view/base.h | 14 +++- res/edc/layout/gallery.edc | 1 + res/edc/layout/movie.edc | 62 ---------------- res/edc/view/base.edc | 62 ++++++++++++++++ res/edc/widgets/gengrid.edc | 26 ++++--- src/layout/gallery.c | 170 ++++++++++++++++++++++++++++++++++++++++++-- src/layout/movie.c | 19 +++-- src/util/util.c | 19 +++++ src/view/base.c | 2 +- 11 files changed, 286 insertions(+), 94 deletions(-) diff --git a/include/layout/movie.h b/include/layout/movie.h index 4d83ecd..5d10efc 100644 --- a/include/layout/movie.h +++ b/include/layout/movie.h @@ -20,14 +20,10 @@ #define LAYOUT_MOVIE "LAYOUT_MOVIE" #define GRP_MOVIE_LAYOUT "group.movie_layout" -#define GRP_LIST_ITEM "group.list_item" #define PART_CONTENT "part.content" #define PART_NOCONTENT "part.nocontent" -#define PART_ITEM_TITLE "part.item_title" -#define PART_ITEM_CONTENT "part.item_content" -#define STYLE_BTN_INDEX "base_btn_index" #define STYLE_GRID_MOVIE_ITEM "movie_item" #endif /* __AIR_MEDIAHUB_LAYOUT_MOVIE_H__ */ diff --git a/include/util/util.h b/include/util/util.h index 59aefce..9f17b5f 100644 --- a/include/util/util.h +++ b/include/util/util.h @@ -20,6 +20,7 @@ Evas_Object *util_add_box(Evas_Object *base); Evas_Object *util_add_gengrid(Evas_Object *base, int item_size_x, int item_size_y); +Evas_Object *util_add_image(Evas_Object *base, const char *file); Evas_Object *util_add_scroller(Evas_Object *base); #endif /* __AIR_MEDIAHUB_UTIL_H__ */ diff --git a/include/view/base.h b/include/view/base.h index 470bc93..a40dd4e 100644 --- a/include/view/base.h +++ b/include/view/base.h @@ -17,15 +17,27 @@ #ifndef __AIR_MEDIAHUB_VIEW_BASE_H__ #define __AIR_MEDIAHUB_VIEW_BASE_H__ +/* view */ #define VIEW_BASE "VIEW_BASE" +/* group */ #define GRP_BASE_VIEW "group.base_view" +#define GRP_LIST_ITEM "group.list_item" +/* part */ #define PART_TITLE "part.title" #define PART_MENU_AREA "part.menu_area" #define PART_THUMBNAIL_AREA "part.thumbnail_area" #define PART_BOTTOM_AREA "part.bottom_area" -#define STYLE_MENU_BTN "base_btn_menu" +#define PART_ITEM_TITLE "part.item_title" +#define PART_ITEM_CONTENT "part.item_content" + +/* images */ +#define IMAGE_THUMBNAIL_PLAY IMAGEDIR"/ic_thumbnail_play.png" + +/* style */ +#define STYLE_BTN_MENU "base_btn_menu" +#define STYLE_BTN_INDEX "base_btn_index" #endif /* __AIR_MEDIAHUB_VIEW_BASE_H__ */ diff --git a/res/edc/layout/gallery.edc b/res/edc/layout/gallery.edc index 520e09a..a773e3d 100644 --- a/res/edc/layout/gallery.edc +++ b/res/edc/layout/gallery.edc @@ -16,4 +16,5 @@ group { name: GRP_GALLERY_LAYOUT; + inherit: GRP_MOVIE_LAYOUT; } diff --git a/res/edc/layout/movie.edc b/res/edc/layout/movie.edc index fa64707..d029dd9 100644 --- a/res/edc/layout/movie.edc +++ b/res/edc/layout/movie.edc @@ -74,65 +74,3 @@ group { } } } - -group { - name: GRP_LIST_ITEM; - parts { - part { - name: "area"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - min: 0 703; - fixed: 0 1; - visible: 0; - } - } - part { - name: PART_ITEM_TITLE; - type: SWALLOW; - scale: 1; - description { - state: "default" 0.0; - rel1.to: "area"; - rel2 { - to: "area"; - relative: 1.0 0.0; - } - min: 0 36; - align: 0.5 0.0; - fixed: 0 1; - } - } - part { - name: "padding_content"; - type: SPACER; - scale: 1; - description { - state: "default" 0.0; - rel1 { - to: PART_ITEM_TITLE; - relative: 0.0 1.0; - } - rel2.to: PART_ITEM_TITLE; - min: 0 28; - align: 0.5 0.0; - fixed: 0 1; - } - } - part { - name: PART_ITEM_CONTENT; - type: SWALLOW; - scale: 1; - description { - state: "default" 0.0; - rel1 { - to: "padding_content"; - relative: 0.0 1.0; - } - rel2.to: "area"; - } - } - } -} diff --git a/res/edc/view/base.edc b/res/edc/view/base.edc index 4ad5a83..931ffda 100644 --- a/res/edc/view/base.edc +++ b/res/edc/view/base.edc @@ -154,3 +154,65 @@ group { } } } + +group { + name: GRP_LIST_ITEM; + parts { + part { + name: "area"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + min: 0 703; + fixed: 0 1; + visible: 0; + } + } + part { + name: PART_ITEM_TITLE; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1.to: "area"; + rel2 { + to: "area"; + relative: 1.0 0.0; + } + min: 0 36; + align: 0.5 0.0; + fixed: 0 1; + } + } + part { + name: "padding_content"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: PART_ITEM_TITLE; + relative: 0.0 1.0; + } + rel2.to: PART_ITEM_TITLE; + min: 0 28; + align: 0.5 0.0; + fixed: 0 1; + } + } + part { + name: PART_ITEM_CONTENT; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding_content"; + relative: 0.0 1.0; + } + rel2.to: "area"; + } + } + } +} diff --git a/res/edc/widgets/gengrid.edc b/res/edc/widgets/gengrid.edc index 67e69eb..624f553 100644 --- a/res/edc/widgets/gengrid.edc +++ b/res/edc/widgets/gengrid.edc @@ -120,7 +120,7 @@ group { to: "bg"; relative: 1.0 0.0; } - min: 0 3; + min: 0 6; align: 0.5 0.0; color: COLOR_ITEM_FOCUS; fixed: 0 1; @@ -158,7 +158,7 @@ group { to: "elm.bg.text"; relative: 0.0 0.0; } - min: 3 0; + min: 6 0; align: 0.0 0.5; color: COLOR_ITEM_FOCUS; fixed: 1 0; @@ -196,7 +196,7 @@ group { to: "elm.bg.text"; relative: 1.0 0.0; } - min: 3 0; + min: 6 0; align: 1.0 0.5; color: COLOR_ITEM_FOCUS; fixed: 1 0; @@ -489,8 +489,16 @@ group { type: SWALLOW; description { state: "default" 0.0; - rel1.to: "defaultbg"; - rel2.to: "defaultbg"; + rel1 { + to: "defaultbg"; + relative: 0.5 0.5; + } + rel2 { + to: "defaultbg"; + relative: 0.5 0.5; + } + min: 80 80; + fixed: 1 1; } } part { @@ -505,7 +513,7 @@ group { to: "bg"; relative: 1.0 0.0; } - min: 0 3; + min: 0 6; align: 0.5 0.0; color: COLOR_ITEM_FOCUS; fixed: 0 1; @@ -543,7 +551,7 @@ group { to: "bg"; relative: 0.0 1.0; } - min: 3 0; + min: 6 0; align: 0.0 0.5; color: COLOR_ITEM_FOCUS; fixed: 1 0; @@ -578,7 +586,7 @@ group { relative: 1.0 1.0; } rel2.to: "bg"; - min: 3 0; + min: 6 0; align: 1.0 0.5; color: COLOR_ITEM_FOCUS; fixed: 1 0; @@ -616,7 +624,7 @@ group { to: "part_focus3"; relative: 0.0 1.0; } - min: 0 3; + min: 0 6; align: 0.5 1.0; color: COLOR_ITEM_FOCUS; fixed: 0 1; diff --git a/src/layout/gallery.c b/src/layout/gallery.c index 85df1b1..9dd4c73 100644 --- a/src/layout/gallery.c +++ b/src/layout/gallery.c @@ -15,20 +15,130 @@ */ #include +#include #include +#include +#include #include #include "define.h" +#include "data/mediadata.h" +#include "util/listmgr.h" +#include "util/util.h" + +#define LIST_MEDIA_COND "media_type=0 OR media_type=1" + +#define TEXT_NOCONTENT "No Photo & Video" + +#define GRID_ITEM_X 206 +#define GRID_ITEM_Y 206 +#define GRID_NUM_ITEM 3 + +#define BOX_PADDING 62 struct _priv { Evas_Object *base; Evas_Object *layout; layoutmgr *lmgr; + + struct listmgr *listmgr; + + struct mediadata *md; + + Eina_List *media_list; +}; + +static Evas_Object *_grid_content_get(void *data, + Evas_Object *obj, const char *part) +{ + Evas_Object *image; + app_media *am; + app_media_info *info; + + if (!data) + return NULL; + + am = data; + info = app_media_get_info(am); + if (!info) { + _ERR("failed to get media info"); + return NULL; + } + + image = NULL; + if (!strcmp(part, PART_ELM_SWALLOW_THUMBNAIL)) { + image = util_add_image(obj, info->thumbnail_path); + if (!image) { + _ERR("failed to create image object"); + return NULL; + } + + evas_object_show(image); + } else if (!strcmp(part, PART_ELM_SWALLOW_VIDEO)) { + if (info->media_type == MEDIA_CONTENT_TYPE_VIDEO) { + image = util_add_image(obj, IMAGE_THUMBNAIL_PLAY); + if (!image) { + _ERR("failed to create image object"); + return NULL; + } + + evas_object_show(image); + } + } + + return image; +} + +static struct grid_class _gclass = { + .item_style = STYLE_GRID_GALLERY_ITEM, + .content_get = _grid_content_get }; +static struct listmgr_data *_create_listmgr_data(void) +{ + struct listmgr_data *data; + + data = calloc(1, sizeof(*data)); + if (!data) { + _ERR("failed to allocate listmgr data"); + return NULL; + } + + data->grid_item_x = GRID_ITEM_X; + data->grid_item_y = GRID_ITEM_Y; + data->grid_num_item = GRID_NUM_ITEM; + data->box_padding = BOX_PADDING; + data->gclass = &_gclass; + + return data; +} + +static void _update_list_area(struct _priv *priv) +{ + Eina_List *list; + + if (priv->media_list) + return; + + list = mediadata_get_list(priv->md, E_LIST_DATE); + if (!list) { + elm_object_part_text_set(priv->layout, + PART_NOCONTENT, TEXT_NOCONTENT); + return; + } + + if (!listmgr_update_list_area(priv->listmgr, list)) + _ERR("failed to update list area"); + + priv->media_list = list; +} + static bool _create(layoutmgr *lmgr, void *data) { + struct listmgr *listmgr; + struct listmgr_data *ldata; + struct mediadata *md; struct _priv *priv; Evas_Object *base, *layout; @@ -46,30 +156,63 @@ static bool _create(layoutmgr *lmgr, void *data) base = layoutmgr_get_base(lmgr); if (!base) { _ERR("failed to get base object"); - free(priv); - return false; + goto err; } layout = elm_layout_add(base); if (!layout) { _ERR("failed to create layout"); - free(priv); - return false; + goto err; } if (!elm_layout_file_set(layout, EDJEFILE, GRP_GALLERY_LAYOUT)) { _ERR("failed to set layout file"); - evas_object_del(layout); - free(priv); + goto err2; + } + + ldata = _create_listmgr_data(); + if (!ldata) { + _ERR("failed to create listmgr data"); + goto err2; + } + + listmgr = listmgr_create(layout, (void *)ldata); + if (!listmgr) { + _ERR("failed to create listmgr"); + goto err3; + } + + md = mediadata_create(LIST_MEDIA_COND, E_SOURCE_ALL, E_SORT_DATE); + if (!md) { + _ERR("failed to create mediadata"); + listmgr_destroy(listmgr); + goto err3; } priv->base = base; priv->layout = layout; priv->lmgr = lmgr; + priv->listmgr = listmgr; + priv->md = md; layoutmgr_set_layout_data(lmgr, LAYOUT_GALLERY, priv); + if (!listmgr_draw_list_area(listmgr)) { + _ERR("failed to draw list area"); + mediadata_destroy(md); + listmgr_destroy(listmgr); + goto err3; + } + return true; + +err3: + free(ldata); +err2: + evas_object_del(layout); +err: + free(priv); + return false; } static void _destroy(void *layout_data) @@ -83,6 +226,11 @@ static void _destroy(void *layout_data) priv = layout_data; + mediadata_free_list(priv->media_list); + mediadata_destroy(priv->md); + + listmgr_destroy(priv->listmgr); + evas_object_del(priv->layout); free(priv); } @@ -120,6 +268,16 @@ static void _hide(void *layout_data) static void _update(void *layout_data, int update_type, void *data) { + struct _priv *priv; + + if (!layout_data) { + _ERR("failed to get layout data"); + return; + } + + priv = layout_data; + + _update_list_area(priv); } static layout_class _lclass = { diff --git a/src/layout/movie.c b/src/layout/movie.c index af6855a..326de60 100644 --- a/src/layout/movie.c +++ b/src/layout/movie.c @@ -24,6 +24,7 @@ #include "define.h" #include "data/mediadata.h" #include "util/listmgr.h" +#include "util/util.h" #define LIST_MEDIA_COND "media_type=1 AND copyright NOT LIKE \"Unknown\"" @@ -84,13 +85,8 @@ static Evas_Object *_grid_content_get(void *data, am = data; + image = NULL; if (!strcmp(part, PART_ELM_SWALLOW_THUMBNAIL)) { - image = elm_image_add(obj); - if (!image) { - _ERR("failed to create image object"); - return NULL; - } - info = app_media_get_info(am); if (!info) { _ERR("failed to get media info"); @@ -98,15 +94,16 @@ static Evas_Object *_grid_content_get(void *data, return NULL; } - elm_image_file_set(image, info->thumbnail_path, NULL); - elm_image_aspect_fixed_set(image, EINA_FALSE); + image = util_add_image(obj, info->thumbnail_path); + if (!image) { + _ERR("failed to create image object"); + return NULL; + } evas_object_show(image); - - return image; } - return NULL; + return image; } static struct grid_class _gclass = { diff --git a/src/util/util.c b/src/util/util.c index df8abad..e89555a 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -69,6 +69,25 @@ Evas_Object *util_add_gengrid(Evas_Object *base, return grid; } +Evas_Object *util_add_image(Evas_Object *base, const char *file) +{ + Evas_Object *image; + + if (!base || !file) + return NULL; + + image = elm_image_add(base); + if (!image) { + _ERR("failed to create image object"); + return NULL; + } + + elm_image_file_set(image, file, NULL); + elm_image_aspect_fixed_set(image, EINA_FALSE); + + return image; +} + Evas_Object *util_add_scroller(Evas_Object *base) { Evas_Object *scr; diff --git a/src/view/base.c b/src/view/base.c index 07247de..7185c77 100644 --- a/src/view/base.c +++ b/src/view/base.c @@ -140,7 +140,7 @@ static bool _draw_menu_btn(struct _priv *priv) return false; } - elm_object_style_set(btn, STYLE_MENU_BTN); + elm_object_style_set(btn, STYLE_BTN_MENU); elm_object_text_set(btn, g_menu_item[i].name); elm_box_pack_end(box, btn); -- 2.7.4 From 430f34d012b6a39508696489a2d00e0094d46f15 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Tue, 7 Jul 2015 15:31:41 +0900 Subject: [PATCH 03/16] add progressbar including slider and info of progress time the progressbar is including slider widget and progress time texts. timer and progress info codes are moved to progressbar. Change-Id: Id557c4996a8cfdde2ed6a457b209bcd0511fb135 Signed-off-by: Minkyu Kang --- CMakeLists.txt | 1 + include/define.h | 3 +- include/util/progressbar.h | 44 ++++++++ include/util/util.h | 3 + include/view/viewer.h | 4 + res/edc/mediahub-theme.edc | 1 + res/edc/view/viewer.edc | 27 +++++ res/edc/widgets/button.edc | 10 +- res/edc/widgets/slider.edc | 225 +++++++++++++++++++++++++++++++++++++++ src/util/progressbar.c | 258 +++++++++++++++++++++++++++++++++++++++++++++ src/util/util.c | 18 ++++ src/view/viewer.c | 187 +++++++++++++------------------- 12 files changed, 662 insertions(+), 119 deletions(-) create mode 100644 include/util/progressbar.h create mode 100644 res/edc/widgets/slider.edc create mode 100644 src/util/progressbar.c diff --git a/CMakeLists.txt b/CMakeLists.txt index cba373b..08e5efd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,7 @@ src/util/listmgr.c src/util/timeout_handler.c src/util/util.c src/util/playermgr.c +src/util/progressbar.c src/data/mediadata.c ) diff --git a/include/define.h b/include/define.h index 6ecf61b..1b4651b 100644 --- a/include/define.h +++ b/include/define.h @@ -41,11 +41,10 @@ #define COLOR_TEXT_FOCUS 255 255 255 255 #define COLOR_TEXT_SELECTED 64 136 211 255 #define COLOR_TEXT_DISABLED 87 87 87 128 -#define COLOR_BTN_FOCUS 0 119 246 255 -#define COLOR_BTN_SELECTED 64 136 211 255 #define COLOR_ITEM_BG 56 55 59 255 #define COLOR_ITEM_FOCUS 0 119 246 255 #define COLOR_ITEM_FOCUS_0 0 119 246 0 +#define COLOR_ITEM_SELECTED 64 136 211 255 /* part */ #define PART_ELM_TEXT_TITLE "elm.text.title" diff --git a/include/util/progressbar.h b/include/util/progressbar.h new file mode 100644 index 0000000..c93a87e --- /dev/null +++ b/include/util/progressbar.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __AIR_MEDIAHUB_PROGRESSBAR_H__ +#define __AIR_MEDIAHUB_PROGRESSBAR_H__ + +struct progressbar; + +struct progressbar_ops { + int (*get_value)(void *data); + int (*set_value)(void *data); +}; + +struct progressbar *progressbar_create(Evas_Object *base); +void progressbar_destroy(struct progressbar *m); + +void progressbar_set_parts(struct progressbar *m, const char *slider, + const char *total, const char *progress, const char *separator); +void progressbar_set_ops(struct progressbar *m, + struct progressbar_ops *ops, void *data); +void progressbar_reset(struct progressbar *m, int position, int duration); + +void progressbar_show(struct progressbar *m); +void progressbar_hide(struct progressbar *m); + +void progressbar_start(struct progressbar *m); +void progressbar_stop(struct progressbar *m); +void progressbar_pause(struct progressbar *m); +void progressbar_resume(struct progressbar *m); + +#endif diff --git a/include/util/util.h b/include/util/util.h index 59aefce..0d624af 100644 --- a/include/util/util.h +++ b/include/util/util.h @@ -22,4 +22,7 @@ Evas_Object *util_add_gengrid(Evas_Object *base, int item_size_x, int item_size_y); Evas_Object *util_add_scroller(Evas_Object *base); +void util_time_string(char *str, int size, unsigned int ms); +void util_up_string(char *str); + #endif /* __AIR_MEDIAHUB_UTIL_H__ */ diff --git a/include/view/viewer.h b/include/view/viewer.h index b7622f2..580e287 100644 --- a/include/view/viewer.h +++ b/include/view/viewer.h @@ -23,6 +23,9 @@ /* group */ #define GRP_VIEWER_VIEW "group.viewer_view" +/* style */ +#define STYLE_VIEWER_PROGRESS "viewer_progress" + /* part */ #define PART_VIEWER_BG "part.viewer_bg" #define PART_VIEWER_CONTENT "part.viewer_content" @@ -32,6 +35,7 @@ #define PART_VIEWER_PROGRESS "part.viewer_progress" #define PART_VIEWER_TOTAL "part.viewer_total" #define PART_VIEWER_FAVORITE "part.viewer_favorite" +#define PART_VIEWER_SLIDER "part.viewer_slider" /* signal */ #define SIG_SET_PLAY "set,play,icon" diff --git a/res/edc/mediahub-theme.edc b/res/edc/mediahub-theme.edc index 4187a48..4eb7b88 100644 --- a/res/edc/mediahub-theme.edc +++ b/res/edc/mediahub-theme.edc @@ -19,4 +19,5 @@ collections { #include "widgets/button.edc" #include "widgets/gengrid.edc" + #include "widgets/slider.edc" } diff --git a/res/edc/view/viewer.edc b/res/edc/view/viewer.edc index e698125..bf7bb02 100644 --- a/res/edc/view/viewer.edc +++ b/res/edc/view/viewer.edc @@ -442,6 +442,31 @@ group { align: 0.0 0.5; } } + part { + name: PART_VIEWER_SLIDER; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + min: 0 4; + rel1 { + to: "bottomarea"; + relative: 0.0 0.0; + } + rel2 { + to: "bottomarea"; + relative: 1.0 0.0; + } + fixed: 0 1; + align: 0.0 1.0; + } + description { + state: "hide" 0.0; + inherit: "default" 0.0; + align: 0.0 0.0; + visible: 0; + } + } } programs { @@ -452,6 +477,7 @@ group { action: STATE_SET "hide" 0.0; target: "toparea"; target: "bottomarea"; + target: PART_VIEWER_SLIDER; transition: LINEAR TRANSITION_TIME; } program { @@ -461,6 +487,7 @@ group { action: STATE_SET "default" 0.0; target: "toparea"; target: "bottomarea"; + target: PART_VIEWER_SLIDER; transition: LINEAR TRANSITION_TIME; after: SIG_SHOWED_BAR; } diff --git a/res/edc/widgets/button.edc b/res/edc/widgets/button.edc index 98bff76..27bbf34 100644 --- a/res/edc/widgets/button.edc +++ b/res/edc/widgets/button.edc @@ -33,7 +33,7 @@ group { description { state: "focused" 0.0; inherit: "default" 0.0; - color: COLOR_BTN_FOCUS; + color: COLOR_ITEM_FOCUS; } description { state: "selected" 0.0; @@ -97,7 +97,7 @@ group { description { state: "selected" 0.0; inherit: "default" 0.0; - color: COLOR_BTN_SELECTED; + color: COLOR_ITEM_SELECTED; } } } @@ -142,7 +142,7 @@ group { description { state: "focused" 0.0; inherit: "default" 0.0; - color: COLOR_BTN_FOCUS; + color: COLOR_ITEM_FOCUS; } } part { @@ -191,7 +191,7 @@ group { } description { state: "selected" 0.0; - color: COLOR_BTN_FOCUS; + color: COLOR_ITEM_FOCUS; } } part { @@ -441,7 +441,7 @@ group { } description { state: "selected_pause" 0.0; - color: COLOR_BTN_FOCUS; + color: COLOR_ITEM_FOCUS; } } part { diff --git a/res/edc/widgets/slider.edc b/res/edc/widgets/slider.edc new file mode 100644 index 0000000..2e0e34c --- /dev/null +++ b/res/edc/widgets/slider.edc @@ -0,0 +1,225 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +group { + name: "elm/slider/horizontal/viewer_progress"; + data.item: "focus_highlight" "on"; + parts { + part { + name: "bg"; + type: RECT; + description { + state: "default" 0.0; + min: 0 4; + fixed: 0 1; + color: 0 0 0 0; + } + } + part { + name: "base"; + scale: 1; + type: RECT; + description { + state: "default" 0.0; + rel1 { + to: "bg"; + relative: 0.0 1.0; + } + rel2 { + to: "bg"; + relative: 1.0 1.0; + } + min: 0 4; + fixed: 0 1; + align: 0.0 1.0; + color: 255 255 255 255; + } + } + part { + name: "glow"; + mouse_events: 0; + scale: 1; + type: RECT; + description { + state: "default" 0.0; + rel1.to: "base"; + rel2 { + relative: 0.5 1.0; + to_x: "button"; + to_y: "base"; + } + min: 0 4; + max: 99999 4; + fixed: 0 1; + align: 0.0 1.0; + color: COLOR_ITEM_SELECTED; + } + description { + state: "focused" 0.0; + inherit: "default" 0.0; + color: COLOR_ITEM_FOCUS; + } + description { + state: "disabled" 0.0; + inherit: "default" 0.0; + color: COLOR_ITEM_FOCUS_0; + } + } + part { + name: "pad.align"; + type: SPACER; + mouse_events: 0; + description { + state: "default" 0.0; + fixed: 1 1; + rel1.to: "elm.dragable.slider"; + rel2.to: "elm.dragable.slider"; + align: 0.0 1.0; + min: 0 0; + max: 0 0; + } + } + part { + name: "clip"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 255 255 255 0; + min: 0 0; + max: 0 0; + fixed: 1 1; + rel1 { + to: "elm.dragable.slider"; + to_y: "bg"; + } + rel2 { + to: "elm.dragable.slider"; + to_y: "bg"; + } + visible: 0; + } + } + part { + name: "button"; + type: GROUP; + mouse_events: 1; + source: "elm/slider/horizontal/progress_indicator/default"; + description { + state: "default" 0.0; + fixed: 1 1; + rel1 { + to: "elm.dragable.slider"; + to_y: "bg"; + } + rel2 { + to: "elm.dragable.slider"; + to_y: "bg"; + } + align: 0.0 0.5; + } + description { + state: "hidden" 0.0; + inherit: "default" 0.0; + visible: 0; + } + } + part { + name: "elm.swallow.bar"; + type: SWALLOW; + repeat_events: 1; + description { + state: "default" 0.0; + rel1.to_y: "bg"; + rel2.to_y: "bg"; + fixed: 1 1; + min: 0 0; + } + } + part { + name: "elm.dragable.slider"; + type: RECT; + mouse_events: 0; + scale: 1; + dragable.x: 1 1 0; + dragable.y: 0 0 0; + dragable.confine: "bg"; + description { + state: "default" 0.0; + min: 1 4; + max: 1 4; + rel1 { + to_x: "bg"; + relative: 0 0.5; + } + rel2 { + to_x: "bg"; + relative: 1 0.5; + } + color: 0 0 0 0; + fixed: 1 1; + align: 0.0 1.0; + } + } + part { + name: "slideevent"; + type: RECT; + mouse_events: 0; + scale: 1; + dragable.events: "elm.dragable.slider"; + description { + state: "default" 0.0; + fixed: 1 1; + min: 1 4; + max: 1 4; + rel1.to: "elm.dragable.slider"; + rel2.to: "elm.dragable.slider"; + color: 0 0 0 0; + } + } + } +} + +group { + name: "elm/slider/horizontal/progress_indicator/default"; + alias: "elm/slider/horizontal/popup/default"; + parts { + part { + name: "knob_fill"; + repeat_events: 1; + scale: 1; + description { + state: "default" 0.0; + min: 1 4; + align: 0.5 0.5; + fixed: 1 1; + visible: 0; + } + } + part { + name: "knob"; + repeat_events: 1; + scale: 1; + description { + state: "default" 0.0; + min: 1 4; + fixed: 1 1; + align: 0.0 1.0; + visible: 0; + } + } + } +} diff --git a/src/util/progressbar.c b/src/util/progressbar.c new file mode 100644 index 0000000..853b507 --- /dev/null +++ b/src/util/progressbar.c @@ -0,0 +1,258 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include + +#include "define.h" +#include "util/progressbar.h" +#include "util/util.h" + +#define SLIDER_DEFAULT 0.05 +#define SLIDER_STEP 0.03 + +#define PROGRESSBAR_INTERVAL 0.1 + +struct progressbar { + Evas_Object *base; + Evas_Object *slider; + Ecore_Timer *timer; + + struct progressbar_ops *ops; + void *ops_data; + + char *part_slider; + char *part_total; + char *part_progress; + char *str_separator; +}; + +static void _update_progress_info(struct progressbar *m, int position) +{ + char progress[32] = {0,}; + + util_time_string(progress, sizeof(progress), position); + elm_object_part_text_set(m->base, m->part_progress, progress); +} + +static void _update_time_info(struct progressbar *m, int position, int duration) +{ + char str[32] = {0,}; + char total[32] = {0,}; + + util_time_string(str, sizeof(str), duration); + snprintf(total, sizeof(total), "%s%s", m->str_separator, str); + + elm_object_part_text_set(m->base, m->part_total, total); + + _update_progress_info(m, position); +} + +static Eina_Bool _timer_cb(void *data) +{ + struct progressbar *m; + int position; + + if (!data) + return ECORE_CALLBACK_CANCEL; + + m = data; + + position = m->ops->get_value(m->ops_data); + + elm_slider_value_set(m->slider, position); + _update_progress_info(m, position); + + return ECORE_CALLBACK_RENEW; +} + +void progressbar_start(struct progressbar *m) +{ + if (!m) { + _ERR("invalid parameter"); + return; + } + + if (m->timer) + ecore_timer_reset(m->timer); + else + m->timer = ecore_timer_add(PROGRESSBAR_INTERVAL, _timer_cb, m); +} + +void progressbar_stop(struct progressbar *m) +{ + if (!m) { + _ERR("invalid parameter"); + return; + } + + ecore_timer_del(m->timer); + m->timer = NULL; +} + +void progressbar_pause(struct progressbar *m) +{ + if (!m) { + _ERR("invalid parameter"); + return; + } + + if (m->timer) + ecore_timer_freeze(m->timer); +} + +void progressbar_resume(struct progressbar *m) +{ + if (!m) { + _ERR("invalid parameter"); + return; + } + + if (m->timer) + ecore_timer_thaw(m->timer); +} + +void progressbar_show(struct progressbar *m) +{ + if (!m) { + _ERR("invalid parameter"); + return; + } + + if (!m->part_slider || !m->slider) { + _ERR("slider did not initialize"); + return; + } + + evas_object_show(m->slider); + elm_object_part_content_set(m->base, m->part_slider, m->slider); +} + +void progressbar_hide(struct progressbar *m) +{ + if (!m) { + _ERR("invalid parameter"); + return; + } + + if (!m->part_slider) { + _ERR("slider did not initialize"); + return; + } + + evas_object_hide(m->slider); + elm_object_part_content_unset(m->base, m->part_slider); +} + +void progressbar_reset(struct progressbar *m, int position, int duration) +{ + if (!m) { + _ERR("invalid parameter"); + return; + } + + progressbar_stop(m); + + elm_slider_value_set(m->slider, position); + elm_slider_min_max_set(m->slider, 0, duration); + elm_slider_step_set(m->slider, SLIDER_STEP); + + _update_time_info(m, position, duration); +} + +void progressbar_set_ops(struct progressbar *m, + struct progressbar_ops *ops, void *data) +{ + if (!m || !ops) { + _ERR("invalid parameter"); + return; + } + + m->ops = ops; + m->ops_data = data; +} + +void progressbar_set_parts(struct progressbar *m, const char *slider, + const char *total, const char *progress, const char *separator) +{ + if (!m) { + _ERR("invalid parameter"); + return; + } + + if (slider) + m->part_slider = strdup(slider); + + if (total) + m->part_total = strdup(total); + + if (progress) + m->part_progress = strdup(progress); + + if (separator) + m->str_separator = strdup(separator); +} + +struct progressbar *progressbar_create(Evas_Object *base) +{ + struct progressbar *m; + Evas_Object *obj; + + m = calloc(1, sizeof(*m)); + if (!m) { + _ERR("failed to allocate"); + return NULL; + } + + obj = elm_slider_add(base); + if (!obj) { + _ERR("failed to adding slider"); + free(m); + return NULL; + } + + elm_slider_indicator_show_set(obj, EINA_FALSE); + elm_slider_indicator_show_on_focus_set(obj, EINA_FALSE); + elm_object_style_set(obj, STYLE_VIEWER_PROGRESS); + elm_slider_horizontal_set(obj, EINA_TRUE); + elm_slider_step_set(obj, SLIDER_DEFAULT); + + /* FIXME: focus disabled */ + elm_object_focus_allow_set(obj, EINA_FALSE); + + m->base = base; + m->slider = obj; + + return m; +} + +void progressbar_destroy(struct progressbar *m) +{ + if (!m) { + _ERR("invalid parameter"); + return; + } + + progressbar_stop(m); + + free(m->part_slider); + free(m->part_total); + free(m->part_progress); + free(m->str_separator); + + free(m); +} diff --git a/src/util/util.c b/src/util/util.c index df8abad..5289fe4 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -87,3 +87,21 @@ Evas_Object *util_add_scroller(Evas_Object *base) return scr; } + +void util_time_string(char *str, int size, unsigned int ms) +{ + int sec; + + sec = ms / 1000; + + snprintf(str, size, "%02d:%02d:%02d", + sec / 3600, (sec % 3600) / 60, sec % 60); +} + +void util_up_string(char *str) +{ + while (*str) { + *str = toupper(*str); + str++; + } +} diff --git a/src/view/viewer.c b/src/view/viewer.c index 898aa07..8ee87bb 100644 --- a/src/view/viewer.c +++ b/src/view/viewer.c @@ -27,6 +27,7 @@ #include "util/controller.h" #include "util/timeout_handler.h" #include "util/playermgr.h" +#include "util/progressbar.h" #include "util/util.h" #define STYLE_VIEWER_BTN "viewer_btn" @@ -34,8 +35,7 @@ #define PLAY_BTN_LOC 2 #define VIEWER_TIMEOUT 3.0 -#define VIEWER_INTERVAL 0.1 - +#define VIEWER_SEPARATOR "/ " #define VIDEO_COPYRIGHT "Unknown" enum { @@ -67,12 +67,12 @@ struct _priv { Evas_Object *photo; Evas_Object *photo_pre; Evas_Object *favorite; - Evas_Object *timer; struct _viewer viewer; struct _playlist playlist; struct timeout_handler *timeout; struct playermgr *player; + struct progressbar *progress; bool bar_show; }; @@ -238,24 +238,6 @@ static inline bool _check_movie_type(app_media_info *mi) return strcmp(mi->video->copyright, VIDEO_COPYRIGHT); } -static void _time_string(char *str, int size, unsigned int ms) -{ - int sec; - - sec = ms / 1000; - - snprintf(str, size, "%02d:%02d:%02d", - sec / 3600, (sec % 3600) / 60, sec % 60); -} - -static void _up_string(char *str) -{ - while (*str) { - *str = toupper(*str); - str++; - } -} - static void _set_bg_color(struct _priv *priv, int r, int g, int b, int a) { Evas_Object *bg; @@ -408,7 +390,7 @@ static void _draw_title_bar(struct _priv *priv, int id, app_media_info *mi) strftime(date, sizeof(date), "%d %b", &tm); strftime(day, sizeof(day), "%a", &tm); - _up_string(day); + util_up_string(day); snprintf(buf, sizeof(buf), "%s, %s", day, date); @@ -420,28 +402,19 @@ static void _draw_title_bar(struct _priv *priv, int id, app_media_info *mi) } } -static void _draw_time_info(struct _priv *priv, int id, app_media_info *mi) +static void _draw_progressbar(struct _priv *priv, int id, app_media_info *mi) { - char progress[32] = {0,}; - char duration[32] = {0,}; - char total[32] = {0,}; + if (id == VIEWER_PHOTO) { + elm_object_part_text_set(priv->base, PART_VIEWER_PROGRESS, ""); + elm_object_part_text_set(priv->base, PART_VIEWER_TOTAL, ""); + progressbar_hide(priv->progress); - if (id != VIEWER_PHOTO) { - _time_string(progress, sizeof(progress), mi->video->position); - _time_string(duration, sizeof(duration), mi->video->duration); - snprintf(total, sizeof(total), "/ %s", duration); + return; } - elm_object_part_text_set(priv->base, PART_VIEWER_PROGRESS, progress); - elm_object_part_text_set(priv->base, PART_VIEWER_TOTAL, total); -} - -static void _draw_progress_info(struct _priv *priv, int ms) -{ - char progress[32] = {0,}; - - _time_string(progress, sizeof(progress), ms); - elm_object_part_text_set(priv->base, PART_VIEWER_PROGRESS, progress); + progressbar_reset(priv->progress, + mi->video->position, mi->video->duration); + progressbar_show(priv->progress); } static void _draw_favorite_icon(struct _priv *priv, int id, app_media_info *mi) @@ -528,7 +501,7 @@ static bool _viewer_show(struct _priv *priv, int foc) _draw_contents(priv, id, mi); _draw_title_bar(priv, id, mi); - _draw_time_info(priv, id, mi); + _draw_progressbar(priv, id, mi); _draw_favorite_icon(priv, id, mi); return true; @@ -577,6 +550,8 @@ static void _viewer_delete(struct _priv *priv) for (i = 0; i < VIEWER_MAX; i++) controller_destroy(priv->viewer.ctl[i]); + + progressbar_destroy(priv->progress); } static bool _viewer_prev(struct _priv *priv) @@ -655,64 +630,21 @@ static void _event_cb(void *data, int type, void *ei) _show_bar(data); } -static bool _ui_init(struct _priv *priv) -{ - Evas_Object *obj; - bool r; - int i; - - for (i = 0; i < VIEWER_MAX; i++) { - r = _viewer_add(priv, i); - if (!r) - goto err; - } - - obj = elm_image_add(priv->base); - if (!obj) { - _ERR("failed to adding image"); - goto err; - } - - elm_image_file_set(obj, IMAGE_VIEWER_FAVORITE, NULL); - priv->favorite = obj; - - priv->timeout = timeout_handler_init(VIEWER_TIMEOUT, - _timeout_cb, priv, - _event_cb, priv); - - priv->bar_show = true; - - return true; - -err: - _viewer_delete(priv); - return false; -} - -static Eina_Bool _timer_cb(void *data) +static int _player_get_position(void *data) { struct _priv *priv; - int ms; if (!data) - return ECORE_CALLBACK_CANCEL; + return 0; priv = data; - ms = playermgr_get_position(priv->player); - - _draw_progress_info(priv, ms); - - return ECORE_CALLBACK_RENEW; + return playermgr_get_position(priv->player); } -static void _timer_reset(struct _priv *priv) -{ - if (priv->timer) - ecore_timer_reset(priv->timer); - else - priv->timer = ecore_timer_add(VIEWER_INTERVAL, _timer_cb, priv); -} +struct progressbar_ops _progressbar_ops = { + .get_value = _player_get_position, +}; static void _player_play(struct _priv *priv) { @@ -723,15 +655,11 @@ static void _player_play(struct _priv *priv) switch (state) { case PLAYER_STATE_PAUSED: - if (priv->timer) - ecore_timer_thaw(priv->timer); - + progressbar_resume(priv->progress); playermgr_resume(priv->player); break; case PLAYER_STATE_PLAYING: - if (priv->timer) - ecore_timer_freeze(priv->timer); - + progressbar_pause(priv->progress); playermgr_pause(priv->player); break; case PLAYER_STATE_IDLE: @@ -743,8 +671,8 @@ static void _player_play(struct _priv *priv) } _remove_thumbnail(priv); - _timer_reset(priv); + progressbar_start(priv->progress); playermgr_play(priv->player, mi->file_path); break; @@ -758,9 +686,7 @@ static void _player_stop(struct _priv *priv) { struct controller *ctl; - ecore_timer_del(priv->timer); - priv->timer = NULL; - + progressbar_stop(priv->progress); playermgr_stop(priv->player); ctl = priv->viewer.ctl[priv->viewer.cur]; @@ -776,30 +702,23 @@ static void _player_complete_cb(void *data) priv = data; - ecore_timer_del(priv->timer); - priv->timer = NULL; + progressbar_stop(priv->progress); } static void _player_set_position_cb(void *data) { struct _priv *priv; struct controller *ctl; - int ms; if (!data) return; priv = data; - ms = playermgr_get_position(priv->player); - _draw_progress_info(priv, ms); - /* FIXME: what will you do here? */ + progressbar_pause(priv->progress); playermgr_pause(priv->player); - if (priv->timer) - ecore_timer_freeze(priv->timer); - ctl = priv->viewer.ctl[priv->viewer.cur]; ctl->ops->signal(ctl->handle, PLAY_BTN_LOC, SIG_SET_PLAY); } @@ -861,6 +780,53 @@ static void _callback_video(void *data, const char *ev) } } +static bool _ui_init(struct _priv *priv) +{ + Evas_Object *obj; + struct progressbar *prog; + bool r; + int i; + + for (i = 0; i < VIEWER_MAX; i++) { + r = _viewer_add(priv, i); + if (!r) + goto err; + } + + prog = progressbar_create(priv->base); + if (!prog) { + _ERR("failed to adding progressbar"); + goto err; + } + + progressbar_set_parts(prog, PART_VIEWER_SLIDER, PART_VIEWER_TOTAL, + PART_VIEWER_PROGRESS, VIEWER_SEPARATOR); + progressbar_set_ops(prog, &_progressbar_ops, priv); + + priv->progress = prog; + + obj = elm_image_add(priv->base); + if (!obj) { + _ERR("failed to adding image"); + goto err; + } + + elm_image_file_set(obj, IMAGE_VIEWER_FAVORITE, NULL); + priv->favorite = obj; + + priv->timeout = timeout_handler_init(VIEWER_TIMEOUT, + _timeout_cb, priv, + _event_cb, priv); + + priv->bar_show = true; + + return true; + +err: + _viewer_delete(priv); + return false; +} + static Evas_Object *_create(Evas_Object *win, void *data) { struct _priv *priv; @@ -982,9 +948,6 @@ static void _destroy(void *view_data) timeout_handler_fini(priv->timeout); - ecore_timer_del(priv->timer); - priv->timer = NULL; - playermgr_destroy(priv->player); evas_object_del(priv->base); -- 2.7.4 From 1eb953610bc1889fd7d698cba34bcec804dfef88 Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Tue, 7 Jul 2015 16:04:24 +0900 Subject: [PATCH 04/16] add ic_thumbnail_play image file Change-Id: Ibcce38f2ef6bb42fcb092a288821f368c8bd563f Signed-off-by: Jehun Lim --- res/images/ic_thumbnail_play.png | Bin 0 -> 5710 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 res/images/ic_thumbnail_play.png diff --git a/res/images/ic_thumbnail_play.png b/res/images/ic_thumbnail_play.png new file mode 100644 index 0000000000000000000000000000000000000000..48030849023250dc8ed1a5ec41159f1421ecde6e GIT binary patch literal 5710 zcmbVQcQ~7E+m9`F?bS-PHCiM_jM%eisTf7gAP6EMw%WC7l&V#uwxaeZHA-!@DT<<~ zqE?M+Ykha0_j%s$`{O;{Kfe1&a*v$rIjd!QgbSQl3U!bhI>FS!Wd`p;u1FXS&04`+Gae;H+> zqX$vNxuYR)5piK#n5Za3Qc^@z0xl^jDg+UOiHbpCz(-P8R008)M2Ja2{yumCZSHpV z2z@n;zjXn3^1O~79(V*4>h0|<;w>(Mb9aD>%E-w4ks&4~3{VIYd|f?IKEkeqYyU`4 zLlbP>F?bIQ&K2@UBFYBm=^@VxSo*IeVDUOS{}${@_}fu{%b-3eJXBN!2E}6ktm`jo zf`>l(f6e%h)C5CcJQ}KxCg42XZGru;zxEF^;Jg2>=no-a4dR|V2G|soiyF?>6N`5B z&{C7<1^yAS!`LCzq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=wA6LgDpagP{|BkSVrl>Y literal 0 HcmV?d00001 -- 2.7.4 From 1814c4e8d86c1245b452aa30bf14b06e035ebb16 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Wed, 8 Jul 2015 09:54:13 +0900 Subject: [PATCH 05/16] use content time instead of modified time when sorting list Change-Id: Ia41c816932c184250e03e541425cc6ad42bdd06f Signed-off-by: Minkyu Kang --- include/data/mediadata.h | 1 + src/data/mediadata.c | 72 ++++++++++++++++++++++++++++++++++-------------- src/view/viewer.c | 7 ++--- 3 files changed, 54 insertions(+), 26 deletions(-) diff --git a/include/data/mediadata.h b/include/data/mediadata.h index 557c85f..45fff25 100644 --- a/include/data/mediadata.h +++ b/include/data/mediadata.h @@ -43,6 +43,7 @@ enum list_type { struct group_info { char *name; Eina_List *list; + void *data; }; struct mediadata *mediadata_create(const char *media_type, diff --git a/src/data/mediadata.c b/src/data/mediadata.c index 16504bb..554c72f 100644 --- a/src/data/mediadata.c +++ b/src/data/mediadata.c @@ -22,6 +22,7 @@ #include "data/mediadata.h" typedef int (*media_compare)(struct group_info *gi, app_media_info *info); +typedef void *(*media_compare_data_get)(app_media_info *info); typedef char *(*group_name_get)(app_media_info *info); static int _compare_cb_date(const void *, const void *); @@ -29,8 +30,10 @@ static int _compare_cb_name(const void *, const void *); static int _compare_title(struct group_info *, app_media_info *); static char *_get_title(app_media_info *); -static int _compare_modified_time(struct group_info *, app_media_info *); -static char *_get_modified_time(app_media_info *); +static void *_get_data_title(app_media_info *info); +static int _compare_time(struct group_info *, app_media_info *); +static char *_get_time(app_media_info *); +static void *_get_data_time(app_media_info *info); enum _filter_type { E_FILTER_FOLDER = 0, @@ -59,6 +62,7 @@ struct _sort_info { struct _list_info { media_compare media_cmp; + media_compare_data_get data_get; group_name_get name_get; }; @@ -79,10 +83,12 @@ static struct _list_info g_list_info[E_LIST_MAX] = { [E_LIST_NAME] = { .media_cmp = _compare_title, .name_get = _get_title, + .data_get = _get_data_title, }, [E_LIST_DATE] = { - .media_cmp = _compare_modified_time, - .name_get = _get_modified_time, + .media_cmp = _compare_time, + .name_get = _get_time, + .data_get = _get_data_time, } }; @@ -121,23 +127,29 @@ static bool _create_filter(struct _data *data, filter_h *filter, int type) return true; } -static char *_get_date_string(time_t time) +static char *_get_date_string(struct tm *tm) { - struct tm tm; char buf[32]; - localtime_r(&time, &tm); - strftime(buf, sizeof(buf), "%Y.%m.%d", &tm); + strftime(buf, sizeof(buf), "%Y.%m.%d", tm); return strdup(buf); } static int _compare_title(struct group_info *gi, app_media_info *info) { - if (!gi || !gi->name || !info->title) + if (!gi || !gi->data || !info->title) return -1; - return strncasecmp(gi->name, info->title, 1); + return strncasecmp(gi->data, info->title, 1); +} + +static void *_get_data_title(app_media_info *info) +{ + if (!info->title) + return NULL; + + return strdup(info->title); } static char *_get_title(app_media_info *info) @@ -148,32 +160,45 @@ static char *_get_title(app_media_info *info) return strndup(info->title, 1); } -static int _compare_modified_time(struct group_info *gi, app_media_info *info) +static int _compare_time(struct group_info *gi, app_media_info *info) { - char *date; - int r; + struct tm *tm; - if (!gi || !gi->name) + if (!gi || !gi->data) return -1; - date = _get_date_string(info->modified_time); + tm = gi->data; - r = strcasecmp(gi->name, date); + if (tm->tm_year == info->content_time->tm_year && + tm->tm_yday == info->content_time->tm_yday) + return 0; - free(date); + return 1; +} - return r; +static void *_get_data_time(app_media_info *info) +{ + struct tm *tm; + + tm = calloc(1, sizeof(*tm)); + if (!tm) + return NULL; + + memcpy(tm, info->content_time, sizeof(*tm)); + + return tm; } -static char *_get_modified_time(app_media_info *info) +static char *_get_time(app_media_info *info) { - return _get_date_string(info->modified_time); + return _get_date_string(info->content_time); } static int _compare_cb_date(const void *data1, const void *data2) { app_media *am1, *am2; app_media_info *info1, *info2; + time_t tm1, tm2; am1 = (app_media *)data1; am2 = (app_media *)data2; @@ -184,7 +209,10 @@ static int _compare_cb_date(const void *data1, const void *data2) if (!info1 || !info2) return -1; - if (info1->modified_time < info2->modified_time) + tm1 = mktime(info1->content_time); + tm2 = mktime(info2->content_time); + + if (tm1 < tm2) return 1; return -1; @@ -429,6 +457,7 @@ Eina_List *mediadata_get_list(struct mediadata *md, int list_type) } gi->name = g_list_info[list_type].name_get(info); + gi->data = g_list_info[list_type].data_get(info); list = eina_list_append(list, gi); } @@ -446,6 +475,7 @@ void mediadata_free_list(Eina_List *list) EINA_LIST_FOREACH(list, l, gi) { free(gi->name); + free(gi->data); eina_list_free(gi->list); free(gi); diff --git a/src/view/viewer.c b/src/view/viewer.c index 8ee87bb..79f2e51 100644 --- a/src/view/viewer.c +++ b/src/view/viewer.c @@ -380,16 +380,13 @@ static void _draw_title_bar(struct _priv *priv, int id, app_media_info *mi) char buf[32] = {0,}; char day[32] = {0,}; char date[32] = {0,}; - struct tm tm; if (id == VIEWER_MOVIE) { elm_object_part_text_set(priv->base, PART_VIEWER_TITLE, mi->title); } else { - localtime_r(&mi->modified_time, &tm); - - strftime(date, sizeof(date), "%d %b", &tm); - strftime(day, sizeof(day), "%a", &tm); + strftime(date, sizeof(date), "%d %b", mi->content_time); + strftime(day, sizeof(day), "%a", mi->content_time); util_up_string(day); snprintf(buf, sizeof(buf), "%s, %s", day, date); -- 2.7.4 From 34f2e7a8a4405c32624ca3c571004fd839e95fab Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Wed, 8 Jul 2015 16:11:16 +0900 Subject: [PATCH 06/16] listmgr: add callback functions for grid item : mouse move, realized, unrealized, selected Change-Id: If07433cafb4c94417350c6ec3bf355d28c38e6d1 Signed-off-by: Jehun Lim --- include/data/mediadata.h | 2 ++ include/define.h | 4 +++ include/util/listmgr.h | 3 +++ include/util/util.h | 2 ++ include/view.h | 12 +++++++++ res/edc/widgets/gengrid.edc | 44 ++++++++++++++++++++++++++++-- src/data/mediadata.c | 10 +++++++ src/layout/gallery.c | 42 +++++++++++++++++++++++++++-- src/layout/movie.c | 42 +++++++++++++++++++++++++++-- src/util/listmgr.c | 65 +++++++++++++++++++++++++++++++++++++++++++++ src/util/util.c | 17 ++++++++++++ 11 files changed, 237 insertions(+), 6 deletions(-) diff --git a/include/data/mediadata.h b/include/data/mediadata.h index 45fff25..c9f15c8 100644 --- a/include/data/mediadata.h +++ b/include/data/mediadata.h @@ -50,6 +50,8 @@ struct mediadata *mediadata_create(const char *media_type, int source_type, int sort_type); void mediadata_destroy(struct mediadata *md); +Eina_List *mediadata_get_medialist(struct mediadata *md); + Eina_List *mediadata_get_list(struct mediadata *md, int list_type); void mediadata_free_list(Eina_List *list); diff --git a/include/define.h b/include/define.h index 1b4651b..905eaea 100644 --- a/include/define.h +++ b/include/define.h @@ -52,4 +52,8 @@ #define PART_ELM_SWALLOW_THUMBNAIL "elm.swallow.thumbnail" #define PART_ELM_SWALLOW_VIDEO "elm.swallow.video" +/* signal */ +#define SIG_ITEM_SELECTED "item_selected" +#define SIG_SOURCE_EDC "edc" + #endif /* __AIR_MEDIAHUB_DEFINE_H__ */ diff --git a/include/util/listmgr.h b/include/util/listmgr.h index 4889e3d..ad0a8ce 100644 --- a/include/util/listmgr.h +++ b/include/util/listmgr.h @@ -27,6 +27,9 @@ struct listmgr_data { int box_padding; struct grid_class *gclass; + + void (*grid_selected_cb)(void *data, Elm_Object_Item *it); + void *cb_data; }; struct listmgr *listmgr_create(Evas_Object *base, void *data); diff --git a/include/util/util.h b/include/util/util.h index aebcb74..ee354f7 100644 --- a/include/util/util.h +++ b/include/util/util.h @@ -26,4 +26,6 @@ Evas_Object *util_add_scroller(Evas_Object *base); void util_time_string(char *str, int size, unsigned int ms); void util_up_string(char *str); +int util_get_media_index(Eina_List *list, void *info); + #endif /* __AIR_MEDIAHUB_UTIL_H__ */ diff --git a/include/view.h b/include/view.h index aabb6ae..afa40e8 100644 --- a/include/view.h +++ b/include/view.h @@ -23,4 +23,16 @@ view_class *view_base_get_vclass(void); /* viewer */ view_class *view_viewer_get_vclass(void); +/* view data */ +struct view_data { + Eina_List *list; + int index; +}; + +/* view update type */ +enum update_type { + UPDATE_CONTENT = 0, + UPDATE_FOCUS +}; + #endif /* __AIR_MEDIAHUB_VIEW_H__ */ diff --git a/res/edc/widgets/gengrid.edc b/res/edc/widgets/gengrid.edc index 624f553..51b9e77 100644 --- a/res/edc/widgets/gengrid.edc +++ b/res/edc/widgets/gengrid.edc @@ -46,7 +46,7 @@ group { visible: 0; } description { - state: "clicked" 0.0; + state: "selected" 0.0; inherit: "default" 0.0; perspective.zplane: -100; } @@ -388,6 +388,26 @@ group { target: "part_focus3"; target: "elm.bg.text"; } + program { + name: "selected"; + signal: "elm,state,selected"; + source: "elm"; + action: STATE_SET "selected" 0.0; + target: "map"; + transition: DECELERATE 0.2; + after: "after_selected"; + } + program { + name: "after_selected"; + action: STATE_SET "default" 0.0; + target: "map"; + transition: DECELERATE 0.2; + after: "item_selected"; + } + program { + name: "item_selected"; + action: SIGNAL_EMIT SIG_ITEM_SELECTED SIG_SOURCE_EDC; + } } } @@ -423,7 +443,7 @@ group { visible: 0; } description { - state: "clicked" 0.0; + state: "selected" 0.0; inherit: "default" 0.0; perspective.zplane: -100; } @@ -732,5 +752,25 @@ group { target: "part_focus3"; target: "part_focus4"; } + program { + name: "selected"; + signal: "elm,state,selected"; + source: "elm"; + action: STATE_SET "selected" 0.0; + target: "map"; + transition: DECELERATE 0.2; + after: "after_selected"; + } + program { + name: "after_selected"; + action: STATE_SET "default" 0.0; + target: "map"; + transition: DECELERATE 0.2; + after: "item_selected"; + } + program { + name: "item_selected"; + action: SIGNAL_EMIT SIG_ITEM_SELECTED SIG_SOURCE_EDC; + } } } diff --git a/src/data/mediadata.c b/src/data/mediadata.c index 554c72f..ffb85ab 100644 --- a/src/data/mediadata.c +++ b/src/data/mediadata.c @@ -421,6 +421,16 @@ void mediadata_destroy(struct mediadata *md) eina_list_free(md->media_list); } +Eina_List *mediadata_get_medialist(struct mediadata *md) +{ + if (!md) { + _ERR("failed to get mediadata"); + return NULL; + } + + return md->media_list; +} + Eina_List *mediadata_get_list(struct mediadata *md, int list_type) { Eina_List *list, *l; diff --git a/src/layout/gallery.c b/src/layout/gallery.c index 9dd4c73..2c6f7fe 100644 --- a/src/layout/gallery.c +++ b/src/layout/gallery.c @@ -20,8 +20,10 @@ #include #include #include +#include #include "define.h" +#include "view.h" #include "data/mediadata.h" #include "util/listmgr.h" #include "util/util.h" @@ -95,7 +97,39 @@ static struct grid_class _gclass = { .content_get = _grid_content_get }; -static struct listmgr_data *_create_listmgr_data(void) +static void _grid_selected_cb(void *data, Elm_Object_Item *it) +{ + app_media *am; + struct view_data *vdata; + struct _priv *priv; + + if (!data || !it) { + _ERR("invalid argument"); + return; + } + + priv = data; + + am = elm_object_item_data_get(it); + if (!am) { + _ERR("failed to get app media"); + return; + } + + vdata = calloc(1, sizeof(*vdata)); + if (!vdata) { + _ERR("failed to allocate view data"); + return; + } + + vdata->list = mediadata_get_medialist(priv->md); + vdata->index = util_get_media_index(vdata->list, am); + + viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT, vdata); + viewmgr_push_view(VIEW_VIEWER); +} + +static struct listmgr_data *_create_listmgr_data(struct _priv *priv) { struct listmgr_data *data; @@ -109,8 +143,12 @@ static struct listmgr_data *_create_listmgr_data(void) data->grid_item_y = GRID_ITEM_Y; data->grid_num_item = GRID_NUM_ITEM; data->box_padding = BOX_PADDING; + data->gclass = &_gclass; + data->grid_selected_cb = _grid_selected_cb; + data->cb_data = priv; + return data; } @@ -170,7 +208,7 @@ static bool _create(layoutmgr *lmgr, void *data) goto err2; } - ldata = _create_listmgr_data(); + ldata = _create_listmgr_data(priv); if (!ldata) { _ERR("failed to create listmgr data"); goto err2; diff --git a/src/layout/movie.c b/src/layout/movie.c index 326de60..f0d1478 100644 --- a/src/layout/movie.c +++ b/src/layout/movie.c @@ -20,8 +20,10 @@ #include #include #include +#include #include "define.h" +#include "view.h" #include "data/mediadata.h" #include "util/listmgr.h" #include "util/util.h" @@ -112,7 +114,39 @@ static struct grid_class _gclass = { .content_get = _grid_content_get }; -static struct listmgr_data *_create_listmgr_data(void) +static void _grid_selected_cb(void *data, Elm_Object_Item *it) +{ + app_media *am; + struct view_data *vdata; + struct _priv *priv; + + if (!data || !it) { + _ERR("invalid argument"); + return; + } + + priv = data; + + am = elm_object_item_data_get(it); + if (!am) { + _ERR("failed to get app media"); + return; + } + + vdata = calloc(1, sizeof(*vdata)); + if (!vdata) { + _ERR("failed to allocate view data"); + return; + } + + vdata->list = mediadata_get_medialist(priv->md); + vdata->index = util_get_media_index(vdata->list, am); + + viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT, vdata); + viewmgr_push_view(VIEW_VIEWER); +} + +static struct listmgr_data *_create_listmgr_data(struct _priv *priv) { struct listmgr_data *data; @@ -126,8 +160,12 @@ static struct listmgr_data *_create_listmgr_data(void) data->grid_item_y = GRID_ITEM_Y; data->grid_num_item = GRID_NUM_ITEM; data->box_padding = BOX_PADDING; + data->gclass = &_gclass; + data->grid_selected_cb = _grid_selected_cb; + data->cb_data = priv; + return data; } @@ -187,7 +225,7 @@ static bool _create(layoutmgr *lmgr, void *data) goto err2; } - ldata = _create_listmgr_data(); + ldata = _create_listmgr_data(priv); if (!ldata) { _ERR("failed to create listmgr data"); goto err2; diff --git a/src/util/listmgr.c b/src/util/listmgr.c index b5ca603..a340e1f 100644 --- a/src/util/listmgr.c +++ b/src/util/listmgr.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "define.h" #include "data/mediadata.h" @@ -31,6 +32,68 @@ struct listmgr { struct listmgr_data *data; }; +void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj, + Evas_Event_Mouse_Move *ev) +{ + Elm_Object_Item *it; + + if (!obj || !ev) + return; + + it = elm_gengrid_at_xy_item_get(obj, ev->cur.canvas.x, + ev->cur.canvas.y, NULL, NULL); + + if (!it) + return; + + if (elm_object_item_focus_get(it)) + return; + + elm_object_item_focus_set(it, EINA_TRUE); +} + +void _grid_selected_cb(void *data, Elm_Object_Item *it, + const char *emission, const char *source) +{ + struct listmgr *lmgr; + struct listmgr_data *ldata; + + if (!data || !it) + return; + + lmgr = data; + ldata = lmgr->data; + + if (ldata->grid_selected_cb) + ldata->grid_selected_cb(ldata->cb_data, it); +} + +void _grid_realized_cb(int id, void *data, Evas_Object *obj, + Elm_Object_Item *it) +{ + if (!data || !it) + return; + + elm_object_item_signal_callback_add(it, SIG_ITEM_SELECTED, + SIG_SOURCE_EDC, _grid_selected_cb, data); +} + +void _grid_unrealized_cb(int id, void *data, Evas_Object *obj, + Elm_Object_Item *it) +{ + if (!it) + return; + + elm_object_item_signal_callback_del(it, SIG_ITEM_SELECTED, + SIG_SOURCE_EDC, _grid_selected_cb); +} + +static input_handler grid_handler = { + .mouse_move = _mouse_move_cb, + .realized = _grid_realized_cb, + .unrealized = _grid_unrealized_cb +}; + static int _get_grid_size(int count, int num_item) { int size; @@ -86,6 +149,8 @@ static Evas_Object *_draw_list_item(struct listmgr *lmgr, struct group_info *gi) evas_object_size_hint_min_set(grid, size * data->grid_item_x, data->grid_num_item * data->grid_item_y); + inputmgr_add_callback(grid, 0, &grid_handler, lmgr); + elm_object_part_content_set(ly, PART_ITEM_TITLE, btn); elm_object_part_content_set(ly, PART_ITEM_CONTENT, grid); diff --git a/src/util/util.c b/src/util/util.c index 20ac818..ce88147 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -124,3 +124,20 @@ void util_up_string(char *str) str++; } } + +int util_get_media_index(Eina_List *list, void *data) +{ + Eina_List *l; + int index; + void *obj; + + index = 0; + EINA_LIST_FOREACH(list, l, obj) { + if (data == obj) + break; + + index++; + } + + return index; +} -- 2.7.4 From 6d092688475ec14bf4357ae32734098a6d5bae82 Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Wed, 8 Jul 2015 16:46:52 +0900 Subject: [PATCH 07/16] gallery: add copyright condition for media list Change-Id: I4fe32eb972df44f331d255b166b21a820b1d6e84 Signed-off-by: Jehun Lim --- src/layout/gallery.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/layout/gallery.c b/src/layout/gallery.c index 2c6f7fe..939a86b 100644 --- a/src/layout/gallery.c +++ b/src/layout/gallery.c @@ -28,7 +28,8 @@ #include "util/listmgr.h" #include "util/util.h" -#define LIST_MEDIA_COND "media_type=0 OR media_type=1" +#define LIST_MEDIA_COND "(media_type=0 OR media_type=1) \ + AND copyright LIKE \"Unknown\"" #define TEXT_NOCONTENT "No Photo & Video" -- 2.7.4 From 3373ddc4e10198d6f322b258156e0c263427b5a4 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Wed, 8 Jul 2015 17:13:13 +0900 Subject: [PATCH 08/16] viewer: add update function for getting media list from base view Change-Id: I9f7aa2b87a36071e0eae410439070a3ea8dec3af Signed-off-by: Minkyu Kang --- include/view.h | 2 +- src/layout/gallery.c | 14 +++----- src/layout/movie.c | 14 +++----- src/view/viewer.c | 90 +++++++++++++++------------------------------------- 4 files changed, 34 insertions(+), 86 deletions(-) diff --git a/include/view.h b/include/view.h index afa40e8..18a07bf 100644 --- a/include/view.h +++ b/include/view.h @@ -24,7 +24,7 @@ view_class *view_base_get_vclass(void); view_class *view_viewer_get_vclass(void); /* view data */ -struct view_data { +struct view_update_data { Eina_List *list; int index; }; diff --git a/src/layout/gallery.c b/src/layout/gallery.c index 939a86b..ecac88b 100644 --- a/src/layout/gallery.c +++ b/src/layout/gallery.c @@ -101,7 +101,7 @@ static struct grid_class _gclass = { static void _grid_selected_cb(void *data, Elm_Object_Item *it) { app_media *am; - struct view_data *vdata; + struct view_update_data vdata; struct _priv *priv; if (!data || !it) { @@ -117,16 +117,10 @@ static void _grid_selected_cb(void *data, Elm_Object_Item *it) return; } - vdata = calloc(1, sizeof(*vdata)); - if (!vdata) { - _ERR("failed to allocate view data"); - return; - } - - vdata->list = mediadata_get_medialist(priv->md); - vdata->index = util_get_media_index(vdata->list, am); + vdata.list = mediadata_get_medialist(priv->md); + vdata.index = util_get_media_index(vdata.list, am); - viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT, vdata); + viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT, &vdata); viewmgr_push_view(VIEW_VIEWER); } diff --git a/src/layout/movie.c b/src/layout/movie.c index f0d1478..d127e31 100644 --- a/src/layout/movie.c +++ b/src/layout/movie.c @@ -117,7 +117,7 @@ static struct grid_class _gclass = { static void _grid_selected_cb(void *data, Elm_Object_Item *it) { app_media *am; - struct view_data *vdata; + struct view_update_data vdata; struct _priv *priv; if (!data || !it) { @@ -133,16 +133,10 @@ static void _grid_selected_cb(void *data, Elm_Object_Item *it) return; } - vdata = calloc(1, sizeof(*vdata)); - if (!vdata) { - _ERR("failed to allocate view data"); - return; - } - - vdata->list = mediadata_get_medialist(priv->md); - vdata->index = util_get_media_index(vdata->list, am); + vdata.list = mediadata_get_medialist(priv->md); + vdata.index = util_get_media_index(vdata.list, am); - viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT, vdata); + viewmgr_update_view(VIEW_VIEWER, UPDATE_CONTENT, &vdata); viewmgr_push_view(VIEW_VIEWER); } diff --git a/src/view/viewer.c b/src/view/viewer.c index 79f2e51..4a80d83 100644 --- a/src/view/viewer.c +++ b/src/view/viewer.c @@ -24,6 +24,7 @@ #include #include "define.h" +#include "view.h" #include "util/controller.h" #include "util/timeout_handler.h" #include "util/playermgr.h" @@ -173,62 +174,6 @@ static struct _viewer_info viewer_info[] = { }, }; -/* FIXME: test function */ -static bool _media(media_info_h media_h, void *dt) -{ - struct _priv *priv; - app_media *am; - - priv = dt; - - am = app_media_create(media_h); - - priv->playlist.list = eina_list_append(priv->playlist.list, am); - - return true; -} - -static void _media_test(struct _priv *priv, int mode) -{ - char *path = "/home/owner/content/Videos/Xmen-Days_of_Future_Past.mp4"; - filter_h filter; - char buf[1024]; - int r; - - r = media_filter_create(&filter); - if (r != MEDIA_CONTENT_ERROR_NONE) { - _ERR("Media Filter Creation Failed"); - return; - } - - if (mode) - snprintf(buf, sizeof(buf), "MEDIA_PATH = \"%s\"", path); - else - snprintf(buf, sizeof(buf), "MEDIA_TYPE=0 OR MEDIA_TYPE=1"); - - r = media_filter_set_condition(filter, buf, - MEDIA_CONTENT_COLLATE_DEFAULT); - if (r != MEDIA_CONTENT_ERROR_NONE) { - _ERR("Fail to set filter condition"); - media_filter_destroy(filter); - return; - } - - media_content_connect(); - - r = media_info_foreach_media_from_db(filter, _media, priv); - if (r != MEDIA_CONTENT_ERROR_NONE) { - _ERR("MEDIA CONTENT ERROR: %d", r); - media_filter_destroy(filter); - media_content_disconnect(); - return; - } - - media_filter_destroy(filter); - media_content_disconnect(); -} -/* FIXME: test function end */ - /* * NOTE: Workaround * we assumed that if video content have the copyright then it's a movie. @@ -385,7 +330,7 @@ static void _draw_title_bar(struct _priv *priv, int id, app_media_info *mi) elm_object_part_text_set(priv->base, PART_VIEWER_TITLE, mi->title); } else { - strftime(date, sizeof(date), "%d %b", mi->content_time); + strftime(date, sizeof(date), "%d %b, %Y", mi->content_time); strftime(day, sizeof(day), "%a", mi->content_time); util_up_string(day); @@ -883,9 +828,6 @@ static Evas_Object *_create(Evas_Object *win, void *data) return NULL; } - /* FIXME: test code */ - _media_test(priv, 0); - viewmgr_set_view_data(VIEW_VIEWER, priv); return base; @@ -902,7 +844,6 @@ static void _show(void *view_data) priv = view_data; - /* FIXME: test code */ _viewer_show(priv, DIR_NONE); timeout_handler_reset(priv->timeout); @@ -926,10 +867,31 @@ static void _hide(void *view_data) evas_object_hide(priv->base); } +static void _update(void *view_data, int update_type, void *data) +{ + struct _priv *priv; + struct view_update_data *vdata; + + if (!view_data) { + _ERR("failed to get view data"); + return; + } + + if (!data) { + _ERR("invalid parameter"); + return; + } + + priv = view_data; + vdata = data; + + priv->playlist.list = vdata->list; + priv->playlist.cur = vdata->index; +} + static void _destroy(void *view_data) { struct _priv *priv; - app_media *am; if (!view_data) { _ERR("failed to get view data"); @@ -940,9 +902,6 @@ static void _destroy(void *view_data) _viewer_delete(priv); - EINA_LIST_FREE(priv->playlist.list, am) - app_media_destroy(am); - timeout_handler_fini(priv->timeout); playermgr_destroy(priv->player); @@ -957,6 +916,7 @@ static view_class _vclass = { .create = _create, .show = _show, .hide = _hide, + .update = _update, .destroy = _destroy, }; -- 2.7.4 From bdf90efceec6ba4f371897c4f5a044560841a995 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Thu, 9 Jul 2015 09:24:22 +0900 Subject: [PATCH 09/16] viewer: process back key event Change-Id: I633b86d66247b334d57170dfbf51c31f652310b0 Signed-off-by: Minkyu Kang --- src/util/timeout_handler.c | 1 - src/view/viewer.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/util/timeout_handler.c b/src/util/timeout_handler.c index e35f571..4d73de1 100644 --- a/src/util/timeout_handler.c +++ b/src/util/timeout_handler.c @@ -87,7 +87,6 @@ struct timeout_handler *timeout_handler_init(double timeout, int i; int event_type[] = { ECORE_EVENT_KEY_UP, - ECORE_EVENT_KEY_DOWN, ECORE_EVENT_MOUSE_BUTTON_DOWN, ECORE_EVENT_MOUSE_BUTTON_UP, ECORE_EVENT_MOUSE_MOVE, diff --git a/src/view/viewer.c b/src/view/viewer.c index 4a80d83..8adbea9 100644 --- a/src/view/viewer.c +++ b/src/view/viewer.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -329,6 +330,9 @@ static void _draw_title_bar(struct _priv *priv, int id, app_media_info *mi) if (id == VIEWER_MOVIE) { elm_object_part_text_set(priv->base, PART_VIEWER_TITLE, mi->title); + + elm_object_part_text_set(priv->base, PART_VIEWER_DATE, ""); + elm_object_part_text_set(priv->base, PART_VIEWER_PAGE, ""); } else { strftime(date, sizeof(date), "%d %b, %Y", mi->content_time); strftime(day, sizeof(day), "%a", mi->content_time); @@ -341,6 +345,8 @@ static void _draw_title_bar(struct _priv *priv, int id, app_media_info *mi) snprintf(buf, sizeof(buf), "%d / %d", priv->playlist.cur + 1, eina_list_count(priv->playlist.list)); elm_object_part_text_set(priv->base, PART_VIEWER_PAGE, buf); + + elm_object_part_text_set(priv->base, PART_VIEWER_TITLE, ""); } } @@ -562,6 +568,16 @@ static void _hide_bar(struct _priv *priv) ctl->ops->disable(ctl->handle); } +static void _pop_view(struct _priv *priv) +{ + struct view_update_data vdata; + + vdata.index = priv->playlist.cur; + + viewmgr_update_view(VIEW_BASE, UPDATE_FOCUS, &vdata); + viewmgr_pop_view(); +} + static void _timeout_cb(void *data, int type, void *ei) { _hide_bar(data); @@ -569,6 +585,30 @@ static void _timeout_cb(void *data, int type, void *ei) static void _event_cb(void *data, int type, void *ei) { + struct _priv *priv; + + if (!data) + return; + + priv = data; + + if (type == ECORE_EVENT_KEY_UP) { + Evas_Event_Key_Up *ev; + + if (!ei) + return; + + ev = ei; + + if (!strcmp(ev->keyname, KEY_BACK) || + !strcmp(ev->keyname, KEY_BACK_REMOTE)) { + if (priv->bar_show) { + _pop_view(priv); + return; + } + } + } + _show_bar(data); } -- 2.7.4 From 678f78f436ecfa98835e90f236504744ee9f4d51 Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Thu, 9 Jul 2015 15:43:33 +0900 Subject: [PATCH 10/16] listmgr: set current state of selected item to false Change-Id: I5713ccb9057770c14451e26436ea9e27acee7cad Signed-off-by: Jehun Lim --- src/util/listmgr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/listmgr.c b/src/util/listmgr.c index a340e1f..b671a49 100644 --- a/src/util/listmgr.c +++ b/src/util/listmgr.c @@ -66,6 +66,8 @@ void _grid_selected_cb(void *data, Elm_Object_Item *it, if (ldata->grid_selected_cb) ldata->grid_selected_cb(ldata->cb_data, it); + + elm_gengrid_item_selected_set(it, EINA_FALSE); } void _grid_realized_cb(int id, void *data, Evas_Object *obj, -- 2.7.4 From 4c8cb9d73a17594fcb8da1912f728202c5e969a4 Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Thu, 9 Jul 2015 17:38:58 +0900 Subject: [PATCH 11/16] timeout_handler: add function for enable/disable handler Change-Id: I45dc8113dd9e5b8d8f336476c1753966849910a0 Signed-off-by: Minkyu Kang --- include/util/timeout_handler.h | 2 ++ src/util/timeout_handler.c | 18 ++++++++++++++++++ src/view/viewer.c | 3 +++ 3 files changed, 23 insertions(+) diff --git a/include/util/timeout_handler.h b/include/util/timeout_handler.h index 29dd6e1..5cd0aab 100644 --- a/include/util/timeout_handler.h +++ b/include/util/timeout_handler.h @@ -29,4 +29,6 @@ void timeout_handler_fini(struct timeout_handler *handle); void timeout_handler_reset(struct timeout_handler *handle); +void timeout_handler_enable(struct timeout_handler *handle, bool enable); + #endif diff --git a/src/util/timeout_handler.c b/src/util/timeout_handler.c index 4d73de1..dce195f 100644 --- a/src/util/timeout_handler.c +++ b/src/util/timeout_handler.c @@ -31,6 +31,7 @@ struct timeout_handler { void *timeout_data; double timeout; + bool enable; }; static Eina_Bool _timer_cb(void *data) @@ -42,6 +43,9 @@ static Eina_Bool _timer_cb(void *data) handle = data; + if (!handle->enable) + return ECORE_CALLBACK_CANCEL; + handle->timeout_cb(handle->timeout_data, 0, NULL); handle->timer = NULL; @@ -57,6 +61,9 @@ static Eina_Bool _event_occured(void *data, int type, void *event) handle = data; + if (!handle->enable) + return ECORE_CALLBACK_PASS_ON; + handle->event_cb(handle->event_data, type, event); timeout_handler_reset(handle); @@ -64,6 +71,16 @@ static Eina_Bool _event_occured(void *data, int type, void *event) return ECORE_CALLBACK_PASS_ON; } +void timeout_handler_enable(struct timeout_handler *handle, bool enable) +{ + handle->enable = enable; + + if (!enable) { + ecore_timer_del(handle->timer); + handle->timer = NULL; + } +} + void timeout_handler_reset(struct timeout_handler *handle) { if (!handle) { @@ -117,6 +134,7 @@ struct timeout_handler *timeout_handler_init(double timeout, handle->timeout_cb = timeout_cb; handle->timeout_data = timeout_data; handle->timeout = timeout; + handle->enable = false; return handle; diff --git a/src/view/viewer.c b/src/view/viewer.c index 8adbea9..e3a9a8a 100644 --- a/src/view/viewer.c +++ b/src/view/viewer.c @@ -886,6 +886,7 @@ static void _show(void *view_data) _viewer_show(priv, DIR_NONE); + timeout_handler_enable(priv->timeout, true); timeout_handler_reset(priv->timeout); evas_object_show(priv->base); @@ -904,6 +905,8 @@ static void _hide(void *view_data) _viewer_hide(priv); + timeout_handler_enable(priv->timeout, false); + evas_object_hide(priv->base); } -- 2.7.4 From 36c8f5cca81bff26bcbcbe928d384101bfcb351f Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Fri, 10 Jul 2015 11:14:25 +0900 Subject: [PATCH 12/16] listmgr: remove the code to free listmgr data Change-Id: I6b6a7e362e689f289f5d9a2ba75853c62daa5ad4 Signed-off-by: Jehun Lim --- src/layout/gallery.c | 4 ++++ src/layout/movie.c | 4 ++++ src/util/listmgr.c | 1 - 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/layout/gallery.c b/src/layout/gallery.c index ecac88b..00df395 100644 --- a/src/layout/gallery.c +++ b/src/layout/gallery.c @@ -46,6 +46,7 @@ struct _priv { layoutmgr *lmgr; struct listmgr *listmgr; + struct listmgr_data *ldata; struct mediadata *md; @@ -226,6 +227,7 @@ static bool _create(layoutmgr *lmgr, void *data) priv->layout = layout; priv->lmgr = lmgr; priv->listmgr = listmgr; + priv->ldata = ldata; priv->md = md; layoutmgr_set_layout_data(lmgr, LAYOUT_GALLERY, priv); @@ -263,8 +265,10 @@ static void _destroy(void *layout_data) mediadata_destroy(priv->md); listmgr_destroy(priv->listmgr); + free(priv->ldata); evas_object_del(priv->layout); + free(priv); } diff --git a/src/layout/movie.c b/src/layout/movie.c index d127e31..a3fa193 100644 --- a/src/layout/movie.c +++ b/src/layout/movie.c @@ -46,6 +46,7 @@ struct _priv { layoutmgr *lmgr; struct listmgr *listmgr; + struct listmgr_data *ldata; struct mediadata *md; @@ -242,6 +243,7 @@ static bool _create(layoutmgr *lmgr, void *data) priv->layout = layout; priv->lmgr = lmgr; priv->listmgr = listmgr; + priv->ldata = ldata; priv->md = md; layoutmgr_set_layout_data(lmgr, LAYOUT_MOVIE, priv); @@ -279,8 +281,10 @@ static void _destroy(void *layout_data) mediadata_destroy(priv->md); listmgr_destroy(priv->listmgr); + free(priv->ldata); evas_object_del(priv->layout); + free(priv); } diff --git a/src/util/listmgr.c b/src/util/listmgr.c index b671a49..c45b6ec 100644 --- a/src/util/listmgr.c +++ b/src/util/listmgr.c @@ -262,7 +262,6 @@ void listmgr_destroy(struct listmgr *lmgr) } gridmgr_destroy(lmgr->gmgr); - free(lmgr->data); free(lmgr); } -- 2.7.4 From 00afafce7a236b7b533e715a675db6619e8be019 Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Fri, 10 Jul 2015 13:32:17 +0900 Subject: [PATCH 13/16] progressbar: add slider style argument in create function Change-Id: I200c6ac8734672e6e27bb52ae7ddfd112c12ce95 Signed-off-by: Jehun Lim --- include/util/progressbar.h | 2 +- src/util/progressbar.c | 6 ++++-- src/view/viewer.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/util/progressbar.h b/include/util/progressbar.h index c93a87e..792dcc8 100644 --- a/include/util/progressbar.h +++ b/include/util/progressbar.h @@ -24,7 +24,7 @@ struct progressbar_ops { int (*set_value)(void *data); }; -struct progressbar *progressbar_create(Evas_Object *base); +struct progressbar *progressbar_create(Evas_Object *base, const char *style); void progressbar_destroy(struct progressbar *m); void progressbar_set_parts(struct progressbar *m, const char *slider, diff --git a/src/util/progressbar.c b/src/util/progressbar.c index 853b507..756c44a 100644 --- a/src/util/progressbar.c +++ b/src/util/progressbar.c @@ -207,7 +207,7 @@ void progressbar_set_parts(struct progressbar *m, const char *slider, m->str_separator = strdup(separator); } -struct progressbar *progressbar_create(Evas_Object *base) +struct progressbar *progressbar_create(Evas_Object *base, const char *style) { struct progressbar *m; Evas_Object *obj; @@ -227,10 +227,12 @@ struct progressbar *progressbar_create(Evas_Object *base) elm_slider_indicator_show_set(obj, EINA_FALSE); elm_slider_indicator_show_on_focus_set(obj, EINA_FALSE); - elm_object_style_set(obj, STYLE_VIEWER_PROGRESS); elm_slider_horizontal_set(obj, EINA_TRUE); elm_slider_step_set(obj, SLIDER_DEFAULT); + if (style) + elm_object_style_set(obj, style); + /* FIXME: focus disabled */ elm_object_focus_allow_set(obj, EINA_FALSE); diff --git a/src/view/viewer.c b/src/view/viewer.c index e3a9a8a..0e8db1c 100644 --- a/src/view/viewer.c +++ b/src/view/viewer.c @@ -775,7 +775,7 @@ static bool _ui_init(struct _priv *priv) goto err; } - prog = progressbar_create(priv->base); + prog = progressbar_create(priv->base, STYLE_VIEWER_PROGRESS); if (!prog) { _ERR("failed to adding progressbar"); goto err; -- 2.7.4 From 30825e5a11c75dc6c1315392a3d6d54bde2aa049 Mon Sep 17 00:00:00 2001 From: Jehun Lim Date: Fri, 10 Jul 2015 14:45:45 +0900 Subject: [PATCH 14/16] add button and slider edc for recently watched content Change-Id: I15ba76bfa2ae093b6d8d0346a8ae16676e9ae8e9 Signed-off-by: Jehun Lim --- include/define.h | 4 +- include/layout/movie.h | 12 + include/view/base.h | 2 + include/view/viewer.h | 1 - res/edc/images/ic_preview_play.png | Bin 0 -> 11370 bytes res/edc/widgets/button.edc | 564 +++++++++++++++++++++++++++++++++++++ res/edc/widgets/slider.edc | 47 ++++ 7 files changed, 628 insertions(+), 2 deletions(-) create mode 100644 res/edc/images/ic_preview_play.png diff --git a/include/define.h b/include/define.h index 905eaea..dd55262 100644 --- a/include/define.h +++ b/include/define.h @@ -53,7 +53,9 @@ #define PART_ELM_SWALLOW_VIDEO "elm.swallow.video" /* signal */ -#define SIG_ITEM_SELECTED "item_selected" +#define SIG_BTN_CLICKED "btn,clicked" +#define SIG_ITEM_SELECTED "item,selected" #define SIG_SOURCE_EDC "edc" +#define SIG_SOURCE_SRC "src" #endif /* __AIR_MEDIAHUB_DEFINE_H__ */ diff --git a/include/layout/movie.h b/include/layout/movie.h index 5d10efc..640ea4e 100644 --- a/include/layout/movie.h +++ b/include/layout/movie.h @@ -17,13 +17,25 @@ #ifndef __AIR_MEDIAHUB_LAYOUT_MOVIE_H__ #define __AIR_MEDIAHUB_LAYOUT_MOVIE_H__ +/* layout */ #define LAYOUT_MOVIE "LAYOUT_MOVIE" +/* group */ #define GRP_MOVIE_LAYOUT "group.movie_layout" +#define GRP_MOVIE_RECENT_CONTENT "group.movie_recent_content" +/* part */ #define PART_CONTENT "part.content" #define PART_NOCONTENT "part.nocontent" +#define PART_RECENT_CONTENT_THUMBNAIL "part.recent_content_thumbnail" +#define PART_RECENT_CONTENT_TITLE "part.recent_content_title" +#define PART_RECENT_CONTENT_DATE "part.recent_content_date" +#define PART_RECENT_CONTENT_PROGRESS "part.recent_content_progress" +#define PART_RECENT_CONTENT_TOTAL "part.recent_content_total" +#define PART_RECENT_CONTENT_SLIDER "part.recent_content_slider" +/* style */ #define STYLE_GRID_MOVIE_ITEM "movie_item" +#define STYLE_BTN_RECENT_CONTENT "base_btn_recent" #endif /* __AIR_MEDIAHUB_LAYOUT_MOVIE_H__ */ diff --git a/include/view/base.h b/include/view/base.h index a40dd4e..aa909e6 100644 --- a/include/view/base.h +++ b/include/view/base.h @@ -34,10 +34,12 @@ #define PART_ITEM_CONTENT "part.item_content" /* images */ +#define IMAGE_PREVIEW_PLAY "ic_preview_play.png" #define IMAGE_THUMBNAIL_PLAY IMAGEDIR"/ic_thumbnail_play.png" /* style */ #define STYLE_BTN_MENU "base_btn_menu" #define STYLE_BTN_INDEX "base_btn_index" +#define STYLE_BASE_PROGRESS "base_recent_progress" #endif /* __AIR_MEDIAHUB_VIEW_BASE_H__ */ diff --git a/include/view/viewer.h b/include/view/viewer.h index 580e287..d3d494e 100644 --- a/include/view/viewer.h +++ b/include/view/viewer.h @@ -40,7 +40,6 @@ /* signal */ #define SIG_SET_PLAY "set,play,icon" #define SIG_SET_PAUSE "set,pause,icon" -#define SIG_BTN_CLICKED "btn,clicked" #define SIG_BTN_CALLBACK "btn,callback" #define SIG_HIDE_BAR "hide,bar" #define SIG_SHOW_BAR "show,bar" diff --git a/res/edc/images/ic_preview_play.png b/res/edc/images/ic_preview_play.png new file mode 100644 index 0000000000000000000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--git a/res/edc/widgets/button.edc b/res/edc/widgets/button.edc index 27bbf34..ae8ef37 100644 --- a/res/edc/widgets/button.edc +++ b/res/edc/widgets/button.edc @@ -591,3 +591,567 @@ group { } } } + +group { + name: "elm/button/base/base_btn_recent"; + data.item, "focus_highlight" "on"; + images { + image: IMAGE_PREVIEW_PLAY COMP; + } + parts { + part { + name: "bg"; + scale: 1; + description { + state: "default" 0.0; + min: 740 614; + } + } + part { + name: "map"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + perspective { + zplane: 0; + focal: 1000; + } + visible: 0; + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + perspective.zplane: -100; + } + } + part { + name: PART_RECENT_CONTENT_THUMBNAIL; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1.to: "bg"; + rel2 { + to: "bg_text"; + relative: 1.0 0.0; + } + map { + perspective_on: 1; + perspective: "map"; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + map.on: 1; + } + } + part { + name: "default_image"; + type: IMAGE; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: PART_RECENT_CONTENT_THUMBNAIL; + relative: 0.5 0.5; + } + rel2 { + to: PART_RECENT_CONTENT_THUMBNAIL; + relative: 0.5 0.5; + } + image.normal: IMAGE_PREVIEW_PLAY; + min: 120 120; + fixed: 1 1; + map { + perspective_on: 1; + perspective: "map"; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + map.on: 1; + } + } + part { + name: "part_focus1"; + type: RECT; + mouse_events: 0; + scale: 1; + description { + state: "default" 0.0; + rel1.to: "bg"; + rel2 { + to: "bg"; + relative: 1.0 0.0; + } + min: 0 6; + align: 0.5 0.0; + color: COLOR_ITEM_FOCUS; + fixed: 0 1; + visible: 0; + map { + perspective_on: 1; + perspective: "map"; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + map.on: 1; + visible: 1; + } + description { + state: "selected_0" 0.0; + inherit: "default" 0.0; + visible: 1; + color: COLOR_ITEM_FOCUS_0; + } + } + part { + name: "part_focus2"; + type: RECT; + mouse_events: 0; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "part_focus1"; + relative: 0.0 1.0; + } + rel2 { + to: "bg_text"; + relative: 0.0 0.0; + } + min: 6 0; + align: 0.0 0.5; + color: COLOR_ITEM_FOCUS; + fixed: 1 0; + visible: 0; + map { + perspective_on: 1; + perspective: "map"; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + map.on: 1; + visible: 1; + } + description { + state: "selected_0" 0.0; + inherit: "default" 0.0; + visible: 1; + color: COLOR_ITEM_FOCUS_0; + } + } + part { + name: "part_focus3"; + type: RECT; + mouse_events: 0; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "part_focus1"; + relative: 1.0 1.0; + } + rel2 { + to: "bg_text"; + relative: 1.0 0.0; + } + min: 6 0; + align: 1.0 0.5; + color: COLOR_ITEM_FOCUS; + fixed: 1 0; + visible: 0; + map { + perspective_on: 1; + perspective: "map"; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + map.on: 1; + visible: 1; + } + description { + state: "selected_0" 0.0; + inherit: "default" 0.0; + visible: 1; + color: COLOR_ITEM_FOCUS_0; + } + } + part { + name: "defaultbg_text"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "bg"; + relative: 0.0 1.0; + } + rel2.to: "bg"; + min: 0 198; + align: 0.5 1.0; + color: COLOR_ITEM_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"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + rel1.to: "defaultbg_text"; + rel2.to: "defaultbg_text"; + color: COLOR_ITEM_BG; + map { + perspective_on: 1; + perspective: "map"; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + color: COLOR_ITEM_FOCUS; + map.on: 1; + } + description { + state: "selected_0" 0.0; + inherit: "default" 0.0; + color: COLOR_ITEM_FOCUS_0; + } + } + part { + name: "padding_text_left"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1.to: "bg_text"; + rel2 { + to: "bg_text"; + relative: 0.0 0.0; + } + min: 26 28; + align: 0.0 0.0; + fixed: 1 1; + } + } + part { + name: "padding_text_right"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "bg_text"; + relative: 1.0 0.0; + } + rel2 { + to: "bg_text"; + relative: 1.0 0.0; + } + min: 26 28; + align: 1.0 0.0; + fixed: 1 1; + } + } + part { + name: PART_RECENT_CONTENT_TITLE; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding_text_left"; + relative: 1.0 1.0; + } + rel2 { + to: "padding_text_right"; + relative: 0.0 1.0; + } + text { + font: FONT_LIGHT; + size: 36; + align: 0.0 0.5; + } + min: 0 36; + align: 0.5 0.0; + color: COLOR_TEXT_FOCUS; + fixed: 0 1; + map { + perspective_on: 1; + perspective: "map"; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + map.on: 1; + } + description { + state: "selected_0" 0.0; + inherit: "selected" 0.0; + } + } + part { + name: "padding_text_date"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: PART_RECENT_CONTENT_TITLE; + relative: 0.0 1.0; + } + rel2.to: PART_RECENT_CONTENT_TITLE; + min: 0 12; + align: 0.5 0.0; + fixed: 0 1; + } + } + part { + name: PART_RECENT_CONTENT_DATE; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding_text_date"; + relative: 0.0 1.0; + } + rel2.to: "padding_text_date"; + text { + font: FONT_LIGHT; + size: 28; + align: 0.0 0.5; + } + min: 0 28; + align: 0.5 0.0; + color: COLOR_TEXT_FOCUS; + fixed: 0 1; + map { + perspective_on: 1; + perspective: "map"; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + map.on: 1; + } + description { + state: "selected_0" 0.0; + inherit: "selected" 0.0; + } + } + part { + name: "padding_text_time"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: PART_RECENT_CONTENT_DATE; + relative: 0.0 1.0; + } + rel2.to: PART_RECENT_CONTENT_DATE; + min: 0 34; + align: 0.5 0.0; + fixed: 0 1; + } + } + part { + name: PART_RECENT_CONTENT_PROGRESS; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding_text_time"; + relative: 0.0 1.0; + } + rel2 { + to: "padding_text_time"; + relative: 0.0 1.0; + } + text { + font: TEXT_LIGHT; + size: 20; + align: 0.0 0.5; + } + min: 100 20; + align: 0.0 0.0; + fixed: 1 1; + } + } + part { + name: PART_RECENT_CONTENT_TOTAL; + type: TEXT; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding_text_time"; + relative: 1.0 1.0; + } + rel2.to: "padding_text_time"; + text { + font: TEXT_LIGHT; + size: 20; + align: 1.0 0.5; + } + min: 100 20; + align: 1.0 0.0; + fixed: 1 1; + } + } + part { + name: "padding_slider"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: PART_RECENT_CONTENT_PROGRESS; + relative: 0.0 1.0; + } + rel2.to: PART_RECENT_CONTENT_TOTAL; + min: 0 10; + align: 0.5 0.0; + fixed: 0 1; + } + } + part { + name: PART_RECENT_CONTENT_SLIDER; + type: SWALLOW; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding_slider"; + relative: 0.0 1.0; + } + rel2.to: "padding_slider"; + min: 0 30; + align: 0.5 0.0; + fixed: 0 1; + } + } + part { + name: "event"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + visible: 0; + } + } + } + programs { + program { + name: "go_active"; + signal: "elm,action,focus"; + source: "elm"; + action: STATE_SET "selected_0" 0.0; + target: "part_focus1"; + target: "part_focus2"; + target: "part_focus3"; + target: "bg_text"; + target: PART_RECENT_CONTENT_TITLE; + target: PART_RECENT_CONTENT_DATE; + after: "focus,in,anim"; + } + program { + name: "focus,in,anim"; + action: STATE_SET "selected" 0.0; + target: PART_RECENT_CONTENT_THUMBNAIL; + target: "default_image"; + target: "part_focus1"; + target: "part_focus2"; + target: "part_focus3"; + target: "bg_text"; + transition: LINEAR 0.17; + after: "focus,in,anim,2"; + } + program { + name: "focus,in,anim,2"; + action: STATE_SET "selected" 0.0; + target: "defaultbg_text"; + } + program { + name: "go_passive"; + signal: "elm,action,unfocus"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: PART_RECENT_CONTENT_TITLE; + target: PART_RECENT_CONTENT_DATE; + target: "defaultbg_text"; + after: "focus,out,anim"; + } + program { + name: "focus,out,anim"; + action: STATE_SET "selected_0" 0.0; + target: "part_focus1"; + target: "part_focus2"; + target: "part_focus3"; + target: "bg_text"; + transition: LINEAR 0.17; + after: "focus,out,anim,2"; + } + program { + name: "focus,out,anim,2"; + action: STATE_SET "default" 0.0; + target: PART_RECENT_CONTENT_THUMBNAIL; + target: "default_image"; + target: "part_focus1"; + target: "part_focus2"; + target: "part_focus3"; + target: "bg_text"; + } + program { + name: "button_clicked"; + signal: "mouse,clicked,1"; + source: "event"; + action: SIGNAL_EMIT "elm,action,click" ""; + } + program { + name: SIG_BTN_CLICKED; + signal: SIG_BTN_CLICKED; + source: SIG_SOURCE_SRC; + action: STATE_SET "selected" 0.0; + target: "map"; + transition: DECELERATE 0.2; + after: "after_selected"; + } + program { + name: "after_selected"; + action: STATE_SET "default" 0.0; + target: "map"; + transition: DECELERATE 0.2; + after: "item_selected"; + } + program { + name: "item_selected"; + action: SIGNAL_EMIT SIG_ITEM_SELECTED SIG_SOURCE_EDC; + } + } +} diff --git a/res/edc/widgets/slider.edc b/res/edc/widgets/slider.edc index 2e0e34c..61a89a4 100644 --- a/res/edc/widgets/slider.edc +++ b/res/edc/widgets/slider.edc @@ -194,6 +194,53 @@ group { } group { + name: "elm/slider/horizontal/base_recent_progress"; + inherit: "elm/slider/horizontal/viewer_progress"; + parts { + part { + name: "base"; + scale: 1; + type: RECT; + description { + state: "default" 0.0; + rel1 { + to: "bg"; + relative: 0.0 0.0; + } + rel2 { + to: "bg"; + relative: 1.0 0.0; + } + min: 0 4; + fixed: 0 1; + align: 0.0 0.0; + color: 255 255 255 51; + } + } + part { + name: "glow"; + mouse_events: 0; + scale: 1; + type: RECT; + description { + state: "default" 0.0; + rel1.to: "base"; + rel2 { + relative: 0.5 1.0; + to_x: "button"; + to_y: "base"; + } + min: 0 4; + max: 99999 4; + fixed: 0 1; + align: 0.0 1.0; + color: COLOR_TEXT_FOCUS; + } + } + } +} + +group { name: "elm/slider/horizontal/progress_indicator/default"; alias: "elm/slider/horizontal/popup/default"; parts { -- 2.7.4 From 7973a7367495b2cc169d68373ae92ae64c900e7b Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Fri, 10 Jul 2015 15:30:48 +0900 Subject: [PATCH 15/16] viewer: set video position when play/stop video file Change-Id: Ideaeb01e3629fdc65e283d87e4617f0684d3550b Signed-off-by: Minkyu Kang --- include/util/playermgr.h | 2 +- src/util/playermgr.c | 8 ++++++- src/view/viewer.c | 57 +++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 62 insertions(+), 5 deletions(-) diff --git a/include/util/playermgr.h b/include/util/playermgr.h index 7ba5831..0eafe4b 100644 --- a/include/util/playermgr.h +++ b/include/util/playermgr.h @@ -22,7 +22,7 @@ struct playermgr; struct playermgr *playermgr_create(Evas_Object *win); void playermgr_destroy(struct playermgr *m); -bool playermgr_play(struct playermgr *m, const char *path); +bool playermgr_play(struct playermgr *m, const char *path, int ms); void playermgr_stop(struct playermgr *m); bool playermgr_resume(struct playermgr *m); bool playermgr_pause(struct playermgr *m); diff --git a/src/util/playermgr.c b/src/util/playermgr.c index 07aa63c..332eebd 100644 --- a/src/util/playermgr.c +++ b/src/util/playermgr.c @@ -157,7 +157,7 @@ void playermgr_stop(struct playermgr *m) player_unprepare(m->player); } -bool playermgr_play(struct playermgr *m, const char *path) +bool playermgr_play(struct playermgr *m, const char *path, int ms) { int r; @@ -199,6 +199,12 @@ bool playermgr_play(struct playermgr *m, const char *path) return false; } + r = player_set_play_position(m->player, ms, false, NULL, NULL); + if (r != PLAYER_ERROR_NONE) { + _ERR("player: set_position error (%d)", r); + return false; + } + return true; } diff --git a/src/view/viewer.c b/src/view/viewer.c index 0e8db1c..b0ac6ca 100644 --- a/src/view/viewer.c +++ b/src/view/viewer.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "define.h" #include "view.h" @@ -149,6 +150,7 @@ struct _viewer_info { }; static void _player_play(struct _priv *priv); +static void _player_stop(struct _priv *priv); static void _callback_movie(void *data, const char *ev); static void _callback_photo(void *data, const char *ev); @@ -394,6 +396,35 @@ static app_media_info *_get_current_media_info(struct _priv *priv) return mi; } +static void _set_played_position(struct _priv *priv, int position) +{ + video_meta_h video; + app_media *am; + int r; + + am = eina_list_nth(priv->playlist.list, priv->playlist.cur); + if (!am) { + _ERR("failed to get app_media"); + return; + } + + video = app_media_get_video_handle(am); + if (!video) { + _ERR("failed to getting video handle"); + return; + } + + r = video_meta_set_played_position(video, position); + if (r != MEDIA_CONTENT_ERROR_NONE) { + _ERR("failed to set played position"); + return; + } + + r = video_meta_update_to_db(video); + if (r != MEDIA_CONTENT_ERROR_NONE) + _ERR("failed to update db"); +} + static bool _viewer_show(struct _priv *priv, int foc) { struct _viewer_info *info; @@ -446,12 +477,14 @@ static bool _viewer_show(struct _priv *priv, int foc) } ctl->ops->focus(ctl->handle, loc, true); - _draw_contents(priv, id, mi); - _draw_title_bar(priv, id, mi); _draw_progressbar(priv, id, mi); _draw_favorite_icon(priv, id, mi); + _draw_contents(priv, id, mi); + + app_contents_recent_add(CONTENTS_MEDIA, mi->media_id); + return true; } @@ -572,6 +605,10 @@ static void _pop_view(struct _priv *priv) { struct view_update_data vdata; + if (priv->viewer.cur == VIEWER_MOVIE || + priv->viewer.cur == VIEWER_VIDEO) + _player_stop(priv); + vdata.index = priv->playlist.cur; viewmgr_update_view(VIEW_BASE, UPDATE_FOCUS, &vdata); @@ -655,7 +692,7 @@ static void _player_play(struct _priv *priv) _remove_thumbnail(priv); progressbar_start(priv->progress); - playermgr_play(priv->player, mi->file_path); + playermgr_play(priv->player, mi->file_path, mi->video->position); break; default: @@ -667,6 +704,12 @@ static void _player_play(struct _priv *priv) static void _player_stop(struct _priv *priv) { struct controller *ctl; + int position; + + if (priv->viewer.cur == VIEWER_MOVIE) { + position = playermgr_get_position(priv->player); + _set_played_position(priv, position); + } progressbar_stop(priv->progress); playermgr_stop(priv->player); @@ -685,6 +728,10 @@ static void _player_complete_cb(void *data) priv = data; progressbar_stop(priv->progress); + _set_played_position(priv, 0); + + if (priv->viewer.cur == VIEWER_MOVIE) + _pop_view(priv); } static void _player_set_position_cb(void *data) @@ -884,6 +931,8 @@ static void _show(void *view_data) priv = view_data; + media_content_connect(); + _viewer_show(priv, DIR_NONE); timeout_handler_enable(priv->timeout, true); @@ -907,6 +956,8 @@ static void _hide(void *view_data) timeout_handler_enable(priv->timeout, false); + media_content_disconnect(); + evas_object_hide(priv->base); } -- 2.7.4 From e06d7568e7404fd0b395112dccc52eb6f8daed7b Mon Sep 17 00:00:00 2001 From: Minkyu Kang Date: Fri, 10 Jul 2015 19:27:10 +0900 Subject: [PATCH 16/16] timeout_handler: add timer when enable the handler Change-Id: I2a815ca06cce19f94f7b0ad46abae87438f2ddf0 Signed-off-by: Minkyu Kang --- include/util/timeout_handler.h | 2 -- src/util/timeout_handler.c | 33 +++++++++++++-------------------- src/view/viewer.c | 1 - 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/include/util/timeout_handler.h b/include/util/timeout_handler.h index 5cd0aab..44ad82f 100644 --- a/include/util/timeout_handler.h +++ b/include/util/timeout_handler.h @@ -27,8 +27,6 @@ struct timeout_handler *timeout_handler_init(double timeout, void timeout_handler_fini(struct timeout_handler *handle); -void timeout_handler_reset(struct timeout_handler *handle); - void timeout_handler_enable(struct timeout_handler *handle, bool enable); #endif diff --git a/src/util/timeout_handler.c b/src/util/timeout_handler.c index dce195f..c4805f1 100644 --- a/src/util/timeout_handler.c +++ b/src/util/timeout_handler.c @@ -52,6 +52,15 @@ static Eina_Bool _timer_cb(void *data) return ECORE_CALLBACK_CANCEL; } +void _timer_reset(struct timeout_handler *handle) +{ + if (handle->timer) + ecore_timer_reset(handle->timer); + else + handle->timer = ecore_timer_add(handle->timeout, + _timer_cb, handle); +} + static Eina_Bool _event_occured(void *data, int type, void *event) { struct timeout_handler *handle; @@ -66,7 +75,7 @@ static Eina_Bool _event_occured(void *data, int type, void *event) handle->event_cb(handle->event_data, type, event); - timeout_handler_reset(handle); + _timer_reset(handle); return ECORE_CALLBACK_PASS_ON; } @@ -75,26 +84,14 @@ void timeout_handler_enable(struct timeout_handler *handle, bool enable) { handle->enable = enable; - if (!enable) { + if (enable) { + _timer_reset(handle); + } else { ecore_timer_del(handle->timer); handle->timer = NULL; } } -void timeout_handler_reset(struct timeout_handler *handle) -{ - if (!handle) { - _ERR("invalid parameter"); - return; - } - - if (handle->timer) - ecore_timer_reset(handle->timer); - else - handle->timer = ecore_timer_add(handle->timeout, - _timer_cb, handle); -} - struct timeout_handler *timeout_handler_init(double timeout, timeout_event_cb timeout_cb, void *timeout_data, timeout_event_cb event_cb, void *event_data) @@ -125,10 +122,6 @@ struct timeout_handler *timeout_handler_init(double timeout, handle->list = eina_list_append(handle->list, ev); } - handle->timer = ecore_timer_add(timeout, _timer_cb, handle); - if (!handle->timer) - goto error; - handle->event_cb = event_cb; handle->event_data = event_data; handle->timeout_cb = timeout_cb; diff --git a/src/view/viewer.c b/src/view/viewer.c index b0ac6ca..886ad6e 100644 --- a/src/view/viewer.c +++ b/src/view/viewer.c @@ -936,7 +936,6 @@ static void _show(void *view_data) _viewer_show(priv, DIR_NONE); timeout_handler_enable(priv->timeout, true); - timeout_handler_reset(priv->timeout); evas_object_show(priv->base); } -- 2.7.4