summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjinwoo.shin <jw0227.shin@samsung.com>2015-09-24 11:25:04 +0900
committerjinwoo.shin <jw0227.shin@samsung.com>2015-09-24 11:39:29 +0900
commitca5e9794cf61e4924e478dfd396b5073aa8b7def (patch)
treee1a14e120b283b7b4d71bcf0ae62eab0bcd66d4e
parent7a786bb412a9e777f3664404d600ee3487b2abd4 (diff)
downloadair_livetv-ca5e9794cf61e4924e478dfd396b5073aa8b7def.tar.gz
air_livetv-ca5e9794cf61e4924e478dfd396b5073aa8b7def.tar.bz2
air_livetv-ca5e9794cf61e4924e478dfd396b5073aa8b7def.zip
Change-Id: Ia08c1738821418858e46b91996e9b23ea317c9b5 Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
-rw-r--r--data/view/channelinfo.edc100
-rw-r--r--include/define.h3
-rw-r--r--src/layout_channelinfo_list.c215
3 files changed, 250 insertions, 68 deletions
diff --git a/data/view/channelinfo.edc b/data/view/channelinfo.edc
index f9ce6a8..6ead49c 100644
--- a/data/view/channelinfo.edc
+++ b/data/view/channelinfo.edc
@@ -177,12 +177,15 @@ group {
state, "default" 0.0;
rel1 {
to, "clip_next";
+ relative, 0.0 0.5;
offset, 0 20;
}
rel2 {
to, "clip_next";
+ relative, 1.0 0.5;
offset, 0 20;
}
+ align, 0.0 0.5;
}
description {
state, "show" 0.0;
@@ -190,6 +193,20 @@ group {
rel1.offset, 0 0;
rel2.offset, 0 0;
}
+ description {
+ state, "up" 0.0;
+ inherit, "show" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 0.0;
+ align, 0.0 0.0;
+ }
+ description {
+ state, "down" 0.0;
+ inherit, "show" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 1.0;
+ align, 0.0 1.0;
+ }
}
part {
name, "padding.current_channel";
@@ -239,8 +256,29 @@ group {
clip_to, "clip_current";
description {
state, "default" 0.0;
- rel1.to, "clip_current";
- rel2.to, "clip_current";
+ rel1 {
+ to, "clip_current";
+ relative, 0.0 0.5;
+ }
+ rel2 {
+ to, "clip_current";
+ relative, 1.0 0.5;
+ }
+ align, 0.0 0.5;
+ }
+ description {
+ state, "up" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 0.0;
+ align, 0.0 0.0;
+ }
+ description {
+ state, "down" 0.0;
+ inherit, "default" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 1.0;
+ align, 0.0 1.0;
}
}
part {
@@ -249,11 +287,11 @@ group {
description {
state, "default" 0.0;
rel1 {
- to, PART_CHANNELINFO_LIST_CURRENT;
+ to, "clip_current";
relative, 0.5 1.0;
}
rel2 {
- to, PART_CHANNELINFO_LIST_CURRENT;
+ to, "clip_current";
relative, 0.5 1.0;
}
min, 0 32;
@@ -293,12 +331,15 @@ group {
state, "default" 0.0;
rel1 {
to, "clip_prev";
+ relative, 0.0 0.5;
offset, 0 -20;
}
rel2 {
to, "clip_prev";
+ relative, 1.0 0.5;
offset, 0 -20;
}
+ align, 0.0 0.5;
}
description {
state, "show" 0.0;
@@ -306,6 +347,20 @@ group {
rel1.offset, 0 0;
rel2.offset, 0 0;
}
+ description {
+ state, "up" 0.0;
+ inherit, "show" 0.0;
+ rel1.relative, 0.0 0.0;
+ rel2.relative, 1.0 0.0;
+ align, 0.0 0.0;
+ }
+ description {
+ state, "down" 0.0;
+ inherit, "show" 0.0;
+ rel1.relative, 0.0 1.0;
+ rel2.relative, 1.0 1.0;
+ align, 0.0 1.0;
+ }
}
part {
name, "padding.navigation_down";
@@ -387,6 +442,42 @@ group {
action, SIGNAL_EMIT SIGNAL_HIDE_FINISHED SOURCE_ELM;
}
}
+ program {
+ signal, SIGNAL_ANIM_MOVE_UP;
+ source, SOURCE_PROGRAM;
+ action, STATE_SET "show" 0.0;
+ target, PART_CHANNELINFO_LIST_NEXT;
+ target, PART_CHANNELINFO_LIST_CURRENT;
+ target, PART_CHANNELINFO_LIST_PREV;
+ sequence {
+ action, STATE_SET "up" 0.0;
+ transition, CUBIC_BEZIER 0.667 TRANSITION_EASE_IN_OUT;
+ target, PART_CHANNELINFO_LIST_NEXT;
+ target, PART_CHANNELINFO_LIST_CURRENT;
+ target, PART_CHANNELINFO_LIST_PREV;
+ after, "anim_end";
+ }
+ }
+ program {
+ signal, SIGNAL_ANIM_MOVE_DOWN;
+ source, SOURCE_PROGRAM;
+ action, STATE_SET "show" 0.0;
+ target, PART_CHANNELINFO_LIST_NEXT;
+ target, PART_CHANNELINFO_LIST_CURRENT;
+ target, PART_CHANNELINFO_LIST_PREV;
+ sequence {
+ action, STATE_SET "down" 0.0;
+ transition, CUBIC_BEZIER 0.667 TRANSITION_EASE_IN_OUT;
+ target, PART_CHANNELINFO_LIST_NEXT;
+ target, PART_CHANNELINFO_LIST_CURRENT;
+ target, PART_CHANNELINFO_LIST_PREV;
+ after, "anim_end";
+ }
+ }
+ program {
+ name, "anim_end";
+ action, SIGNAL_EMIT SIGNAL_ANIM_FINISHED SOURCE_ELM;
+ }
}
}
@@ -863,7 +954,6 @@ group {
state, "default" 0.0;
min, 536 70;
align, 0.0 0.0;
- fixed, 1 1;
visible, 0;
}
}
diff --git a/include/define.h b/include/define.h
index 0012083..40d9be3 100644
--- a/include/define.h
+++ b/include/define.h
@@ -50,6 +50,9 @@
#define SIGNAL_HIDE "hide"
#define SIGNAL_HIDE_FINISHED "elm,action,hide,finished"
#define SIGNAL_TIMEOUT "timeout"
+#define SIGNAL_ANIM_MOVE_UP "anim,move_up"
+#define SIGNAL_ANIM_MOVE_DOWN "anim,move_down"
+#define SIGNAL_ANIM_FINISHED "anim,finished"
#define FONT_REGULAR "BreezeSans"
#define FONT_LIGHT "BreezeSans:style=Light"
diff --git a/src/layout_channelinfo_list.c b/src/layout_channelinfo_list.c
index d64743c..8f5e7c6 100644
--- a/src/layout_channelinfo_list.c
+++ b/src/layout_channelinfo_list.c
@@ -25,6 +25,10 @@
#include "tv.h"
#include "view.h"
+#define TUNE_WAIT_TIME 0.1
+#define CHANNEL_PADDING_X 0
+#define CHANNEL_PADDING_Y 5
+
static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
Evas_Event_Key_Down *ev);
@@ -38,6 +42,7 @@ struct _priv {
Evas_Object *prev_channel;
Evas_Object *current_channel;
Evas_Object *next_channel;
+ Ecore_Timer *tune_timer;
const struct tv_channel_info *channel_info;
layoutmgr *lmgr;
@@ -91,83 +96,142 @@ static int _set_next_channel(struct _priv *priv, int order)
return 0;
}
-static void _update_channel_info(struct _priv *priv)
+static bool _get_next_channel(
+ const struct tv_channel_info *current,
+ const struct tv_channel_info **prev,
+ const struct tv_channel_info **next)
{
- const struct tv_channel_info *prev, *current, *next, *channel;
+ const struct tv_channel_info *channel;
Eina_List *channel_list, *l;
- if (priv->channel_info)
- current = priv->channel_info;
- else {
- current = tv_channel_get_info();
- if (!current) {
- _ERR("failed to get channel info");
+ if (!current) {
+ _ERR("failed to get current channel");
- return;
- }
+ return false;
}
- util_draw_channel_info(priv->current_channel, current);
-
channel_list = tv_channel_get_list();
if (!channel_list) {
_ERR("failed to get channel list");
- return;
+
+ return false;
}
- prev = NULL;
- next = NULL;
+ *prev = NULL;
+ *next = NULL;
EINA_LIST_FOREACH(channel_list, l, channel) {
if (channel->service_id == current->service_id) {
- prev = eina_list_data_get(eina_list_prev(l));
- next = eina_list_data_get(eina_list_next(l));
+ *prev = eina_list_data_get(eina_list_prev(l));
+ *next = eina_list_data_get(eina_list_next(l));
break;
}
}
- if (!prev) {
- prev = eina_list_data_get(eina_list_last(channel_list));
- if (prev == current)
- prev = NULL;
+ if (!*prev)
+ *prev = eina_list_data_get(eina_list_last(channel_list));
+
+ if (!*next)
+ *next = eina_list_data_get(channel_list);
+
+ *prev = tv_channel_clone_info(*prev);
+ *next = tv_channel_clone_info(*next);
+
+ tv_channel_del_list(channel_list);
+
+ return true;
+}
+
+static void _draw_channel_info(Evas_Object *box,
+ const struct tv_channel_info *current, char *grp)
+{
+ const struct tv_channel_info *prev, *next;
+ Evas_Object *layout;
+
+ if (!current) {
+ _ERR("failed to get current channel");
+
+ return;
+ }
+
+ if (!_get_next_channel(current, &prev, &next) ||
+ !prev || !next) {
+ _ERR("failed to get next channel");
+
+ return;
}
- if (!next) {
- next = eina_list_data_get(channel_list);
- if (next == current)
- next = NULL;
+ elm_box_clear(box);
+
+ layout = util_add_layout(box, grp);
+ util_draw_channel_info(layout, next);
+ elm_box_pack_end(box, layout);
+
+ layout = util_add_layout(box, grp);
+ util_draw_channel_info(layout, current);
+ elm_box_pack_end(box, layout);
+
+ layout = util_add_layout(box, grp);
+ util_draw_channel_info(layout, prev);
+ elm_box_pack_end(box, layout);
+
+ tv_channel_del_info(prev);
+ tv_channel_del_info(next);
+}
+
+static void _update_channel_info(struct _priv *priv)
+{
+ const struct tv_channel_info *prev, *current, *next;
+
+ if (priv->channel_info)
+ current = priv->channel_info;
+ else {
+ current = tv_channel_get_info();
+ if (!current) {
+ _ERR("failed to get channel info");
+
+ return;
+ }
}
+ if (!_get_next_channel(current, &prev, &next)) {
+ _ERR("failed to get next channel");
+
+ return;
+ }
+
+ _draw_channel_info(priv->prev_channel, prev, GRP_CHANNELINFO_SIMPLE);
+ _draw_channel_info(priv->current_channel, current, GRP_CHANNELINFO);
+ _draw_channel_info(priv->next_channel, next, GRP_CHANNELINFO_SIMPLE);
+
if (prev)
- util_draw_channel_info(priv->prev_channel, prev);
+ tv_channel_del_info(prev);
if (next)
- util_draw_channel_info(priv->next_channel, next);
-
- tv_channel_del_list(channel_list);
+ tv_channel_del_info(next);
}
static bool _draw_channel_layout(struct _priv *priv)
{
- priv->next_channel = util_add_layout(priv->base,
- GRP_CHANNELINFO_SIMPLE);
+ priv->next_channel = util_add_box(priv->base, EINA_FALSE);
if (!priv->next_channel)
return false;
-
+ elm_box_padding_set(priv->next_channel,
+ CHANNEL_PADDING_X, CHANNEL_PADDING_Y);
elm_object_part_content_set(priv->base,
PART_CHANNELINFO_LIST_NEXT, priv->next_channel);
- priv->current_channel = util_add_layout(priv->base, GRP_CHANNELINFO);
+ priv->current_channel = util_add_box(priv->base, EINA_FALSE);
if (!priv->current_channel)
return false;
-
elm_object_part_content_set(priv->base,
PART_CHANNELINFO_LIST_CURRENT, priv->current_channel);
- priv->prev_channel = util_add_layout(priv->base,
- GRP_CHANNELINFO_SIMPLE);
+
+ priv->prev_channel = util_add_box(priv->base, EINA_FALSE);
if (!priv->prev_channel)
return false;
-
+ elm_box_padding_set(priv->prev_channel,
+ CHANNEL_PADDING_X, CHANNEL_PADDING_Y);
elm_object_part_content_set(priv->base,
PART_CHANNELINFO_LIST_PREV, priv->prev_channel);
@@ -197,6 +261,40 @@ static void _hide_finished_cb(void *data, Evas_Object *obj,
evas_object_hide(priv->base);
}
+Eina_Bool _tune_timer(void *data)
+{
+ struct _priv *priv;
+
+ if (!data)
+ return ECORE_CALLBACK_CANCEL;
+
+ priv = data;
+
+ tv_channel_tune_with_service_id(
+ priv->channel_info->service_id);
+
+ priv->tune_timer = NULL;
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static void _anim_finished_cb(void *data, Evas_Object *obj,
+ const char *emission, const char *source)
+{
+ struct _priv *priv;
+
+ if (!data)
+ return;
+
+ priv = data;
+
+ if (priv->tune_timer)
+ ecore_timer_reset(priv->tune_timer);
+ else
+ priv->tune_timer = ecore_timer_add(TUNE_WAIT_TIME,
+ _tune_timer, priv);
+}
+
static bool _create(layoutmgr *lmgr, void *data)
{
struct _priv *priv;
@@ -240,6 +338,8 @@ static bool _create(layoutmgr *lmgr, void *data)
inputmgr_add_callback(priv->base, 0, &key_handler, priv);
elm_layout_signal_callback_add(priv->base, SIGNAL_HIDE_FINISHED,
SOURCE_ELM, _hide_finished_cb, priv);
+ elm_layout_signal_callback_add(priv->base, SIGNAL_ANIM_FINISHED,
+ SOURCE_ELM, _anim_finished_cb, priv);
return true;
}
@@ -256,9 +356,14 @@ static void _destroy(void *layout_data)
if (priv->channel_info)
tv_channel_del_info(priv->channel_info);
+ if (priv->tune_timer)
+ ecore_timer_del(priv->tune_timer);
+
inputmgr_remove_callback(priv->base, &key_handler);
elm_layout_signal_callback_del(priv->base, SIGNAL_HIDE_FINISHED,
SOURCE_ELM, _hide_finished_cb);
+ elm_layout_signal_callback_del(priv->base, SIGNAL_ANIM_FINISHED,
+ SOURCE_ELM, _anim_finished_cb);
evas_object_del(priv->base);
free(priv);
@@ -316,39 +421,23 @@ static void _update(void *layout_data, int type, void *data)
}
if (!strcmp(ev->keyname, KEY_CHANNELUP)) {
+ _update_channel_info(priv);
+
+ elm_object_signal_emit(priv->base,
+ SIGNAL_ANIM_MOVE_UP, SOURCE_PROGRAM);
+
r = _set_next_channel(priv, CHANNEL_NEXT);
if (r < 0)
_ERR("failed to set next channel");
- else
- _update_channel_info(priv);
} else if (!strcmp(ev->keyname, KEY_CHANNELDOWN)) {
- r = _set_next_channel(priv, CHANNEL_PREV);
- if (r < 0)
- _ERR("failed to set prev channel");
- else
- _update_channel_info(priv);
- }
- } else if (type == UPDATE_TYPE_INPUT_KEY_UP) {
- Evas_Event_Key_Up *ev = data;
-
- if (!ev) {
- _ERR("failed to get ev");
- return;
- }
+ _update_channel_info(priv);
- if (!strcmp(ev->keyname, KEY_CHANNELUP) ||
- !strcmp(ev->keyname, KEY_CHANNELDOWN)) {
- if (!priv->channel_info) {
- _ERR("failed to get channel info");
- return;
- }
+ elm_object_signal_emit(priv->base,
+ SIGNAL_ANIM_MOVE_DOWN, SOURCE_PROGRAM);
- r = tv_channel_tune_with_service_id(
- priv->channel_info->service_id);
+ r = _set_next_channel(priv, CHANNEL_PREV);
if (r < 0)
- _ERR("failed to tune next channel");
-
- _update_channel_info(priv);
+ _ERR("failed to set prev channel");
}
}
}