summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjinwoo.shin <jw0227.shin@samsung.com>2015-08-24 21:56:57 +0900
committerjinwoo.shin <jw0227.shin@samsung.com>2015-08-24 21:56:57 +0900
commitc09d66e3d39480afbe31fe794b13fb922c8bc11a (patch)
tree07c12031d2af8b56ba26aadf1c85fc317ffc118d /src
parentc14da7b0782bca3f37ff1a7b508a2bcbaeb95ce6 (diff)
downloadair_livetv-c09d66e3d39480afbe31fe794b13fb922c8bc11a.tar.gz
air_livetv-c09d66e3d39480afbe31fe794b13fb922c8bc11a.tar.bz2
air_livetv-c09d66e3d39480afbe31fe794b13fb922c8bc11a.zip
Change-Id: Ie33775e39dacf1e42fc80f7e72fb1c3a8aa677b6 Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
Diffstat (limited to 'src')
-rw-r--r--src/util.c38
-rw-r--r--src/view_action_menu.c26
2 files changed, 59 insertions, 5 deletions
diff --git a/src/util.c b/src/util.c
index d7b4044..518fad5 100644
--- a/src/util.c
+++ b/src/util.c
@@ -22,6 +22,8 @@
#include "view.h"
#define BUF_MAX 128
+#define TOAST_TIMEOUT 5.0
+#define STYLE_TOAST "toast"
Evas_Object *util_add_layout(Evas_Object *parent, const char *group)
{
@@ -157,6 +159,42 @@ Evas_Object *util_add_button(Evas_Object *parent, const char *part,
return btn;
}
+Evas_Object *util_add_toast(Evas_Object *parent, char *text)
+{
+ Evas_Object *toast, *content;
+
+ if (!parent) {
+ _ERR("Invalid argument.");
+ return NULL;
+ }
+
+ toast = elm_notify_add(parent);
+ if (!toast) {
+ _ERR("elm_popup_add failed");
+ return NULL;
+ }
+
+ elm_object_style_set(toast, STYLE_TOAST);
+ elm_notify_align_set(toast, 0.0, 1.0);
+ elm_notify_timeout_set(toast, TOAST_TIMEOUT);
+
+ content = elm_label_add(toast);
+ if (!content) {
+ _ERR("elm_label_add failed");
+ evas_object_del(toast);
+ return NULL;
+ }
+
+ elm_object_text_set(content, text);
+ elm_object_style_set(content, STYLE_TOAST);
+ elm_object_content_set(toast, content);
+ evas_object_show(content);
+
+ evas_object_show(toast);
+
+ return toast;
+}
+
static int _get_program_time(char *buf, int buf_len, time_t start_time,
time_t end_time)
{
diff --git a/src/view_action_menu.c b/src/view_action_menu.c
index 8e5438c..a012383 100644
--- a/src/view_action_menu.c
+++ b/src/view_action_menu.c
@@ -51,6 +51,7 @@ enum _button_state {
};
struct _priv {
+ Evas_Object *win;
Evas_Object *base;
Evas_Object *channel_info;
Evas_Object *menu_btn[BUTTON_MAX];
@@ -80,10 +81,20 @@ static void _fav_clicked(void)
!channel_info->favorite);
if (r < 0)
_ERR("failed to set favorite");
-
- viewmgr_update_view(VIEW_ACTION_MENU, UPDATE_TYPE_ACTION_MENU, NULL);
+ else {
+ if (channel_info->favorite)
+ viewmgr_update_view(VIEW_ACTION_MENU,
+ UPDATE_TYPE_SHOW_TOAST,
+ STR_UNFAVORITE_TOAST);
+ else
+ viewmgr_update_view(VIEW_ACTION_MENU,
+ UPDATE_TYPE_SHOW_TOAST,
+ STR_FAVORITE_TOAST);
+ }
tv_channel_del_info(channel_info);
+
+ viewmgr_hide_view(VIEW_ACTION_MENU);
}
static int _fav_state(void)
@@ -509,6 +520,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
elm_win_resize_object_add(win, base);
priv->base = base;
+ priv->win = win;
if (!viewmgr_set_view_data(VIEW_ACTION_MENU, priv)) {
_ERR("Set view data failed.");
@@ -608,9 +620,13 @@ static void _update(void *view_data, int type, void *data)
viewmgr_show_view(VIEW_ACTION_MENU);
break;
}
- case UPDATE_TYPE_ACTION_MENU:
- _update_channel_info(priv);
- _update_favorite(priv);
+ case UPDATE_TYPE_SHOW_TOAST:
+ if (!data) {
+ _ERR("failed to get data");
+ return;
+ }
+
+ util_add_toast(priv->win, data);
break;
}
}