add toast in utils 04/46904/2
authorSoohye Shin <soohye.shin@samsung.com>
Thu, 27 Aug 2015 05:46:15 +0000 (14:46 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Fri, 28 Aug 2015 06:34:02 +0000 (23:34 -0700)
Change-Id: Ic054118fd7a434b49a32f1fecbd5b7076ae1ec4d
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
edje/home-theme.edc
edje/widget/notify.edc [new file with mode: 0644]
include/defs.h
include/utils.h
src/utils.c

index da6ee29..2845082 100644 (file)
@@ -20,4 +20,5 @@ collections {
        #include "widget/label.edc"
        #include "widget/gengrid.edc"
        #include "widget/entry.edc"
+       #include "widget/notify.edc"
 }
diff --git a/edje/widget/notify.edc b/edje/widget/notify.edc
new file mode 100644 (file)
index 0000000..58a869f
--- /dev/null
@@ -0,0 +1,174 @@
+/*
+ * 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.
+ */
+
+styles {
+       style {
+               name: "toast_style";
+               base: "font=TizenSans:style=Light font_size=28 align=center color=#515151";
+               tag: "br" "\n";
+               tag: "tab" "\t";
+       }
+}
+
+group {
+       name: "elm/notify/bottom_left/toast";
+       parts {
+               part {
+                       name: "padding";
+                       type: SPACER;
+                       description {
+                               state: "default" 0.0;
+                               rel1.relative: 0.0 1.0;
+                               rel2.relative: 0.0 1.0;
+                               min: 40 40;
+                               align: 0.0 1.0;
+                               fixed: 1 1;
+                       }
+               }
+               part {
+                       name: "area";
+                       type: SPACER;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1 {
+                                       to: "padding";
+                                       relative: 1.0 0.0;
+                               }
+                               rel2 {
+                                       to: "padding";
+                                       relative: 1.0 0.0;
+                               }
+                               min: 536 70;
+                               max: 536 108;
+                               align: 0.0 1.0;
+                               fixed: 1 1;
+                       }
+               }
+               part {
+                       name: "base";
+                       type: RECT;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               rel1.to: "area";
+                               rel2.to: "area";
+                               align: 1.0 1.0;
+                               color: 255 255 255 255;
+                               fixed: 1 1;
+                       }
+               }
+               part {
+                       name: "border.top";
+                       type: RECT;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               color: 194 194 194 255;
+                               rel1.to: "base";
+                               rel2.to: "base";
+                               rel2.relative: 1.0 0.0;
+                               min: 0 1;
+                               align: 0.0 0.0;
+                               fixed: 0 1;
+                       }
+               }
+               part {
+                       name: "border.left";
+                       type: RECT;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               color: 194 194 194 255;
+                               rel1.to: "base";
+                               rel2.to: "base";
+                               rel2.relative, 0.0 1.0;
+                               min, 1 0;
+                               align, 0.0 0.0;
+                               fixed, 1 0;
+                       }
+               }
+               part {
+                       name: "border.right";
+                       type: RECT;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               color: 194 194 194 255;
+                               rel1.to: "base";
+                               rel2.to: "base";
+                               rel1.relative, 1.0 0.0;
+                               min, 1 0;
+                               align, 1.0 0.0;
+                               fixed, 1 0;
+                       }
+               }
+               part {
+                       name: "border.bottom";
+                       type: RECT;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               color: 194 194 194 255;
+                               rel1.to: "base";
+                               rel2.to: "base";
+                               rel1.relative, 0.0 1.0;
+                               min, 0 1;
+                               align, 0.0 1.0;
+                               fixed, 0 1;
+                       }
+               }
+               part {
+                       name: "elm.swallow.content";
+                       type: SWALLOW;
+                       description {
+                               state: "default" 0.0;
+                               rel1 {
+                                       to: "base";
+                                       relative: 0.5 0.5;
+                               }
+                               rel2 {
+                                       to: "base";
+                                       relative: 0.5 0.5;
+                               }
+                               align: 0.5 0.5;
+                               min: 476 28;
+                               fixed: 1 1;
+                       }
+               }
+       }
+}
+
+group {
+       name: "elm/label/base/toast";
+       parts {
+               part {
+                       name: "elm.text";
+                       type: TEXTBLOCK;
+                       mouse_events: 0;
+                       scale: 1;
+                       description {
+                               state: "default" 0.0;
+                               text {
+                                       style: "toast_style";
+                                       min: 0 1;
+                                       max: 0 1;
+                               }
+                       }
+               }
+       }
+}
+
index 63cbc31..6c63405 100644 (file)
 #define STYLE_LABEL_ACTION_MENU_TITLE "slide_action_menu_title"
 #define STYLE_LABEL_ACTION_MENU_TITLE_FOCUS "slide_action_menu_title_focus"
 #define STYLE_LABEL_ACTION_MENU_TITLE_DIS "slide_action_menu_title_dis"
+#define STYLE_TOAST "toast"
 
 #define COLOR_DEFAULT_R 0
 #define COLOR_DEFAULT_G 119
index 6c42fe5..de543db 100644 (file)
@@ -49,6 +49,7 @@ Evas_Object *utils_add_entry(Evas_Object *base, bool password, bool scroll,
                const char *part, const char *style);
 Evas_Object *utils_add_popup(Evas_Object *base, char *title, char *message);
 Evas_Object *utils_add_rectangle(Evas_Object *base, int r, int g, int b, int a);
+Evas_Object *utils_add_toast(Evas_Object *base, char *message);
 bool utils_launch_app(const char *pkg, const char *key, const char *value);
 
 #endif /* __AIR_HOME_UTILS_H__ */
index 28655dc..25ba2c8 100644 (file)
@@ -409,6 +409,41 @@ Evas_Object *utils_add_rectangle(Evas_Object *base, int r, int g, int b, int a)
        return rect;
 }
 
+Evas_Object *utils_add_toast(Evas_Object *base, char *message)
+{
+       Evas_Object *notify, *label;
+
+       if (!base || !message) {
+               _ERR("Invalid argument");
+               return NULL;
+
+       }
+
+       notify = elm_notify_add(base);
+       if (!notify) {
+               _ERR("failed to add notify");
+               return NULL;
+       }
+
+       elm_object_style_set(notify, STYLE_TOAST);
+       elm_notify_align_set(notify, 0.0, 1.0);
+       elm_notify_timeout_set(notify, 3.0);
+
+       label = elm_label_add(notify);
+       if (!label) {
+               _ERR("failed to add label");
+               evas_object_del(notify);
+               return NULL;
+       }
+       elm_object_style_set(label, STYLE_TOAST);
+       elm_object_text_set(label, message);
+
+       elm_object_content_set(notify, label);
+       evas_object_show(notify);
+
+       return notify;
+}
+
 bool utils_launch_app(const char *pkg, const char *key, const char *value)
 {
        app_control_h app_control;