--- /dev/null
+#ifndef __MOMENT_CITY_H__\r
+#define __MOMENT_CITY_H__\r
+\r
+enum {\r
+ CITY_HONOLULU = 0,\r
+ CITY_LOS_ANGELES,\r
+ CITY_SAN_FRANCISCO,\r
+ CITY_VANCOUVER,\r
+ CITY_CHICAGO,\r
+ CITY_MEICO_CITY,\r
+ CITY_SAN_JOSE,\r
+ CITY_NEW_YORK_CITY,\r
+ CITY_TORONTO,\r
+ CITY_WASHINGTON_DC,\r
+ CITY_BRASILIA,\r
+ CITY_BUENOS_AIRES,\r
+ CITY_SAO_PAULO,\r
+ CITY_DUBLIN,\r
+ CITY_LISBON,\r
+ CITY_LONDON,\r
+ CITY_AMSTERDAM,\r
+ CITY_BARCELONA,\r
+ CITY_BERLIN,\r
+ CITY_BRUSSELS,\r
+ CITY_CAPE_TOWN,\r
+ CITY_GENEVA,\r
+ CITY_MADRID,\r
+ CITY_PARIS,\r
+ CITY_ROME,\r
+ CITY_STOCKHOLM,\r
+ CITY_WARSAW,\r
+ CITY_ANKARA,\r
+ CITY_ATHENS,\r
+ CITY_HELSINKI,\r
+ CITY_ISTANBUL,\r
+ CITY_JERUSALEM,\r
+ CITY_KAHIRA,\r
+ CITY_BAGHDAD,\r
+ CITY_DUBAI,\r
+ CITY_MOSCOW,\r
+ CITY_ISLAMABAD,\r
+ CITY_DELHI,\r
+ CITY_MUMBAI,\r
+ CITY_BOMBAY,\r
+ CITY_CALCUTTA,\r
+ CITY_BANGKOK,\r
+ CITY_JAKARTA,\r
+ CITY_BEIJING,\r
+ CITY_HONG_KONG,\r
+ CITY_SINGAPORE,\r
+ CITY_TAIPEI,\r
+ CITY_SEOUL,\r
+ CITY_TOKYO,\r
+ CITY_SYDNEY,\r
+ CITY_MAX,\r
+};\r
+\r
+struct _city_info_s {\r
+ int id;\r
+ float timezone;\r
+ char *name;\r
+ char *nation;\r
+};\r
+typedef struct _city_info_s city_s;\r
+\r
+extern city_s *city_get(void);\r
+\r
+#endif /* __MOMENT_CITY_H__ */\r
Evas_Object *conform;\r
Evas_Object *ui_manager;\r
Evas_Object *main_view;\r
+ Evas_Object *result_view;\r
Evas_Object *scroller;\r
\r
Evas *e;\r
--- /dev/null
+#ifndef __MAIN_VIEW_H__\r
+#define __MAIN_VIEW_H__\r
+\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
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd.
+ *
+ * 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/license/
+ *
+ * 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.
+ */
+
+#ifndef __ADVENTURE_H__
+#define __ADVENTURE_H__
+
+#include <app.h>
+#include <Elementary.h>
+#include <system_settings.h>
+#include <efl_extension.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "adventure"
+
+#if !defined(PACKAGE)
+#define PACKAGE "org.tizen.adventure"
+#endif
+
+#define EDJ_FILE "edje/adventure.edj"
+#define GRP_MAIN "main"
+
+struct _adventure_info_s {
+ Evas_Object *win;
+ Evas_Object *conform;
+ Evas_Object *adventure;
+ Evas_Object *initial;
+ Evas_Object *loading;
+ Evas_Object *ui_manager;
+
+ Ecore_Timer *initial_timer;
+
+ Eina_List *view;
+
+ int width;
+ int height;
+};
+typedef struct _adventure_info_s adventure_info_s;
+
+struct _path_info_s {
+ int path_id;
+ int created_time;
+ int duration;
+ int rate;
+
+ char *title;
+ char *title_image;
+ char *content;
+ char *author;
+};
+typedef struct _path_info_s path_info_s;
+
+struct _point_info_s {
+ int point_id;
+ int path_id;
+
+ char *title;
+ char *nation;
+ char *district;
+ char *title_image;
+ char *content;
+ char *map_image;
+ char *duration;
+};
+typedef struct _point_info_s point_info_s;
+
+struct _user_info_s {
+ char *user_id;
+ char *password;
+};
+typedef struct _user_info_s user_info_s;
+
+#endif /* __ADVENTURE_H__ */
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd.
+ *
+ * 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/license/
+ *
+ * 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.
+ */
+
+#ifndef __ADVENTURE_DB_H__
+#define __ADVENTURE_DB_H__
+
+#include <sqlite3.h>
+#include "util.h"
+
+extern sqlite3 *db_open(void);
+extern void db_close(sqlite3 *db);
+
+extern sqlite3_stmt *db_prepare(sqlite3 *db, const char *query);
+extern int db_next(sqlite3 *db, sqlite3_stmt *stmt);
+extern int db_reset(sqlite3 *db, sqlite3_stmt *stmt);
+
+extern int db_bind_bool(sqlite3 *db, sqlite3_stmt *stmt, int idx, bool value);
+extern int db_bind_int(sqlite3 *db, sqlite3_stmt *stmt, int idx, int value);
+extern int db_bind_double(sqlite3 *db, sqlite3_stmt *stmt, int idx, double value);
+extern int db_bind_str(sqlite3 *db, sqlite3_stmt *stmt, int idx, const char *str);
+
+extern bool db_get_bool(sqlite3_stmt *stmt, int index);
+extern int db_get_int(sqlite3_stmt *stmt, int index);
+extern int db_get_double(sqlite3_stmt *stmt, int index);
+extern const char *db_get_str(sqlite3_stmt *stmt, int index);
+
+extern int db_finalize(sqlite3 *db, sqlite3_stmt *stmt);
+extern int db_exec(sqlite3 *db, const char *query);
+
+extern int db_begin_transaction(sqlite3 *db);
+extern int db_end_transaction(sqlite3 *db);
+
+extern int db_drop_table(sqlite3 *db);
+extern int db_create_table(sqlite3 *db);
+
+extern int db_insert_version(sqlite3 *db, int version);
+extern int db_remove_version(sqlite3 *db, int version);
+extern int db_update_version(sqlite3 *db, int version);
+extern int db_count_version(sqlite3 *db);
+
+extern int db_insert_login(sqlite3 *db, const char *id, const char *passwd);
+extern int db_update_login(sqlite3 *db, const char *id, const char *passwd);
+extern int db_remove_login(sqlite3 *db, const char *id, const char *passwd);
+extern int db_count_login(sqlite3 *db, const char *id, const char *passwd);
+
+#endif // __ADVENTURE_DB_H__
--- /dev/null
+#include <Elementary.h>
+
+extern Evas_Object *initial_create(Evas_Object *parent, int width, int height);
+extern void initial_destroy(Evas_Object *initial);
--- /dev/null
+#include <Elementary.h>
+
+extern Evas_Object *loading_create(Evas_Object *parent, int width, int height);
+extern void loading_destroy(Evas_Object *loading);
--- /dev/null
+#ifndef __MOMENT_LOG_H__
+#define __MOMENT_LOG_H__
+
+#include <dlog.h>
+
+#undef LOG_TAG
+#define LOG_TAG "ADVENTURE"
+
+#define COLOR_RED "\033[0;40;31m"
+#define COLOR_LIGHTBLUE "\033[1;40;34m"
+#define COLOR_YELLOW "\033[1;40;33m"
+#define COLOR_END "\033[0;m"
+#define COLOR_GRAY "\033[1;40;30m"
+#define COLOR_MAGENTA "\033[1;35m"
+
+#if !defined(_D)
+#define _D(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, COLOR_YELLOW "[%s:%d]" fmt COLOR_END"\n", __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(_W)
+#define _W(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, COLOR_GRAY "[%s:%d]" fmt COLOR_END"\n", __func__, __LINE__, ##arg)
+#endif
+
+#if !defined(_E)
+#define _E(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, COLOR_RED "[%s:%d]" fmt COLOR_END"\n", __func__, __LINE__, ##arg)
+#endif
+
+#define retv_if(expr, val) do { \
+ if(expr) { \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return (val); \
+ } \
+} while (0)
+
+#define ret_if(expr) do { \
+ if(expr) { \
+ _E("(%s) -> %s() return", #expr, __FUNCTION__); \
+ return; \
+ } \
+} while (0)
+
+#define goto_if(expr, val) do { \
+ if(expr) { \
+ _E("(%s) -> goto", #expr); \
+ goto val; \
+ } \
+} while (0)
+
+#define break_if(expr) { \
+ if(expr) { \
+ _E("(%s) -> break", #expr); \
+ break; \
+ } \
+}
+
+#define continue_if(expr) { \
+ if(expr) { \
+ _E("(%s) -> continue", #expr); \
+ continue; \
+ } \
+}
+
+#endif /* __MOMENT_LOG_H__ */
--- /dev/null
+#include <Elementary.h>
+
+extern Evas_Object *login_create(Evas_Object *parent);
+extern void login_destroy(Evas_Object *login);
+
+extern void login_add_result_cb(Evas_Object *login, int (*result_cb)(void *data), void *data);
+extern void login_remove_result_cb(Evas_Object *login);
--- /dev/null
+/*\r
+ * Samsung API\r
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the License);\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/license/\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an AS IS BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#ifndef __MOMENT_H__\r
+#define __MOMENT_H__\r
+\r
+#include <app.h>\r
+#include <Elementary.h>\r
+#include <system_settings.h>\r
+#include <efl_extension.h>\r
+#include <dlog.h>\r
+\r
+#ifdef LOG_TAG\r
+#undef LOG_TAG\r
+#endif\r
+#define LOG_TAG "MOMENT"\r
+\r
+#if !defined(PACKAGE)\r
+#define PACKAGE "org.tizen.moment"\r
+#endif\r
+\r
+#define PATH_LEN 1024\r
+\r
+struct _moment_info_s {\r
+ Evas_Object *win;\r
+ Evas_Object *conform;\r
+ Evas_Object *ui_manager;\r
+ Evas_Object *main_view;\r
+ Evas_Object *result_view;\r
+ Evas_Object *scroller;\r
+\r
+ Evas *e;\r
+\r
+ int width;\r
+ int height;\r
+};\r
+typedef struct _moment_info_s moment_info_s;\r
+\r
+#endif /* __MOMENT_H__ */\r
--- /dev/null
+#ifndef __MAIN_VIEW_H__\r
+#define __MAIN_VIEW_H__\r
+\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
--- /dev/null
+#ifndef __MAP_H__
+#define __MAP_H__
+
+enum {
+ CITY_HONOLULU = 0,
+ CITY_LOS_ANGELES,
+ CITY_SAN_FRANCISCO,
+ CITY_VANCOUVER,
+ CITY_CHICAGO,
+ CITY_MEICO_CITY,
+ CITY_SAN_JOSE,
+ CITY_NEW_YORK_CITY,
+ CITY_TORONTO,
+ CITY_WASHINGTON_DC,
+ CITY_BRASILIA,
+ CITY_BUENOS_AIRES,
+ CITY_SAO_PAULO,
+ CITY_DUBLIN,
+ CITY_LISBON,
+ CITY_LONDON,
+ CITY_AMSTERDAM,
+ CITY_BARCELONA,
+ CITY_BERLIN,
+ CITY_BRUSSELS,
+ CITY_CAPE_TOWN,
+ CITY_GENEVA,
+ CITY_MADRID,
+ CITY_PARIS,
+ CITY_ROME,
+ CITY_STOCKHOLM,
+ CITY_WARSAW,
+ CITY_ANKARA,
+ CITY_ATHENS,
+ CITY_HELSINKI,
+ CITY_ISTANBUL,
+ CITY_JERUSALEM,
+ CITY_KAHIRA,
+ CITY_BAGHDAD,
+ CITY_DUBAI,
+ CITY_MOSCOW,
+ CITY_ISLAMABAD,
+ CITY_DELHI,
+ CITY_MUMBAI,
+ CITY_BOMBAY,
+ CITY_CALCUTTA,
+ CITY_BANGKOK,
+ CITY_JAKARTA,
+ CITY_BEIJING,
+ CITY_HONG_KONG,
+ CITY_SINGAPORE,
+ CITY_TAIPEI,
+ CITY_SEOUL,
+ CITY_TOKYO,
+ CITY_SYDNEY,
+}
+
+struct _city_info_s {
+ int id;
+ float timezone;
+ char *name;
+ char *nation;
+};
+typedef struct _city_info_s city_info_s;
+
+extern Evas_Object *map_create(Evas_Object *parent);
+extern void *map_destroy(Evas_Object *map);
+
+#endif /* __MAP_H__ */
--- /dev/null
+#ifndef __PATH_H__
+#define __PATH_H__
+
+#include <Elementary.h>
+#include "adventure.h"
+
+extern Evas_Object *path_create(Evas_Object *parent, path_info_s *path_info);
+extern void *path_destroy(Evas_Object *path);
+
+#endif /* __PATH_H__ */
--- /dev/null
+#ifndef __PATH_GROUP_H__
+#define __PATH_GROUP_H__
+
+#include <Elementary.h>
+
+enum {
+ PATH_GROUP_TYPE_PLACE = 0,
+ PATH_GROUP_TYPE_BUY_LIST,
+ PATH_GROUP_TYEP_MY_LIST,
+ PATH_GROUP_TYPE_ALL,
+};
+
+extern Evas_Object *path_group_create(Evas_Object *parent, int type, void *data);
+extern void *path_group_destroy(Evas_Object *path_group);
+
+#endif /* __PATH_GROUP_H__ */
--- /dev/null
+#ifndef __POINT_H__
+#define __POINT_H__
+
+#include <Elementary.h>
+#include "adventure.h"
+
+extern Evas_Object *point_create(Evas_Object *parent, point_info_s *point_info);
+extern void *point_destroy(Evas_Object *point);
+
+#endif /* __POINT_H__ */
--- /dev/null
+#ifndef __MAIN_VIEW_H__\r
+#define __MAIN_VIEW_H__\r
+\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
--- /dev/null
+#ifndef __SCROLLER_H__
+#define __SCROLLER_H__
+
+#include <Elementary.h>
+
+typedef enum {
+ SCROLLER_EVENT_TYPE_INVALID = 0,
+ SCROLLER_EVENT_TYPE_SCROLL,
+ SCROLLER_EVENT_TYPE_MAX,
+} scroller_event_type_e;
+
+extern int scroller_is_scrolling(Evas_Object *scroller);
+
+extern Evas_Object *scroller_create(Evas_Object *parent);
+extern void scroller_destroy(Evas_Object *scroller);
+
+extern void scroller_append_item(Evas_Object *scroller, Evas_Object *item);
+extern void scroller_remove_item(Evas_Object *scroller, Evas_Object *item);
+
+extern void scroller_bring_in_item(Evas_Object *scroller, Evas_Object *item);
+
+extern int scroller_register_event_cb(Evas_Object *scroller, int event_type, void (*event_cb)(Evas_Object *scroller, int event_type, void *event_info, void *user_data), void *user_data);
+extern int scroller_unregister_event_cb(Evas_Object *scroller, int event_type, void (*event_cb)(Evas_Object *scroller, int event_type, void *event_info, void *user_data));
+
+#endif /* __SCROLLER_H__ */
--- /dev/null
+#ifndef __UI_MANAGER_H__
+#define __UI_MANAGER_H__
+
+#include <Elementary.h>
+#include "main.h"
+
+extern Evas_Object *ui_manager_create(Evas_Object *parent, moment_info_s *moment_info);
+extern void ui_manager_destroy(Evas_Object *ui_manager);
+
+#endif /* __UI_MANAGER_H__ */
--- /dev/null
+/*
+
+
+
+
+
+
+
+
+ * Samsung API
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd.
+ *
+ * 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/license/
+ *
+ * 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.
+ */
+
+#ifndef __ADVENTURE_INTERNAL_H__
+#define __ADVENTURE_INTERNAL_H__
+
+/* Multi-language */
+#if !defined(_)
+#define _(str) gettext(str)
+#endif
+#define gettext_noop(str) (str)
+#define N_(str) gettext_noop(str)
+#define D_(str) dgettext("sys_string", str)
+
+/* SIZE */
+#define FILE_LEN 256
+#define BUFSZE 1024
+#define PATH_LEN 1024
+
+/* Build */
+#define HAPI __attribute__((visibility("hidden")))
+
+/* Return values */
+typedef enum {
+ APPL_ERROR_NONE = 0,
+ APPL_ERROR_FAIL = -1,
+ APPL_ERROR_DB_FAILED = -2,
+ APPL_ERROR_OUT_OF_MEMORY = -3,
+ APPL_ERROR_INVALID_PARAMETER = -4,
+ APPL_ERROR_NO_DATA = -5,
+} appl_error_e;
+
+#endif /* __ADVENTURE_INTERNAL_H__ */
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd.
+ *
+ * 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/license/
+ *
+ * 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.
+ */
+
+#ifndef __ADVENTURE_WEBVIEW_H__
+#define __ADVENTURE_WEBVIEW_H__
+
+#include <Evas.h>
+
+extern Evas_Object *webview_create(Evas_Object *parent);
+extern void webview_destroy(Evas_Object *webview);
+
+extern void webview_set_url(Evas_Object *webview, const char *url);
+
+#endif // __ADVENTURE_WEBVIEW_H__
--- /dev/null
+#ifndef __WRITE_PATH_H__
+#define __WRITE_PATH_H__
+
+#include <Elementary.h>
+#include "adventure.h"
+
+extern Evas_Object *write_path_create(Evas_Object *parent);
+extern void *write_path_destroy(Evas_Object *write_path);
+
+#endif /* __WRITE_PATH_H__ */
--- /dev/null
+collections {
+ group { name: "main";
+ parts {
+ part { name: "bg";
+ type: RECT;
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ color: 255 255 255 255;
+ }
+ part {
+ name: "loading";
+ type: SWALLOW;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.5 0.5; to: "bg"; }
+ rel2 { relative: 0.5 0.5; to: "bg"; }
+ align: 0.5 0.5;
+ visible: 1;
+ }
+ }
+ part {
+ name: "initial";
+ type: SWALLOW;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.5 0.5; to: "bg"; }
+ rel2 { relative: 0.5 0.5; to: "bg"; }
+ align: 0.5 0.5;
+ visible: 1;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+images {
+ image: "Aventure01.1.png" COMP;
+ image: "Location.gif" COMP;
+}
+
+
+collections {
+ group { name: "main";
+ parts {
+ part { name: "bg";
+ type: SWALLOW;
+ description { state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ visible: 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: "Aventure01.1.png";
+ }
+ visible: 1;
+ }
+ }
+ part { name: "point_bg";
+ type: SPACER;
+ description { state: "default" 0.0;
+ align: 0.5 0.5;
+ rel1 { relative: 0.35 0.5; }
+ rel2 { relative: 0.35 0.5; }
+ }
+ description { state: "down" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: 0.35 0.535; }
+ rel2 { relative: 0.35 0.535; }
+ }
+ }
+ part { name: "point";
+ type: IMAGE;
+ mouse_events: 0;
+ description { state: "default" 0.0;
+ rel1 { relative: 0.5 0.5; to: "point_bg"; }
+ rel2 { relative: 0.5 0.5; to: "point_bg"; }
+ image {
+ normal: "Location.gif";
+ }
+ min: 82 113;
+ visible: 1;
+ }
+ }
+ }
+ programs {
+ program {
+ name: "go_down";
+ signal: "load";
+ action: STATE_SET "down" 0.0;
+ target: "point_bg";
+ transition: ACCELERATE 1.0;
+ after: "go_up";
+ }
+ program {
+ name: "go_up";
+ signal: "load";
+ action: STATE_SET "default" 0.0;
+ target: "point_bg";
+ transition: DECELERATE 1.0;
+ after: "go_down";
+ }
+
+ }
+ }
+}
--- /dev/null
+
+styles {
+ style {
+ /* Font size is changed from 24 to 20 because of resolution issues. */
+ name: "text_style";
+ base: "font=Tizen:style=Regular font_size=20 color=#ffffff align=center style=shadow shadow_color=#000000bf wrap=mixed ellipsis=-1";
+ tag: "br" "\n";
+ tag: "hilight" "+ font_weight=Bold";
+ tag: "b" "+ font_weight=Bold";
+ tag: "tab" "\t";
+ }
+}
+
+collections {
+ group {
+ name: "main";
+ parts {
+ part {
+ name: "bg";
+ type: SWALLOW;
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ }
+ }
+ part {
+ name: "name";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.1; to: "bg"; }
+ rel2 { relative: 1.0 0.5; to: "bg"; }
+ color: 0 0 0 255;
+ text {
+ text: "";
+ font: "Tizen:style=Bold";
+ text_class: "tizen";
+ min: 0 0;
+ size: 24;
+ align: 0.0 0.5;
+ }
+ visible: 1;
+ }
+ }
+ part {
+ name: "gmt";
+ type: TEXT;
+ mouse_events: 0;
+ scale: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.5; to: "bg"; }
+ rel2 { relative: 1.0 0.9; to: "bg"; }
+ color: 0 0 0 255;
+ text {
+ text: "";
+ font: "Tizen:style=Bold";
+ text_class: "tizen";
+ min: 0 0;
+ size: 20;
+ align: 0.0 0.5;
+ }
+ visible: 1;
+ }
+ }
+ part {
+ name: "button";
+ type: SWALLOW;
+ mouse_events: 1;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "bg"; }
+ rel2 { relative: 1.0 1.0; to: "bg"; }
+ visible: 1;
+ }
+ }
+ } //parts
+ }
+} //collections
--- /dev/null
+collections {
+ group {
+ name: "main";
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ color: 255 255 255 255;
+ visible: 1;
+ }
+ }
+
+ part {
+ name: "lighten";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ perspective {
+ zplane: 100;
+ }
+ color: 0 0 255 255;
+ //color2: 0 0 255 255;
+ visible: 0;
+ }
+ }
+/*
+ part {
+ name: "pers";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ perspective {
+ zplane: -100;
+ }
+ visible: 0;
+ }
+ }*/
+
+ part {
+ name: "rect_1";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.4 0.4; to: "bg"; }
+ rel2 { relative: 0.6 0.6; to: "bg"; }
+ color: 255 0 0 255;
+ visible: 1;
+
+ map {
+ //perspective: "pers";
+ light: "lighten";
+ on: 1;
+ }
+ }
+ }
+
+
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+images {
+ image: "1.png" COMP;
+ image: "2.png" COMP;
+ image: "3.png" COMP;
+ image: "4.png" COMP;
+ image: "5.png" COMP;
+ image: "6.png" COMP;
+ image: "7.png" COMP;
+ image: "8.png" COMP;
+ image: "9.png" COMP;
+ image: "10.png" COMP;
+ image: "11.png" COMP;
+ image: "12.png" COMP;
+ image: "13.png" COMP;
+ image: "14.png" COMP;
+ image: "15.png" COMP;
+ image: "16.png" COMP;
+ image: "17.png" COMP;
+ image: "18.png" COMP;
+ image: "19.png" COMP;
+ image: "20.png" COMP;
+ image: "21.png" COMP;
+ image: "22.png" COMP;
+ image: "23.png" COMP;
+ image: "24.png" COMP;
+ image: "25.png" COMP;
+ image: "26.png" COMP;
+ image: "27.png" COMP;
+}
+
+collections {
+ group {
+ name: "loading";
+
+ parts {
+ part {
+ name: "bg";
+ type: SPACER;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ }
+ }
+ part {
+ name: "loading";
+ type: IMAGE;
+ scale: 1;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.5 0.5; }
+ rel2 { relative: 0.5 0.5; }
+ align: 0.5 0.5;
+ min: 80 80;
+ visible: 1;
+ image {
+ normal: "27.png";
+ tween: "1.png";
+ tween: "2.png";
+ tween: "3.png";
+ tween: "4.png";
+ tween: "5.png";
+ tween: "6.png";
+ tween: "7.png";
+ tween: "8.png";
+ tween: "9.png";
+ tween: "10.png";
+ tween: "11.png";
+ tween: "12.png";
+ tween: "13.png";
+ tween: "14.png";
+ tween: "15.png";
+ tween: "16.png";
+ tween: "17.png";
+ tween: "18.png";
+ tween: "19.png";
+ tween: "20.png";
+ tween: "21.png";
+ tween: "22.png";
+ tween: "23.png";
+ tween: "24.png";
+ tween: "25.png";
+ tween: "26.png";
+ tween: "27.png";
+ }
+ }
+ }
+ }
+
+ programs {
+ program {
+ name: "on";
+ signal: "load";
+ action: STATE_SET "default" 0.0;
+ target: "loading";
+ transition: ACCELERATE 1.0;
+ in: 1.0 0.0;
+ after: "on";
+ }
+ }
+ }
+}
--- /dev/null
+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: "search";
+ 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;
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: 0.5 -0.1; to: "bg"; }
+ rel2 { relative: 0.5 -0.1; to: "bg"; }
+ }
+ }
+ part {
+ name: "map";
+ 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: "search"; }
+ 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: "content";
+ 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: "search_result";
+ type: SWALLOW;
+ scale: 1;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 1.0; to: "search"; }
+ rel2 { relative: 1.0 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: "search";
+ action: STATE_SET "hide" 0.0;
+ target: "search";
+ }
+ program {
+ signal: "show";
+ source: "search";
+ action: STATE_SET "default" 0.0;
+ target: "search";
+ }
+
+ program {
+ signal: "hide";
+ source: "search_result";
+ action: STATE_SET "hide" 0.0;
+ target: "search_result";
+ }
+ program {
+ signal: "show";
+ source: "search_result";
+ action: STATE_SET "default" 0.0;
+ target: "search_result";
+ }
+
+ 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: "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";
+ }
+
+ 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";
+ }
+ }
+ }
+}
--- /dev/null
+images {\r
+ image: "" COMP;\r
+}\r
+\r
+collections {\r
+ group {\r
+ name: "main";\r
+ parts {\r
+ part {\r
+ name: "bg";\r
+ type: SPACER;\r
+ description {\r
+ state: "default" 0.0;\r
+ align: 0.0 0.0;\r
+ rel1 { relative: 0.0 0.0; }\r
+ rel2 { relative: 1.0 1.0; }\r
+ }\r
+ }\r
+ part {\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.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
+ programs {\r
+ }\r
+ }\r
+}\r
--- /dev/null
+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: "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;
+ }
+ }
+ }
+ part {
+ name: "time_current";
+ 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: 24;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part {
+ name: "time_best_name";
+ 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: 24;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part {
+ name: "time_recomment_name";
+ 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: 24;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part {
+ name: "time_best_value";
+ 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: 24;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part {
+ name: "time_recomment_value";
+ 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: 24;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part {
+ name: "result_circle";
+ 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;
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: 0.5 -0.1; to: "bg"; }
+ rel2 { relative: 0.5 -0.1; to: "bg"; }
+ }
+ }
+ part {
+ name: "button_save";
+ 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: "search"; }
+ align: 0.5 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "button_alarm";
+ 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: "search"; }
+ align: 0.5 0.0;
+ visible: 1;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+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: "entry";
+ type: SWALLOW;
+ scale: 1;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "bg"; }
+ rel2 { relative: 0.8 1.0; to: "bg"; }
+ align: 0.5 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "button";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 1.0 0.0; to: "entry"; }
+ rel2 { relative: 0.0 1.0; to: "button_search"; }
+ align: 0.5 1.0;
+ visible: 1;
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "button_result";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.9 1.0; to: "bg"; }
+ rel2 { relative: 1.0 1.0; to: "bg"; }
+ align: 0.5 1.0;
+ visible: 1;
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: 1.0 1.0; to: "bg"; }
+ rel2 { relative: 1.1 1.0; to: "bg"; }
+ }
+ }
+ }
+ programs {
+ program {
+ signal: "hide";
+ source: "button_result";
+ action: STATE_SET "hide" 0.0;
+ target: "button_result";
+ }
+ program {
+ signal: "show";
+ source: "button_result";
+ action: STATE_SET "default" 0.0;
+ target: "button_result";
+ }
+ }
+ }
+}
--- /dev/null
+collections {
+ group {
+ name: "main";
+
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ color: 0 0 0 0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "content";
+ type: SWALLOW;
+ 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"; }
+ align: 0.5 0.0;
+ visible: 1;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+images {
+ image: "Aventure01_background.png" COMP;
+}
+
+collections {
+ group {
+ name: "main";
+ parts {
+ part {
+ name: "bg";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ visible: 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: "Aventure01_background.png";
+ }
+ visible: 1;
+ }
+ }
+ part {
+ name: "content";
+ type: SWALLOW;
+ description {
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ visible: 1;
+ }
+ }
+ part {
+ name: "popup";
+ type: SWALLOW;
+ description {
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ visible: 1;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd.
+ *
+ * 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/license/
+ *
+ * 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.
+ */
+
+#include <tizen.h>
+#include <Elementary.h>
+#include "adventure.h"
+#include "log.h"
+#include "initial.h"
+#include "loading.h"
+#include "util.h"
+
+static void
+win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ ui_app_exit();
+}
+
+static Evas_Object *_create_adventure(Evas_Object *parent)
+{
+ Evas_Object *adventure = NULL;
+ char *path = NULL;
+ char full_path[PATH_LEN] = {0, };
+
+ adventure = elm_layout_add(parent);
+ retv_if(!adventure, NULL);
+
+ path = app_get_resource_path();
+ retv_if(!path, NULL);
+
+ snprintf(full_path, sizeof(full_path), "%s/edje/adventure.edj", path);
+
+ elm_layout_file_set(adventure, full_path, "main");
+ evas_object_size_hint_weight_set(adventure, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(adventure, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(adventure);
+
+ return adventure;
+}
+
+static void _destroy_adventure(Evas_Object *adventure)
+{
+ ret_if(!adventure);
+ evas_object_del(adventure);
+}
+
+Eina_Bool _destroy_initial_cb(void *data)
+{
+ adventure_info_s *adventure_info = data;
+
+ retv_if(!adventure_info, ECORE_CALLBACK_CANCEL);
+
+ elm_object_part_content_unset(adventure_info->adventure, "initial");
+ initial_destroy(adventure_info->initial);
+ adventure_info->initial_timer = NULL;
+
+ adventure_info->ui_manager = ui_manager_create(adventure_info->conformant, adventure_info);
+ retv_if(!adventure_info->ui_manager, ECORE_CALLBACK_CANCEL);
+
+#if 0
+ adventure_info->loading = loading_create(adventure_info->adventure, adventure_info->width, adventure_info->height);
+ retv_if(!adventure_info->loading, ECORE_CALLBACK_CANCEL);
+ elm_object_part_content_set(adventure_info->adventure, "loading", adventure_info->loading);
+#endif
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
+static bool
+app_create(void *data)
+{
+ adventure_info_s *adventure_info = data;
+ 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);
+ 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);
+ evas_object_show(adventure_info->win);
+
+ 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);
+
+ _D("Window size (%d:%d)", adventure_info->width, adventure_info->height);
+
+ adventure_info->adventure = _create_adventure(adventure_info->conform);
+ if (adventure_info->adventure)
+ elm_object_content_set(adventure_info->conform, adventure_info->adventure);
+ else
+ _E("cannot create the adventure ui");
+
+ adventure_info->initial = initial_create(adventure_info->conform, adventure_info->width, adventure_info->height);
+ if (adventure_info->initial)
+ elm_object_part_content_set(adventure_info->adventure, "initial", adventure_info->initial);
+ else
+ _E("cannot create the initial ui");
+
+ adventure_info->initial_timer = ecore_timer_add(3.0f, _destroy_initial_cb, adventure_info);
+ retv_if(!adventure_info->initial_timer, false);
+
+ return true;
+}
+
+static void
+app_control(app_control_h app_control, void *data)
+{
+ adventure_info_s *adventure_info = data;
+ ret_if(!adventure_info);
+}
+
+static void
+app_pause(void *data)
+{
+ /* Take necessary actions when application becomes invisible. */
+}
+
+static void
+app_resume(void *data)
+{
+ /* Take necessary actions when application becomes visible. */
+}
+
+static void
+app_terminate(void *data)
+{
+ adventure_info_s *adventure_info = data;
+
+ if (adventure_info->ui_manager)
+ ui_manager_destroy(adventure_info->ui_manager);
+
+ if (adventure_info->adventure)
+ _destroy_adventure(adventure_info->adventure);
+
+ if (adventure_info->initial_timer) {
+ ecore_timer_del(adventure_info->initial_timer);
+ initial_destroy(adventure_info->initial);
+ }
+
+ if (adventure_info->conform)
+ evas_object_del(adventure_info->conform);
+
+ if (adventure_info->win)
+ evas_object_del(adventure_info->win);
+}
+
+static void
+ui_app_lang_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LANGUAGE_CHANGED*/
+ char *locale = NULL;
+ system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
+ elm_language_set(locale);
+ free(locale);
+ return;
+}
+
+static void
+ui_app_orient_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
+ return;
+}
+
+static void
+ui_app_region_changed(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_REGION_FORMAT_CHANGED*/
+}
+
+static void
+ui_app_low_battery(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LOW_BATTERY*/
+}
+
+static void
+ui_app_low_memory(app_event_info_h event_info, void *user_data)
+{
+ /*APP_EVENT_LOW_MEMORY*/
+}
+
+int
+main(int argc, char *argv[])
+{
+ adventure_info_s adventure_info = {0,};
+ int ret = 0;
+
+ ui_app_lifecycle_callback_s event_callback = {0,};
+ app_event_handler_h handlers[5] = {NULL, };
+
+ event_callback.create = app_create;
+ event_callback.terminate = app_terminate;
+ event_callback.pause = app_pause;
+ 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, &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, &adventure_info);
+ if (ret != APP_ERROR_NONE) {
+ dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main() is failed. err = %d", ret);
+ }
+
+ return ret;
+}
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd.
+ *
+ * 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/license/
+ *
+ * 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.
+ */
+
+#include <Evas.h>
+#include <sqlite3.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <app_common.h>
+
+#include "db.h"
+#include "log.h"
+#include "util.h"
+
+#define APP_DB_FILE ".app.db"
+
+
+
+
+HAPI sqlite3 *db_open(void)
+{
+ sqlite3 *db = NULL;
+ char *path = NULL;
+ char db_file[FILE_LEN] = {0, };
+ int ret = SQLITE_OK;
+
+ path = app_get_data_path();
+ retv_if(!path, NULL);
+
+ snprintf(db_file, sizeof(db_file), "%s/%s", path, APP_DB_FILE);
+ free(path);
+
+ ret = sqlite3_open(db_file, &db);
+ if (SQLITE_OK != ret) {
+ _E("%s", sqlite3_errmsg(db));
+ return NULL;
+ }
+
+ return db;
+}
+
+
+
+HAPI void db_close(sqlite3 *db)
+{
+ ret_if(!db);
+ sqlite3_close(db);
+}
+
+
+
+HAPI sqlite3_stmt *db_prepare(sqlite3 *db, const char *query)
+{
+ sqlite3_stmt *stmt = NULL;
+ int ret = SQLITE_OK;
+
+ retv_if(!query, NULL);
+
+ ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
+ if (SQLITE_OK != ret) {
+ _E("%s, %s", query, sqlite3_errmsg(db));
+ return NULL;
+ }
+
+ return stmt;
+}
+
+
+
+HAPI int db_next(sqlite3 *db, sqlite3_stmt *stmt)
+{
+ int ret = SQLITE_OK;
+
+ retv_if(!stmt, APPL_ERROR_FAIL);
+
+ ret = sqlite3_step(stmt);
+ switch (ret) {
+ case SQLITE_ROW: /* SQLITE_ROW : 100 */
+ return APPL_ERROR_NONE;
+ case SQLITE_DONE: /* SQLITE_ROW : 101 */
+ return APPL_ERROR_NO_DATA;
+ default:
+ _E("%s", sqlite3_errmsg(db));
+ return APPL_ERROR_FAIL;
+ }
+
+ return APPL_ERROR_NONE;
+}
+
+
+
+HAPI int db_reset(sqlite3 *db, sqlite3_stmt *stmt)
+{
+ int ret = SQLITE_OK;
+
+ retv_if(!stmt, APPL_ERROR_INVALID_PARAMETER);
+
+ ret = sqlite3_reset(stmt);
+ if (SQLITE_OK != ret) {
+ _E("%s", sqlite3_errmsg(db));
+ return APPL_ERROR_FAIL;
+ }
+
+ sqlite3_clear_bindings(stmt);
+
+ return APPL_ERROR_NONE;
+}
+
+
+
+HAPI int db_bind_bool(sqlite3 *db, sqlite3_stmt *stmt, int idx, bool value)
+{
+ int ret = SQLITE_OK;
+
+ retv_if(!stmt, APPL_ERROR_FAIL);
+
+ ret = sqlite3_bind_int(stmt, idx, (int) value);
+ if (SQLITE_OK != ret) {
+ _E("%s", sqlite3_errmsg(db));
+ return APPL_ERROR_FAIL;
+ }
+
+ return APPL_ERROR_NONE;
+}
+
+
+
+HAPI int db_bind_int(sqlite3 *db, sqlite3_stmt *stmt, int idx, int value)
+{
+ int ret = SQLITE_OK;
+
+ retv_if(!stmt, APPL_ERROR_FAIL);
+
+ ret = sqlite3_bind_int(stmt, idx, value);
+ if (SQLITE_OK != ret) {
+ _E("%s", sqlite3_errmsg(db));
+ return APPL_ERROR_FAIL;
+ }
+
+ return APPL_ERROR_NONE;
+}
+
+
+
+HAPI int db_bind_double(sqlite3 *db, sqlite3_stmt *stmt, int idx, double value)
+{
+ int ret = SQLITE_OK;
+
+ retv_if(!stmt, APPL_ERROR_FAIL);
+
+ ret = sqlite3_bind_double(stmt, idx, value);
+ if (SQLITE_OK != ret) {
+ _E("%s", sqlite3_errmsg(db));
+ return APPL_ERROR_FAIL;
+ }
+
+ return APPL_ERROR_NONE;
+}
+
+
+
+HAPI int db_bind_str(sqlite3 *db, sqlite3_stmt *stmt, int idx, const char *str)
+{
+ int ret = SQLITE_OK;
+
+ retv_if(!stmt, APPL_ERROR_FAIL);
+
+ if (str) {
+ ret = sqlite3_bind_text(stmt, idx, str, -1, SQLITE_TRANSIENT);
+ } else {
+ ret = sqlite3_bind_null(stmt, idx);
+ }
+
+ if (SQLITE_OK != ret) {
+ _E("%s", sqlite3_errmsg(db));
+ return APPL_ERROR_FAIL;
+ }
+
+ return APPL_ERROR_NONE;
+}
+
+
+
+HAPI bool db_get_bool(sqlite3_stmt *stmt, int index)
+{
+ retv_if(!stmt, false);
+ return (bool) (!!sqlite3_column_int(stmt, index));
+}
+
+
+
+HAPI int db_get_int(sqlite3_stmt *stmt, int index)
+{
+ retv_if(!stmt, 0);
+ return sqlite3_column_int(stmt, index);
+}
+
+
+
+HAPI int db_get_double(sqlite3_stmt *stmt, int index)
+{
+ retv_if(!stmt, 0);
+ return sqlite3_column_double(stmt, index);
+}
+
+
+
+HAPI const char *db_get_str(sqlite3_stmt *stmt, int index)
+{
+ retv_if(!stmt, NULL);
+ return (const char *) sqlite3_column_text(stmt, index);
+}
+
+
+
+HAPI int db_finalize(sqlite3 *db, sqlite3_stmt *stmt)
+{
+ int ret = SQLITE_OK;
+
+ retv_if(!stmt, APPL_ERROR_INVALID_PARAMETER);
+
+ ret = sqlite3_finalize(stmt);
+ if (SQLITE_OK != ret) {
+ _E("%s", sqlite3_errmsg(db));
+ return APPL_ERROR_FAIL;
+ }
+
+ return APPL_ERROR_NONE;
+}
+
+
+
+HAPI int db_exec(sqlite3 *db, const char *query)
+{
+ sqlite3_stmt *stmt = NULL;
+
+ retv_if(!query, APPL_ERROR_INVALID_PARAMETER);
+
+ stmt = db_prepare(db, query);
+ retv_if(!stmt, APPL_ERROR_FAIL);
+
+ goto_if(APPL_ERROR_FAIL == db_next(db, stmt), ERROR);
+ goto_if(APPL_ERROR_FAIL == db_finalize(db, stmt), ERROR);
+
+ return APPL_ERROR_NONE;
+
+ERROR:
+ if (stmt) db_finalize(db, stmt);
+ return APPL_ERROR_FAIL;
+}
+
+
+
+HAPI int db_create_table(sqlite3 *db)
+{
+ const char *TABLES[] = {
+ "CREATE TABLE IF NOT EXIST db_checksum (version INT);",
+ "CREATE TABLE IF NOT EXIST path_information ("
+ "path_id INTEGER PRIMARY KEY"
+ ", user_id INTEGER NOT NULL"
+ ", latitude DOUBLE NOT NULL"
+ ", longitude DOUBLE NOT NULL"
+ ", title TEXT"
+ ", score INT"
+ ", price INT"
+ ", visible BOOL"
+ ", FOREIGH KEY(user_id) REFERENCES user(user_id)"
+ ");",
+ "CREATE TABLE IF NOT EXIST path ("
+ "path_id INTEGER NOT NULL"
+ ", order INTEGER NOT NULL"
+ ", content_id INTENGER NOT NULL"
+ ", PRIMARY KEY(path_id, order)"
+ ", FOREIGN KEY(path_id) REFERENCES path(path_id)"
+ ", FOREIGH KEY(content_id) REFERENCES content(contend_id)",
+ ");",
+ "CREATE TABLE IF NOT EXIST content ("
+ "content_id INTEGER PRIMARY KEY"
+ ", user_id INTEGER NOT NULL"
+ ", latitude DOUBLE NOT NULL"
+ ", longitude DOUBLE NOT NULL"
+ ", title TEXT"
+ ", content TEXT"
+ ", tag TEXT"
+ ", location TEXT"
+ ", icon TEXT"
+ ", attach_id INTEGER"
+ ", FOREIGN KEY(user_id) REFERENCES user(user_id)"
+ ", FOREIGN KEY(attach_id) REFERENCES attach(attach_id)"
+ ");",
+ "CREATE TABLE IF NOT EXIST attach ("
+ "attach_id INTEGER PRIMARY KEY"
+ ", path TEXT NOT NULL"
+ ", ref_count INT NOT NULL"
+ ");",
+ "CREATE TABLE IF NOT EXIST purchase ("
+ "user_id INTEGER NOT NULL"
+ ", content_id INTEGER NOT NULL"
+ ", PRIMARY KEY(user_id, content_id)"
+ ", FOREIGN KEY(user_id) REFERENCES user(user_id)"
+ ", FOREIGN KEY(content_id) REFERENCES content(content_id)"
+ ");",
+ "CREATE TABLE IF NOT EXIST user ("
+ "user_id INTEGER PRIMARY KEY"
+ ", name TEXT"
+ ");",
+ };
+ int count = 0;
+ int i = 0;
+
+ count = sizeof(TABLES) / sizeof(char *);
+ for (; i < count; i++) {
+ _D("Create a table[%s]", TABLES[i]);
+ break_if(db_exec(db, TABLES[i]) != APPL_ERROR_NONE);
+ }
+
+ return APPL_ERROR_FAIL;
+}
+
+
+
+HAPI int db_drop_table(sqlite3 *db)
+{
+ const char *TABLES[] = {
+ "DROP TABLE IF EXIST db_checksum;",
+ "DROP TABLE IF EXIST path_information;",
+ "DROP TABLE IF EXIST path;",
+ "DROP TABLE IF EXIST content;",
+ "DROP TABLE IF EXIST attach;",
+ "DROP TABLE IF EXIST purchase;",
+ "DROP TABLE IF EXIST user;",
+ };
+ int count = 0;
+ int i = 0;
+
+ count = sizeof(TABLES) / sizeof(char *);
+ for (; i < count; i++) {
+ _D("Drop a table[%s]", TABLES[i]);
+ break_if(db_exec(db, TABLES[i]) != APPL_ERROR_NONE);
+ }
+
+ return APPL_ERROR_FAIL;
+}
+
+
+
+HAPI int db_insert_version(sqlite3 *db, int version)
+{
+ const char *QUERY_SYNTAX = "INSERT INTO db_checksum (version) values (%d);";
+ char *query = NULL;
+
+ query = sqlite3_mprintf(QUERY_SYNTAX, version);
+ retv_if(!query, APPL_ERROR_FAIL);
+
+ if (db_exec(db, query) != APPL_ERROR_NONE) {
+ _E("Cannot execute query.[%s]", query);
+ sqlite3_free(query);
+ return APPL_ERROR_FAIL;
+ }
+
+ sqlite3_free(query);
+
+ /* keep the home DB opened */
+
+ return APPL_ERROR_NONE;
+}
+
+
+
+HAPI int db_remove_version(sqlite3 *db, int version)
+{
+ const char *QUERY_SYNTAX = "DELETE FROM db_checksum WHERE version=%d;";
+ char *query = NULL;
+
+ query = sqlite3_mprintf(QUERY_SYNTAX, version);
+ retv_if(!query, APPL_ERROR_FAIL);
+
+ if (db_exec(db, query) != APPL_ERROR_NONE) {
+ _E("Cannot execute query.[%s]", query);
+ sqlite3_free(query);
+ return APPL_ERROR_FAIL;
+ }
+
+ sqlite3_free(query);
+
+ /* keep the home DB opened */
+
+ return APPL_ERROR_NONE;
+}
+
+
+
+HAPI int db_update_version(sqlite3 *db, int version)
+{
+ const char *QUERY_SYNTAX = "UPDATE db_checksum SET version=%d;";
+ char *query = NULL;
+
+ query = sqlite3_mprintf(QUERY_SYNTAX, version);
+ retv_if(!query, APPL_ERROR_FAIL);
+
+ if (db_exec(db, query) != APPL_ERROR_NONE) {
+ _E("Cannot execute query.[%s]", query);
+ sqlite3_free(query);
+ return APPL_ERROR_FAIL;
+ }
+
+ sqlite3_free(query);
+
+ /* keep the home DB opened */
+
+ return APPL_ERROR_NONE;
+}
+
+
+
+HAPI int db_count_version(sqlite3 *db)
+{
+ const char *QUERY_SYNTAX = "SELECT COUNT(*) FROM db_checksum;";
+ sqlite3_stmt *st = NULL;
+ int count = 0;
+
+ st = db_prepare(db, QUERY_SYNTAX);
+ retv_if(!st, APPL_ERROR_FAIL);
+
+ if (db_next(db, st) == APPL_ERROR_FAIL) {
+ _E("db_next error");
+ db_finalize(db, st);
+ return -1;
+ }
+
+ count = db_get_int(st, 0);
+ db_reset(db, st);
+ db_finalize(db, st);
+
+ /* keep the home DB opened */
+
+ return count;
+}
+
+
+
+// End of file.
--- /dev/null
+#include <Elementary.h>
+#include <app.h>
+#include "log.h"
+#include "util.h"
+
+const char *const INITIAL_EDJE = "initial.edj";
+
+
+
+Evas_Object *initial_create(Evas_Object *parent, int width, int height)
+{
+ Evas_Object *initial = NULL;
+ Evas_Object *rect = 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_EDJE);
+ free(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_show(initial);
+
+ rect = evas_object_rectangle_add(evas_object_evas_get(parent));
+ if (rect) {
+ evas_object_size_hint_min_set(rect, width, height);
+ evas_object_show(rect);
+ elm_object_part_content_set(initial, "bg", rect);
+ }
+
+ return initial;
+}
+
+void initial_destroy(Evas_Object *initial)
+{
+ ret_if(!initial);
+ evas_object_del(initial);
+}
--- /dev/null
+#include <Elementary.h>
+#include <app.h>
+#include "log.h"
+#include "adventure.h"
+#include "util.h"
+
+
+
+Evas_Object *loading_create(Evas_Object *parent, int width, int height)
+{
+ Evas_Object *loading = 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/loading.edj", path);
+ free(path);
+
+ loading = elm_layout_add(parent);
+ goto_if(!loading, error);
+
+ elm_layout_file_set(loading, full_path, "loading");
+ evas_object_size_hint_weight_set(loading, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(loading, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_min_set(loading, width, height);
+ evas_object_show(loading);
+
+ return loading;
+
+error:
+ return NULL;
+}
+
+
+
+void loading_destroy(Evas_Object *loading)
+{
+ ret_if(!loading);
+ evas_object_del(loading);
+}
--- /dev/null
+/*\r
+ * Samsung API\r
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the License);\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/license/\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an AS IS BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+#include <tizen.h>\r
+#include <Elementary.h>\r
+#include "log.h"\r
+#include "util.h"\r
+#include "main.h"\r
+#include "ui_manager.h"\r
+\r
+static void\r
+_win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)\r
+{\r
+ ui_app_exit();\r
+}\r
+\r
+static bool\r
+app_create(void *data)\r
+{\r
+ moment_info_s *moment_info = data;\r
+\r
+ moment_info->win = elm_win_util_standard_add(PACKAGE, PACKAGE);\r
+ elm_win_conformant_set(moment_info->win, EINA_TRUE);\r
+ elm_win_autodel_set(moment_info->win, EINA_TRUE);\r
+ if (elm_win_wm_rotation_supported_get(moment_info->win)) {\r
+ int rots[1] = {0};\r
+ elm_win_wm_rotation_available_rotations_set(moment_info->win, (const int *)(&rots), 1);\r
+ }\r
+ evas_object_smart_callback_add(moment_info->win, "delete,request", _win_delete_request_cb, NULL);\r
+ elm_win_screen_size_get(moment_info->win, NULL, NULL, &moment_info->width, &moment_info->height);\r
+ evas_object_show(moment_info->win);\r
+\r
+ moment_info->conform = elm_conformant_add(moment_info->win);\r
+ elm_win_indicator_mode_set(moment_info->win, ELM_WIN_INDICATOR_HIDE);\r
+ evas_object_size_hint_weight_set(moment_info->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);\r
+ elm_win_resize_object_add(moment_info->win, moment_info->conform);\r
+ evas_object_show(moment_info->conform);\r
+\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
+static void\r
+app_control(app_control_h app_control, void *data)\r
+{\r
+ moment_info_s *moment_info = data;\r
+ ret_if(!moment_info);\r
+ ret_if(!mement_info->conformant);\r
+\r
+ moment_info->ui_manager = ui_manager_create(moment_info->conformant, moment_info);\r
+ ret_if(!moment_info->ui_manager);\r
+}\r
+\r
+static void\r
+app_pause(void *data)\r
+{\r
+ /* Take necessary actions when application becomes invisible. */\r
+}\r
+\r
+static void\r
+app_resume(void *data)\r
+{\r
+ /* Take necessary actions when application becomes visible. */\r
+}\r
+\r
+static void\r
+app_terminate(void *data)\r
+{\r
+ moment_info_s *moment_info = data;\r
+\r
+ if (moment_info->ui_manager)\r
+ ui_manager_destroy(moment_info->ui_manager);\r
+\r
+ if (moment_info->conform)\r
+ evas_object_del(moment_info->conform);\r
+\r
+ if (moment_info->win)\r
+ evas_object_del(moment_info->win);\r
+}\r
+\r
+static void\r
+ui_app_lang_changed(app_event_info_h event_info, void *user_data)\r
+{\r
+ /*APP_EVENT_LANGUAGE_CHANGED*/\r
+ char *locale = NULL;\r
+ system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);\r
+ elm_language_set(locale);\r
+ free(locale);\r
+ return;\r
+}\r
+\r
+static void\r
+ui_app_orient_changed(app_event_info_h event_info, void *user_data)\r
+{\r
+ /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/\r
+ return;\r
+}\r
+\r
+static void\r
+ui_app_region_changed(app_event_info_h event_info, void *user_data)\r
+{\r
+ /*APP_EVENT_REGION_FORMAT_CHANGED*/\r
+}\r
+\r
+static void\r
+ui_app_low_battery(app_event_info_h event_info, void *user_data)\r
+{\r
+ /*APP_EVENT_LOW_BATTERY*/\r
+}\r
+\r
+static void\r
+ui_app_low_memory(app_event_info_h event_info, void *user_data)\r
+{\r
+ /*APP_EVENT_LOW_MEMORY*/\r
+}\r
+\r
+int\r
+main(int argc, char *argv[])\r
+{\r
+ moment_info_s moment_info = {0,};\r
+ int ret = 0;\r
+\r
+ ui_app_lifecycle_callback_s event_callback = {0,};\r
+ app_event_handler_h handlers[5] = {NULL, };\r
+\r
+ event_callback.create = app_create;\r
+ event_callback.terminate = app_terminate;\r
+ event_callback.pause = app_pause;\r
+ event_callback.resume = app_resume;\r
+ event_callback.app_control = app_control;\r
+\r
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &moment_info);\r
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &moment_info);\r
+ ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &moment_info);\r
+ ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &moment_info);\r
+ ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &moment_info);\r
+ ui_app_remove_event_handler(handlers[APP_EVENT_LOW_MEMORY]);\r
+\r
+ ret = ui_app_main(argc, argv, &event_callback, &moment_info);\r
+ if (ret != APP_ERROR_NONE) {\r
+ dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main() is failed. err = %d", ret);\r
+ }\r
+\r
+ return ret;\r
+}\r
--- /dev/null
+#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
+static void _change_entry_cb(void *data, Evas_Object *obj, void *event_info)\r
+{\r
+ moment_info_s *moment_info = data;\r
+\r
+ ret_if(!moment_info);\r
+}\r
+\r
+static Evas_Object *_create_search_entry(Evas_Object *parent, moment_info_s *moment_info)\r
+{\r
+ Evas_Object *entry = NULL;\r
+\r
+ retv_if(!parent, NULL);\r
+\r
+ entry = elm_entry_add(parent);\r
+ retv_if(!entry, NULL);\r
+\r
+ elm_entry_single_line_set(entry, EINA_TRUE);\r
+ elm_entry_scrollable_set(entry, EINA_TRUE);\r
+ elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);\r
+ elm_object_part_text_set(entry, "elm.guide", "City");\r
+\r
+ evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);\r
+ evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);\r
+\r
+ evas_object_smart_callback_add(entry, "changed", _change_entry_cb, moment_info);\r
+ evas_object_smart_callback_add(entry, "focused", _focus_entry_cb, moment_info);\r
+ evas_object_smart_callback_add(entry, "unfocused", _focus_entry_cb, moment_info);\r
+\r
+ evas_object_show(entry);\r
+\r
+ return entry;\r
+}\r
+\r
+void _destroy_search_entry(Evas_Object *entry)\r
+{\r
+ ret_if(!entry);\r
+ evas_object_del(entry);\r
+}\r
+\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
+ char *path = NULL;\r
+ char full_path[] = {0, };\r
+\r
+ retv_if(!parent, NULL);\r
+\r
+ path = app_get_resource_path();\r
+ retv_if(!path, NULL);\r
+\r
+ snprintf(full_path, sizeof(full_path), "%s/edje/%s", path, MAIN_VIEW_EDJE);\r
+ free(path);\r
+\r
+ main_view = elm_layout_add(parent);\r
+ retv_if(!main_view, NULL);\r
+ elm_layout_file_set(main_view, full_path, "main");\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
+ elm_object_part_text_set(main_view, "description", "After you add cities, they will be shown here.");\r
+\r
+ button = elm_button_add(parent);\r
+ if (button) {\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
+}\r
+\r
+void main_view_destroy(Evas_Object *main_view)\r
+{\r
+ Evas_Object *button = NULL;\r
+\r
+ ret_if(!main_view);\r
+\r
+ button = elm_object_part_content_unset(main_view, "button");\r
+ if (button) {\r
+ evas_object_del(button);\r
+ }\r
+\r
+ evas_object_del(main_view);\r
+}\r
--- /dev/null
+#include <Elementary.h>
+#include "main.h"
+#include "log.h"
+
+const char *const MAP_EDJE = "map.edj";
+
+
+static city_info_s cities[] = {
+ {
+ .id = CITY_HONOLULU,
+ .timezone = -10.0,
+ .name = "Honolulu",
+ .nation = "USA",
+ },
+ {
+ .id = CITY_LOS_ANGELES,
+ .timezone = -8.0,
+ .name = "Los Angeles",
+ .nation = "USA",
+ },
+ {
+ .id = CITY_SAN_FRANCISCO,
+ .timezone = -8.0,
+ .name = "San Francisco",
+ .nation = "USA",
+ },
+ {
+ .id = CITY_VANCOUVER,
+ .timezone = -8.0,
+ .name = "Vancouver",
+ .nation = "Canada",
+ },
+ {
+ .id = CITY_CHICAGO,
+ .timezone = -6.0,
+ .name = "Chicago",
+ .nation = "USA",
+ },
+ {
+ .id = CITY_MEICO_CITY,
+ .timezone = -6.0,
+ .name = "Mexico City",
+ .nation = "Mexico",
+ },
+ {
+ .id = CITY_SAN_JOSE,
+ .timezone = -6.0,
+ .name = "San Jose",
+ .nation = "Costa Rica",
+ },
+ {
+ .id = CITY_NEW_YORK_CITY,
+ .timezone = -5.0,
+ .name = "New York City",
+ .nation = "USA",
+ },
+ {
+ .id = CITY_TORONTO,
+ .timezone = -5.0,
+ .name = "Toronto",
+ .nation = "Canada",
+ },
+ {
+ .id = CITY_WASHINGTON_DC,
+ .timezone = -5.0,
+ .name = "Washington DC",
+ .nation = "USA",
+ },
+ {
+ .id = CITY_BRASILIA,
+ .timezone = -3.0,
+ .name = "Brasilia",
+ .nation = "Brazil",
+ },
+ {
+ .id = CITY_BUENOS_AIRES,
+ .timezone = -3.0,
+ .name = "Buenos Aires",
+ .nation = "Argentina",
+ },
+ {
+ .id = CITY_SAO_PAULO,
+ .timezone = -3.0,
+ .name = "Sao Paulo",
+ .nation = "Brazil",
+ },
+ {
+ .id = CITY_DUBLIN,
+ .timezone = 0.0,
+ .name = "Dublin",
+ .nation = "Ireland",
+ },
+ {
+ .id = CITY_LISBON,
+ .timezone = 0.0,
+ .name = "Lisbon",
+ .nation = "Portugal",
+ },
+ {
+ .id = CITY_LONDON,
+ .timezone = 0.0,
+ .name = "London",
+ .nation = "England",
+ },
+ {
+ .id = CITY_AMSTERDAM,
+ .timezone = 1.0,
+ .name = "Amsterdam",
+ .nation = "Netherlands",
+ },
+ {
+ .id = CITY_BARCELONA,
+ .timezone = 1.0,
+ .name = "Barcelona",
+ .nation = "Spain",
+ },
+ {
+ .id = CITY_BERLIN,
+ .timezone = 1.0,
+ .name = "Berlin",
+ .nation = "Germany",
+ },
+ {
+ .id = CITY_BRUSSELS,
+ .timezone = 1.0,
+ .name = "Brussels",
+ .nation = "Belgium",
+ },
+ {
+ .id = CITY_CAPE_TOWN,
+ .timezone = 1.0,
+ .name = "Cape Town",
+ .nation = "South Africa",
+ },
+ {
+ .id = CITY_GENEVA,
+ .timezone = 1.0,
+ .name = "Geneva",
+ .nation = "Switzerland",
+ },
+ {
+ .id = CITY_MADRID,
+ .timezone = 1.0,
+ .name = "Madrid",
+ .nation = "Spain",
+ },
+ {
+ .id = CITY_PARIS,
+ .timezone = 1.0,
+ .name = "Paris",
+ .nation = "France",
+ },
+ {
+ .id = CITY_ROME,
+ .timezone = 1.0,
+ .name = "Rome",
+ .nation = "Italy",
+ },
+ {
+ .id = CITY_STOCKHOLM,
+ .timezone = 1.0,
+ .name = "Stockholm",
+ .nation = "Sweden",
+ },
+ {
+ .id = CITY_WARSAW,
+ .timezone = 1.0,
+ .name = "Warsaw",
+ .nation = "Poland",
+ },
+ {
+ .id = CITY_ANKARA,
+ .timezone = 2.0,
+ .name = "Ankara",
+ .nation = "Turkey",
+ },
+ {
+ .id = CITY_ATHENS,
+ .timezone = 2.0,
+ .name = "Athens",
+ .nation = "Greece",
+ },
+ {
+ .id = CITY_HELSINKI,
+ .timezone = 2.0,
+ .name = "Helsinki",
+ .nation = "Finland",
+ },
+ {
+ .id = CITY_ISTANBUL,
+ .timezone = 2.0,
+ .name = "Istanbul",
+ .nation = "Turkey",
+ },
+ {
+ .id = CITY_JERUSALEM,
+ .timezone = 2.0,
+ .name = "Jerusalem",
+ .nation = "Israel",
+ },
+ {
+ .id = CITY_KAHIRA,
+ .timezone = 2.0,
+ .name = "Jerusalem",
+ .nation = "Egypt",
+ },
+ {
+ .id = CITY_BAGHDAD,
+ .timezone = 3.0,
+ .name = "Baghdad",
+ .nation = "Iraq",
+ },
+ {
+ .id = CITY_DUBAI,
+ .timezone = 3.0,
+ .name = "Dubai",
+ .nation = "United Arab Emirates",
+ },
+ {
+ .id = CITY_MOSCOW,
+ .timezone = 3.0,
+ .name = "Moscow",
+ .nation = "Russia",
+ },
+ {
+ .id = CITY_ISLAMABAD,
+ .timezone = 5.0,
+ .name = "Islamabad",
+ .nation = "Pakistan",
+ },
+ {
+ .id = CITY_DELHI,
+ .timezone = 5.5,
+ .name = "Delhi",
+ .nation = "India",
+ },
+ {
+ .id = CITY_MUMBAI,
+ .timezone = 5.5,
+ .name = "Mumbai",
+ .nation = "India",
+ },
+ {
+ .id = CITY_BOMBAY,
+ .timezone = 6.0,
+ .name = "Bombay",
+ .nation = "India",
+ },
+ {
+ .id = CITY_CALCUTTA,
+ .timezone = 6.0,
+ .name = "Calcutta",
+ .nation = "India",
+ },
+ {
+ .id = CITY_BANGKOK,
+ .timezone = 7.0,
+ .name = "Bangkok",
+ .nation = "Thailand",
+ },
+ {
+ .id = CITY_JAKARTA,
+ .timezone = 7.0,
+ .name = "Jakarta",
+ .nation = "Indonesia",
+ },
+ {
+ .id = CITY_BEIJING,
+ .timezone = 8.0,
+ .name = "Beijing",
+ .nation = "China",
+ },
+ {
+ .id = CITY_HONG_KONG,
+ .timezone = 8.0,
+ .name = "Hong Kong",
+ .nation = "China",
+ },
+ {
+ .id = CITY_SINGAPORE,
+ .timezone = 8.0,
+ .name = "Singapore",
+ .nation = "Singapore",
+ },
+ {
+ .id = CITY_TAIPEI,
+ .timezone = 8.0,
+ .name = "Taipei",
+ .nation = "Thaiwan",
+ },
+ {
+ .id = CITY_SEOUL,
+ .timezone = 9.0,
+ .name = "Seoul",
+ .nation = "Korea",
+ },
+ {
+ .id = CITY_TOKYO,
+ .timezone = 9.0,
+ .name = "Tokyo",
+ .nation = "Japan",
+ },
+ {
+ .id = CITY_SYDNEY,
+ .timezone = 10.0,
+ .name = "Sydney",
+ .nation = "Australia",
+ },
+};
+
+Evas_Object *map_create(Evas_Object *parent)
+{
+ Evas_Object *map = NULL;
+ Evas_Object *button = NULL;
+ char *path = NULL;
+ char full_path[] = {0, };
+
+ retv_if(!parent, NULL);
+
+ path = app_get_resource_path();
+ retv_if(!path, NULL);
+
+ snprintf(full_path, sizeof(full_path), "%s/edje/%s", path, MAP_EDJE);
+ free(path);
+
+ map = elm_layout_add(parent);
+ retv_if(!map, NULL);
+ elm_layout_file_set(map, full_path, "main");
+ evas_object_show(map);
+
+ return map;
+}
+
+void map_destroy(Evas_Object *map)
+{
+ Evas_Object *button = NULL;
+
+ ret_if(!map);
+
+ evas_object_del(map);
+}
--- /dev/null
+#include <Elementary.h>\r
+#include "main.h"\r
+#include "log.h"\r
+#include "scroller"\r
+\r
+const char *const MAIN_VIEW_EDJE = "result_view.edj";\r
+\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->result_view\r
+\r
+ moment_info->scroller = scroller_create(moment_info->ui_manager);\r
+ ret_if(!moment_info->scroller);\r
+}\r
+\r
+Evas_Object *result_view_create(Evas_Object *parent, moment_info_s *moment_info)\r
+{\r
+ Evas_Object *result_view = NULL;\r
+ Evas_Object *button = NULL;\r
+ char *path = NULL;\r
+ char full_path[] = {0, };\r
+\r
+ retv_if(!parent, NULL);\r
+\r
+ path = app_get_resource_path();\r
+ retv_if(!path, NULL);\r
+\r
+ snprintf(full_path, sizeof(full_path), "%s/edje/%s", path, MAIN_VIEW_EDJE);\r
+ free(path);\r
+\r
+ result_view = elm_layout_add(parent);\r
+ retv_if(!result_view, NULL);\r
+ elm_layout_file_set(result_view, full_path, "main");\r
+ evas_object_size_hint_weight_set(result_view, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);\r
+ evas_object_size_hint_align_set(result_view, EVAS_HINT_FILL, EVAS_HINT_FILL);\r
+ evas_object_show(result_view);\r
+\r
+ elm_object_part_text_set(result_view, "title", "No cities");\r
+ elm_object_part_text_set(result_view, "description", "After you add cities, they will be shown here.");\r
+\r
+ button = elm_button_add(parent);\r
+ if (button) {\r
+ elm_object_text_set(button, "+ Add");\r
+ elm_object_part_content_set(result_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 result_view;\r
+}\r
+\r
+void result_view_destroy(Evas_Object *result_view)\r
+{\r
+ Evas_Object *button = NULL;\r
+\r
+ ret_if(!result_view);\r
+\r
+ button = elm_object_part_content_unset(result_view, "button");\r
+ if (button) {\r
+ evas_object_del(button);\r
+ }\r
+\r
+ evas_object_del(result_view);\r
+}\r
--- /dev/null
+#include <Elementary.h>
+
+#include "util.h"
+#include "log.h"
+#include "scroller.h"
+
+#define PRIVATE_DATA_KEY_SCROLLER_IS_SCROLLING "p_is_sc"
+#define PRIVATE_DATA_KEY_SCROLLER_DRAG_START "p_dg_st"
+#define PRIVATE_DATA_KEY_EVENT_CALLBACK_LIST "pdkec"
+
+
+
+struct _event_cb {
+ int event_type;
+ void (*event_cb)(Evas_Object *scroller, int event_type, void *event_info, void *user_data);
+ void *user_data;
+};
+typedef struct _event_cb event_cb_s;
+
+
+
+int scroller_is_scrolling(Evas_Object *scroller)
+{
+ retv_if(!scroller, 0);
+ return (int) evas_object_data_get(scroller, PRIVATE_DATA_KEY_SCROLLER_IS_SCROLLING);
+}
+
+
+
+static void __anim_start_cb(void *data, Evas_Object *scroller, void *event_info)
+{
+ _D("start the scroller(%p) animation", scroller);
+ evas_object_data_set(scroller, PRIVATE_DATA_KEY_SCROLLER_IS_SCROLLING, (void *) 1);
+}
+
+
+
+static void __anim_stop_cb(void *data, Evas_Object *scroller, void *event_info)
+{
+ _D("stop the scroller(%p) animation", scroller);
+ evas_object_data_del(scroller, PRIVATE_DATA_KEY_SCROLLER_IS_SCROLLING);
+ evas_object_data_del(scroller, PRIVATE_DATA_KEY_SCROLLER_DRAG_START);
+}
+
+
+
+static void __drag_start_cb(void *data, Evas_Object *scroller, void *event_info)
+{
+ _D("start to drag the scroller(%p)", scroller);
+ evas_object_data_set(scroller, PRIVATE_DATA_KEY_SCROLLER_DRAG_START, (void *) 1);
+}
+
+
+
+static void __drag_stop_cb(void *data, Evas_Object *scroller, void *event_info)
+{
+ _D("stop to drag the scroller(%p)", scroller);
+}
+
+
+
+static void __scroll_cb(void *data, Evas_Object *scroller, void *event_info)
+{
+ int y = 0;
+
+ ret_if(!scroller);
+
+ if (!evas_object_data_get(scroller, PRIVATE_DATA_KEY_SCROLLER_DRAG_START))
+ return;
+
+ elm_scroller_region_get(scroller, NULL, &y, NULL, NULL);
+}
+
+
+
+Evas_Object *scroller_create(Evas_Object *parent)
+{
+ Evas_Object *box = NULL;
+ Evas_Object *scroller = NULL;
+
+ retv_if(!parent, NULL);
+
+ scroller = elm_scroller_add(parent);
+ retv_if(!scroller, NULL);
+
+ elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_FALSE);
+ elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+ elm_scroller_page_scroll_limit_set(scroller, 0, 0);
+ elm_scroller_content_min_limit(scroller, EINA_FALSE, EINA_TRUE);
+ elm_scroller_single_direction_set(scroller, ELM_SCROLLER_SINGLE_DIRECTION_HARD);
+
+ evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_min_set(scroller, 0, 0);
+
+ elm_object_style_set(scroller, "effect");
+ evas_object_show(scroller);
+ elm_object_scroll_lock_y_set(scroller, EINA_FALSE);
+
+ evas_object_smart_callback_add(scroller, "scroll,anim,start", __anim_start_cb, NULL);
+ evas_object_smart_callback_add(scroller, "scroll,anim,stop", __anim_stop_cb, NULL);
+ evas_object_smart_callback_add(scroller, "scroll,drag,start", __drag_start_cb, NULL);
+ evas_object_smart_callback_add(scroller, "scroll,drag,stop", __drag_stop_cb, NULL);
+ evas_object_smart_callback_add(scroller, "scroll", __scroll_cb, NULL);
+
+ box = elm_box_add(scroller);
+ goto_if(!box, ERROR);
+
+ elm_box_horizontal_set(box, EINA_FALSE);
+ elm_box_align_set(box, 0.0, 0.5);
+ evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(box);
+
+ elm_object_content_set(scroller, box);
+
+ return scroller;
+
+ERROR:
+ if (scroller) {
+ evas_object_del(scroller);
+ }
+
+ return NULL;
+}
+
+
+
+void scroller_destroy(Evas_Object *scroller)
+{
+ Evas_Object *box = NULL;
+
+ ret_if(!scroller);
+
+ box = elm_object_content_unset(scroller);
+ if (box) {
+ evas_object_del(box);
+ }
+
+ evas_object_del(scroller);
+}
+
+
+
+void scroller_append_item(Evas_Object *scroller, Evas_Object *item)
+{
+ Evas_Object *box = NULL;
+
+ box = elm_object_content_get(scroller);
+ ret_if(!box);
+
+ elm_box_pack_end(box, item);
+}
+
+
+
+void scroller_remove_item(Evas_Object *scroller, Evas_Object *item)
+{
+ Evas_Object *box = NULL;
+ Evas_Object *tmp = NULL;
+ Eina_List *list = NULL;
+
+ int is_item_exist = 0;
+
+ box = elm_object_content_get(scroller);
+ ret_if(!box);
+
+ list = elm_box_children_get(box);
+ EINA_LIST_FREE(list, tmp) {
+ continue_if(!tmp);
+ if (item == tmp) {
+ is_item_exist = 1;
+ }
+ }
+
+ if (!is_item_exist) {
+ _D("No item to remove");
+ return;
+ }
+
+ elm_box_unpack(box, item);
+}
+
+
+
+void scroller_bring_in_item(Evas_Object *scroller, Evas_Object *item)
+{
+ Evas_Object *box = NULL;
+ Evas_Object *tmp = NULL;
+ Eina_List *list = NULL;
+ int y = 0;
+ int exist = 0;
+
+ ret_if(!scroller);
+ ret_if(!item);
+
+ box = elm_object_content_get(scroller);
+ ret_if(!box);
+
+ list = elm_box_children_get(box);
+ ret_if(!list);
+
+ EINA_LIST_FREE(list, tmp) {
+ continue_if(!tmp);
+ if (item == tmp) {
+ evas_object_geometry_get(item, NULL, &y, NULL, NULL);
+ exist = 1;
+ }
+ }
+
+ if (exist) {
+ elm_scroller_region_bring_in(scroller, 0, y, 0, 0);
+ }
+}
+
+
+
+int scroller_register_event_cb(Evas_Object *scroller, int event_type, void (*event_cb)(Evas_Object *scroller, int event_type, void *event_info, void *user_data), void *user_data)
+{
+ Eina_List *event_cb_list = NULL;
+ event_cb_s *event_cb_info = NULL;
+
+ retv_if(!scroller, APPL_ERROR_INVALID_PARAMETER);
+ retv_if(event_type <= SCROLLER_EVENT_TYPE_INVALID, APPL_ERROR_INVALID_PARAMETER);
+ retv_if(event_type >= SCROLLER_EVENT_TYPE_MAX, APPL_ERROR_INVALID_PARAMETER);
+ retv_if(!event_cb, APPL_ERROR_INVALID_PARAMETER);
+
+ event_cb_info = calloc(1, sizeof(event_cb_s));
+ retv_if(!event_cb_info, APPL_ERROR_OUT_OF_MEMORY);
+
+ event_cb_info->event_type = event_type;
+ event_cb_info->event_cb = event_cb;
+ event_cb_info->user_data = user_data;
+
+ event_cb_list = evas_object_data_get(scroller, PRIVATE_DATA_KEY_EVENT_CALLBACK_LIST);
+ event_cb_list = eina_list_append(event_cb_list, event_cb_info);
+ evas_object_data_set(scroller, PRIVATE_DATA_KEY_EVENT_CALLBACK_LIST, event_cb_list);
+
+ return APPL_ERROR_NONE;
+}
+
+
+
+int scroller_unregister_event_cb(Evas_Object *scroller, int event_type, void (*event_cb)(Evas_Object *scroller, int event_type, void *event_info, void *user_data))
+{
+ Eina_List *event_cb_list = NULL;
+ const Eina_List *l = NULL;
+ const Eina_List *ln = NULL;
+ event_cb_s *event_cb_info = NULL;
+
+ retv_if(!scroller, APPL_ERROR_INVALID_PARAMETER);
+ retv_if(event_type <= SCROLLER_EVENT_TYPE_INVALID, APPL_ERROR_INVALID_PARAMETER);
+ retv_if(event_type >= SCROLLER_EVENT_TYPE_MAX, APPL_ERROR_INVALID_PARAMETER);
+ retv_if(!event_cb, APPL_ERROR_INVALID_PARAMETER);
+
+ event_cb_list = evas_object_data_get(scroller, PRIVATE_DATA_KEY_EVENT_CALLBACK_LIST);
+ retv_if(!event_cb_list, APPL_ERROR_FAIL);
+
+ EINA_LIST_FOREACH_SAFE(event_cb_list, l, ln, event_cb_info) {
+ if (event_cb_info->event_type == event_type
+ && event_cb_info->event_cb == event_cb) {
+ event_cb_list = eina_list_remove(event_cb_list, event_cb_info);
+ break;
+ }
+ }
+
+ evas_object_data_set(scroller, PRIVATE_DATA_KEY_EVENT_CALLBACK_LIST, event_cb_list);
+
+ return APPL_ERROR_NONE;
+}
--- /dev/null
+#include <Elementary.h>
+#include "main.h"
+#include "log.h"
+#include "scroller"
+
+const char *const MAIN_VIEW_EDJE = "search.edj";
+
+static _clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ moment_info_s *moment_info = data;
+
+ _D("Add button is clicked");
+
+ ret_if(!moment_info);
+
+ elm_object_signal_emit(moment_info->search
+
+ moment_info->scroller = scroller_create(moment_info->ui_manager);
+ ret_if(!moment_info->scroller);
+}
+
+Evas_Object *search_create(Evas_Object *parent, moment_info_s *moment_info)
+{
+ Evas_Object *search = NULL;
+ Evas_Object *button = NULL;
+ char *path = NULL;
+ char full_path[] = {0, };
+
+ retv_if(!parent, 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);
+
+ search = elm_layout_add(parent);
+ retv_if(!search, NULL);
+ elm_layout_file_set(search, full_path, "main");
+ evas_object_size_hint_weight_set(search, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(search, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(search);
+
+ elm_object_part_text_set(search, "title", "No cities");
+ elm_object_part_text_set(search, "description", "After you add cities, they will be shown here.");
+
+ button = elm_button_add(parent);
+ if (button) {
+ elm_object_text_set(button, "+ Add");
+ elm_object_part_content_set(search, "button", button);
+ evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(button, "clicked", _clicked_cb, moment_info);
+ }
+
+ return search;
+}
+
+void search_destroy(Evas_Object *search)
+{
+ Evas_Object *button = NULL;
+
+ ret_if(!search);
+
+ button = elm_object_part_content_unset(search, "button");
+ if (button) {
+ evas_object_del(button);
+ }
+
+ evas_object_del(search);
+}
--- /dev/null
+#include <Elementary.h>
+#include "main.h"
+#include "log.h"
+
+const char *const UI_MANAGER_EDJE = "ui_manager.edj";
+
+Evas_Object *ui_manager_create(Evas_Object *parent, moment_info_s *moment_info)
+{
+ Evas_Object *ui_manager = NULL;
+ Evas_Object *rect = 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(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;
+}
+
+
+
+extern void ui_manager_destroy(Evas_Object *ui_manager)
+{
+ Evas_Object *rect = NULL;
+ Evas_Object *content = NULL;
+ void (*destroy_function)(void *data);
+
+ ret_if(!ui_manager);
+
+ rect = elm_object_part_content_unset(ui_manager, "bg");
+ if (rect)
+ evas_object_del(rect);
+
+ content = elm_object_part_content_unset(ui_manager, "content");
+ if (content) {
+ destroy_function = evas_object_data_del(ui_manager, DATA_KEY_DESTROY_FUNCTION);
+ if (destroy_function)
+ destroy_function(content);
+ }
+
+ evas_object_del(ui_manager);
+}
--- /dev/null
+/*
+ * Samsung API
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd.
+ *
+ * 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/license/
+ *
+ * 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.
+ */
+
+#include <tizen.h>
+#include <EWebKit.h>
+#include "adventure.h"
+#include "log.h"
+
+
+Evas_Object *webview_create(Evas_Object *parent)
+{
+ Evas *e = NULL;
+ Evas_Object *webview = NULL;
+ int ret = -1;
+
+ retv_if(!parent, NULL);
+
+ ret = ewk_init();
+ retv_if(ret <= 0, NULL);
+
+ e = evas_object_evas_get(parent);
+ goto_if(!e, error);
+
+ webview = ewk_view_add(e);
+ goto_if(!webview, error);
+
+ return webview;
+
+error:
+ ewk_shutdown();
+ return NULL;
+}
+
+void webview_destroy(Evas_Object *webview)
+{
+ ret_if(!webview);
+ evas_object_del(webview);
+ ewk_shutdown();
+}
+
+void webview_set_url(Evas_Object *webview, const char *url)
+{
+ ret_if(!webview);
+ ret_if(!url);
+
+ ewk_view_url_set(webview, url);
+}
}
collections {
- base_scale: 1.7;
group {
- name: "item";
+ name: "main";
parts {
part {
name: "bg";
}
}
part {
- name: "icon";
- type: SWALLOW;
- mouse_events: 1;
+ name: "name";
+ type: TEXT;
+ mouse_events: 0;
scale: 1;
description {
state: "default" 0.0;
- rel1 { relative: 0.1 0.1; to: "bg"; }
- rel2 { relative: 0.9 0.66; to: "bg"; }
- color: 255 255 255 255;
+ rel1 { relative: 0.0 0.1; to: "bg"; }
+ rel2 { relative: 1.0 0.5; to: "bg"; }
+ color: 0 0 0 255;
+ text {
+ text: "";
+ font: "Tizen:style=Bold";
+ text_class: "tizen";
+ min: 0 0;
+ size: 24;
+ align: 0.0 0.5;
+ }
visible: 1;
}
- description {
- state: "pressed" 0.0;
- inherit: "default" 0.0;
- color: 100 100 100 255;
- }
}
part {
- name: "name";
- type: TEXTBLOCK;
- mouse_events: 1;
+ name: "gmt";
+ type: TEXT;
+ mouse_events: 0;
scale: 1;
description {
state: "default" 0.0;
- rel1 { relative: 0.0 0.7; to: "bg"; }
- rel2 { relative: 1.0 1.0; to: "bg"; }
- align: 0.5 0.0;
- color: 0 0 0 100;
+ rel1 { relative: 0.0 0.5; to: "bg"; }
+ rel2 { relative: 1.0 0.9; to: "bg"; }
+ color: 0 0 0 255;
text {
- style: "text_style";
- align: 0.5 0.0;
+ text: "";
+ font: "Tizen:style=Bold";
+ text_class: "tizen";
+ min: 0 0;
+ size: 20;
+ align: 0.0 0.5;
}
visible: 1;
}
}
}
part {
- name: "map";
+ name: "search";
type: SWALLOW;
scale: 1;
mouse_events: 0;
align: 0.5 0.0;
visible: 1;
}
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: 0.5 -0.1; to: "bg"; }
+ rel2 { relative: 0.5 -0.1; to: "bg"; }
+ }
+ }
+ part {
+ name: "map";
+ 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: "search"; }
+ align: 0.5 0.0;
+ visible: 1;
+ }
}
part {
name: "title";
}
}
part {
- name: "search";
+ name: "content";
type: SWALLOW;
scale: 1;
mouse_events: 0;
}
}
part {
- name: "content";
+ name: "search_result";
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"; }
+ rel1 { relative: 0.0 1.0; to: "search"; }
+ rel2 { relative: 1.0 1.0; to: "bg"; }
align: 0.5 0.0;
visible: 1;
}
programs {
program {
signal: "hide";
- source: "text";
+ source: "search";
action: STATE_SET "hide" 0.0;
- target: "title";
- target: "description";
+ target: "search";
}
program {
signal: "show";
- source: "text";
+ source: "search";
action: STATE_SET "default" 0.0;
- target: "title";
- target: "description";
+ target: "search";
}
program {
signal: "hide";
- source: "button";
+ source: "search_result";
action: STATE_SET "hide" 0.0;
- target: "button";
+ target: "search_result";
}
program {
signal: "show";
- source: "button";
+ source: "search_result";
action: STATE_SET "default" 0.0;
- target: "button";
+ target: "search_result";
+ }
+
+ 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 {
target: "search";
target: "content";
}
+
+ 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";
+ }
}
}
}
--- /dev/null
+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: "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;
+ }
+ }
+ }
+ part {
+ name: "time_current";
+ 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: 24;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part {
+ name: "time_best_name";
+ 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: 24;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part {
+ name: "time_recomment_name";
+ 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: 24;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part {
+ name: "time_best_value";
+ 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: 24;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part {
+ name: "time_recomment_value";
+ 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: 24;
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part {
+ name: "result_circle";
+ 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;
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: 0.5 -0.1; to: "bg"; }
+ rel2 { relative: 0.5 -0.1; to: "bg"; }
+ }
+ }
+ part {
+ name: "button_save";
+ 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: "search"; }
+ align: 0.5 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "button_alarm";
+ 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: "search"; }
+ align: 0.5 0.0;
+ visible: 1;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+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: "entry";
+ type: SWALLOW;
+ scale: 1;
+ mouse_events: 0;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; to: "bg"; }
+ rel2 { relative: 0.8 1.0; to: "bg"; }
+ align: 0.5 0.0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "button";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 1.0 0.0; to: "entry"; }
+ rel2 { relative: 0.0 1.0; to: "button_search"; }
+ align: 0.5 1.0;
+ visible: 1;
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+ part {
+ name: "button_result";
+ type: SWALLOW;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.9 1.0; to: "bg"; }
+ rel2 { relative: 1.0 1.0; to: "bg"; }
+ align: 0.5 1.0;
+ visible: 1;
+ }
+ description {
+ state: "hide" 0.0;
+ inherit: "default" 0.0;
+ rel1 { relative: 1.0 1.0; to: "bg"; }
+ rel2 { relative: 1.1 1.0; to: "bg"; }
+ }
+ }
+ }
+ programs {
+ program {
+ signal: "hide";
+ source: "button_result";
+ action: STATE_SET "hide" 0.0;
+ target: "button_result";
+ }
+ program {
+ signal: "show";
+ source: "button_result";
+ action: STATE_SET "default" 0.0;
+ target: "button_result";
+ }
+ }
+ }
+}
--- /dev/null
+collections {
+ group {
+ name: "main";
+
+ parts {
+ part {
+ name: "bg";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ rel1 { relative: 0.0 0.0; }
+ rel2 { relative: 1.0 1.0; }
+ color: 0 0 0 0;
+ visible: 1;
+ }
+ }
+ part {
+ name: "content";
+ type: SWALLOW;
+ 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"; }
+ align: 0.5 0.0;
+ visible: 1;
+ }
+ }
+ }
+ }
+}
--- /dev/null
+#include "city.h"\r
+\r
+static city_s cities[] = {\r
+ {\r
+ .id = CITY_HONOLULU,\r
+ .timezone = -10.0,\r
+ .name = "Honolulu",\r
+ .nation = "USA",\r
+ },\r
+ {\r
+ .id = CITY_LOS_ANGELES,\r
+ .timezone = -8.0,\r
+ .name = "Los Angeles",\r
+ .nation = "USA",\r
+ },\r
+ {\r
+ .id = CITY_SAN_FRANCISCO,\r
+ .timezone = -8.0,\r
+ .name = "San Francisco",\r
+ .nation = "USA",\r
+ },\r
+ {\r
+ .id = CITY_VANCOUVER,\r
+ .timezone = -8.0,\r
+ .name = "Vancouver",\r
+ .nation = "Canada",\r
+ },\r
+ {\r
+ .id = CITY_CHICAGO,\r
+ .timezone = -6.0,\r
+ .name = "Chicago",\r
+ .nation = "USA",\r
+ },\r
+ {\r
+ .id = CITY_MEICO_CITY,\r
+ .timezone = -6.0,\r
+ .name = "Mexico City",\r
+ .nation = "Mexico",\r
+ },\r
+ {\r
+ .id = CITY_SAN_JOSE,\r
+ .timezone = -6.0,\r
+ .name = "San Jose",\r
+ .nation = "Costa Rica",\r
+ },\r
+ {\r
+ .id = CITY_NEW_YORK_CITY,\r
+ .timezone = -5.0,\r
+ .name = "New York City",\r
+ .nation = "USA",\r
+ },\r
+ {\r
+ .id = CITY_TORONTO,\r
+ .timezone = -5.0,\r
+ .name = "Toronto",\r
+ .nation = "Canada",\r
+ },\r
+ {\r
+ .id = CITY_WASHINGTON_DC,\r
+ .timezone = -5.0,\r
+ .name = "Washington DC",\r
+ .nation = "USA",\r
+ },\r
+ {\r
+ .id = CITY_BRASILIA,\r
+ .timezone = -3.0,\r
+ .name = "Brasilia",\r
+ .nation = "Brazil",\r
+ },\r
+ {\r
+ .id = CITY_BUENOS_AIRES,\r
+ .timezone = -3.0,\r
+ .name = "Buenos Aires",\r
+ .nation = "Argentina",\r
+ },\r
+ {\r
+ .id = CITY_SAO_PAULO,\r
+ .timezone = -3.0,\r
+ .name = "Sao Paulo",\r
+ .nation = "Brazil",\r
+ },\r
+ {\r
+ .id = CITY_DUBLIN,\r
+ .timezone = 0.0,\r
+ .name = "Dublin",\r
+ .nation = "Ireland",\r
+ },\r
+ {\r
+ .id = CITY_LISBON,\r
+ .timezone = 0.0,\r
+ .name = "Lisbon",\r
+ .nation = "Portugal",\r
+ },\r
+ {\r
+ .id = CITY_LONDON,\r
+ .timezone = 0.0,\r
+ .name = "London",\r
+ .nation = "England",\r
+ },\r
+ {\r
+ .id = CITY_AMSTERDAM,\r
+ .timezone = 1.0,\r
+ .name = "Amsterdam",\r
+ .nation = "Netherlands",\r
+ },\r
+ {\r
+ .id = CITY_BARCELONA,\r
+ .timezone = 1.0,\r
+ .name = "Barcelona",\r
+ .nation = "Spain",\r
+ },\r
+ {\r
+ .id = CITY_BERLIN,\r
+ .timezone = 1.0,\r
+ .name = "Berlin",\r
+ .nation = "Germany",\r
+ },\r
+ {\r
+ .id = CITY_BRUSSELS,\r
+ .timezone = 1.0,\r
+ .name = "Brussels",\r
+ .nation = "Belgium",\r
+ },\r
+ {\r
+ .id = CITY_CAPE_TOWN,\r
+ .timezone = 1.0,\r
+ .name = "Cape Town",\r
+ .nation = "South Africa",\r
+ },\r
+ {\r
+ .id = CITY_GENEVA,\r
+ .timezone = 1.0,\r
+ .name = "Geneva",\r
+ .nation = "Switzerland",\r
+ },\r
+ {\r
+ .id = CITY_MADRID,\r
+ .timezone = 1.0,\r
+ .name = "Madrid",\r
+ .nation = "Spain",\r
+ },\r
+ {\r
+ .id = CITY_PARIS,\r
+ .timezone = 1.0,\r
+ .name = "Paris",\r
+ .nation = "France",\r
+ },\r
+ {\r
+ .id = CITY_ROME,\r
+ .timezone = 1.0,\r
+ .name = "Rome",\r
+ .nation = "Italy",\r
+ },\r
+ {\r
+ .id = CITY_STOCKHOLM,\r
+ .timezone = 1.0,\r
+ .name = "Stockholm",\r
+ .nation = "Sweden",\r
+ },\r
+ {\r
+ .id = CITY_WARSAW,\r
+ .timezone = 1.0,\r
+ .name = "Warsaw",\r
+ .nation = "Poland",\r
+ },\r
+ {\r
+ .id = CITY_ANKARA,\r
+ .timezone = 2.0,\r
+ .name = "Ankara",\r
+ .nation = "Turkey",\r
+ },\r
+ {\r
+ .id = CITY_ATHENS,\r
+ .timezone = 2.0,\r
+ .name = "Athens",\r
+ .nation = "Greece",\r
+ },\r
+ {\r
+ .id = CITY_HELSINKI,\r
+ .timezone = 2.0,\r
+ .name = "Helsinki",\r
+ .nation = "Finland",\r
+ },\r
+ {\r
+ .id = CITY_ISTANBUL,\r
+ .timezone = 2.0,\r
+ .name = "Istanbul",\r
+ .nation = "Turkey",\r
+ },\r
+ {\r
+ .id = CITY_JERUSALEM,\r
+ .timezone = 2.0,\r
+ .name = "Jerusalem",\r
+ .nation = "Israel",\r
+ },\r
+ {\r
+ .id = CITY_KAHIRA,\r
+ .timezone = 2.0,\r
+ .name = "Jerusalem",\r
+ .nation = "Egypt",\r
+ },\r
+ {\r
+ .id = CITY_BAGHDAD,\r
+ .timezone = 3.0,\r
+ .name = "Baghdad",\r
+ .nation = "Iraq",\r
+ },\r
+ {\r
+ .id = CITY_DUBAI,\r
+ .timezone = 3.0,\r
+ .name = "Dubai",\r
+ .nation = "United Arab Emirates",\r
+ },\r
+ {\r
+ .id = CITY_MOSCOW,\r
+ .timezone = 3.0,\r
+ .name = "Moscow",\r
+ .nation = "Russia",\r
+ },\r
+ {\r
+ .id = CITY_ISLAMABAD,\r
+ .timezone = 5.0,\r
+ .name = "Islamabad",\r
+ .nation = "Pakistan",\r
+ },\r
+ {\r
+ .id = CITY_DELHI,\r
+ .timezone = 5.5,\r
+ .name = "Delhi",\r
+ .nation = "India",\r
+ },\r
+ {\r
+ .id = CITY_MUMBAI,\r
+ .timezone = 5.5,\r
+ .name = "Mumbai",\r
+ .nation = "India",\r
+ },\r
+ {\r
+ .id = CITY_BOMBAY,\r
+ .timezone = 6.0,\r
+ .name = "Bombay",\r
+ .nation = "India",\r
+ },\r
+ {\r
+ .id = CITY_CALCUTTA,\r
+ .timezone = 6.0,\r
+ .name = "Calcutta",\r
+ .nation = "India",\r
+ },\r
+ {\r
+ .id = CITY_BANGKOK,\r
+ .timezone = 7.0,\r
+ .name = "Bangkok",\r
+ .nation = "Thailand",\r
+ },\r
+ {\r
+ .id = CITY_JAKARTA,\r
+ .timezone = 7.0,\r
+ .name = "Jakarta",\r
+ .nation = "Indonesia",\r
+ },\r
+ {\r
+ .id = CITY_BEIJING,\r
+ .timezone = 8.0,\r
+ .name = "Beijing",\r
+ .nation = "China",\r
+ },\r
+ {\r
+ .id = CITY_HONG_KONG,\r
+ .timezone = 8.0,\r
+ .name = "Hong Kong",\r
+ .nation = "China",\r
+ },\r
+ {\r
+ .id = CITY_SINGAPORE,\r
+ .timezone = 8.0,\r
+ .name = "Singapore",\r
+ .nation = "Singapore",\r
+ },\r
+ {\r
+ .id = CITY_TAIPEI,\r
+ .timezone = 8.0,\r
+ .name = "Taipei",\r
+ .nation = "Thaiwan",\r
+ },\r
+ {\r
+ .id = CITY_SEOUL,\r
+ .timezone = 9.0,\r
+ .name = "Seoul",\r
+ .nation = "Korea",\r
+ },\r
+ {\r
+ .id = CITY_TOKYO,\r
+ .timezone = 9.0,\r
+ .name = "Tokyo",\r
+ .nation = "Japan",\r
+ },\r
+ {\r
+ .id = CITY_SYDNEY,\r
+ .timezone = 10.0,\r
+ .name = "Sydney",\r
+ .nation = "Australia",\r
+ },\r
+};\r
+\r
+city_s *city_get(void)\r
+{\r
+ return cities;\r
+}\r
\r
const char *const MAIN_VIEW_EDJE = "main_view.edj";\r
\r
+static void _change_entry_cb(void *data, Evas_Object *obj, void *event_info)\r
+{\r
+ moment_info_s *moment_info = data;\r
+\r
+ ret_if(!moment_info);\r
+}\r
+\r
+static Evas_Object *_create_search_entry(Evas_Object *parent, moment_info_s *moment_info)\r
+{\r
+ Evas_Object *entry = NULL;\r
+\r
+ retv_if(!parent, NULL);\r
+\r
+ entry = elm_entry_add(parent);\r
+ retv_if(!entry, NULL);\r
+\r
+ elm_entry_single_line_set(entry, EINA_TRUE);\r
+ elm_entry_scrollable_set(entry, EINA_TRUE);\r
+ elm_entry_cnp_mode_set(entry, ELM_CNP_MODE_PLAINTEXT);\r
+ elm_object_part_text_set(entry, "elm.guide", "City");\r
+\r
+ evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);\r
+ evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);\r
+\r
+ evas_object_smart_callback_add(entry, "changed", _change_entry_cb, moment_info);\r
+ evas_object_smart_callback_add(entry, "focused", _focus_entry_cb, moment_info);\r
+ evas_object_smart_callback_add(entry, "unfocused", _focus_entry_cb, moment_info);\r
+\r
+ evas_object_show(entry);\r
+\r
+ return entry;\r
+}\r
+\r
+void _destroy_search_entry(Evas_Object *entry)\r
+{\r
+ ret_if(!entry);\r
+ evas_object_del(entry);\r
+}\r
+\r
static _clicked_cb(void *data, Evas_Object *obj, void *event_info)\r
{\r
moment_info_s *moment_info = data;\r
\r
main_view = elm_layout_add(parent);\r
retv_if(!main_view, NULL);\r
- elm_layout_file_set(main_view, "main", NULL);\r
+ elm_layout_file_set(main_view, full_path, "main");\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
map = elm_layout_add(parent);
retv_if(!map, NULL);
- elm_layout_file_set(map, "main", NULL);
+ elm_layout_file_set(map, full_path, "main");
evas_object_show(map);
return map;
--- /dev/null
+#include <Elementary.h>\r
+#include "main.h"\r
+#include "log.h"\r
+#include "scroller"\r
+\r
+const char *const MAIN_VIEW_EDJE = "result_view.edj";\r
+\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->result_view\r
+\r
+ moment_info->scroller = scroller_create(moment_info->ui_manager);\r
+ ret_if(!moment_info->scroller);\r
+}\r
+\r
+Evas_Object *result_view_create(Evas_Object *parent, moment_info_s *moment_info)\r
+{\r
+ Evas_Object *result_view = NULL;\r
+ Evas_Object *button = NULL;\r
+ char *path = NULL;\r
+ char full_path[] = {0, };\r
+\r
+ retv_if(!parent, NULL);\r
+\r
+ path = app_get_resource_path();\r
+ retv_if(!path, NULL);\r
+\r
+ snprintf(full_path, sizeof(full_path), "%s/edje/%s", path, MAIN_VIEW_EDJE);\r
+ free(path);\r
+\r
+ result_view = elm_layout_add(parent);\r
+ retv_if(!result_view, NULL);\r
+ elm_layout_file_set(result_view, full_path, "main");\r
+ evas_object_size_hint_weight_set(result_view, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);\r
+ evas_object_size_hint_align_set(result_view, EVAS_HINT_FILL, EVAS_HINT_FILL);\r
+ evas_object_show(result_view);\r
+\r
+ elm_object_part_text_set(result_view, "title", "No cities");\r
+ elm_object_part_text_set(result_view, "description", "After you add cities, they will be shown here.");\r
+\r
+ button = elm_button_add(parent);\r
+ if (button) {\r
+ elm_object_text_set(button, "+ Add");\r
+ elm_object_part_content_set(result_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 result_view;\r
+}\r
+\r
+void result_view_destroy(Evas_Object *result_view)\r
+{\r
+ Evas_Object *button = NULL;\r
+\r
+ ret_if(!result_view);\r
+\r
+ button = elm_object_part_content_unset(result_view, "button");\r
+ if (button) {\r
+ evas_object_del(button);\r
+ }\r
+\r
+ evas_object_del(result_view);\r
+}\r
elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_FALSE);
elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
- elm_scroller_page_scroll_limit_set(scroller, 1, 1);
+ elm_scroller_page_scroll_limit_set(scroller, 0, 0);
elm_scroller_content_min_limit(scroller, EINA_FALSE, EINA_TRUE);
elm_scroller_single_direction_set(scroller, ELM_SCROLLER_SINGLE_DIRECTION_HARD);
elm_object_style_set(scroller, "effect");
evas_object_show(scroller);
- elm_object_scroll_lock_y_set(scroller, EINA_TRUE);
+ elm_object_scroll_lock_y_set(scroller, EINA_FALSE);
evas_object_smart_callback_add(scroller, "scroll,anim,start", __anim_start_cb, NULL);
evas_object_smart_callback_add(scroller, "scroll,anim,stop", __anim_stop_cb, NULL);
box = elm_box_add(scroller);
goto_if(!box, ERROR);
- elm_box_horizontal_set(box, EINA_TRUE);
- elm_box_align_set(box, 0.5, 0.0);
+ elm_box_horizontal_set(box, EINA_FALSE);
+ elm_box_align_set(box, 0.0, 0.5);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(box);
--- /dev/null
+#include <Elementary.h>
+#include "main.h"
+#include "log.h"
+#include "scroller"
+
+const char *const MAIN_VIEW_EDJE = "search.edj";
+
+static _clicked_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ moment_info_s *moment_info = data;
+
+ _D("Add button is clicked");
+
+ ret_if(!moment_info);
+
+ elm_object_signal_emit(moment_info->search
+
+ moment_info->scroller = scroller_create(moment_info->ui_manager);
+ ret_if(!moment_info->scroller);
+}
+
+Evas_Object *search_create(Evas_Object *parent, moment_info_s *moment_info)
+{
+ Evas_Object *search = NULL;
+ Evas_Object *button = NULL;
+ char *path = NULL;
+ char full_path[] = {0, };
+
+ retv_if(!parent, 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);
+
+ search = elm_layout_add(parent);
+ retv_if(!search, NULL);
+ elm_layout_file_set(search, full_path, "main");
+ evas_object_size_hint_weight_set(search, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(search, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_show(search);
+
+ elm_object_part_text_set(search, "title", "No cities");
+ elm_object_part_text_set(search, "description", "After you add cities, they will be shown here.");
+
+ button = elm_button_add(parent);
+ if (button) {
+ elm_object_text_set(button, "+ Add");
+ elm_object_part_content_set(search, "button", button);
+ evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_smart_callback_add(button, "clicked", _clicked_cb, moment_info);
+ }
+
+ return search;
+}
+
+void search_destroy(Evas_Object *search)
+{
+ Evas_Object *button = NULL;
+
+ ret_if(!search);
+
+ button = elm_object_part_content_unset(search, "button");
+ if (button) {
+ evas_object_del(button);
+ }
+
+ evas_object_del(search);
+}