summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjinwoo.shin <jw0227.shin@samsung.com>2015-09-15 19:41:26 +0900
committerjinwoo.shin <jw0227.shin@samsung.com>2015-09-15 19:50:39 +0900
commitfbfc2393cf390509957d19b78c9c8d19bff09f56 (patch)
tree1c2a896d98e655765212e4ed9be302556011fae5
parent1431b38deb76eeda4c4fc125184bda5659155cda (diff)
downloadair_livetv-fbfc2393cf390509957d19b78c9c8d19bff09f56.tar.gz
air_livetv-fbfc2393cf390509957d19b78c9c8d19bff09f56.tar.bz2
air_livetv-fbfc2393cf390509957d19b78c9c8d19bff09f56.zip
Restructuring channelinfo view and added animations
- Each layout creates its own base layout to show animation effect - Added show/hide effect on each layout except search layout Change-Id: Ibf11a7e21cc6f43754886533b7207602b638fc5b Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
-rw-r--r--data/view/channelinfo.edc282
-rw-r--r--include/define.h8
-rw-r--r--include/view.h2
-rw-r--r--src/layout_channelinfo.c100
-rw-r--r--src/layout_channelinfo_list.c137
-rw-r--r--src/layout_channelinfo_search.c104
-rw-r--r--src/util.c3
-rw-r--r--src/view_channelinfo.c70
8 files changed, 490 insertions, 216 deletions
diff --git a/data/view/channelinfo.edc b/data/view/channelinfo.edc
index 0ebf575..8b7ece3 100644
--- a/data/view/channelinfo.edc
+++ b/data/view/channelinfo.edc
@@ -36,7 +36,53 @@ group {
}
group {
- name, GRP_CHANNELINFO_LIST;
+ name, GRP_LAYOUT_CHANNELINFO;
+ parts {
+ part {
+ name, PART_CONTENT;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.relative, 1.0 0.5;
+ rel2.relative, 1.0 0.5;
+ min, 536 486;
+ align, 0.0 0.5;
+ fixed, 1 1;
+ visible, 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ align, 1.0 0.5;
+ visible, 1;
+ }
+ }
+ }
+ programs {
+ program {
+ signal, SIGNAL_SHOW;
+ action, STATE_SET "show" 0.0;
+ target, PART_CONTENT;
+ transition, CUBIC_BEZIER 0.5 0.45 0.03 0.41 1.0;
+ }
+ program {
+ signal, SIGNAL_HIDE;
+ source, SOURCE_ELM;
+ action, STATE_SET "default" 0.0;
+ target, PART_CONTENT;
+ transition, CUBIC_BEZIER 0.167 0.25 0.46 0.45 1.0;
+ after, "hide_finished";
+ }
+ program {
+ name, "hide_finished";
+ action, SIGNAL_EMIT SIGNAL_HIDE_FINISHED SOURCE_ELM;
+ }
+ }
+}
+
+group {
+ name, GRP_LAYOUT_CHANNELINFO_LIST;
images {
image, "btn_navigation_up.png" COMP;
image, "btn_navigation_down.png" COMP;
@@ -48,18 +94,24 @@ group {
scale, 1;
description {
state, "default" 0.0;
- rel1.relative, 0.0 0.5;
- rel2.relative, 0.0 0.5;
+ rel1.relative, 1.0 0.5;
+ rel2.relative, 1.0 0.5;
min, 536 486;
align, 0.0 0.5;
fixed, 1 1;
}
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ align, 1.0 0.5;
+ }
}
part {
name, "part.navigation_up";
type, IMAGE;
scale, 1;
description {
+ state, "default" 0.0;
image.normal, "btn_navigation_up.png";
rel1 {
to, "bg";
@@ -79,115 +131,194 @@ group {
name, "padding.next_channel";
type, SPACER;
description {
+ state, "default" 0.0;
rel1 {
- to_y, "part.navigation_up";
- relative, 0.0 1.0;
+ to, "part.navigation_up";
+ relative, 0.5 1.0;
}
rel2 {
- to_y, "part.navigation_up";
- relative, 1.0 1.0;
+ to, "part.navigation_up";
+ relative, 0.5 1.0;
}
min, 0 20;
- align, 0.0 0.0;
+ align, 0.5 0.0;
fixed, 1 1;
}
}
part {
- name, PART_CHANNELINFO_LIST_NEXT;
- type, SWALLOW;
+ name, "clip_next";
+ type, RECT;
description {
+ state, "default" 0.0;
rel1 {
- to_y, "padding.next_channel";
- relative, 0.0 1.0;
+ to, "padding.next_channel";
+ relative, 0.5 1.0;
}
rel2 {
- to_y, "padding.next_channel";
- relative, 1.0 1.0;
+ to, "padding.next_channel";
+ relative, 0.5 1.0;
}
min, 536 70;
- align, 0.0 0.0;
+ align, 0.5 0.0;
fixed, 1 1;
+ color, 255 255 255 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, PART_CHANNELINFO_LIST_NEXT;
+ type, SWALLOW;
+ clip_to, "clip_next";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "clip_next";
+ offset, 0 20;
+ }
+ rel2 {
+ to, "clip_next";
+ offset, 0 20;
+ }
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ rel1.offset, 0 0;
+ rel2.offset, 0 0;
}
}
part {
name, "padding.current_channel";
type, SPACER;
description {
+ state, "default" 0.0;
rel1 {
- to_y, PART_CHANNELINFO_LIST_NEXT;
- relative, 0.0 1.0;
+ to, "clip_next";
+ relative, 0.5 1.0;
}
rel2 {
- to_y, PART_CHANNELINFO_LIST_NEXT;
- relative, 1.0 1.0;
+ to, "clip_next";
+ relative, 0.5 1.0;
}
min, 0 32;
- align, 0.0 0.0;
+ align, 0.5 0.0;
fixed, 1 1;
}
}
part {
- name, PART_CHANNELINFO_LIST_CURRENT;
- type, SWALLOW;
+ name, "clip_current";
+ type, RECT;
description {
+ state, "default" 0.0;
rel1 {
- to_y, "padding.current_channel";
- relative, 0.0 1.0;
+ to, "padding.current_channel";
+ relative, 0.5 1.0;
}
rel2 {
- to_y, "padding.current_channel";
- relative, 1.0 1.0;
+ to, "padding.current_channel";
+ relative, 0.5 1.0;
}
min, 536 174;
- align, 0.0 0.0;
+ align, 0.5 0.0;
fixed, 1 1;
+ color, 255 255 255 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, PART_CHANNELINFO_LIST_CURRENT;
+ type, SWALLOW;
+ clip_to, "clip_current";
+ description {
+ state, "default" 0.0;
+ rel1.to, "clip_current";
+ rel2.to, "clip_current";
}
}
part {
name, "padding.prev_channel";
type, SPACER;
description {
+ state, "default" 0.0;
rel1 {
- to_y, PART_CHANNELINFO_LIST_CURRENT;
- relative, 0.0 1.0;
+ to, PART_CHANNELINFO_LIST_CURRENT;
+ relative, 0.5 1.0;
}
rel2 {
- to_y, PART_CHANNELINFO_LIST_CURRENT;
- relative, 1.0 1.0;
+ to, PART_CHANNELINFO_LIST_CURRENT;
+ relative, 0.5 1.0;
}
min, 0 32;
- align, 0.0 0.0;
+ align, 0.5 0.0;
fixed, 1 1;
}
}
part {
- name, PART_CHANNELINFO_LIST_PREV;
- type, SWALLOW;
+ name, "clip_prev";
+ type, RECT;
description {
+ state, "default" 0.0;
rel1 {
- to_y, "padding.prev_channel";
- relative, 0.0 1.0;
+ to, "padding.prev_channel";
+ relative, 0.5 1.0;
}
rel2 {
- to_y, "padding.prev_channel";
- relative, 1.0 1.0;
+ to, "padding.prev_channel";
+ relative, 0.5 1.0;
}
min, 536 70;
- align, 0.0 0.0;
+ align, 0.5 0.0;
fixed, 1 1;
+ color, 255 255 255 0;
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ color, 255 255 255 255;
+ }
+ }
+ part {
+ name, PART_CHANNELINFO_LIST_PREV;
+ type, SWALLOW;
+ clip_to, "clip_prev";
+ description {
+ state, "default" 0.0;
+ rel1 {
+ to, "clip_prev";
+ offset, 0 -20;
+ }
+ rel2 {
+ to, "clip_prev";
+ offset, 0 -20;
+ }
+ }
+ description {
+ state, "show" 0.0;
+ inherit, "default" 0.0;
+ rel1.offset, 0 0;
+ rel2.offset, 0 0;
}
}
part {
name, "padding.navigation_down";
type, SPACER;
description {
+ state, "default" 0.0;
rel1 {
- to_y, PART_CHANNELINFO_LIST_PREV;
- relative, 0.0 1.0;
+ to, "clip_prev";
+ relative, 0.5 1.0;
}
rel2 {
- to_y, PART_CHANNELINFO_LIST_PREV;
- relative, 1.0 1.0;
+ to, "clip_prev";
+ relative, 0.5 1.0;
}
min, 0 20;
align, 0.0 0.0;
@@ -199,13 +330,14 @@ group {
type, IMAGE;
scale, 1;
description {
+ state, "default" 0.0;
image.normal, "btn_navigation_down.png";
rel1 {
- to_y, "padding.navigation_down";
+ to, "padding.navigation_down";
relative, 0.5 1.0;
}
rel2 {
- to_y, "padding.navigation_down";
+ to, "padding.navigation_down";
relative, 0.5 1.0;
}
min, 98 34;
@@ -215,6 +347,66 @@ group {
}
}
}
+ programs {
+ program {
+ signal, SIGNAL_SHOW;
+ action, STATE_SET "show" 0.0;
+ target, "bg";
+ after, "show_current";
+ after, "show_other";
+ }
+ program {
+ name, "show_current";
+ action, STATE_SET "show" 0.0;
+ target, "clip_current";
+ transition, CUBIC_BEZIER 0.334 0.45 0.03 0.41 1.0;
+ }
+ program {
+ name, "show_other";
+ action, STATE_SET "show" 0.0;
+ target, "clip_next";
+ target, PART_CHANNELINFO_LIST_NEXT;
+ target, "clip_prev";
+ target, PART_CHANNELINFO_LIST_PREV;
+ transition, CUBIC_BEZIER 0.401 0.45 0.03 0.41 1.0;
+ }
+ program {
+ signal, SIGNAL_HIDE;
+ source, SOURCE_ELM;
+ action, STATE_SET "default" 0.0;
+ target, "bg";
+ transition, CUBIC_BEZIER 0.167 0.25 0.46 0.45 1.0;
+ sequence {
+ action, STATE_SET "default" 0.0;
+ target, "clip_next";
+ target, PART_CHANNELINFO_LIST_NEXT;
+ target, "clip_prev";
+ target, PART_CHANNELINFO_LIST_PREV;
+ target, "clip_current";
+
+ action, SIGNAL_EMIT SIGNAL_HIDE_FINISHED SOURCE_ELM;
+ }
+ }
+ }
+}
+
+group {
+ name, GRP_LAYOUT_CHANNELINFO_SEARCH;
+ parts {
+ part {
+ name, PART_CONTENT;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ rel1.relative, 1.0 0.0;
+ rel2.relative, 1.0 1.0;
+ min, 536 0;
+ align, 1.0 0.0;
+ fixed, 1 0;
+ }
+ }
+ }
}
group {
diff --git a/include/define.h b/include/define.h
index 4ff5bfd..ac98f3d 100644
--- a/include/define.h
+++ b/include/define.h
@@ -46,6 +46,9 @@
#define SIGNAL_NO_FAVORITE "elm,state,no_favorite"
#define SIGNAL_TOGGLE "elm,state,toggle"
#define SIGNAL_UNTOGGLE "elm,state,untoggle"
+#define SIGNAL_SHOW "show"
+#define SIGNAL_HIDE "hide"
+#define SIGNAL_HIDE_FINISHED "elm,action,hide,finished"
#define SIGNAL_TIMEOUT "timeout"
#define FONT_REGULAR "TizenSans"
@@ -95,11 +98,12 @@
#define LAYOUT_CHANNELINFO_SEARCH "LAYOUT_CHANNELINFO_SEARCH"
#define GRP_VIEW_CHANNELINFO "grp.view.channelinfo"
-
-#define GRP_CHANNELINFO_LIST "grp.channelinfo.list"
+#define GRP_LAYOUT_CHANNELINFO "grp.lavout.channelinfo.list"
+#define GRP_LAYOUT_CHANNELINFO_LIST "grp.layout.channelinfo.list"
#define PART_CHANNELINFO_LIST_NEXT "part.channelinfo.list.next"
#define PART_CHANNELINFO_LIST_CURRENT "part.channelinfo.list.current"
#define PART_CHANNELINFO_LIST_PREV "part.channelinfo.list.prev"
+#define GRP_LAYOUT_CHANNELINFO_SEARCH "grp.layout.channelinfo.search"
#define GRP_CHANNELINFO "grp.channelinfo"
#define GRP_CHANNELINFO_SIMPLE "grp.channelinfo.simple"
diff --git a/include/view.h b/include/view.h
index 34abc88..db1a783 100644
--- a/include/view.h
+++ b/include/view.h
@@ -33,8 +33,6 @@ enum _update_op {
STOP_HIDE_TIMER
};
-void draw_channel_info(Evas_Object *obj, const struct tv_channel_info *channel_info);
-
view_class *view_channelnumber_get_vclass(void);
view_class *view_channelinfo_get_vclass(void);
view_class *view_error_get_vclass(void);
diff --git a/src/layout_channelinfo.c b/src/layout_channelinfo.c
index 3d9dec9..6226ae0 100644
--- a/src/layout_channelinfo.c
+++ b/src/layout_channelinfo.c
@@ -25,14 +25,22 @@
#include "view.h"
#include "util.h"
+static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Down *ev);
+
struct _priv {
Evas_Object *base;
Evas_Object *layout;
+ Evas_Object *channel;
layoutmgr *lmgr;
const struct tv_channel_info *channel_info;
};
+static input_handler key_handler = {
+ .key_down = _key_down_cb,
+};
+
static void _update_channel_info(struct _priv *priv)
{
if (priv->channel_info) {
@@ -47,13 +55,50 @@ static void _update_channel_info(struct _priv *priv)
return;
}
- util_draw_channel_info(priv->layout, priv->channel_info);
+ util_draw_channel_info(priv->channel, priv->channel_info);
+}
+
+static bool _draw_channel_layout(struct _priv *priv)
+{
+ priv->channel = elm_layout_add(priv->base);
+ if (!priv->channel) {
+ _ERR("failed to create channel layout");
+ return false;
+ }
+
+ elm_layout_file_set(priv->channel, EDJEFILE, GRP_CHANNELINFO);
+ elm_object_content_set(priv->base, priv->channel);
+
+ return true;
+}
+
+static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Down *ev)
+{
+ if (!strcmp(ev->keyname, KEY_BACK) ||
+ !strcmp(ev->keyname, KEY_BACK_REMOTE) ||
+ !strcmp(ev->keyname, KEY_EXIT)) {
+ viewmgr_hide_view(VIEW_CHANNELINFO);
+ }
+}
+
+static void _hide_finished_cb(void *data, Evas_Object *obj,
+ const char *emission, const char *source)
+{
+ struct _priv *priv;
+
+ if (!data)
+ return;
+
+ priv = data;
+
+ evas_object_hide(priv->base);
}
static bool _create(layoutmgr *lmgr, void *data)
{
struct _priv *priv;
- Evas_Object *base, *layout;
+ Evas_Object *win;
priv = calloc(1, sizeof(*priv));
if (!priv) {
@@ -61,32 +106,39 @@ static bool _create(layoutmgr *lmgr, void *data)
return false;
}
- base = layoutmgr_get_base(lmgr);
+ win = layoutmgr_get_base(lmgr);
- layout = elm_layout_add(base);
- if (!layout) {
+ priv->base = elm_layout_add(win);
+ if (!priv->base) {
_ERR("failed to create layout");
free(priv);
return false;
}
- if (!elm_layout_file_set(layout, EDJEFILE, GRP_CHANNELINFO))
- goto error;
- priv->base = base;
- priv->layout = layout;
- priv->lmgr = lmgr;
+ elm_layout_file_set(priv->base, EDJEFILE, GRP_LAYOUT_CHANNELINFO);
+ evas_object_size_hint_weight_set(priv->base,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, priv->base);
+ elm_object_focus_allow_set(priv->base, EINA_TRUE);
- layoutmgr_set_layout_data(lmgr, LAYOUT_CHANNELINFO, priv);
+ if (!_draw_channel_layout(priv)) {
+ _ERR("failed to create channel layout");
- return true;
+ evas_object_del(priv->base);
+ free(priv);
-error:
- _ERR("failed to create layout");
- evas_object_del(layout);
- free(priv);
+ return false;
+ }
- return false;
+ 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);
+ layoutmgr_set_layout_data(lmgr, LAYOUT_CHANNELINFO, priv);
+
+ priv->lmgr = lmgr;
+
+ return true;
}
static void _destroy(void *layout_data)
@@ -103,7 +155,11 @@ static void _destroy(void *layout_data)
priv->channel_info = NULL;
}
- evas_object_del(priv->layout);
+ inputmgr_remove_callback(priv->base, &key_handler);
+ elm_layout_signal_callback_del(priv->base, SIGNAL_HIDE_FINISHED,
+ SOURCE_ELM, _hide_finished_cb);
+
+ evas_object_del(priv->base);
free(priv);
}
@@ -118,8 +174,9 @@ static void _show(void *layout_data)
_update_channel_info(priv);
- elm_object_content_set(priv->base, priv->layout);
- evas_object_show(priv->layout);
+ evas_object_show(priv->base);
+
+ elm_object_focus_set(priv->base, EINA_TRUE);
}
static void _hide(void *layout_data)
@@ -131,8 +188,7 @@ static void _hide(void *layout_data)
priv = layout_data;
- evas_object_hide(priv->layout);
- elm_object_content_unset(priv->base);
+ elm_layout_signal_emit(priv->base, SIGNAL_HIDE, SOURCE_ELM);
}
static void _update(void *layout_data, int update_type, void *data)
diff --git a/src/layout_channelinfo_list.c b/src/layout_channelinfo_list.c
index 6cb64de..760d565 100644
--- a/src/layout_channelinfo_list.c
+++ b/src/layout_channelinfo_list.c
@@ -25,6 +25,9 @@
#include "tv.h"
#include "view.h"
+static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Down *ev);
+
enum _order {
CHANNEL_NEXT,
CHANNEL_PREV
@@ -32,7 +35,6 @@ enum _order {
struct _priv {
Evas_Object *base;
- Evas_Object *layout;
Evas_Object *prev_channel;
Evas_Object *current_channel;
Evas_Object *next_channel;
@@ -41,6 +43,10 @@ struct _priv {
layoutmgr *lmgr;
};
+static input_handler key_handler = {
+ .key_down = _key_down_cb,
+};
+
static int _set_next_channel(struct _priv *priv, int order)
{
const struct tv_channel_info *next, *current, *channel;
@@ -140,9 +146,61 @@ static void _update_channel_info(struct _priv *priv)
tv_channel_del_list(channel_list);
}
+static bool _draw_channel_layout(struct _priv *priv)
+{
+ priv->next_channel = util_add_layout(priv->base,
+ GRP_CHANNELINFO_SIMPLE);
+ if (!priv->next_channel)
+ return false;
+
+ elm_object_part_content_set(priv->base,
+ PART_CHANNELINFO_LIST_NEXT, priv->next_channel);
+
+ priv->current_channel = util_add_layout(priv->base, GRP_CHANNELINFO);
+ 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);
+ if (!priv->prev_channel)
+ return false;
+
+ elm_object_part_content_set(priv->base,
+ PART_CHANNELINFO_LIST_PREV, priv->prev_channel);
+
+ return true;
+}
+
+static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Down *ev)
+{
+ if (!strcmp(ev->keyname, KEY_BACK) ||
+ !strcmp(ev->keyname, KEY_BACK_REMOTE) ||
+ !strcmp(ev->keyname, KEY_EXIT)) {
+ viewmgr_hide_view(VIEW_CHANNELINFO);
+ }
+}
+
+static void _hide_finished_cb(void *data, Evas_Object *obj,
+ const char *emission, const char *source)
+{
+ struct _priv *priv;
+
+ if (!data)
+ return;
+
+ priv = data;
+
+ evas_object_hide(priv->base);
+}
+
static bool _create(layoutmgr *lmgr, void *data)
{
struct _priv *priv;
+ Evas_Object *win;
priv = calloc(1, sizeof(*priv));
if (!priv) {
@@ -150,57 +208,40 @@ static bool _create(layoutmgr *lmgr, void *data)
return false;
}
- priv->base = layoutmgr_get_base(lmgr);
+ win = layoutmgr_get_base(lmgr);
+
+ priv->base = elm_layout_add(win);
+ if (!priv->base) {
+ _ERR("failed to create base layout");
+ free(priv);
- priv->layout = elm_layout_add(priv->base);
- if (!priv->layout) {
- _ERR("failed to create layout");
return false;
}
- if (!elm_layout_file_set(priv->layout, EDJEFILE, GRP_CHANNELINFO_LIST))
- goto error;
- priv->next_channel = util_add_layout(priv->layout,
- GRP_CHANNELINFO_SIMPLE);
- if (!priv->next_channel)
- goto error;
- elm_object_part_content_set(priv->layout,
- PART_CHANNELINFO_LIST_NEXT, priv->next_channel);
+ elm_layout_file_set(priv->base, EDJEFILE, GRP_LAYOUT_CHANNELINFO_LIST);
- priv->current_channel = util_add_layout(priv->layout, GRP_CHANNELINFO);
- if (!priv->current_channel)
- goto error;
- elm_object_part_content_set(priv->layout,
- PART_CHANNELINFO_LIST_CURRENT, priv->current_channel);
+ evas_object_size_hint_weight_set(priv->base,
+ EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, priv->base);
+ elm_object_focus_allow_set(priv->base, EINA_TRUE);
- priv->prev_channel = util_add_layout(priv->layout,
- GRP_CHANNELINFO_SIMPLE);
- if (!priv->prev_channel)
- goto error;
- elm_object_part_content_set(priv->layout,
- PART_CHANNELINFO_LIST_PREV, priv->prev_channel);
-
- priv->lmgr = lmgr;
+ if (!_draw_channel_layout(priv)) {
+ _ERR("failed to create channel layout");
- layoutmgr_set_layout_data(lmgr, LAYOUT_CHANNELINFO_LIST, priv);
+ evas_object_del(priv->base);
+ free(priv);
- return true;
-
-error:
- _ERR("failed to create layout");
+ return false;
+ }
- if (priv->layout)
- evas_object_del(priv->layout);
- if (priv->prev_channel)
- evas_object_del(priv->prev_channel);
- if (priv->current_channel)
- evas_object_del(priv->current_channel);
- if (priv->next_channel)
- evas_object_del(priv->next_channel);
+ priv->lmgr = lmgr;
+ layoutmgr_set_layout_data(lmgr, LAYOUT_CHANNELINFO_LIST, priv);
- free(priv);
+ 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);
- return false;
+ return true;
}
static void _destroy(void *layout_data)
@@ -215,7 +256,11 @@ static void _destroy(void *layout_data)
if (priv->channel_info)
tv_channel_del_info(priv->channel_info);
- evas_object_del(priv->layout);
+ inputmgr_remove_callback(priv->base, &key_handler);
+ elm_layout_signal_callback_del(priv->base, SIGNAL_HIDE_FINISHED,
+ SOURCE_ELM, _hide_finished_cb);
+
+ evas_object_del(priv->base);
free(priv);
}
@@ -228,8 +273,9 @@ static void _show(void *layout_data)
priv = layout_data;
- elm_object_content_set(priv->base, priv->layout);
- evas_object_show(priv->layout);
+ evas_object_show(priv->base);
+
+ elm_object_focus_set(priv->base, EINA_TRUE);
}
static void _hide(void *layout_data)
@@ -246,8 +292,7 @@ static void _hide(void *layout_data)
priv->channel_info = NULL;
}
- evas_object_hide(priv->layout);
- elm_object_content_unset(priv->base);
+ elm_layout_signal_emit(priv->base, SIGNAL_HIDE, SOURCE_ELM);
}
static void _update(void *layout_data, int type, void *data)
diff --git a/src/layout_channelinfo_search.c b/src/layout_channelinfo_search.c
index 6aaa01e..4267b7f 100644
--- a/src/layout_channelinfo_search.c
+++ b/src/layout_channelinfo_search.c
@@ -27,10 +27,10 @@
#define DIVIDER_WIDTH 536
#define DIVIDER_HEIGHT 1
-#define DIVIDER_COLOR_R 0
-#define DIVIDER_COLOR_G 0
-#define DIVIDER_COLOR_B 0
-#define DIVIDER_COLOR_A (255 * 0.1)
+#define DIVIDER_COLOR_R 154
+#define DIVIDER_COLOR_G 154
+#define DIVIDER_COLOR_B 154
+#define DIVIDER_COLOR_A 255
struct _priv {
Evas_Object *base;
@@ -66,9 +66,23 @@ static void _tune_channel(void *data)
static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
Evas_Event_Key_Down *ev)
{
+ int op;
+
if (!strcmp(ev->keyname, KEY_ENTER) ||
- !strcmp(ev->keyname, KEY_ENTER_REMOTE))
+ !strcmp(ev->keyname, KEY_ENTER_REMOTE)) {
+ ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+
_tune_channel(data);
+ } else if (!strcmp(ev->keyname, KEY_BACK) ||
+ !strcmp(ev->keyname, KEY_BACK_REMOTE) ||
+ !strcmp(ev->keyname, KEY_EXIT)) {
+ viewmgr_hide_view(VIEW_CHANNELINFO);
+ } else if (!strcmp(ev->keyname, KEY_UP) ||
+ !strcmp(ev->keyname, KEY_DOWN)) {
+ op = START_HIDE_TIMER;
+ viewmgr_update_view(VIEW_CHANNELINFO,
+ UPDATE_TYPE_TIMER, &op);
+ }
}
static void _mouse_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
@@ -77,9 +91,20 @@ static void _mouse_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
_tune_channel(data);
}
+static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Mouse_Move *ev)
+{
+ int op;
+
+ op = START_HIDE_TIMER;
+ viewmgr_update_view(VIEW_CHANNELINFO,
+ UPDATE_TYPE_TIMER, &op);
+}
+
static input_handler channel_handler = {
.key_down = _key_down_cb,
.mouse_down = _mouse_down_cb,
+ .mouse_move = _mouse_move_cb,
};
static void _release_channel_handler(Evas_Object *obj)
@@ -156,6 +181,26 @@ static void _load_channel_list(struct _priv *priv, Eina_List *channel_list)
}
}
+static bool _draw_channel_layout(struct _priv *priv)
+{
+ priv->scroll = util_add_scroller(priv->base, NULL);
+ if (!priv->scroll) {
+ _ERR("failed to create scroll");
+ return false;
+ }
+
+ priv->box = util_add_box(priv->scroll, false);
+ if (!priv->box) {
+ _ERR("failed to create box");
+ evas_object_del(priv->scroll);
+
+ return false;
+ }
+ elm_box_align_set(priv->box, 0.0, 0.5);
+
+ return true;
+}
+
static void _update_channel_list(struct _priv *priv)
{
Eina_List *channel_list;
@@ -179,6 +224,7 @@ static void _update_channel_list(struct _priv *priv)
static bool _create(layoutmgr *lmgr, void *data)
{
struct _priv *priv;
+ Evas_Object *win;
priv = calloc(1, sizeof(*priv));
if (!priv) {
@@ -186,35 +232,35 @@ static bool _create(layoutmgr *lmgr, void *data)
return false;
}
- priv->base = layoutmgr_get_base(lmgr);
+ win = layoutmgr_get_base(lmgr);
- priv->scroll = elm_scroller_add(priv->base);
- if (!priv->scroll) {
- _ERR("failed to create scroll");
- goto error;
+ priv->base = elm_layout_add(win);
+ if (!priv->base) {
+ _ERR("failed to create layout");
+ free(priv);
+
+ return false;
}
- evas_object_size_hint_weight_set(priv->scroll,
+
+ elm_layout_file_set(priv->base, EDJEFILE,
+ GRP_LAYOUT_CHANNELINFO_SEARCH);
+ evas_object_size_hint_weight_set(priv->base,
EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, priv->base);
- priv->box = util_add_box(priv->scroll, false);
- if (!priv->box) {
- _ERR("failed to create box");
- goto error;
+ if (!_draw_channel_layout(priv)) {
+ _ERR("failed to create channel layout");
+
+ evas_object_del(priv->base);
+ free(priv);
+
+ return false;
}
- elm_box_align_set(priv->box, 0.0, 0.5);
priv->lmgr = lmgr;
-
layoutmgr_set_layout_data(lmgr, LAYOUT_CHANNELINFO_SEARCH, priv);
return true;
-
-error:
- evas_object_del(priv->scroll);
- evas_object_del(priv->box);
- free(priv);
-
- return false;
}
static void _destroy(void *layout_data)
@@ -226,7 +272,9 @@ static void _destroy(void *layout_data)
priv = layout_data;
- evas_object_del(priv->scroll);
+ _release_channel_handler(priv->box);
+
+ evas_object_del(priv->base);
free(priv);
}
@@ -241,8 +289,7 @@ static void _show(void *layout_data)
_update_channel_list(priv);
- elm_object_content_set(priv->base, priv->scroll);
- evas_object_show(priv->scroll);
+ evas_object_show(priv->base);
}
static void _hide(void *layout_data)
@@ -254,8 +301,7 @@ static void _hide(void *layout_data)
priv = layout_data;
- elm_object_content_unset(priv->base);
- evas_object_hide(priv->scroll);
+ evas_object_hide(priv->base);
}
static void _update(void *layout_data, int update_type, void *data)
diff --git a/src/util.c b/src/util.c
index 041d77b..272c63e 100644
--- a/src/util.c
+++ b/src/util.c
@@ -94,8 +94,7 @@ Evas_Object *util_add_scroller(Evas_Object *parent, const char *part)
elm_scroller_policy_set(scroll, ELM_SCROLLER_POLICY_OFF,
ELM_SCROLLER_POLICY_OFF);
- if (part)
- elm_object_part_content_set(parent, part, scroll);
+ elm_object_part_content_set(parent, part, scroll);
evas_object_show(scroll);
diff --git a/src/view_channelinfo.c b/src/view_channelinfo.c
index 6a44cbf..20d40c4 100644
--- a/src/view_channelinfo.c
+++ b/src/view_channelinfo.c
@@ -60,48 +60,6 @@ static void _set_current_layout(struct _priv *priv, const char *layout_id)
priv->current_layout = layout_id;
}
-static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
- Evas_Event_Key_Down *ev)
-{
- struct _priv *priv;
- int op;
-
- if (!data) {
- _ERR("failed to get data");
- return;
- }
-
- priv = data;
-
- if (!strcmp(ev->keyname, KEY_ENTER) ||
- !strcmp(ev->keyname, KEY_ENTER_REMOTE)) {
- _set_current_layout(priv, LAYOUT_CHANNELINFO_SEARCH);
- } else if (!strcmp(ev->keyname, KEY_BACK) ||
- !strcmp(ev->keyname, KEY_BACK_REMOTE) ||
- !strcmp(ev->keyname, KEY_EXIT)) {
- viewmgr_hide_view(VIEW_CHANNELINFO);
- } else {
- op = START_HIDE_TIMER;
- viewmgr_update_view(VIEW_CHANNELINFO,
- UPDATE_TYPE_TIMER, &op);
- }
-}
-
-static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
- Evas_Event_Mouse_Move *ev)
-{
- int op;
-
- op = START_HIDE_TIMER;
- viewmgr_update_view(VIEW_CHANNELINFO,
- UPDATE_TYPE_TIMER, &op);
-}
-
-static input_handler key_handler = {
- .key_down = _key_down_cb,
- .mouse_move = _mouse_move_cb,
-};
-
static Eina_Bool _hide_timer(void *data)
{
struct _priv *priv;
@@ -149,20 +107,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
return NULL;
}
- priv->base = elm_layout_add(win);
- if (!priv->base) {
- _ERR("failed to create base object");
- free(priv);
- return NULL;
- }
- elm_layout_file_set(priv->base, EDJEFILE, GRP_VIEW_CHANNELINFO);
- elm_object_focus_allow_set(priv->base, EINA_TRUE);
-
- evas_object_size_hint_weight_set(priv->base,
- EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(win, priv->base);
-
- priv->lmgr = layoutmgr_create(priv->base);
+ priv->lmgr = layoutmgr_create(win);
layoutmgr_add_layout(priv->lmgr, layout_channelinfo_get_lclass(), NULL);
layoutmgr_add_layout(priv->lmgr,
layout_channelinfo_list_get_lclass(), NULL);
@@ -171,9 +116,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
viewmgr_set_view_data(VIEW_CHANNELINFO, priv);
- inputmgr_add_callback(priv->base, 0, &key_handler, priv);
-
- return priv->base;
+ return win;
}
static void _show(void *view_data)
@@ -187,9 +130,6 @@ static void _show(void *view_data)
priv = view_data;
- evas_object_show(priv->base);
- elm_object_focus_set(priv->base, EINA_TRUE);
-
if (!priv->current_layout)
_set_current_layout(priv, LAYOUT_CHANNELINFO);
}
@@ -206,8 +146,6 @@ static void _hide(void *view_data)
priv = view_data;
_hide_current_layout(priv);
-
- evas_object_hide(priv->base);
}
static void _destroy(void *view_data)
@@ -226,10 +164,6 @@ static void _destroy(void *view_data)
layoutmgr_remove_layout(priv->lmgr, LAYOUT_CHANNELINFO_SEARCH);
layoutmgr_destroy(priv->lmgr);
- inputmgr_remove_callback(priv->base, &key_handler);
-
- evas_object_del(priv->base);
-
free(priv);
}