Add detail popup 86/46686/2 accepted/tizen/tv/20150826.015658 submit/tizen/20150825.125147
authorjinwoo.shin <jw0227.shin@samsung.com>
Tue, 25 Aug 2015 04:22:30 +0000 (13:22 +0900)
committerjinwoo.shin <jw0227.shin@samsung.com>
Tue, 25 Aug 2015 04:40:12 +0000 (13:40 +0900)
Change-Id: I09dc3df16ee3d28a0449a87c18eb82d8a1207287
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
daemon/notification_display_service.c
data/widget/gengrid.edc
src/main.c
src/notification_view.c
src/square_view.c
src/util.c

index 09699b3..ebc890b 100644 (file)
@@ -69,24 +69,6 @@ void _notification_changed_cb(void *data, notification_type_e notif_type)
        notification_free_list(noti_list);
 }
 
-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);
-       }
-}
-
 time_t _get_last_time(void)
 {
        time_t last_time = 0;
@@ -96,9 +78,8 @@ time_t _get_last_time(void)
        notification_get_list(NOTIFICATION_TYPE_NOTI, -1, &noti_list);
        if (noti_list) {
                noti = notification_list_get_data(noti_list);
-               if (noti) {
+               if (noti)
                        notification_get_insert_time(noti, &last_time);
-               }
        }
 
        notification_free_list(noti_list);
@@ -159,9 +140,6 @@ int main(int argc, char **argv)
                return 0;
        }
 
-       /* NOTE: Odroid specific code to workaround time issue */
-       _clear_notification();
-
        priv->last_time = _get_last_time();
 
        error_n = NOTIFICATION_ERROR_SERVICE_NOT_READY;
index b2cc004..6d0483b 100644 (file)
@@ -661,14 +661,12 @@ group {
                        source: "elm";
                        action: STATE_SET "selected" 0.0;
                        target: "map";
-                       transition: DECELERATE 0.2;
                        after: "after_selected";
                }
                program {
                        name: "after_selected";
                        action: STATE_SET "default" 0.0;
                        target: "map";
-                       transition: DECELERATE 0.2;
                        after: "item_selected";
                }
                program {
index ea9344a..645931f 100644 (file)
@@ -85,7 +85,6 @@ static bool _create(void *data)
                return false;
        }
 
-       elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN);
        viewmgr_add_view(notification_view_get_vclass(), NULL);
        viewmgr_add_view(square_view_get_vclass(), NULL);
 
index 3224482..7cca825 100644 (file)
 #define NOTIFICATION_ITEM_PADDING 26
 #define NOTIFICATION_ITEMS_IN_COL 4.0
 
+#define SIG_ITEM_FOCUSED "item,focused"
+#define SIG_ITEM_UNFOCUSED "item,unfocused"
+
+enum _update_type {
+       UPDATE_TYPE_SHOW_POPUP,
+};
+
+enum _obj_id {
+       OBJ_CLEAR,
+       OBJ_TITLE,
+       OBJ_GRID
+};
+
 enum notification_category {
        CATEGORY_FIRST = 0,
        CATEGORY_TODAY = CATEGORY_FIRST,
@@ -72,6 +85,8 @@ static void _clear_mouse_up_cb(int id, void *data,
                Evas *e, Evas_Object *obj, Evas_Event_Mouse_Up *ev);
 static void _category_unfocused_cb(int id, void *data,
                Evas_Object *obj, Elm_Object_Item *it);
+static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj,
+               Evas_Event_Mouse_Move *ev);
 
 static input_handler base_handler = {
        .key_up = _base_key_up_cb,
@@ -83,6 +98,9 @@ static input_handler clear_handler = {
 static input_handler category_handler = {
        .unfocused = _category_unfocused_cb,
 };
+static input_handler focus_handler = {
+       .mouse_move = _mouse_move,
+};
 
 static const char *_get_category_title(int category)
 {
@@ -108,6 +126,23 @@ static const char *_get_category_title(int category)
        }
 }
 
+static void _show_popup(void *data)
+{
+       viewmgr_update_view(NOTIFICATION_VIEW,
+                       UPDATE_TYPE_SHOW_POPUP, data);
+}
+
+static void _grid_select(void *data, Evas_Object *obj, void *event_info)
+{
+       notification_h noti;
+
+       noti = elm_object_item_data_get(event_info);
+       if (!noti)
+               return;
+
+       ecore_job_add(_show_popup, noti);
+}
+
 static Evas_Object *_add_category_title(Evas_Object *base, int category)
 {
        Evas_Object *btn;
@@ -145,6 +180,7 @@ static Evas_Object *_add_category_grid(Evas_Object *base)
        elm_gengrid_horizontal_set(grid, EINA_TRUE);
        evas_object_size_hint_weight_set(grid,
                        EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_gengrid_select_mode_set(grid, ELM_OBJECT_SELECT_MODE_ALWAYS);
 
        elm_object_content_set(base, grid);
 
@@ -194,7 +230,9 @@ static void _draw_category(struct _priv *priv, int category)
        elm_object_focus_next_object_set(grid, grid, ELM_FOCUS_RIGHT);
 
        inputmgr_add_callback(title, category, &category_handler, priv);
+       inputmgr_add_callback(title, OBJ_TITLE, &focus_handler, NULL);
        inputmgr_add_callback(grid, category, &category_handler, priv);
+       inputmgr_add_callback(grid, OBJ_GRID, &focus_handler, NULL);
 
        elm_box_pack_end(priv->category_container, ly);
        evas_object_show(grid);
@@ -216,6 +254,7 @@ static void _draw_notification(struct _priv *priv, int category,
                notification_list_h ongoing_list, notification_list_h noti_list)
 {
        notification_h noti;
+       Elm_Object_Item *it;
        int count = 0, col, w;
 
        if (category < CATEGORY_FIRST ||
@@ -233,8 +272,9 @@ static void _draw_notification(struct _priv *priv, int category,
 
        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);
+               it = elm_gengrid_item_append(priv->category[category]->grid,
+                               priv->grid_class, noti, _grid_select, priv);
+               elm_object_item_data_set(it, noti);
 
                ongoing_list = notification_list_remove(ongoing_list, noti);
                count++;
@@ -242,8 +282,9 @@ static void _draw_notification(struct _priv *priv, int category,
 
        while (noti_list != NULL) {
                noti = notification_list_get_data(noti_list);
-               elm_gengrid_item_append(priv->category[category]->grid,
-                               priv->grid_class, noti, NULL, noti);
+               it = elm_gengrid_item_append(priv->category[category]->grid,
+                               priv->grid_class, noti, _grid_select, priv);
+               elm_object_item_data_set(it, noti);
 
                noti_list = notification_list_remove(noti_list, noti);
                count++;
@@ -400,7 +441,6 @@ static Evas_Object *_create(Evas_Object *win, void *data)
        elm_object_content_set(priv->base, scroller);
        elm_scroller_step_size_set(scroller,
                        NOTIFICATION_CATEGORY_STEP_SIZE, 0);
-       elm_object_focus_allow_set(scroller, EINA_FALSE);
 
        priv->category_container = elm_box_add(scroller);
        elm_object_content_set(scroller, priv->category_container);
@@ -409,6 +449,8 @@ static Evas_Object *_create(Evas_Object *win, void *data)
        elm_box_padding_set(priv->category_container,
                        NOTIFICATION_CATEGORY_PADDING_X,
                        NOTIFICATION_CATEGORY_PADDING_Y);
+       elm_object_focus_allow_set(scroller, EINA_FALSE);
+       elm_object_focus_allow_set(priv->category_container, EINA_FALSE);
 
        priv->clear_btn = elm_layout_add(priv->base);
        elm_layout_file_set(priv->clear_btn, EDJEFILE, GRP_NOTIFICATION_CLEAR);
@@ -417,6 +459,7 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                        PART_NOTIFICATION_CLEAR, priv->clear_btn);
        evas_object_show(priv->clear_btn);
        inputmgr_add_callback(priv->clear_btn, 0, &clear_handler, NULL);
+       inputmgr_add_callback(priv->clear_btn, OBJ_CLEAR, &focus_handler, NULL);
 
        priv->grid_class = elm_gengrid_item_class_new();
        priv->grid_class->item_style = STYLE_GRID_ITEM;
@@ -439,6 +482,8 @@ static void _show(void *view_data)
                return;
        }
 
+       elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_CLICK);
+
        priv = (struct _priv *) view_data;
 
        evas_object_show(priv->base);
@@ -487,8 +532,12 @@ static void _destroy(void *view_data)
                if (priv->category[i]) {
                        inputmgr_remove_callback(priv->category[i]->title,
                                        &category_handler);
+                       inputmgr_remove_callback(priv->category[i]->title,
+                                       &focus_handler);
                        inputmgr_remove_callback(priv->category[i]->grid,
                                        &category_handler);
+                       inputmgr_remove_callback(priv->category[i]->grid,
+                                       &focus_handler);
                        free(priv->category[i]);
                }
        }
@@ -496,12 +545,37 @@ static void _destroy(void *view_data)
        free(priv);
 }
 
+static void _update(void *view_data, int type, void *data)
+{
+       struct _priv *priv;
+       notification_h noti;
+
+       if (!view_data) {
+               _ERR("failed to get view data");
+               return;
+       }
+
+       priv = view_data;
+
+       switch (type) {
+       case UPDATE_TYPE_SHOW_POPUP:
+               noti = data;
+
+               if (!noti)
+                       return;
+
+               util_show_notification_popup(priv->base, noti);
+               break;
+       }
+}
+
 static view_class vclass = {
        .view_id = NOTIFICATION_VIEW,
        .create = _create,
        .show = _show,
        .hide = _hide,
        .destroy = _destroy,
+       .update = _update,
 };
 
 static void _base_key_up_cb(int id, void *data, Evas *e, Evas_Object *obj,
@@ -544,6 +618,29 @@ static void _category_unfocused_cb(int id, void *data,
                                priv->category[id]->title, ELM_FOCUS_DOWN);
 }
 
+static void _mouse_move(int id, void *data, Evas *e, Evas_Object *obj,
+               Evas_Event_Mouse_Move *ev)
+{
+       Elm_Object_Item *it;
+
+       switch (id) {
+       case OBJ_GRID:
+               it = elm_gengrid_at_xy_item_get(obj, ev->cur.canvas.x,
+                               ev->cur.canvas.y, NULL, NULL);
+
+               if (!it)
+                       return;
+
+               if (!elm_object_item_focus_get(it))
+                       elm_object_item_focus_set(it, EINA_TRUE);
+               break;
+       case OBJ_CLEAR:
+       case OBJ_TITLE:
+               elm_object_focus_set(obj, EINA_TRUE);
+               break;
+       }
+}
+
 view_class *notification_view_get_vclass(void)
 {
        return &vclass;
index 8518e0f..6511f63 100644 (file)
@@ -340,6 +340,8 @@ static void _show(void *view_data)
                return;
        }
 
+       elm_config_focus_move_policy_set(ELM_FOCUS_MOVE_POLICY_IN);
+
        priv = (struct _priv *) view_data;
 
        _print_info(priv);
index 90fe646..587eccf 100644 (file)
@@ -50,17 +50,11 @@ static void _key_up_cb(int id, void *data, Evas *e, Evas_Object *obj,
 
 static void _clicked(int id, void *data, Evas_Object *obj)
 {
-       notification_h noti;
-
        if (!data)
                return;
 
        switch (id) {
        case BUTTON_OK:
-               noti = evas_object_data_get(data, KEY_NOTI);
-               if (noti)
-                       notification_delete(noti);
-
                inputmgr_remove_callback(data, &popup_handler);
                evas_object_del(data);
                break;
@@ -79,6 +73,7 @@ Evas_Object *util_show_notification_popup(
                _ERR("create popup failed");
                return NULL;
        }
+       evas_object_show(popup);
 
        notification_get_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, &title);
        elm_object_part_text_set(popup, "title,text", title);
@@ -96,8 +91,6 @@ Evas_Object *util_show_notification_popup(
        evas_object_show(btn1);
        elm_object_focus_set(btn1, EINA_TRUE);
 
-       evas_object_show(popup);
-
        return popup;
 }