diff options
author | Hyojung Jo <hj903.jo@samsung.com> | 2015-08-25 14:52:01 +0900 |
---|---|---|
committer | Hyojung Jo <hj903.jo@samsung.com> | 2015-08-25 17:27:07 +0900 |
commit | bad9bd9c939363172e2f1cf61ae1834868da5b81 (patch) | |
tree | f03bfb83b07fcf752902572f9aa6bd1994aad83f | |
parent | 13d61c71cb31c22268cdcfed58710b5f32e1e156 (diff) | |
download | air_favorite-bad9bd9c939363172e2f1cf61ae1834868da5b81.tar.gz air_favorite-bad9bd9c939363172e2f1cf61ae1834868da5b81.tar.bz2 air_favorite-bad9bd9c939363172e2f1cf61ae1834868da5b81.zip |
Add notify util function and edc code for notify stylesubmit/tizen/20150825.125147accepted/tizen/tv/20150826.015708
Change-Id: I5c5eebe38e8045eb238130aa1dda80efafb42bee
Signed-off-by: Hyojung Jo <hj903.jo@samsung.com>
-rw-r--r-- | include/utils.h | 3 | ||||
-rw-r--r-- | res/favorite-theme.edc | 2 | ||||
-rw-r--r-- | res/widgets/label.edc | 38 | ||||
-rw-r--r-- | res/widgets/notify.edc | 209 | ||||
-rw-r--r-- | src/common/utils.c | 45 | ||||
-rw-r--r-- | src/view/view_action_menu.c | 3 | ||||
-rw-r--r-- | src/view/view_base.c | 46 |
7 files changed, 316 insertions, 30 deletions
diff --git a/include/utils.h b/include/utils.h index be99fb2..975a8e3 100644 --- a/include/utils.h +++ b/include/utils.h @@ -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__ */ diff --git a/res/favorite-theme.edc b/res/favorite-theme.edc index 11f37c6..9cd2ad9 100644 --- a/res/favorite-theme.edc +++ b/res/favorite-theme.edc @@ -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 index 0000000..df26f9f --- /dev/null +++ b/res/widgets/label.edc @@ -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 index 0000000..c1756e5 --- /dev/null +++ b/res/widgets/notify.edc @@ -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; + } + } +} diff --git a/src/common/utils.c b/src/common/utils.c index f3e7223..ed0958c 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -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; diff --git a/src/view/view_action_menu.c b/src/view/view_action_menu.c index 0f063a5..52d8aed 100644 --- a/src/view/view_action_menu.c +++ b/src/view/view_action_menu.c @@ -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; } diff --git a/src/view/view_base.c b/src/view/view_base.c index c3ef441..c39c01b 100644 --- a/src/view/view_base.c +++ b/src/view/view_base.c @@ -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); } |