Add notify util function and edc code for notify style 96/46696/2 accepted/tizen/tv/20150826.015708 submit/tizen/20150825.125147
authorHyojung Jo <hj903.jo@samsung.com>
Tue, 25 Aug 2015 05:52:01 +0000 (14:52 +0900)
committerHyojung Jo <hj903.jo@samsung.com>
Tue, 25 Aug 2015 08:27:07 +0000 (17:27 +0900)
Change-Id: I5c5eebe38e8045eb238130aa1dda80efafb42bee
Signed-off-by: Hyojung Jo <hj903.jo@samsung.com>
include/utils.h
res/favorite-theme.edc
res/widgets/label.edc [new file with mode: 0644]
res/widgets/notify.edc [new file with mode: 0644]
src/common/utils.c
src/view/view_action_menu.c
src/view/view_base.c

index be99fb2..975a8e3 100644 (file)
@@ -28,6 +28,9 @@ Evas_Object *utils_add_button(Evas_Object *parent, const char *part,
                const char *text, const char *style);
 Evas_Object *utils_add_table(Evas_Object *table, const char *part,
                int padding_x, int padding_y);
+Evas_Object *utils_add_notify(Evas_Object *parent, const char *text,
+               const char *noti_style, const char *label_style,
+               int timeout);
 bool utils_launch_app(const char *appid, const char *key, const char *value);
 
 #endif /* __AIR_FAVORITE_UTILS_H__ */
index 11f37c6..9cd2ad9 100644 (file)
@@ -24,4 +24,6 @@ collections {
        #include "widgets/gengrid_apps.edc"
        #include "widgets/gengrid_webs.edc"
        #include "widgets/button.edc"
+       #include "widgets/notify.edc"
+       #include "widgets/label.edc"
 }
diff --git a/res/widgets/label.edc b/res/widgets/label.edc
new file mode 100644 (file)
index 0000000..df26f9f
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+group {
+       name, "elm/label/base/style.toast";
+       parts {
+               part {
+                       name, "elm.text";
+                       type, TEXT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               rel1.relative, 0.0 0.0;
+                               rel2.relative, 1.0 1.0;
+                               text {
+                                       font, FONT_TIZENSANS_LIGHT;
+                                       size, 28;
+                                       align, 0.5 0.5;
+                                       min, 0 1;
+                               }
+                               color, 51 51 51 255;
+                       }
+               }
+       }
+}
diff --git a/res/widgets/notify.edc b/res/widgets/notify.edc
new file mode 100644 (file)
index 0000000..c1756e5
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+group {
+       name, "elm/notify/bottom_left/style.toast";
+       parts {
+               part {
+                       name, "padding.bottom.left";
+                       type, SPACER;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               min, 40 40;
+                               rel1.relative, 0.0 1.0;
+                               rel2.relative, 0.0 1.0;
+                               align, 0.0 1.0;
+                               fixed, 1 1;
+                       }
+               }
+
+               part {
+                       name, "base";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 255 255 255 255;
+                               min, 536 70;
+                               max, 536 70;
+                               rel1 {
+                                       to, "padding.bottom.left";
+                                       relative, 1.0 0.0;
+                               }
+                               rel2 {
+                                       to, "padding.bottom.left";
+                                       relative, 1.0 0.0;
+                               }
+                               align, 0.0 1.0;
+                               fixed, 1 1;
+                               visible, 0;
+                       }
+                       description {
+                               state, "visible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.up";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 194 194 194 255;
+                               rel1.to, "base";
+                               rel2 {
+                                       to, "base";
+                                       relative, 1.0 0.0;
+                               }
+                               min, 0 1;
+                               align, 0.5 0.0;
+                               fixed, 0 1;
+                               visible, 0;
+                       }
+                       description {
+                               state, "visible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.left";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 194 194 194 255;
+                               rel1 {
+                                       to, "part.inside.line.up";
+                                       relative, 0.0 1.0;
+                               }
+                               rel2 {
+                                       to, "base";
+                                       relative, 0.0 1.0;
+                               }
+                               min, 1 0;
+                               align, 0.0 0.5;
+                               fixed, 1 0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "visible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.right";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 194 194 194 255;
+                               rel1 {
+                                       to, "part.inside.line.up";
+                                       relative, 1.0 1.0;
+                               }
+                               rel2.to, "base";
+                               min, 1 0;
+                               align, 1.0 0.5;
+                               fixed, 1 0;
+                               visible, 0;
+                       }
+                       description {
+                               state, "visible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+               }
+
+               part {
+                       name, "part.inside.line.down";
+                       type, RECT;
+                       scale, 1;
+                       description {
+                               state, "default" 0.0;
+                               color, 194 194 194 255;
+                               rel1 {
+                                       to, "part.inside.line.left";
+                                       relative, 1.0 1.0;
+                               }
+                               rel2 {
+                                       to, "part.inside.line.right";
+                                       relative, 0.0 1.0;
+                               }
+                               min, 0 1;
+                               align, 0.5 1.0;
+                               fixed, 0 1;
+                               visible, 0;
+                       }
+                       description {
+                               state, "visible" 0.0;
+                               inherit, "default" 0.0;
+                               visible, 1;
+                       }
+               }
+
+               part {
+                       name, "elm.swallow.content";
+                       type, SWALLOW;
+                       description {
+                               state, "default" 0.0;
+                               rel1.to, "base";
+                               rel2.to, "base";
+                       }
+               }
+       }
+
+       programs {
+               program {
+                       signal, "show";
+                       source, "";
+                       action, STATE_SET "visible" 0.0;
+                       target, "base";
+                       target, "part.inside.line.up";
+                       target, "part.inside.line.left";
+                       target, "part.inside.line.right";
+                       target, "part.inside.line.down";
+                       transition, DECELERATE 0.5;
+               }
+               program {
+                       signal, "hide";
+                       source, "";
+                       action, STATE_SET "default" 0.0;
+                       target, "base";
+                       target, "part.inside.line.up";
+                       target, "part.inside.line.left";
+                       target, "part.inside.line.right";
+                       target, "part.inside.line.down";
+               }
+               program {
+                       signal, "elm,hide";
+                       source, "elm";
+                       action, STATE_SET "default" 0.0;
+                       target, "base";
+                       target, "part.inside.line.up";
+                       target, "part.inside.line.left";
+                       target, "part.inside.line.right";
+                       target, "part.inside.line.down";
+                       transition, DECELERATE 0.5;
+               }
+       }
+}
index f3e7223..ed0958c 100644 (file)
@@ -184,6 +184,51 @@ Evas_Object *utils_add_table(Evas_Object *parent, const char *part,
        return table;
 }
 
+Evas_Object *utils_add_notify(Evas_Object *parent, const char *text,
+               const char *noti_style, const char *label_style, int timeout)
+{
+       Evas_Object *notify, *lbl;
+
+       if (!parent) {
+               _ERR("Invalid argument.");
+               return NULL;
+       }
+
+       notify = elm_notify_add(parent);
+       if (!notify) {
+               _ERR("elm_notify_add failed.");
+               return NULL;
+       }
+
+       evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND,
+                       EVAS_HINT_EXPAND);
+       elm_notify_align_set(notify, 0.0, 1.0);
+       elm_notify_timeout_set(notify, timeout);
+
+       if (noti_style)
+               elm_object_style_set(notify, noti_style);
+
+       lbl = elm_label_add(notify);
+       if (!lbl) {
+               _ERR("elm_label_add failed.");
+               evas_object_del(notify);
+               return NULL;
+       }
+
+       elm_object_content_set(notify, lbl);
+       evas_object_show(lbl);
+
+       if (label_style)
+               elm_object_style_set(lbl, label_style);
+
+       if (text)
+               elm_object_text_set(lbl, text);
+
+       evas_object_show(notify);
+
+       return notify;
+}
+
 bool utils_launch_app(const char *appid, const char *key, const char *value)
 {
        app_control_h app_ctrl;
index 0f063a5..52d8aed 100644 (file)
@@ -17,6 +17,7 @@
 #include <viewmgr.h>
 #include <inputmgr.h>
 #include <app_contents.h>
+#include <app_define.h>
 #include <app_debug.h>
 
 #include "define.h"
@@ -75,7 +76,7 @@ static void _mouse_move_cb(int id, void *data, Evas *e, Evas_Object *obj,
 
 static void _livetv_selected(void)
 {
-       if (!utils_launch_app(STR_LIVETV_APP_ID, NULL, NULL)) {
+       if (!utils_launch_app(APP_ID_LIVETV, NULL, NULL)) {
                _ERR("Launch live tv failed.");
                return;
        }
index c3ef441..c39c01b 100644 (file)
@@ -81,10 +81,22 @@ static void _draw_content_count(Evas_Object *base, int count, int id)
        }
 }
 
+static void _update_grid_item_list(struct _priv *priv, struct grid_data *gdata)
+{
+       gdata->list = gdata->create_item_list();
+       if (!gdata->list) {
+               elm_object_part_text_set(priv->base, PART_NO_CONTENTS,
+                               STR_NO_CONTENTS);
+               return;
+       }
+
+       if (!gridmgr_append_list(priv->gmgr, gdata->id, gdata->list))
+               _ERR("Gridmgr append list failed.");
+}
+
 static bool _load_current_grid(struct _priv *priv, int id)
 {
        struct grid_data *gdata;
-       Eina_List *list = NULL;
        Evas_Object *prev_grid;
 
        if (!priv || !priv->gmgr || !priv->base) {
@@ -100,27 +112,12 @@ static bool _load_current_grid(struct _priv *priv, int id)
        prev_grid = elm_object_part_content_unset(priv->base, PART_GENGRID);
        evas_object_hide(prev_grid);
 
-       if (!gdata->list) {
-               list = gdata->create_item_list();
-               if (!list) {
-                       elm_object_part_text_set(priv->base, PART_NO_CONTENTS,
-                                       STR_NO_CONTENTS);
-                       _draw_content_count(priv->base, 0, id);
-
-                       return true;
-               }
-
-               if (!gridmgr_append_list(priv->gmgr, gdata->id, list)) {
-                       _ERR("Gridmgr append list failed.");
-                       return false;
-               }
-
-               gdata->list = list;
-       }
-
        elm_object_part_content_set(priv->base, PART_GENGRID, gdata->grid);
        evas_object_show(gdata->grid);
 
+       if (!gdata->list)
+               _update_grid_item_list(priv, gdata);
+
        _draw_content_count(priv->base, eina_list_count(gdata->list), id);
 
        return true;
@@ -513,16 +510,7 @@ static void _update(void *view_data, int update_type, void *data)
        gdata = data;
 
        if (update_type == UPDATE_GRID) {
-               if (!priv || !priv->gmgr || !priv->base)
-                       return;
-
-               gdata->list = gdata->create_item_list();
-               if (!gdata->list)
-                       elm_object_part_text_set(priv->base, PART_NO_CONTENTS,
-                                       STR_NO_CONTENTS);
-               else
-                       gridmgr_append_list(priv->gmgr, gdata->id, gdata->list);
-
+               _update_grid_item_list(priv, gdata);
                _draw_content_count(priv->base, eina_list_count(gdata->list),
                                priv->cur_menu_id);
        }