Moment : Prototyping of the first UI
authorJin Yoon <jinny.yoon@samsung.com>
Wed, 5 Aug 2015 02:52:14 +0000 (11:52 +0900)
committerJin Yoon <jinny.yoon@samsung.com>
Wed, 5 Aug 2015 02:52:14 +0000 (11:52 +0900)
24 files changed:
inc/ctxpopup.h [changed mode: 0755->0644]
inc/db.h [changed mode: 0755->0644]
inc/initial.h [changed mode: 0755->0644]
inc/list.h [changed mode: 0755->0644]
inc/log.h [changed mode: 0755->0644]
inc/login.h [changed mode: 0755->0644]
inc/main.h [changed mode: 0755->0644]
inc/main_view.h [changed mode: 0755->0644]
inc/map.h [changed mode: 0755->0644]
inc/scroller.h [changed mode: 0755->0644]
inc/ui_manager.h [changed mode: 0755->0644]
inc/util.h [changed mode: 0755->0644]
res/edje/main_view.edc
res/edje/map.edc
res/edje/ui_manager.edc
src/ctx_popup.c [changed mode: 0755->0644]
src/db.c [changed mode: 0755->0644]
src/initial.c [changed mode: 0755->0644]
src/list.c [changed mode: 0755->0644]
src/main.c [changed mode: 0755->0644]
src/main_view.c [changed mode: 0755->0644]
src/map.c [changed mode: 0755->0644]
src/scroller.c [changed mode: 0755->0644]
src/ui_manager.c [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index ed2f504..dc621a7
--- a/inc/log.h
+++ b/inc/log.h
@@ -1,5 +1,5 @@
-#ifndef __YOUR_APPLICATION_LOG_H__
-#define __YOUR_APPLICATION_LOG_H__
+#ifndef __MOMENT_LOG_H__
+#define __MOMENT_LOG_H__
 
 #include <dlog.h>
 
@@ -60,4 +60,4 @@
        } \
 }
 
-#endif                         /* __YOUR_APPLICATION_LOG_H__ */
+#endif                         /* __MOMENT_LOG_H__ */
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 7c41ba4..99ec076
@@ -39,8 +39,10 @@ struct _moment_info_s {
        Evas_Object *win;\r
        Evas_Object *conform;\r
        Evas_Object *ui_manager;\r
+       Evas_Object *main_view;\r
+       Evas_Object *scroller;\r
 \r
-       char *res_path;\r
+       Evas *e;\r
 \r
        int width;\r
        int height;\r
old mode 100755 (executable)
new mode 100644 (file)
index 8263593..073352e
@@ -1,7 +1,10 @@
 #ifndef __MAIN_VIEW_H__\r
 #define __MAIN_VIEW_H__\r
 \r
-extern Evas_Object *main_view_create(Evas_Object *parent);\r
+#include <Elementary.h>\r
+#include "main.h"\r
+\r
+extern Evas_Object *main_view_create(Evas_Object *parent, moment_info_s *moment_info);\r
 extern void *main_view_destroy(Evas_Object *main_view);\r
 \r
 #endif /* __MAIN_VIEW_H__ */\r
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index e69de29..7484776 100755 (executable)
@@ -0,0 +1,187 @@
+collections {
+       group {
+               name: "main";
+
+               styles {
+                       style {
+                               name: "description_style";
+                               base: "font=Tizen:style=Bold font_size=26 color=#ffffff align=center text_class=tizen";
+                               tag:  "br" "\n";
+                               tag:  "hilight" "+ font_weight=Bold";
+                               tag:  "b" "+ font_weight=Bold";
+                               tag:  "tab" "\t";
+                       }
+               }
+
+               parts {
+                       part {
+                               name: "bg";
+                               type: SPACER;
+                               description {
+                                       state: "default" 0.0;
+                                       align: 0.0 0.0;
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 1.0 1.0; }
+                               }
+                       }
+                       part {
+                               name: "map";
+                               type: SWALLOW;
+                               scale: 1;
+                               mouse_events: 0;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.5 0.0; to: "bg"; }
+                                       rel2 { relative: 0.5 0.0; to: "bg"; }
+                                       align: 0.5 0.0;
+                                       visible: 1;
+                               }
+                       }
+                       part {
+                               name: "title";
+                               type: TEXT;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 1.0; to: "map"; }
+                                       rel2 { relative: 1.0 1.0; to: "map"; }
+                                       color: 0 0 0 255;
+                                       align: 0.5 0.0;
+                                       min: 0 50;
+                                       visible: 1;
+                                       text {
+                                               text: "";
+                                               font: "Tizen:style=Bold";
+                                               text_class: "tizen";
+                                               min: 0 0;
+                                               size: 32;
+                                               align: 0.5 0.5;
+                                       }
+                               }
+                               description {
+                                       state: "hide" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "description";
+                               type: TEXTBLOCK;
+                               scale: 1;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.0 1.0; to: "title"; }
+                                       rel2 { relative: 1.0 1.0; to: "title"; }
+                                       align: 0.5 0.0;
+                                       min: 0 100;
+                                       visible: 1;
+                                       text {
+                                               text: "";
+                                               style: "description_style";
+                                       }
+                               }
+                               description {
+                                       state: "hide" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "button";
+                               type: SWALLOW;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.5 1.0; to: "bg"; }
+                                       rel2 { relative: 0.5 1.0; to: "bg"; }
+                                       align: 0.5 1.0;
+                                       visible: 1;
+                               }
+                               description {
+                                       state: "hide" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "search";
+                               type: SWALLOW;
+                               scale: 1;
+                               mouse_events: 0;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.5 1.0; to: "map"; }
+                                       rel2 { relative: 0.5 1.0; to: "map"; }
+                                       align: 0.5 0.0;
+                                       visible: 1;
+                               }
+                               description {
+                                       state: "hide" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible: 0;
+                               }
+                       }
+                       part {
+                               name: "content";
+                               type: SWALLOW;
+                               scale: 1;
+                               mouse_events: 0;
+                               description {
+                                       state: "default" 0.0;
+                                       rel1 { relative: 0.5 1.0; to: "search"; }
+                                       rel2 { relative: 0.5 1.0; to: "bg"; }
+                                       align: 0.5 0.0;
+                                       visible: 1;
+                               }
+                               description {
+                                       state: "hide" 0.0;
+                                       inherit: "default" 0.0;
+                                       visible: 0;
+                               }
+                       }
+               }
+               programs {
+                       program {
+                               signal: "hide";
+                               source: "text";
+                               action: STATE_SET "hide" 0.0;
+                               target: "title";
+                               target: "description";
+                       }
+                       program {
+                               signal: "show";
+                               source: "text";
+                               action: STATE_SET "default" 0.0;
+                               target: "title";
+                               target: "description";
+                       }
+
+                       program {
+                               signal: "hide";
+                               source: "button";
+                               action: STATE_SET "hide" 0.0;
+                               target: "button";
+                       }
+                       program {
+                               signal: "show";
+                               source: "button";
+                               action: STATE_SET "default" 0.0;
+                               target: "button";
+                       }
+
+                       program {
+                               signal: "hide";
+                               source: "content";
+                               action: STATE_SET "hide" 0.0;
+                               target: "search";
+                               target: "content";
+                       }
+                       program {
+                               signal: "show";
+                               source: "content";
+                               action: STATE_SET "default" 0.0;
+                               target: "search";
+                               target: "content";
+                       }
+               }
+       }
+}
index 4cbbe06..696a00b 100755 (executable)
@@ -1,3 +1,7 @@
+images {\r
+       image: "" COMP;\r
+}\r
+\r
 collections {\r
        group {\r
                name: "main";\r
@@ -13,42 +17,18 @@ collections {
                                }\r
                        }\r
                        part {\r
-                               name: "map";\r
-                               type: SWALLOW;\r
+                               name: "map_img";\r
+                               type: IMAGE;\r
                                scale: 1;\r
                                mouse_events: 0;\r
                                description { state: "default" 0.0;\r
-                                       rel1 { relative: 0.5 0.0; to: "bg"; }\r
-                                       rel2 { relative: 0.5 0.0; to: "bg"; }\r
-                                       align: 0.5 0.0;\r
-                                       visible: 1;\r
-                         }\r
-                       }\r
-                       part {\r
-                               name: "title";\r
-                               type: TEXT;\r
-                               description {\r
-                                       rel1 { relative: 0.0 1.0; to: "map"; }\r
-                                       rel2 { relative: 1.0 1.0; to: "bg"; }\r
-                                       visible: 1;\r
-                               }\r
-                       }\r
-                       part {\r
-                               name: "description";\r
-                               type: TEXTBLOCK;\r
-                               description {\r
-                                       rel1 { relative: 0.0 1.0; to: "title"; }\r
-                                       rel2 { relative: 1.0 1.0; to: "bg"; }\r
-                                       visible: 1;\r
-                               }\r
-                       }\r
-                       part {\r
-                               name: "button";\r
-                               type: SWALLOW;\r
-                               description {\r
-                                       rel1 { relative: 0.0 1.0; to: "description"; }\r
-                                       rel2 { relative: 1.0 1.0; to: "bg"; }\r
+                                       rel1 { relative: 0.5 0.5; to: "bg"; }\r
+                                       rel2 { relative: 0.5 0.5; to: "bg"; }\r
+                                       align: 0.5 0.5;\r
                                        visible: 1;\r
+                                       image {\r
+                                               normal: "";\r
+                                       }\r
                                }\r
                        }\r
                }\r
index f2635e0..3c9d525 100755 (executable)
@@ -2,9 +2,9 @@ images {
        image: "Aventure01_background.png" COMP;
 }
 
-
 collections {
-       group { name: "main";
+       group {
+               name: "main";
                parts {
                        part {
                                name: "bg";
@@ -29,7 +29,7 @@ collections {
                                                normal: "Aventure01_background.png";
                                        }
                                        visible: 1;
-                         }
+                               }
                        }
                        part {
                                name: "content";
@@ -40,8 +40,15 @@ collections {
                                        visible: 1;
                                }
                        }
-               }
-               programs {
+                       part {
+                               name: "popup";
+                               type: SWALLOW;
+                               description {
+                                       rel1 { relative: 0.0 0.0; }
+                                       rel2 { relative: 1.0 1.0; }
+                                       visible: 1;
+                               }
+                       }
                }
        }
 }
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 7f9f140..4335eb5
@@ -52,6 +52,8 @@ app_create(void *data)
 \r
        _D("Window size (%d:%d)", moment_info->width, moment_info->height);\r
 \r
+       moment_info->e = evas_object_evas_get(moment_info->win);\r
+\r
        return true;\r
 }\r
 \r
old mode 100755 (executable)
new mode 100644 (file)
index 0b4be61..c7e5927
@@ -1,10 +1,25 @@
 #include <Elementary.h>\r
 #include "main.h"\r
 #include "log.h"\r
+#include "scroller"\r
 \r
 const char *const MAIN_VIEW_EDJE = "main_view.edj";\r
 \r
-Evas_Object *main_view_create(Evas_Object *parent)\r
+static _clicked_cb(void *data, Evas_Object *obj, void *event_info)\r
+{\r
+       moment_info_s *moment_info = data;\r
+\r
+       _D("Add button is clicked");\r
+\r
+       ret_if(!moment_info);\r
+\r
+       elm_object_signal_emit(moment_info->main_view\r
+\r
+       moment_info->scroller = scroller_create(moment_info->ui_manager);\r
+       ret_if(!moment_info->scroller);\r
+}\r
+\r
+Evas_Object *main_view_create(Evas_Object *parent, moment_info_s *moment_info)\r
 {\r
        Evas_Object *main_view = NULL;\r
        Evas_Object *button = NULL;\r
@@ -22,6 +37,8 @@ Evas_Object *main_view_create(Evas_Object *parent)
        main_view = elm_layout_add(parent);\r
        retv_if(!main_view, NULL);\r
        elm_layout_file_set(main_view, "main", NULL);\r
+       evas_object_size_hint_weight_set(main_view, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);\r
+       evas_object_size_hint_align_set(main_view, EVAS_HINT_FILL, EVAS_HINT_FILL);\r
        evas_object_show(main_view);\r
 \r
        elm_object_part_text_set(main_view, "title", "No cities");\r
@@ -29,8 +46,11 @@ Evas_Object *main_view_create(Evas_Object *parent)
 \r
        button = elm_button_add(parent);\r
        if (button) {\r
-               evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);\r
+               elm_object_text_set(button, "+ Add");\r
                elm_object_part_content_set(main_view, "button", button);\r
+               evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);\r
+               evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);\r
+               evas_object_smart_callback_add(button, "clicked", _clicked_cb, moment_info);\r
        }\r
 \r
        return main_view;\r
old mode 100755 (executable)
new mode 100644 (file)
index 740b2b1..c5ce96a
--- a/src/map.c
+++ b/src/map.c
@@ -24,15 +24,6 @@ Evas_Object *map_create(Evas_Object *parent)
        elm_layout_file_set(map, "main", NULL);\r
        evas_object_show(map);\r
 \r
-       elm_object_part_text_set(map, "title", "No cities");\r
-       elm_object_part_text_set(map, "description", "After you add cities, they will be shown here.");\r
-\r
-       button = elm_button_add(parent);\r
-       if (button) {\r
-               evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);\r
-               elm_object_part_content_set(map, "button", button);\r
-       }\r
-\r
        return map;\r
 }\r
 \r
@@ -42,10 +33,5 @@ void map_destroy(Evas_Object *map)
 \r
        ret_if(!map);\r
 \r
-       button = elm_object_part_content_unset(map, "button");\r
-       if (button) {\r
-               evas_object_del(button);\r
-       }\r
-\r
        evas_object_del(map);\r
 }\r
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 22bf2b0..ccf295d
@@ -8,25 +8,41 @@ Evas_Object *ui_manager_create(Evas_Object *parent, moment_info_s *moment_info)
 {
        Evas_Object *ui_manager = NULL;
        Evas_Object *rect = NULL;
-       Evas_Object *content = NULL;
-
+       char *path = NULL;
+       char full_path[] = {0, };
 
        retv_if(!parent, NULL);
+       retv_if(!moment_info, NULL);
+
+       path = app_get_resource_path();
+       retv_if(!path, NULL);
+
+       snprintf(full_path, sizeof(full_path), "%s/edje/%s", path, MAIN_VIEW_EDJE);
+       free(path);
 
        ui_manager = elm_layout_add(parent);
        retv_if(!ui_manager, NULL);
+
        elm_layout_file_set(ui_manager, full_path, "main");
        evas_object_size_hint_weight_set(ui_manager, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(ui_manager, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_show(ui_manager);
 
-       rect = evas_object_rectangle_add(evas_object_evas_get(parent));
+       rect = evas_object_rectangle_add(moment_info->e);
        if (rect) {
                evas_object_size_hint_min_set(rect, width, height);
+               evas_object_color_set(rect, 200, 200, 200, 200);
                evas_object_show(rect);
                elm_object_part_content_set(ui_manager, "bg", rect);
        } else
                _E("cannot add a rectangle");
 
+       moment_info->main_view = main_view_create(ui_manager, moment_info);
+       if (moment_info->main_view)
+               elm_object_part_content_set(ui_manager, "content", moment_info->main_view);
+       else
+               _E("cannot add the main view");
+
        return ui_manager;
 }