[OAPBSA-52][UI] Toast popup creation 53/61053/8
authorMichal Skorupinski <m.skorupinsk@samsung.com>
Thu, 3 Mar 2016 12:06:21 +0000 (13:06 +0100)
committerAgnieszka Janowicz <a.janowicz@samsung.com>
Mon, 7 Mar 2016 10:48:56 +0000 (11:48 +0100)
Change-Id: I9a24682d2195e8377abb1892a60f3c05a8a67240
Signed-off-by: Michal Skorupinski <m.skorupinsk@samsung.com>
include/common/viewmgr.h
include/define.h
res/settings.edc
res/view/common/toast_message.edc [new file with mode: 0644]
src/view/system/view_pincode.c
src/view/view_base.c

index 032ba33..f0172d4 100644 (file)
@@ -46,7 +46,8 @@ enum update_type {
        UPDATE_CONTENT,
        UPDATE_ENABLE,
        UPDATE_DISABLE,
-       UPDATE_REORDER_MODE_ON
+       UPDATE_REORDER_MODE_ON,
+       UPDATE_TOAST
 };
 
 /**
index ea90a1e..573bd6d 100644 (file)
@@ -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"
 #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"
 #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__ */
index 2167ee7..7d7a451 100644 (file)
@@ -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 (file)
index 0000000..f279423
--- /dev/null
@@ -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
index fc8ecec..48381c0 100644 (file)
@@ -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,
index c5cf41d..075d782 100644 (file)
@@ -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;
        }