From: Michal Skorupinski Date: Thu, 3 Mar 2016 12:06:21 +0000 (+0100) Subject: [OAPBSA-52][UI] Toast popup creation X-Git-Tag: accepted/tizen/tv/20160308.101500~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d286ce0761dbd2b45917a96c38ca0a7f4e6ca497;p=profile%2Ftv%2Fapps%2Fnative%2Fair_settings.git [OAPBSA-52][UI] Toast popup creation Change-Id: I9a24682d2195e8377abb1892a60f3c05a8a67240 Signed-off-by: Michal Skorupinski --- diff --git a/include/common/viewmgr.h b/include/common/viewmgr.h index 032ba33..f0172d4 100644 --- a/include/common/viewmgr.h +++ b/include/common/viewmgr.h @@ -46,7 +46,8 @@ enum update_type { UPDATE_CONTENT, UPDATE_ENABLE, UPDATE_DISABLE, - UPDATE_REORDER_MODE_ON + UPDATE_REORDER_MODE_ON, + UPDATE_TOAST }; /** diff --git a/include/define.h b/include/define.h index ea90a1e..573bd6d 100644 --- a/include/define.h +++ b/include/define.h @@ -68,6 +68,8 @@ #define GRP_VIEW_POPUP_2BTNS "grp.view.popup_2btns" #define GRP_VIEW_GENERIC_SLIDER "grp.view.generic_slider" +#define GRP_VIEW_TOAST_MESSAGE "grp.toast.message" + /* Part for EDC */ #define PART_TOP_TITLE "part.top.title" #define PART_MENU "part.menu" @@ -132,6 +134,8 @@ #define PART_VIEW_SLIDER_MAX "part.view.slider.max" #define PART_VIEW_SLIDER_CUR "part.view.slider.cur" +#define PART_TOAST_TEXT "part.view.toast.text" + /* Styles */ #define STYLE_MENU_BTN "style.menu.button" #define STYLE_BASE_BTN "style.base.button" @@ -259,5 +263,13 @@ #define SYS_PIN_WARN_SET_MSG_ID 1 #define PIC_SLIDER_UPDATE_VAL 2 +/* Toast popup */ +#define TOAST_POPUP_TIMEOUT 5.0 + + +/* Toast messages */ +#define VIEW_TOAST_MESSAGE_PINCODE "Complete Pin code change" +#define VIEW_TOAST_MESSAGE_FAVORITE_ADD "Added to your favorite" +#define VIEW_TOAST_MESSAGE_FAVORITE_REMOVE "Removed from your favorite" #endif /* __AIR_SETTINGS_DEFINE_H__ */ diff --git a/res/settings.edc b/res/settings.edc index 2167ee7..7d7a451 100644 --- a/res/settings.edc +++ b/res/settings.edc @@ -43,4 +43,5 @@ collections { #include "layout/support.edc" #include "layout/system.edc" #include "layout/voice.edc" + #include "view/common/toast_message.edc" } diff --git a/res/view/common/toast_message.edc b/res/view/common/toast_message.edc new file mode 100644 index 0000000..f279423 --- /dev/null +++ b/res/view/common/toast_message.edc @@ -0,0 +1,40 @@ +group { + name, GRP_VIEW_TOAST_MESSAGE; + + parts { + part { + name, "bg"; + type, RECT; + description { + min, 536 70; + state, "default" 0.0; + color: 255 255 255 255; + } + } + + part { + name, PART_TOAST_TEXT; + type, TEXT; + description { + state, "default" 0.0; + color: 51 51 51 255; + rel1 { + to, bg; + offset, 1 1; + relative, 0 0; + } + rel2 { + to, bg; + offset, -1 -1; + relative, 1 1; + } + text { + font, FONT_LIGHT; + size, 28; + min, 1 1; + ellipsis, -1; + } + } + } + } +} \ No newline at end of file diff --git a/src/view/system/view_pincode.c b/src/view/system/view_pincode.c index fc8ecec..48381c0 100644 --- a/src/view/system/view_pincode.c +++ b/src/view/system/view_pincode.c @@ -254,6 +254,7 @@ static void _hide(void *view_data) static void _cancel_btn_mouse_cb(int id, void *data, Evas_Object *obj) { viewmgr_pop_view(); + viewmgr_update_view(VIEW_BASE, UPDATE_TOAST, VIEW_TOAST_MESSAGE_PINCODE); } static void _pin_entry_key_cb(int id, void *data, Evas *e, Evas_Object *obj, diff --git a/src/view/view_base.c b/src/view/view_base.c index c5cf41d..075d782 100644 --- a/src/view/view_base.c +++ b/src/view/view_base.c @@ -171,6 +171,31 @@ static input_handler _menu_input_handler = { .focused = _menu_focused_cb, }; +static void _show_toast_message(Evas_Object *parent, char *text) +{ + Evas_Object *layout = NULL; + static Evas_Object *popup = NULL; + + if(popup) { + evas_object_del(popup); + } + + popup = elm_notify_add(parent); + if (!popup) { + _ERR("toast == NULL"); + return; + } + + layout = utils_add_layout(popup, GRP_VIEW_TOAST_MESSAGE, EINA_FALSE); + elm_layout_text_set(layout, PART_TOAST_TEXT, text); + elm_object_part_content_set(popup, "default", layout); + + elm_notify_timeout_set(popup, TOAST_POPUP_TIMEOUT); + elm_notify_align_set(popup, 0.0, 1.0); + + evas_object_show(popup); +} + static bool _draw_menu_area(struct _priv *priv) { Evas_Object *box, *btn; @@ -327,6 +352,9 @@ static void _update(void *view_data, int update_type, void *data) case UPDATE_DISABLE: elm_object_disabled_set(priv->base, EINA_TRUE); break; + case UPDATE_TOAST: + _show_toast_message(priv->base, (char*)data); + break; default: break; }