Update infosquare view 20/42020/1
authorjinwoo.shin <jw0227.shin@samsung.com>
Mon, 22 Jun 2015 04:52:44 +0000 (13:52 +0900)
committerjinwoo.shin <jw0227.shin@samsung.com>
Mon, 22 Jun 2015 05:04:21 +0000 (14:04 +0900)
- Adjust layout for infosquare UX v0.2
- Add callback for notification update
- Add focus event handler
- Add release handler for notification list item release

Change-Id: I95ac13456fe3830ff7b0e066364f1ee39a0e38e0
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
data/view/square_view.edc
images/btn_noti_list_clearall_dis.png
images/btn_noti_list_clearall_foc.png
images/btn_noti_list_clearall_nor.png
images/ic_info_time.png
images/ic_info_weather_slash.png
images/ic_info_weather_temp.png
images/ic_thumbnail_favorite.png
include/define.h
src/main.c
src/square_view.c

index 84d571d..66fc561 100644 (file)
@@ -43,7 +43,7 @@ group {
                                rel1.relative, 1.0 0.0;
                                rel2.relative, 1.0 0.0;
                                state, "default" 0.0;
-                               min, 37 50;
+                               min, 38 50;
                                align, 1.0 0.0;
                                fixed, 1 1;
                        }
@@ -62,7 +62,7 @@ group {
                                        to_x, "margin.notification";
                                        relative, 1.0 1.0;
                                }
-                               min, 489 0;
+                               min, 490 0;
                                align, 0.0 0.0;
                                fixed, 1 0;
                                visible, 0;
@@ -77,8 +77,9 @@ group {
                                        rel2.relative, 0.0 0.0;
                                        color, 48 48 48 255;
                                        align, 0.0 0.0;
-                                       min, 375 65;
+                                       min, 376 66;
                                        fixed, 1 1;
+                                       visible, 1;
                                }
                                part {
                                        name, PART_NOTIFICATION_TITLE;
@@ -87,14 +88,17 @@ group {
                                        description {
                                                state, "default" 0.0;
                                                text {
-                                                       font, "TizenSans";
+                                                       font, FONT_LIGHT;
                                                        text, STR_SQUARE_TITLE;
                                                        size, 36;
                                                        align, 0.5 0.5;
+                                                       min, 1 1;
+                                                       ellipsis, -1;
                                                }
                                                color, 255 255 255 179;
                                                align, 0.0 0.0;
                                                fixed, 1 1;
+                                               visible, 1;
                                        }
                                }
                        }
@@ -107,7 +111,7 @@ group {
                                        rel1.relative, 1.0 0.0;
                                        rel2.relative, 1.0 0.0;
                                        align, 1.0 0.0;
-                                       min, 99 65;
+                                       min, 98 66;
                                        fixed, 1 1;
                                }
                        }
@@ -125,7 +129,7 @@ group {
                                                to_y, PART_NOTIFICATION_TITLE;
                                                relative, 1.0 1.0;
                                        }
-                                       min, 0 63;
+                                       min, 0 62;
                                        align, 0.0 0.0;
                                        fixed, 1 1;
                                }
@@ -186,7 +190,62 @@ group {
                                        }
                                        min, 0 0;
                                        align, 0.0 0.0;
-                                       fixed, 1 1;
+                                       fixed, 0 0;
+                                       visible, 1;
+                               }
+                               description {
+                                       state, "no_notification" 0.0;
+                                       inherit, "default" 0.0;
+                                       visible, 0;
+                               }
+                       }
+                       part {
+                               name, PART_NOTIFICATION_NO_NOTIFICATION_BG;
+                               type, RECT;
+                               scale, 1;
+                               description {
+                                       state, "default" 0.0;
+                                       rel1 {
+                                               to_y, "padding.notification.list";
+                                               relative, 0.0 1.0;
+                                       }
+                                       rel2 {
+                                               to_y, "padding.notification.list";
+                                       }
+                                       color, 48 48 48 255;
+                                       min, 0 788;
+                                       align, 0.0 0.0;
+                                       fixed, 0 1;
+                                       visible, 0;
+                               }
+                               description {
+                                       state, "no_notification" 0.0;
+                                       inherit, "default" 0.0;
+                                       visible, 1;
+                               }
+
+                               part {
+                                       name, PART_NOTIFICATION_NO_NOTIFICATION;
+                                       type, TEXT;
+                                       scale, 1;
+                                       description {
+                                               state, "default" 0.0;
+                                               text {
+                                                       text, STR_NONOTIFICATION;
+                                                       font, FONT_LIGHT;
+                                                       size, 28;
+                                                       align, 0.5 0.5;
+                                               }
+                                               color, 255 255 255 128;
+                                               align, 0.5 0.5;
+                                               fixed, 0 1;
+                                               visible, 0;
+                                       }
+                                       description {
+                                               state, "no_notification" 0.0;
+                                               inherit, "default" 0.0;
+                                               visible, 1;
+                                       }
                                }
                        }
                }
@@ -204,9 +263,9 @@ group {
                                        to_x, "margin.info";
                                        relative, 0.0 1.0;
                                }
-                               min, 500 246;
+                               min, 0 246;
                                align, 1.0 0.0;
-                               fixed, 1 1;
+                               fixed, 0 1;
                                visible, 0;
                        }
                        part {
@@ -215,16 +274,18 @@ group {
                                scale, 1;
                                description {
                                        state, "default" 0.0;
-                                       rel1.relative, 0.0 0.0;
+                                       rel1.relative, 1.0 0.0;
                                        rel2.relative, 1.0 0.0;
                                        text {
-                                               font, "TizenSans";
+                                               font, FONT_LIGHT;
                                                text, STR_DEFAULT_USER_MESSAGE;
                                                size, 56;
                                                align, 1.0 0.0;
+                                               min, 1 1;
+                                               ellipsis, -1;
                                        }
                                        min, 0 56;
-                                       align, 0.0 0.0;
+                                       align, 1.0 0.0;
                                        fixed, 1 1;
                                        visible, 1;
                                }
@@ -243,8 +304,8 @@ group {
                                                to_y, PART_INFO_USER_MESSAGE;
                                                relative, 1.0 1.0;
                                        }
-                                       min, 0 27;
-                                       align, 0.0 0.0;
+                                       min, 0 24;
+                                       align, 1.0 0.0;
                                        fixed, 1 1;
                                }
                        }
@@ -273,14 +334,15 @@ group {
                                        description {
                                                state, "default" 0.0;
                                                rel1.relative, 1.0 0.0;
-                                               rel2.relative, 1.0 1.0;
+                                               rel2.relative, 1.0 0.0;
                                                text {
-                                                       font, "TizenSans";
-                                                       text, STR_DEFAULT_TIME_MINUTE;
+                                                       font, FONT_LIGHT;
                                                        size, 120;
                                                        align, 0.0 1.0;
+                                                       min, 1 0;
+                                                       ellipsis, -1;
                                                }
-                                               min, 132 120;
+                                               min, 0 120;
                                                align, 1.0 0.0;
                                                fixed, 1 1;
                                                visible, 1;
@@ -300,7 +362,7 @@ group {
                                                        to_x, PART_INFO_TIME_MINUTE;
                                                        relative, 0.0 1.0;
                                                }
-                                               min, 22 120;
+                                               min, 28 120;
                                                align, 1.0 0.0;
                                                fixed, 1 1;
                                        }
@@ -319,7 +381,7 @@ group {
                                                        to_x, "padding_right.info.time_separator";
                                                        relative, 0.0 1.0;
                                                }
-                                               min, 15 120;
+                                               min, 14 120;
                                                align, 1.0 0.0;
                                                fixed, 1 1;
                                                visible, 1;
@@ -339,7 +401,7 @@ group {
                                                        to_x, PART_INFO_TIME_SEPARATOR;
                                                        relative, 0.0 1.0;
                                                }
-                                               min, 22 0;
+                                               min, 20 0;
                                                align, 1.0 0.0;
                                                fixed, 1 1;
                                        }
@@ -359,12 +421,13 @@ group {
                                                        relative, 0.0 0.0;
                                                }
                                                text {
-                                                       font, "TizenSans";
-                                                       text, STR_DEFAULT_TIME_HOUR;
+                                                       font, FONT_LIGHT;
                                                        size, 120;
                                                        align, 0.0 1.0;
+                                                       min, 1 0;
+                                                       ellipsis, -1;
                                                }
-                                               min, 132 120;
+                                               min, 0 120;
                                                align, 1.0 0.0;
                                                fixed, 1 1;
                                                visible, 1;
@@ -384,7 +447,7 @@ group {
                                                        to_x, PART_INFO_TIME_HOUR;
                                                        relative, 0.0 0.0;
                                                }
-                                               min, 7 8;
+                                               min, 10 8;
                                                align, 1.0 0.0;
                                                fixed, 1 1;
                                        }
@@ -404,12 +467,13 @@ group {
                                                        relative, 0.0 1.0;
                                                }
                                                text {
-                                                       font, "TizenSans";
-                                                       text, STR_DEFAULT_TIME_AM_PM;
+                                                       font, FONT_LIGHT;
                                                        size, 30;
-                                                       align, 1.0 0.0;
+                                                       align, 1.0 1.0;
+                                                       min, 1 0;
+                                                       ellipsis, -1;
                                                }
-                                               min, 80 30;
+                                               min, 0 30;
                                                align, 1.0 0.0;
                                                fixed, 1 1;
                                                visible, 1;
@@ -431,19 +495,41 @@ group {
                                                relative, 1.0 1.0;
                                        }
                                        text {
-                                               font, "TizenSans";
-                                               text, STR_DEFAULT_DATE;
+                                               font, FONT_LIGHT;
                                                size, 30;
                                                align, 1.0 1.0;
+                                               min, 1 1;
+                                               ellipsis, -1;
                                        }
-                                       min, 0 30;
-                                       align, 0.0 0.0;
+                                       min, 0 46;
+                                       align, 1.0 0.0;
                                        fixed, 1 1;
                                        visible, 1;
                                }
                        }
                }
        }
+
+       programs {
+               program {
+                       name, "no_notification";
+                       signal, SIGNAL_NO_NOTIFICATION;
+                       source, SOURCE_PROGRAM;
+                       action, STATE_SET "no_notification" 0.0;
+                       target, PART_NOTIFICATION_LIST;
+                       target, PART_NOTIFICATION_NO_NOTIFICATION_BG;
+                       target, PART_NOTIFICATION_NO_NOTIFICATION;
+               }
+               program {
+                       name, "notification";
+                       signal, SIGNAL_NOTIFICATION;
+                       action, STATE_SET "default" 0.0;
+                       source, SOURCE_PROGRAM;
+                       target, PART_NOTIFICATION_LIST;
+                       target, PART_NOTIFICATION_NO_NOTIFICATION_BG;
+                       target, PART_NOTIFICATION_NO_NOTIFICATION;
+               }
+       }
 }
 
 group {
@@ -455,7 +541,7 @@ group {
                        scale, 1;
                        description {
                                state, "default" 0.0;
-                               min, 489 112;
+                               min, 490 112;
                                color, 51 51 51 255;
                                visible, 1;
                        }
@@ -479,7 +565,7 @@ group {
                                        to, "border_bg";
                                        relative, 0.5 0.5;
                                }
-                               min, 485 108;
+                               min, 486 108;
                                color, 0 0 0 255;
                                align, 0.5 0.5;
                                fixed, 1 1;
@@ -488,8 +574,8 @@ group {
                        description {
                                state, "focused" 0.0;
                                inherit, "default" 0.0;
-                               min, 481 104;
-                               color, 46 46 46 51;
+                               min, 482 104;
+                               color, 46 46 46 255;
                        }
                }
                part {
@@ -519,6 +605,7 @@ group {
                                        to_x, "padding.icon";
                                        relative, 1.0 0.5;
                                }
+                               color, 255 255 255 153;
                                align, 0.0 0.5;
                                min, 54 54;
                                fixed, 1 1;
@@ -545,7 +632,7 @@ group {
                        }
                }
                part {
-                       name, PART_TEXT;
+                       name, PART_TITLE;
                        type, TEXT;
                        scale, 1;
                        description {
@@ -559,15 +646,42 @@ group {
                                        relative, 1.0 0.5;
                                }
                                text {
-                                       font, "TizenSans";
+                                       font, FONT_LIGHT;
                                        size, 27;
                                        align, 0.0 0.5;
                                }
+                               color, 255 255 255 128;
                                min, 354 27;
                                align, 0.0 0.5;
                                fixed, 1 1;
                                visible, 1;
                        }
+                       description {
+                               state, "focused" 0.0;
+                               inherit, "default" 0.0;
+                               color, 255 255 255 255;
+                               text.font, FONT_REGULAR;
+                       }
+               }
+       }
+       programs {
+               program {
+                       name, "focused";
+                       signal, SIGNAL_FOCUSED;
+                       source, SOURCE_PROGRAM;
+                       action, STATE_SET "focused" 0.0;
+                       target, "border_bg";
+                       target, "bg";
+                       target, PART_TITLE;
+               }
+               program {
+                       name, "unfocused";
+                       signal, SIGNAL_UNFOCUSED;
+                       source, SOURCE_PROGRAM;
+                       action, STATE_SET "default" 0.0;
+                       target, "border_bg";
+                       target, "bg";
+                       target, PART_TITLE;
                }
        }
 }
@@ -590,7 +704,7 @@ group {
                                rel2.relative, 1.0 0.0;
                                color, 48 48 48 255;
                                align, 1.0 0.0;
-                               min, 99 65;
+                               min, 98 66;
                                fixed, 1 1;
                        }
                        part {
index a1125c9..bc1739f 100644 (file)
Binary files a/images/btn_noti_list_clearall_dis.png and b/images/btn_noti_list_clearall_dis.png differ
index fa9fc12..8ee25f6 100644 (file)
Binary files a/images/btn_noti_list_clearall_foc.png and b/images/btn_noti_list_clearall_foc.png differ
index fe2885c..e97cd6d 100644 (file)
Binary files a/images/btn_noti_list_clearall_nor.png and b/images/btn_noti_list_clearall_nor.png differ
index 4f26198..9024476 100644 (file)
Binary files a/images/ic_info_time.png and b/images/ic_info_time.png differ
index 0e7658d..673dc56 100644 (file)
Binary files a/images/ic_info_weather_slash.png and b/images/ic_info_weather_slash.png differ
index 493ab7e..f7c3010 100644 (file)
Binary files a/images/ic_info_weather_temp.png and b/images/ic_info_weather_temp.png differ
index ca55b22..546bb80 100644 (file)
Binary files a/images/ic_thumbnail_favorite.png and b/images/ic_thumbnail_favorite.png differ
index 084cb10..cdc35d1 100644 (file)
 
 #include "strings.h"
 
+/* Definitions for common */
 #define SOURCE_PROGRAM "program"
+
 #define PART_CONTENT "elm.swallow.content"
 #define PART_ICON "elm.swallow.icon"
-#define PART_TEXT "elm.text"
+#define PART_TITLE "elm.text"
+
+#define SIGNAL_FOCUSED "elm,state,focused"
+#define SIGNAL_UNFOCUSED "elm,state,unfocused"
 #define SIGNAL_NO_NOTIFICATION "signal.no_notification"
 #define SIGNAL_NOTIFICATION "signal.notification"
 
+#define FONT_REGULAR "TizenSans"
+#define FONT_LIGHT "TizenSans:style=Light"
+#define FONT_BOLD "TizenSans:style=Bold"
+
+/* Definitions for notification view */
 #define NOTIFICATION_VIEW "NOTIFICATION_VIEW"
 #define GRP_NOTIFICATION_VIEW "grp.notification.view"
 
+/* Definitions for infosquare view */
 #define SQUARE_VIEW "SQUARE_VIEW"
 #define GRP_SQUARE_VIEW "grp.square.view"
 #define PART_NOTIFICATION "part.notification"
index fca0fe5..60bc8b4 100644 (file)
@@ -40,7 +40,7 @@ static Evas_Object *_add_win(const char *name)
                return NULL;
        }
        elm_win_alpha_set(win, EINA_FALSE);
-       elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
+       elm_win_focus_highlight_enabled_set(win, EINA_FALSE);
        elm_win_focus_highlight_style_set(win, "invisible");
 
        evas_object_show(win);
index 582432a..ab5308a 100644 (file)
 #include <inputmgr.h>
 #include <app_debug.h>
 #include <notification.h>
+#include <notification_internal.h>
 #include <vconf.h>
 
 #include "define.h"
 
 #define KEY_USER_MESSAGE "db/setting/user_message"
+#define KEY_NOTI "KEY_NOTI"
 #define CLOCK_UPDATE_DUR 1
 #define NOTIFICATION_ITEM_PADDING_X 0
 #define NOTIFICATION_ITEM_PADDING_Y 20
+#define SIG_CHILD_REMOVED "child,removed"
 
 static void _clear_key_up_cb(int id, void *data,
                Evas *e, Evas_Object *obj, Evas_Event_Key_Up *ev);
 static void _clear_clicked_cb(int id, void *data, Evas_Object *obj);
+static void _child_removed_cb(void *data, Evas_Object *obj, void *ei);
+static void _focused_cb(int id, void *data,
+               Evas_Object *obj, Elm_Object_Item *item);
+static void _unfocused_cb(int id, void *data,
+               Evas_Object *obj, Elm_Object_Item *item);
+static void _mouse_move_cb(int id, void *data, Evas *e,
+               Evas_Object *obj, Evas_Event_Mouse_Move *ev);
 
 struct _priv {
        Evas_Object *base;
        Evas_Object *list;
        Evas_Object *clear_btn;
        Ecore_Timer *clock_timer;
-       notification_list_h noti_list;
 };
 
 static input_handler clear_handler = {
@@ -45,6 +54,12 @@ static input_handler clear_handler = {
        .clicked = _clear_clicked_cb
 };
 
+static input_handler focus_handler = {
+       .focused = _focused_cb,
+       .unfocused = _unfocused_cb,
+       .mouse_move = _mouse_move_cb
+};
+
 static void _print_user_message(struct _priv *priv)
 {
        char *message;
@@ -106,29 +121,25 @@ static void _update_list(struct _priv *priv)
 {
        Evas_Object *icon, *item;
        notification_h noti = NULL;
-       notification_list_h get_list = NULL;
+       notification_list_h noti_list = NULL;
        char *title = NULL, *icon_path = NULL;
 
        elm_box_clear(priv->list);
 
-       if (priv->noti_list) {
-               notification_free_list(priv->noti_list);
-               priv->noti_list = NULL;
-       }
-
-       notification_get_list(NOTIFICATION_TYPE_NOTI, -1, &priv->noti_list);
-       if (priv->noti_list) {
+       notification_get_list(NOTIFICATION_TYPE_NOTI, -1, &noti_list);
+       if (noti_list) {
                elm_object_signal_emit(priv->base,
                                SIGNAL_NOTIFICATION, SOURCE_PROGRAM);
                elm_object_disabled_set(priv->clear_btn, EINA_FALSE);
 
-               get_list = notification_list_get_head(priv->noti_list);
-               noti = notification_list_get_data(get_list);
-               while (get_list != NULL) {
+               while (noti_list != NULL) {
+                       noti = notification_list_get_data(noti_list);
+
                        item = elm_layout_add(priv->list);
                        elm_layout_file_set(item, EDJEFILE,
                                        GRP_NOTIFICATION_ITEM);
                        elm_object_focus_allow_set(item, EINA_TRUE);
+                       evas_object_data_set(item, KEY_NOTI, noti);
 
                        notification_get_image(noti,
                                        NOTIFICATION_IMAGE_TYPE_ICON,
@@ -151,8 +162,9 @@ static void _update_list(struct _priv *priv)
 
                        evas_object_show(item);
 
-                       get_list = notification_list_get_next(get_list);
-                       noti = notification_list_get_data(get_list);
+                       inputmgr_add_callback(item, 0, &focus_handler, NULL);
+
+                       noti_list = notification_list_remove(noti_list, noti);
                }
        } else {
                elm_object_signal_emit(priv->base,
@@ -203,6 +215,14 @@ void stop_clock_timer(struct _priv *priv)
        }
 }
 
+static void _noti_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;
@@ -233,6 +253,8 @@ static Evas_Object *_create(Evas_Object *win, void *data)
        scroller = elm_scroller_add(priv->base);
        if (!scroller)
                goto error;
+       elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF,
+                       ELM_SCROLLER_POLICY_OFF);
        elm_object_part_content_set(priv->base,
                        PART_NOTIFICATION_LIST, scroller);
        evas_object_show(scroller);
@@ -248,6 +270,8 @@ static Evas_Object *_create(Evas_Object *win, void *data)
                        NOTIFICATION_ITEM_PADDING_Y);
        evas_object_show(priv->list);
        elm_object_content_set(scroller, priv->list);
+       evas_object_smart_callback_add(priv->list, SIG_CHILD_REMOVED,
+                       _child_removed_cb, NULL);
 
        priv->clear_btn = elm_layout_add(priv->base);
        elm_layout_file_set(priv->clear_btn, EDJEFILE, GRP_NOTIFICATION_CLEAR);
@@ -256,6 +280,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, &focus_handler, NULL);
        inputmgr_add_callback(priv->clear_btn, 0, &clear_handler, NULL);
 
        viewmgr_set_view_data(SQUARE_VIEW, priv);
@@ -288,6 +313,7 @@ static void _show(void *view_data)
        evas_object_show(priv->base);
 
        start_clock_timer(priv);
+       notification_resister_changed_cb(_noti_changed_cb, priv);
 }
 
 static void _hide(void *view_data)
@@ -302,6 +328,7 @@ static void _hide(void *view_data)
        priv = (struct _priv *) view_data;
 
        stop_clock_timer(priv);
+       notification_unresister_changed_cb(_noti_changed_cb);
 
        evas_object_hide(priv->base);
 }
@@ -317,12 +344,9 @@ static void _destroy(void *view_data)
 
        priv = (struct _priv *) view_data;
 
-       if (priv->noti_list) {
-               notification_free_list(priv->noti_list);
-               priv->noti_list = NULL;
-       }
-
        stop_clock_timer(priv);
+       inputmgr_remove_callback(priv->clear_btn, &clear_handler);
+       inputmgr_remove_callback(priv->clear_btn, &focus_handler);
 
        evas_object_del(priv->base);
 
@@ -341,6 +365,40 @@ static void _clear_clicked_cb(int id, void *data, Evas_Object *obj)
        notification_delete_all(NOTIFICATION_TYPE_NOTI);
 }
 
+static void _focused_cb(int id, void *data,
+               Evas_Object *obj, Elm_Object_Item *item)
+{
+       elm_object_signal_emit(obj, SIGNAL_FOCUSED, SOURCE_PROGRAM);
+}
+
+static void _unfocused_cb(int id, void *data,
+               Evas_Object *obj, Elm_Object_Item *item)
+{
+       elm_object_signal_emit(obj, SIGNAL_UNFOCUSED, SOURCE_PROGRAM);
+}
+
+static void _mouse_move_cb(int id, void *data, Evas *e,
+               Evas_Object *obj, Evas_Event_Mouse_Move *ev)
+{
+       if (!elm_object_focus_get(obj))
+               elm_object_focus_set(obj, EINA_TRUE);
+}
+
+static void _child_removed_cb(void *data, Evas_Object *obj, void *ei)
+{
+       notification_h noti;
+       Evas_Object *item = ei;
+
+       if (!ei)
+               return;
+
+       noti = evas_object_data_del(item, KEY_NOTI);
+       if (noti)
+               notification_free(noti);
+
+       inputmgr_remove_callback(item, &focus_handler);
+}
+
 static view_class vclass = {
        .view_id = SQUARE_VIEW,
        .create = _create,