Initial : first version
authorJin Yoon <jinny.yoon@samsung.com>
Sun, 12 Jul 2015 16:59:47 +0000 (01:59 +0900)
committerJin Yoon <jinny.yoon@samsung.com>
Sun, 12 Jul 2015 16:59:47 +0000 (01:59 +0900)
inc/adventure.h
inc/initial.h [new file with mode: 0644]
inc/log.h
inc/util.h
res/edje/images/initial.jpg [new file with mode: 0644]
res/edje/initial.edc [new file with mode: 0644]
src/adventure.c
src/initial.c [new file with mode: 0644]

index 64e30df..9f2301f 100644 (file)
 #define EDJ_FILE "edje/adventure.edj"
 #define GRP_MAIN "main"
 
+struct _adventure_info_s {
+       Evas_Object *win;
+       Evas_Object *conform;
+       Evas_Object *initial;
+       Eina_List *view;
+
+       int width;
+       int height;
+};
+typedef struct _adventure_info_s adventure_info_s;
+
+struct _view_info_s {
+       char *name;
+       Evas_Object *view;
+};
+typedef struct _view_info_s view_info_s;
+
 
 #endif /* __ADVENTURE_H__ */
diff --git a/inc/initial.h b/inc/initial.h
new file mode 100644 (file)
index 0000000..3dddf37
--- /dev/null
@@ -0,0 +1,4 @@
+#include <Elementary.h>
+
+extern Evas_Object *initial_create(Evas_Object *parent, int width, int height);
+extern void initial_destroy(Evas_Object *initial);
index 5c98907..f06293f 100644 (file)
--- a/inc/log.h
+++ b/inc/log.h
@@ -4,7 +4,7 @@
 #include <dlog.h>
 
 #undef LOG_TAG
-#define LOG_TAG "YOUR_APPLICATION"
+#define LOG_TAG "ADVENTURE"
 
 #define COLOR_RED           "\033[0;40;31m"
 #define COLOR_LIGHTBLUE     "\033[1;40;34m"
index 5c52759..fc57685 100644 (file)
@@ -37,6 +37,7 @@
 /* SIZE */
 #define FILE_LEN 256
 #define BUFSZE 1024
+#define PATH_LEN 1024
 
 /* Build */
 #define HAPI __attribute__((visibility("hidden")))
diff --git a/res/edje/images/initial.jpg b/res/edje/images/initial.jpg
new file mode 100644 (file)
index 0000000..b984d4c
Binary files /dev/null and b/res/edje/images/initial.jpg differ
diff --git a/res/edje/initial.edc b/res/edje/initial.edc
new file mode 100644 (file)
index 0000000..ed0906a
--- /dev/null
@@ -0,0 +1,80 @@
+images {
+   image: "initial.jpg" COMP;
+}
+
+
+collections {
+   group { name: "main";
+      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: "bg_img";
+            type: IMAGE;
+            scale: 1;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; to: "bg"; }
+               rel2 { relative: 1.0 1.0; to: "bg"; }
+               image {
+                  normal: "initial.jpg";
+               }
+               visible: 1;
+            }
+         }
+         part { name: "point_bg";
+            type: SPACER;
+            description { state: "default" 0.0;
+               align: 0.5 0.5;
+               rel1 { relative: 0.0 0.1; }
+               rel2 { relative: 1.0 0.3; }
+            }
+            description { state: "down" 0.0;
+               inherit: "default" 0.0;
+               rel1 { relative: 0.0 0.4; }
+               rel2 { relative: 1.0 0.6; }
+            }
+         }
+         part { name: "point";
+            type: TEXT;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; to: "point_bg"; }
+               rel2 { relative: 1.0 1.0; to: "point_bg"; }
+               color: 255 255 255 255;
+               text {
+                  font: "TIZEN:style=medium";
+                  size: 80;
+                  text: "@";
+                  align: 0.5 0.5;
+               }
+               visible: 1;
+            }
+         }
+      }
+      programs {
+         program {
+            name: "go_down";
+            signal: "load";
+            action: STATE_SET "down" 0.0;
+            target: "point";
+            transition: ACCELERATE 2.0;
+            after: "go_up";
+         }
+         program {
+            name: "go_up";
+            signal: "load";
+            action: STATE_SET "default" 0.0;
+            target: "point";
+            transition: DECELERATE 2.0;
+            after: "go_down";
+         }
+
+      }
+   }
+}
index b3a1753..6cfb2da 100644 (file)
 #include <tizen.h>
 #include "adventure.h"
 #include "log.h"
-#include "webview.h"
-
-typedef struct appdata{
-       Evas_Object* win;
-       Evas_Object* layout;
-       Evas_Object* conform;
-} appdata_s;
+#include "initial.h"
 
 static void
 win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
@@ -33,39 +27,36 @@ win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
 }
 
 static void
-create_base_gui(appdata_s *ad)
+create_base_gui(adventure_info_s *adventure_info)
 {
-       /* Window */
-       ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
-       elm_win_conformant_set(ad->win, EINA_TRUE);
-       elm_win_autodel_set(ad->win, EINA_TRUE);
-
-       if (elm_win_wm_rotation_supported_get(ad->win)) {
-               int rots[4] = { 0, 90, 180, 270 };
-               elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4);
-       }
+       adventure_info->win = elm_win_util_standard_add(PACKAGE, PACKAGE);
+       elm_win_conformant_set(adventure_info->win, EINA_TRUE);
+       elm_win_autodel_set(adventure_info->win, EINA_TRUE);
 
-       evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL);
+       if (elm_win_wm_rotation_supported_get(adventure_info->win)) {
+               int rots[1] = {0};
+               elm_win_wm_rotation_available_rotations_set(adventure_info->win, (const int *)(&rots), 1);
+       }
+       evas_object_smart_callback_add(adventure_info->win, "delete,request", win_delete_request_cb, NULL);
+       elm_win_screen_size_get(adventure_info->win, NULL, NULL, &adventure_info->width, &adventure_info->height);
 
-       /* Conformant */
-       ad->conform = elm_conformant_add(ad->win);
-       elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW);
-       elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE);
-       evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_win_resize_object_add(ad->win, ad->conform);
-       evas_object_show(ad->conform);
+       adventure_info->conform = elm_conformant_add(adventure_info->win);
+       elm_win_indicator_mode_set(adventure_info->win, ELM_WIN_INDICATOR_HIDE);
+       evas_object_size_hint_weight_set(adventure_info->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(adventure_info->win, adventure_info->conform);
+       evas_object_show(adventure_info->conform);
 
        /* Show window after base gui is set up */
-       evas_object_show(ad->win);
+       evas_object_show(adventure_info->win);
 
 }
 
 static bool
 app_create(void *data)
 {
-       appdata_s *ad = data;
+       adventure_info_s *adventure_info = data;
 
-       create_base_gui(ad);
+       create_base_gui(adventure_info);
 
        return true;
 }
@@ -73,14 +64,11 @@ app_create(void *data)
 static void
 app_control(app_control_h app_control, void *data)
 {
-       appdata_s *ad = data;
-       Evas_Object *webview = NULL;
-
-       webview = webview_create(ad->conform);
-       ret_if(!webview);
-       elm_object_content_set(ad->conform, webview);
+       adventure_info_s *adventure_info = data;
+       Evas_Object *initial = NULL;
 
-       webview_set_url(webview, "http://www.naver.com");
+       initial = initial_create(adventure_info->conform, adventure_info->width, adventure_info->height);
+       ret_if(!initial);
 }
 
 static void
@@ -140,7 +128,7 @@ ui_app_low_memory(app_event_info_h event_info, void *user_data)
 int
 main(int argc, char *argv[])
 {
-       appdata_s ad = {0,};
+       adventure_info_s adventure_info = {0,};
        int ret = 0;
 
        ui_app_lifecycle_callback_s event_callback = {0,};
@@ -152,14 +140,14 @@ main(int argc, char *argv[])
        event_callback.resume = app_resume;
        event_callback.app_control = app_control;
 
-       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
-       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
-       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
-       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
-       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &adventure_info);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &adventure_info);
+       ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &adventure_info);
+       ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &adventure_info);
+       ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &adventure_info);
        ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);
 
-       ret = ui_app_main(argc, argv, &event_callback, &ad);
+       ret = ui_app_main(argc, argv, &event_callback, &adventure_info);
        if (ret != APP_ERROR_NONE) {
                dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main() is failed. err = %d", ret);
        }
diff --git a/src/initial.c b/src/initial.c
new file mode 100644 (file)
index 0000000..924ee8f
--- /dev/null
@@ -0,0 +1,40 @@
+#include <Elementary.h>
+#include <app.h>
+#include "log.h"
+#include "util.h"
+
+const char *const INITIAL_EDC = "initial.edj";
+
+
+
+Evas_Object *initial_create(Evas_Object *parent, int width, int height)
+{
+       Evas_Object *initial = NULL;
+       char *path = NULL;
+       char full_path[PATH_LEN] = {0, };
+
+       retv_if(!parent, NULL);
+
+       path = app_get_resource_path();
+       retv_if(!path, NULL);
+
+       snprintf(full_path, sizeof(full_path), "%s/edje/%s", path, INITIAL_EDC);
+       _D("HELLO, full_path:%s", full_path);
+
+       initial = elm_layout_add(parent);
+       retv_if(!initial, NULL);
+       elm_layout_file_set(initial, full_path, "main");
+       evas_object_size_hint_weight_set(initial, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_min_set(initial, width, height);
+       evas_object_size_hint_max_set(initial, width, height);
+       evas_object_resize(initial, width, height);
+       evas_object_show(initial);
+
+       return initial;
+}
+
+void initial_destroy(Evas_Object *initial)
+{
+       ret_if(!initial);
+       evas_object_del(initial);
+}