summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjinwoo.shin <jw0227.shin@samsung.com>2015-09-03 14:16:07 +0900
committerjinwoo.shin <jw0227.shin@samsung.com>2015-09-03 14:16:07 +0900
commitcf24548ef200fedb5909f94766c01c726f3a4690 (patch)
treea9bb0f70f8b2880b0484fcda2b8256219c9ffb34
parenta1d208163b57dff2d31124d5df22449a4bc3bf14 (diff)
downloadair_livetv-cf24548ef200fedb5909f94766c01c726f3a4690.tar.gz
air_livetv-cf24548ef200fedb5909f94766c01c726f3a4690.tar.bz2
air_livetv-cf24548ef200fedb5909f94766c01c726f3a4690.zip
Change-Id: I12d012f4d832fdc37fd27f2d22aa5886cf6e8d3c Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
-rw-r--r--include/define.h12
-rw-r--r--include/strings.h2
-rw-r--r--res/images/btn_menu_add_ch_dis.pngbin0 -> 1472 bytes
-rw-r--r--res/images/btn_menu_add_ch_foc.pngbin0 -> 1464 bytes
-rw-r--r--res/images/btn_menu_add_ch_nor.pngbin0 -> 1548 bytes
-rw-r--r--res/images/btn_menu_add_ch_sel.pngbin0 -> 1527 bytes
-rw-r--r--res/images/btn_menu_add_remove_ch_dis.pngbin0 -> 3355 bytes
-rw-r--r--res/images/btn_menu_add_remove_ch_foc.pngbin0 -> 3352 bytes
-rw-r--r--res/images/btn_menu_add_remove_ch_nor.pngbin0 -> 3383 bytes
-rw-r--r--res/images/btn_menu_add_remove_ch_sel.pngbin0 -> 3461 bytes
-rw-r--r--res/images/btn_menu_remove_favorite_dis.pngbin0 -> 1741 bytes
-rw-r--r--res/images/btn_menu_remove_favorite_foc.pngbin0 -> 1729 bytes
-rw-r--r--res/images/btn_menu_remove_favorite_nor.pngbin0 -> 1780 bytes
-rw-r--r--res/images/btn_menu_remove_favorite_sel.pngbin0 -> 1786 bytes
-rw-r--r--src/view_action_menu.c114
15 files changed, 114 insertions, 14 deletions
diff --git a/include/define.h b/include/define.h
index 6e6279a..4ff5bfd 100644
--- a/include/define.h
+++ b/include/define.h
@@ -67,6 +67,10 @@
#define IMAGE_FAV_FOC IMAGEDIR"/btn_menu_favorite_foc.png"
#define IMAGE_FAV_SEL IMAGEDIR"/btn_menu_favorite_sel.png"
#define IMAGE_FAV_DIS IMAGEDIR"/btn_menu_favorite_dis.png"
+#define IMAGE_UNFAV_NOR IMAGEDIR"/btn_menu_remove_favorite_nor.png"
+#define IMAGE_UNFAV_FOC IMAGEDIR"/btn_menu_remove_favorite_foc.png"
+#define IMAGE_UNFAV_SEL IMAGEDIR"/btn_menu_remove_favorite_sel.png"
+#define IMAGE_UNFAV_DIS IMAGEDIR"/btn_menu_remove_favorite_dis.png"
#define IMAGE_LOCK_NOR IMAGEDIR"/btn_menu_lock_nor.png"
#define IMAGE_LOCK_FOC IMAGEDIR"/btn_menu_lock_foc.png"
#define IMAGE_LOCK_SEL IMAGEDIR"/btn_menu_lock_sel.png"
@@ -75,6 +79,14 @@
#define IMAGE_UNLOCK_FOC IMAGEDIR"/btn_menu_unlock_foc.png"
#define IMAGE_UNLOCK_SEL IMAGEDIR"/btn_menu_unlock_sel.png"
#define IMAGE_UNLOCK_DIS IMAGEDIR"/btn_menu_unlock_dis.png"
+#define IMAGE_ADD_CH_NOR IMAGEDIR"/btn_menu_add_ch_nor.png"
+#define IMAGE_ADD_CH_FOC IMAGEDIR"/btn_menu_add_ch_foc.png"
+#define IMAGE_ADD_CH_SEL IMAGEDIR"/btn_menu_add_ch_sel.png"
+#define IMAGE_ADD_CH_DIS IMAGEDIR"/btn_menu_add_ch_dis.png"
+#define IMAGE_REMOVE_CH_NOR IMAGEDIR"/btn_menu_add_remove_ch_nor.png"
+#define IMAGE_REMOVE_CH_FOC IMAGEDIR"/btn_menu_add_remove_ch_foc.png"
+#define IMAGE_REMOVE_CH_SEL IMAGEDIR"/btn_menu_add_remove_ch_sel.png"
+#define IMAGE_REMOVE_CH_DIS IMAGEDIR"/btn_menu_add_remove_ch_dis.png"
#define IMAGE_FAVORITE_DEFAULT IMAGEDIR"/ic_default_tv.png"
#define VIEW_CHANNELINFO "VIEW_CHANNELINFO"
diff --git a/include/strings.h b/include/strings.h
index a1dfb08..d21f511 100644
--- a/include/strings.h
+++ b/include/strings.h
@@ -28,6 +28,8 @@
#define STR_BUTTON_FAVORITE "Favorite"
#define STR_BUTTON_LOCK "Lock"
#define STR_BUTTON_UNLOCK "Unlock"
+#define STR_BUTTON_ADD_CHANNEL "Channel"
+#define STR_BUTTON_REMOVE_CHANNEL "Channel"
#define STR_NOFAVORITE "No favorite channels"
#define STR_FAVORITE_TOAST "Added to your favorite."
#define STR_UNFAVORITE_TOAST "Removed from your favorite."
diff --git a/res/images/btn_menu_add_ch_dis.png b/res/images/btn_menu_add_ch_dis.png
new file mode 100644
index 0000000..d2f2052
--- /dev/null
+++ b/res/images/btn_menu_add_ch_dis.png
Binary files differ
diff --git a/res/images/btn_menu_add_ch_foc.png b/res/images/btn_menu_add_ch_foc.png
new file mode 100644
index 0000000..9f59e84
--- /dev/null
+++ b/res/images/btn_menu_add_ch_foc.png
Binary files differ
diff --git a/res/images/btn_menu_add_ch_nor.png b/res/images/btn_menu_add_ch_nor.png
new file mode 100644
index 0000000..3e3e14b
--- /dev/null
+++ b/res/images/btn_menu_add_ch_nor.png
Binary files differ
diff --git a/res/images/btn_menu_add_ch_sel.png b/res/images/btn_menu_add_ch_sel.png
new file mode 100644
index 0000000..cdea71b
--- /dev/null
+++ b/res/images/btn_menu_add_ch_sel.png
Binary files differ
diff --git a/res/images/btn_menu_add_remove_ch_dis.png b/res/images/btn_menu_add_remove_ch_dis.png
new file mode 100644
index 0000000..b095ef7
--- /dev/null
+++ b/res/images/btn_menu_add_remove_ch_dis.png
Binary files differ
diff --git a/res/images/btn_menu_add_remove_ch_foc.png b/res/images/btn_menu_add_remove_ch_foc.png
new file mode 100644
index 0000000..a61de3a
--- /dev/null
+++ b/res/images/btn_menu_add_remove_ch_foc.png
Binary files differ
diff --git a/res/images/btn_menu_add_remove_ch_nor.png b/res/images/btn_menu_add_remove_ch_nor.png
new file mode 100644
index 0000000..ec4c147
--- /dev/null
+++ b/res/images/btn_menu_add_remove_ch_nor.png
Binary files differ
diff --git a/res/images/btn_menu_add_remove_ch_sel.png b/res/images/btn_menu_add_remove_ch_sel.png
new file mode 100644
index 0000000..593a830
--- /dev/null
+++ b/res/images/btn_menu_add_remove_ch_sel.png
Binary files differ
diff --git a/res/images/btn_menu_remove_favorite_dis.png b/res/images/btn_menu_remove_favorite_dis.png
new file mode 100644
index 0000000..a85e31f
--- /dev/null
+++ b/res/images/btn_menu_remove_favorite_dis.png
Binary files differ
diff --git a/res/images/btn_menu_remove_favorite_foc.png b/res/images/btn_menu_remove_favorite_foc.png
new file mode 100644
index 0000000..086e864
--- /dev/null
+++ b/res/images/btn_menu_remove_favorite_foc.png
Binary files differ
diff --git a/res/images/btn_menu_remove_favorite_nor.png b/res/images/btn_menu_remove_favorite_nor.png
new file mode 100644
index 0000000..fd4a972
--- /dev/null
+++ b/res/images/btn_menu_remove_favorite_nor.png
Binary files differ
diff --git a/res/images/btn_menu_remove_favorite_sel.png b/res/images/btn_menu_remove_favorite_sel.png
new file mode 100644
index 0000000..7a56a9f
--- /dev/null
+++ b/res/images/btn_menu_remove_favorite_sel.png
Binary files differ
diff --git a/src/view_action_menu.c b/src/view_action_menu.c
index 4f36cf0..a73131b 100644
--- a/src/view_action_menu.c
+++ b/src/view_action_menu.c
@@ -41,6 +41,7 @@ enum _button_id {
BUTTON_LIVETV,
BUTTON_FAV,
BUTTON_LOCK,
+ BUTTON_CHANNEL,
};
enum _button_state {
@@ -138,8 +139,61 @@ static int _lock_state(void)
return r;
}
+static void _channel_clicked(void)
+{
+ const struct tv_channel_info *channel_info;
+ int r;
+
+ channel_info = tv_channel_get_info();
+ if (!channel_info) {
+ _ERR("failed to get channel info");
+ return;
+ }
+
+ if (channel_info->remembered)
+ r = tv_channel_del_channel(channel_info->service_id);
+ else
+ r = tv_channel_add_channel(channel_info->service_id);
+
+ if (r < 0)
+ _ERR("failed to set channel");
+ else {
+ if (channel_info->remembered)
+ viewmgr_update_view(VIEW_ACTION_MENU,
+ UPDATE_TYPE_SHOW_TOAST,
+ STR_REMOVE_CHANNEL_TOAST);
+ else
+ viewmgr_update_view(VIEW_ACTION_MENU,
+ UPDATE_TYPE_SHOW_TOAST,
+ STR_ADD_CHANNEL_TOAST);
+ }
+
+ tv_channel_del_info(channel_info);
+
+ viewmgr_hide_view(VIEW_ACTION_MENU);
+}
+
+static int _channel_state(void)
+{
+ const struct tv_channel_info *channel_info;
+ int r;
+
+ channel_info = tv_channel_get_info();
+ if (!channel_info) {
+ _ERR("failed to get channel info");
+ return STATE_INVALID;
+ }
+
+ r = channel_info->remembered ? STATE_TOGGLE : STATE_UNTOGGLE;
+
+ tv_channel_del_info(channel_info);
+
+ return r;
+}
+
struct _button {
int id;
+ const char *style;
struct _button_data data[2];
void (*clicked)(void);
@@ -149,12 +203,13 @@ struct _button {
static struct _button buttons[] = {
{
.id = BUTTON_FAV,
+ .style = STYLE_ACTION_MENU_BTN,
.data[UNTOGGLE] = {
.text = STR_BUTTON_FAVORITE,
- .normal = IMAGE_FAV_NOR,
- .focused = IMAGE_FAV_FOC,
- .selected = IMAGE_FAV_SEL,
- .disabled = IMAGE_FAV_DIS
+ .normal = IMAGE_UNFAV_NOR,
+ .focused = IMAGE_UNFAV_FOC,
+ .selected = IMAGE_UNFAV_SEL,
+ .disabled = IMAGE_UNFAV_DIS
},
.data[TOGGLE] = {
.text = STR_BUTTON_FAVORITE,
@@ -168,24 +223,45 @@ static struct _button buttons[] = {
},
{
.id = BUTTON_LOCK,
+ .style = STYLE_ACTION_MENU_BTN,
.data[UNTOGGLE] = {
.text = STR_BUTTON_LOCK,
- .normal = IMAGE_LOCK_NOR,
- .focused = IMAGE_LOCK_FOC,
- .selected = IMAGE_LOCK_SEL,
- .disabled = IMAGE_LOCK_DIS
- },
- .data[TOGGLE] = {
- .text = STR_BUTTON_UNLOCK,
.normal = IMAGE_UNLOCK_NOR,
.focused = IMAGE_UNLOCK_FOC,
.selected = IMAGE_UNLOCK_SEL,
.disabled = IMAGE_UNLOCK_DIS
},
+ .data[TOGGLE] = {
+ .text = STR_BUTTON_UNLOCK,
+ .normal = IMAGE_LOCK_NOR,
+ .focused = IMAGE_LOCK_FOC,
+ .selected = IMAGE_LOCK_SEL,
+ .disabled = IMAGE_LOCK_DIS
+ },
.clicked = _lock_clicked,
.state = _lock_state
},
{
+ .id = BUTTON_CHANNEL,
+ .style = STYLE_ACTION_MENU_BTN,
+ .data[UNTOGGLE] = {
+ .text = STR_BUTTON_ADD_CHANNEL,
+ .normal = IMAGE_REMOVE_CH_NOR,
+ .focused = IMAGE_REMOVE_CH_FOC,
+ .selected = IMAGE_REMOVE_CH_SEL,
+ .disabled = IMAGE_REMOVE_CH_DIS
+ },
+ .data[TOGGLE] = {
+ .text = STR_BUTTON_REMOVE_CHANNEL,
+ .normal = IMAGE_ADD_CH_NOR,
+ .focused = IMAGE_ADD_CH_FOC,
+ .selected = IMAGE_ADD_CH_SEL,
+ .disabled = IMAGE_ADD_CH_DIS
+ },
+ .clicked = _channel_clicked,
+ .state = _channel_state
+ },
+ {
.id = BUTTON_INVALID
}
};
@@ -355,6 +431,17 @@ static void _update_favorite(struct _priv *priv)
tv_channel_del_list(channel_list);
}
+static void _update_menu(struct _priv *priv)
+{
+ int i;
+
+ i = 0;
+ while (buttons[i].id != BUTTON_INVALID && i < BUTTON_MAX) {
+ _update_button_state(priv->menu_btn[i], &buttons[i]);
+ i++;
+ }
+}
+
static bool _draw_channel_info(struct _priv *priv)
{
Evas_Object *layout;
@@ -406,7 +493,7 @@ static bool _draw_menu_area(struct _priv *priv)
while (buttons[i].id != BUTTON_INVALID && i < BUTTON_MAX) {
btn = util_add_button(priv->base, NULL,
buttons[i].data[UNTOGGLE].text,
- STYLE_ACTION_MENU_BTN);
+ buttons[i].style);
if (!btn) {
_ERR("Add button failed.");
evas_object_del(table);
@@ -434,8 +521,6 @@ static bool _draw_menu_area(struct _priv *priv)
inputmgr_add_callback(btn, buttons[i].id,
&button_handler, &buttons[i]);
- _update_button_state(btn, &buttons[i]);
-
col = i % ITEMS_IN_ROW;
row = i / ITEMS_IN_ROW;
elm_table_pack(table, btn, col, row, 1, 1);
@@ -565,6 +650,7 @@ static void _show(void *data)
priv = data;
_update_channel_info(priv);
+ _update_menu(priv);
_update_favorite(priv);
evas_object_show(priv->base);