Update notification 06/44606/1 accepted/tizen/tv/20150728.070557 submit/tizen/20150728.063352
authorjinwoo.shin <jw0227.shin@samsung.com>
Thu, 23 Jul 2015 12:52:06 +0000 (21:52 +0900)
committerjinwoo.shin <jw0227.shin@samsung.com>
Thu, 23 Jul 2015 12:54:31 +0000 (21:54 +0900)
- Add ongoing type notification
- Update notification layout
- Substitute clear notification function
- Add notification changed callback on notification view

Change-Id: Idb0d7d1bd604470657ec079b60dc26fa7873a0e7
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
data/view/notification_view.edc
data/widget/button.edc
src/notification_view.c

index e8cc3d4..9e1012c 100644 (file)
@@ -152,7 +152,7 @@ group {
                                        relative, 0.5 1.0;
                                }
                                color, 229 229 229 255;
-                               min, 1796 788;
+                               min, 1796 614;
                                align, 0.5 0.0;
                                fixed, 1 1;
                                visible, 0;
@@ -170,9 +170,9 @@ group {
                                description {
                                        state, "default" 0.0;
                                        text {
-                                               font, FONT_REGULAR;
+                                               font, FONT_LIGHT;
                                                text, STR_NONOTIFICATION;
-                                               size, 40;
+                                               size, 32;
                                                align, 0.5 0.5;
                                        }
                                        color, 0 0 0 179;
index 8d44dce..4b2ec61 100644 (file)
@@ -46,7 +46,7 @@ group {
                 state: "default" 0.0;
                 rel1.relative: 0.0 0.0;
                 rel2.relative: 0.0 0.0;
-                align: 0.0 0.0;
+                align: 1.0 0.0;
                 min: 16 16;
                 fixed: 1 1;
             }
index fddad23..24811d6 100644 (file)
@@ -20,6 +20,7 @@
 #include <app_debug.h>
 #include <notification.h>
 #include <notification_noti.h>
+#include <notification_internal.h>
 
 #include "define.h"
 
@@ -211,7 +212,7 @@ error:
 }
 
 static void _draw_notification(struct _priv *priv, int category,
-               notification_list_h noti_list)
+               notification_list_h ongoing_list, notification_list_h noti_list)
 {
        notification_h noti;
        int count = 0, col, w;
@@ -229,6 +230,15 @@ static void _draw_notification(struct _priv *priv, int category,
 
        elm_gengrid_clear(priv->category[category]->grid);
 
+       while (ongoing_list != NULL) {
+               noti = notification_list_get_data(ongoing_list);
+               elm_gengrid_item_append(priv->category[category]->grid,
+                               priv->grid_class, noti, NULL, noti);
+
+               ongoing_list = notification_list_remove(ongoing_list, noti);
+               count++;
+       }
+
        while (noti_list != NULL) {
                noti = notification_list_get_data(noti_list);
                elm_gengrid_item_append(priv->category[category]->grid,
@@ -250,11 +260,12 @@ static void _draw_notification(struct _priv *priv, int category,
 
 static void _update_list(struct _priv *priv)
 {
-       notification_list_h noti_list = NULL;
+       notification_list_h ongoing_list = NULL, noti_list = NULL;
        Elm_Object_Item *it;
 
        notification_get_list(NOTIFICATION_TYPE_NOTI, -1, &noti_list);
-       if (!noti_list) {
+       notification_get_list(NOTIFICATION_TYPE_ONGOING, -1, &ongoing_list);
+       if (!ongoing_list && !noti_list) {
                elm_object_signal_emit(priv->base,
                                SIGNAL_NO_NOTIFICATION, SOURCE_PROGRAM);
                elm_object_disabled_set(priv->clear_btn, EINA_TRUE);
@@ -272,7 +283,7 @@ static void _update_list(struct _priv *priv)
        if (!priv->category[CATEGORY_TODAY])
                _draw_category(priv, CATEGORY_TODAY);
 
-       _draw_notification(priv, CATEGORY_TODAY, noti_list);
+       _draw_notification(priv, CATEGORY_TODAY, ongoing_list, noti_list);
 
        if (priv->category[CATEGORY_TODAY]) {
                it = elm_gengrid_first_item_get(
@@ -347,6 +358,14 @@ static void _grid_del(void *data, Evas_Object *obj)
        notification_free(noti);
 }
 
+static void _notification_changed_cb(void *data, notification_type_e type)
+{
+       struct _priv *priv = data;
+
+       if (priv)
+               _update_list(priv);
+}
+
 static Evas_Object *_create(Evas_Object *win, void *data)
 {
        struct _priv *priv;
@@ -423,6 +442,8 @@ static void _show(void *view_data)
        evas_object_show(priv->base);
 
        _update_list(priv);
+
+       notification_resister_changed_cb(_notification_changed_cb, priv);
 }
 
 static void _hide(void *view_data)
@@ -436,6 +457,8 @@ static void _hide(void *view_data)
 
        priv = (struct _priv *) view_data;
 
+       notification_unresister_changed_cb(_notification_changed_cb);
+
        evas_object_hide(priv->base);
 }
 
@@ -488,17 +511,35 @@ static void _base_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj,
        }
 }
 
+static void _clear_notification(void)
+{
+       notification_list_h noti_list = NULL;
+       notification_h noti;
+
+       notification_get_list(NOTIFICATION_TYPE_NOTI, -1, &noti_list);
+       if (!noti_list)
+               return;
+
+       while (noti_list != NULL) {
+               noti = notification_list_get_data(noti_list);
+               notification_delete(noti);
+
+               noti_list = notification_list_remove(noti_list, noti);
+               notification_free(noti);
+       }
+}
+
 static void _clear_key_up_cb(int id, void *data, Evas *e,
                Evas_Object *obj, Evas_Event_Key_Up *ev)
 {
        if (!strcmp(ev->keyname, KEY_ENTER))
-               notification_delete_all(NOTIFICATION_TYPE_NOTI);
+               _clear_notification();
 }
 
 static void _clear_mouse_up_cb(int id, void *data, Evas *e,
                Evas_Object *obj, Evas_Event_Mouse_Up *ev)
 {
-       notification_delete_all(NOTIFICATION_TYPE_NOTI);
+       _clear_notification();
 }
 
 static void _category_unfocused_cb(int id, void *data,