diff options
author | jinwoo.shin <jw0227.shin@samsung.com> | 2015-08-24 21:56:57 +0900 |
---|---|---|
committer | jinwoo.shin <jw0227.shin@samsung.com> | 2015-08-24 21:56:57 +0900 |
commit | c09d66e3d39480afbe31fe794b13fb922c8bc11a (patch) | |
tree | 07c12031d2af8b56ba26aadf1c85fc317ffc118d | |
parent | c14da7b0782bca3f37ff1a7b508a2bcbaeb95ce6 (diff) | |
download | air_livetv-c09d66e3d39480afbe31fe794b13fb922c8bc11a.tar.gz air_livetv-c09d66e3d39480afbe31fe794b13fb922c8bc11a.tar.bz2 air_livetv-c09d66e3d39480afbe31fe794b13fb922c8bc11a.zip |
Shows toast when action was performedsubmit/tizen/20150824.133824accepted/tizen/tv/20150825.060934
Change-Id: Ie33775e39dacf1e42fc80f7e72fb1c3a8aa677b6
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
-rw-r--r-- | data/live-tv-theme.edc | 1 | ||||
-rw-r--r-- | data/widget/notify.edc | 157 | ||||
-rw-r--r-- | include/strings.h | 8 | ||||
-rw-r--r-- | include/util.h | 1 | ||||
-rw-r--r-- | include/view.h | 2 | ||||
-rw-r--r-- | src/util.c | 38 | ||||
-rw-r--r-- | src/view_action_menu.c | 26 |
7 files changed, 226 insertions, 7 deletions
diff --git a/data/live-tv-theme.edc b/data/live-tv-theme.edc index f5c808a..1e7f622 100644 --- a/data/live-tv-theme.edc +++ b/data/live-tv-theme.edc @@ -18,4 +18,5 @@ collections { #include "widget/button.edc" + #include "widget/notify.edc" } diff --git a/data/widget/notify.edc b/data/widget/notify.edc new file mode 100644 index 0000000..f574396 --- /dev/null +++ b/data/widget/notify.edc @@ -0,0 +1,157 @@ +group { + name: "elm/notify/bottom_left/toast"; + parts { + part { + name: "padding"; + type: SPACER; + description { + state: "default" 0.0; + rel1.relative: 0.0 1.0; + rel2.relative: 0.0 1.0; + min: 40 40; + align: 0.0 1.0; + fixed: 1 1; + } + } + part { + name: "area"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding"; + relative: 1.0 0.0; + } + rel2 { + to: "padding"; + relative: 1.0 0.0; + } + min: 536 70; + max: 536 108; + align: 0.0 1.0; + fixed: 1 1; + } + } + part { + name: "base"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + rel1.to: "area"; + rel2.to: "area"; + align: 1.0 1.0; + color: 255 255 255 255; + fixed: 1 1; + } + } + part { + name: "border.top"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 194 194 194 255; + rel1.to: "base"; + rel2.to: "base"; + rel2.relative: 1.0 0.0; + min: 0 1; + align: 0.0 0.0; + fixed: 0 1; + } + } + part { + name: "border.left"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 194 194 194 255; + rel1.to: "base"; + rel2.to: "base"; + rel2.relative, 0.0 1.0; + min, 1 0; + align, 0.0 0.0; + fixed, 1 0; + } + } + part { + name: "border.right"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 194 194 194 255; + rel1.to: "base"; + rel2.to: "base"; + rel1.relative, 1.0 0.0; + min, 1 0; + align, 1.0 0.0; + fixed, 1 0; + } + } + part { + name: "border.bottom"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 194 194 194 255; + rel1.to: "base"; + rel2.to: "base"; + rel1.relative, 0.0 1.0; + min, 0 1; + align, 0.0 1.0; + fixed, 0 1; + } + } + part { + name: "elm.swallow.content"; + type: SWALLOW; + description { + state: "default" 0.0; + rel1 { + to: "base"; + relative: 0.5 0.5; + } + rel2 { + to: "base"; + relative: 0.5 0.5; + } + align: 0.5 0.5; + min: 476 28; + fixed: 1 1; + } + } + } +} + +group { + name: "elm/label/base/toast"; + styles { + style { + name: "toast_style"; + base: "font=TizenSans:style=Light font_size=28 align=center color=#515151"; + tag: "br" "\n"; + tag: "tab" "\t"; + } + } + parts { + part { + name: "elm.text"; + type: TEXTBLOCK; + mouse_events: 0; + scale: 1; + description { + state: "default" 0.0; + text { + style: "toast_style"; + min: 0 1; + max: 0 1; + } + } + } + } +} + diff --git a/include/strings.h b/include/strings.h index 6652c6d..a1dfb08 100644 --- a/include/strings.h +++ b/include/strings.h @@ -19,7 +19,6 @@ #define STR_NOTITLE "No Information" #define STR_NOTIME "No Data" -#define STR_NOFAVORITE "No favorite channels" #define STR_CHANNEL_PREFIX "CH." #define STR_NOCHANNEL_TITLE "No Channel" #define STR_NOCHANNEL_TEXT "The channel is not found" @@ -29,5 +28,12 @@ #define STR_BUTTON_FAVORITE "Favorite" #define STR_BUTTON_LOCK "Lock" #define STR_BUTTON_UNLOCK "Unlock" +#define STR_NOFAVORITE "No favorite channels" +#define STR_FAVORITE_TOAST "Added to your favorite." +#define STR_UNFAVORITE_TOAST "Removed from your favorite." +#define STR_LOCK_TOAST "Channel is locked." +#define STR_UNLOCK_TOAST "Channel is unlocked." +#define STR_ADD_CHANNEL_TOAST "Added to channel list." +#define STR_REMOVE_CHANNEL_TOAST "Removed from channel list." #endif /* __AIR_LIVETV_STRINGS_H__*/ diff --git a/include/util.h b/include/util.h index 1e29db5..805aec0 100644 --- a/include/util.h +++ b/include/util.h @@ -27,6 +27,7 @@ Evas_Object *util_add_icon(Evas_Object *parent, const char *file, const char *part); Evas_Object *util_add_button(Evas_Object *parent, const char *part, const char *text, const char *style); +Evas_Object *util_add_toast(Evas_Object *parent, char *text); void util_draw_channel_info(Evas_Object *obj, const struct tv_channel_info *channel_info); diff --git a/include/view.h b/include/view.h index 327bedd..7648f05 100644 --- a/include/view.h +++ b/include/view.h @@ -25,7 +25,7 @@ enum _update_type { UPDATE_TYPE_INPUT_KEY_UP, UPDATE_TYPE_NOCHANNEL, UPDATE_TYPE_NOSIGNAL, - UPDATE_TYPE_ACTION_MENU, + UPDATE_TYPE_SHOW_TOAST, }; enum _update_op { @@ -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; } } |