From: Lukasz Stanislawski Date: Mon, 25 Jul 2016 10:32:34 +0000 (+0200) Subject: template of multipackage project added. X-Git-Tag: submit/tizen/20161113.192141~86 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fea429760da282cfb0aefea8612e5f0ebb398147;p=profile%2Fmobile%2Fapps%2Fnative%2Fclock.git template of multipackage project added. --- fea429760da282cfb0aefea8612e5f0ebb398147 diff --git a/clock/.cproject b/clock/.cproject new file mode 100644 index 0000000..fadcfc5 --- /dev/null +++ b/clock/.cproject @@ -0,0 +1,617 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clock/.exportMap b/clock/.exportMap new file mode 100644 index 0000000..43e310e --- /dev/null +++ b/clock/.exportMap @@ -0,0 +1,4 @@ +{ + global: main; + local: *; +}; diff --git a/clock/.project b/clock/.project new file mode 100644 index 0000000..4c9b913 --- /dev/null +++ b/clock/.project @@ -0,0 +1,54 @@ + + + clock + + + ring + clock-common + + + + org.tizen.nativecore.apichecker.apicheckerbuilder + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.tizen.nativecore.apichecker.apicheckernature + + + + 1469441105659 + + 26 + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-*/.tpk + + + + 1469441105662 + + 6 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-project_def.prop + + + + diff --git a/clock/inc/clock.h b/clock/inc/clock.h new file mode 100644 index 0000000..458e504 --- /dev/null +++ b/clock/inc/clock.h @@ -0,0 +1,23 @@ +#ifndef __clock_H__ +#define __clock_H__ + +#include +#include +#include +#include +#include + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "clock" + +#if !defined(PACKAGE) +#define PACKAGE "org.tizen.clock" +#endif + +#define EDJ_FILE "edje/clock.edj" +#define GRP_MAIN "main" + + +#endif /* __clock_H__ */ diff --git a/clock/project_def.prop b/clock/project_def.prop new file mode 100644 index 0000000..f5d467b --- /dev/null +++ b/clock/project_def.prop @@ -0,0 +1,11 @@ +APPNAME = clock + +type = app +profile = mobile-3.0 + +USER_SRCS = src/clock.c +USER_DEFS = +USER_INC_DIRS = inc +USER_OBJS = +USER_LIBS = +USER_EDCS = res/edje/clock.edc diff --git a/clock/res/edje/clock.edc b/clock/res/edje/clock.edc new file mode 100644 index 0000000..083dc42 --- /dev/null +++ b/clock/res/edje/clock.edc @@ -0,0 +1,14 @@ +collections { + group { name: "main"; + parts { + part { name: "txt_title"; + type: TEXT; + mouse_events: 0; + description { state: "default" 0.0; + text { text: "Hello Tizen"; font: "Tizen:style=regular"; size: 20; min: 1 1; align: 0.5 0; ellipsis: -1; } + color: 0 0 0 255; + } + } + } + } +} diff --git a/clock/shared/res/clock.png b/clock/shared/res/clock.png new file mode 100644 index 0000000..9765b1b Binary files /dev/null and b/clock/shared/res/clock.png differ diff --git a/clock/src/clock.c b/clock/src/clock.c new file mode 100644 index 0000000..d718d69 --- /dev/null +++ b/clock/src/clock.c @@ -0,0 +1,190 @@ +#include "clock.h" +#include "clock-common.h" + +typedef struct appdata{ + Evas_Object* win; + Evas_Object* layout; + Evas_Object* conform; +} appdata_s; + +static void +win_delete_request_cb(void *data, Evas_Object *obj, void *event_info) +{ + tizenclock_common(); + ui_app_exit(); +} + +static void +layout_back_cb(void *data, Evas_Object *obj, void *event_info) +{ + appdata_s *ad = data; + /* Let window go to hide state. */ + elm_win_lower(ad->win); +} + +static void +app_get_resource(const char *edj_file_in, char *edj_path_out, int edj_path_max) +{ + char *res_path = app_get_resource_path(); + if (res_path) { + snprintf(edj_path_out, edj_path_max, "%s%s", res_path, edj_file_in); + free(res_path); + } +} + +static void +create_base_gui(appdata_s *ad) +{ + char edj_path[PATH_MAX] = {0, }; + + /* Window */ + /* Create and initialize elm_win. + elm_win is mandatory to manipulate window. */ + ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE); + elm_win_conformant_set(ad->win, EINA_TRUE); + elm_win_autodel_set(ad->win, EINA_TRUE); + + if (elm_win_wm_rotation_supported_get(ad->win)) { + int rots[4] = { 0, 90, 180, 270 }; + elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4); + } + + evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL); + + /* Conformant */ + /* Create and initialize elm_conformant. + elm_conformant is mandatory for base gui to have proper size + when indicator or virtual keypad is visible. */ + ad->conform = elm_conformant_add(ad->win); + elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW); + elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE); + evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(ad->win, ad->conform); + evas_object_show(ad->conform); + + /* Base Layout */ + /* Create an actual view of the base gui. + Modify this part to change the view. */ + app_get_resource(EDJ_FILE, edj_path, (int)PATH_MAX); + ad->layout = elm_layout_add(ad->win); + elm_layout_file_set(ad->layout, edj_path, GRP_MAIN); + evas_object_size_hint_weight_set(ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + eext_object_event_callback_add(ad->layout, EEXT_CALLBACK_BACK, layout_back_cb, ad); + elm_object_content_set(ad->conform, ad->layout); + + /* Show window after base gui is set up */ + evas_object_show(ad->win); + +} + +static bool +app_create(void *data) +{ + /* Hook to take necessary actions before main event loop starts + Initialize UI resources and application's data + If this function returns true, the main loop of application starts + If this function returns false, the application is terminated */ + appdata_s *ad = data; + + create_base_gui(ad); + + return true; +} + +static void +app_control(app_control_h app_control, void *data) +{ + /* Handle the launch request. */ +} + +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) +{ + /* Release all resources. */ +} + +static void +ui_app_lang_changed(app_event_info_h event_info, void *user_data) +{ + /*APP_EVENT_LANGUAGE_CHANGED*/ + + int ret; + char *language; + + ret = app_event_get_language(event_info, &language); + if (ret != APP_ERROR_NONE) { + dlog_print(DLOG_ERROR, LOG_TAG, "app_event_get_language() failed. Err = %d.", ret); + return; + } + + if (language != NULL) { + elm_language_set(language); + free(language); + } +} + +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[]) +{ + appdata_s ad = {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, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad); + + ret = ui_app_main(argc, argv, &event_callback, &ad); + if (ret != APP_ERROR_NONE) { + dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main() is failed. err = %d", ret); + } + + return ret; +} diff --git a/clock/tizen-manifest.xml b/clock/tizen-manifest.xml new file mode 100644 index 0000000..f075431 --- /dev/null +++ b/clock/tizen-manifest.xml @@ -0,0 +1,8 @@ + + + + + clock.png + + + diff --git a/common/.cproject b/common/.cproject new file mode 100644 index 0000000..542b9d8 --- /dev/null +++ b/common/.cproject @@ -0,0 +1,604 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/common/.project b/common/.project new file mode 100644 index 0000000..3e6cef5 --- /dev/null +++ b/common/.project @@ -0,0 +1,46 @@ + + + clock-common + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + 1469441172964 + + 26 + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-*/.tpk + + + + 1469441172967 + + 6 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-project_def.prop + + + + diff --git a/common/inc/clock-common.h b/common/inc/clock-common.h new file mode 100644 index 0000000..9665de2 --- /dev/null +++ b/common/inc/clock-common.h @@ -0,0 +1,21 @@ +#ifndef _CLOCK_COMMON_H_ +#define _CLOCK_COMMON_H_ + +/** + * This header file is included to define _EXPORT_. + */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// This method is exported from clock-common.so +EXPORT_API bool tizenclock_common(void); + +#ifdef __cplusplus +} +#endif +#endif // _CLOCK-COMMON_H_ + diff --git a/common/project_def.prop b/common/project_def.prop new file mode 100644 index 0000000..8ca132c --- /dev/null +++ b/common/project_def.prop @@ -0,0 +1,11 @@ +APPNAME = clock-common + +type = sharedLib +profile = mobile-3.0 + +USER_SRCS = src/clock-common.c +USER_DEFS = +USER_INC_DIRS = inc +USER_OBJS = +USER_LIBS = +USER_EDCS = diff --git a/common/src/clock-common.c b/common/src/clock-common.c new file mode 100644 index 0000000..7f06be9 --- /dev/null +++ b/common/src/clock-common.c @@ -0,0 +1,11 @@ +/** + * This file contains the exported symbol. + */ +#include "clock-common.h" + +// This is an example of an exported method. +bool +tizenclock_common(void) +{ + return true; +} diff --git a/ring/.cproject b/ring/.cproject new file mode 100644 index 0000000..73fa002 --- /dev/null +++ b/ring/.cproject @@ -0,0 +1,616 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ring/.exportMap b/ring/.exportMap new file mode 100644 index 0000000..43e310e --- /dev/null +++ b/ring/.exportMap @@ -0,0 +1,4 @@ +{ + global: main; + local: *; +}; diff --git a/ring/.project b/ring/.project new file mode 100644 index 0000000..41c0754 --- /dev/null +++ b/ring/.project @@ -0,0 +1,46 @@ + + + ring + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + 1469441200563 + + 26 + + org.eclipse.ui.ide.multiFilter + 1.0-projectRelativePath-matches-false-false-*/.tpk + + + + 1469441200565 + + 6 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-project_def.prop + + + + diff --git a/ring/inc/ring.h b/ring/inc/ring.h new file mode 100644 index 0000000..2e94f1a --- /dev/null +++ b/ring/inc/ring.h @@ -0,0 +1,23 @@ +#ifndef __ring_H__ +#define __ring_H__ + +#include +#include +#include +#include +#include + +#ifdef LOG_TAG +#undef LOG_TAG +#endif +#define LOG_TAG "ring" + +#if !defined(PACKAGE) +#define PACKAGE "org.tizen.clock" +#endif + +#define EDJ_FILE "edje/ring.edj" +#define GRP_MAIN "main" + + +#endif /* __ring_H__ */ diff --git a/ring/project_def.prop b/ring/project_def.prop new file mode 100644 index 0000000..061f2b2 --- /dev/null +++ b/ring/project_def.prop @@ -0,0 +1,11 @@ +APPNAME = ring + +type = app +profile = mobile-3.0 + +USER_SRCS = src/ring.c +USER_DEFS = +USER_INC_DIRS = inc +USER_OBJS = +USER_LIBS = +USER_EDCS = res/edje/ring.edc diff --git a/ring/res/edje/ring.edc b/ring/res/edje/ring.edc new file mode 100644 index 0000000..083dc42 --- /dev/null +++ b/ring/res/edje/ring.edc @@ -0,0 +1,14 @@ +collections { + group { name: "main"; + parts { + part { name: "txt_title"; + type: TEXT; + mouse_events: 0; + description { state: "default" 0.0; + text { text: "Hello Tizen"; font: "Tizen:style=regular"; size: 20; min: 1 1; align: 0.5 0; ellipsis: -1; } + color: 0 0 0 255; + } + } + } + } +} diff --git a/ring/shared/res/ring.png b/ring/shared/res/ring.png new file mode 100644 index 0000000..9765b1b Binary files /dev/null and b/ring/shared/res/ring.png differ diff --git a/ring/src/ring.c b/ring/src/ring.c new file mode 100644 index 0000000..7e9fd72 --- /dev/null +++ b/ring/src/ring.c @@ -0,0 +1,188 @@ +#include "ring.h" + +typedef struct appdata{ + Evas_Object* win; + Evas_Object* layout; + Evas_Object* conform; +} appdata_s; + +static void +win_delete_request_cb(void *data, Evas_Object *obj, void *event_info) +{ + ui_app_exit(); +} + +static void +layout_back_cb(void *data, Evas_Object *obj, void *event_info) +{ + appdata_s *ad = data; + /* Let window go to hide state. */ + elm_win_lower(ad->win); +} + +static void +app_get_resource(const char *edj_file_in, char *edj_path_out, int edj_path_max) +{ + char *res_path = app_get_resource_path(); + if (res_path) { + snprintf(edj_path_out, edj_path_max, "%s%s", res_path, edj_file_in); + free(res_path); + } +} + +static void +create_base_gui(appdata_s *ad) +{ + char edj_path[PATH_MAX] = {0, }; + + /* Window */ + /* Create and initialize elm_win. + elm_win is mandatory to manipulate window. */ + ad->win = elm_win_util_standard_add(PACKAGE, PACKAGE); + elm_win_conformant_set(ad->win, EINA_TRUE); + elm_win_autodel_set(ad->win, EINA_TRUE); + + if (elm_win_wm_rotation_supported_get(ad->win)) { + int rots[4] = { 0, 90, 180, 270 }; + elm_win_wm_rotation_available_rotations_set(ad->win, (const int *)(&rots), 4); + } + + evas_object_smart_callback_add(ad->win, "delete,request", win_delete_request_cb, NULL); + + /* Conformant */ + /* Create and initialize elm_conformant. + elm_conformant is mandatory for base gui to have proper size + when indicator or virtual keypad is visible. */ + ad->conform = elm_conformant_add(ad->win); + elm_win_indicator_mode_set(ad->win, ELM_WIN_INDICATOR_SHOW); + elm_win_indicator_opacity_set(ad->win, ELM_WIN_INDICATOR_OPAQUE); + evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(ad->win, ad->conform); + evas_object_show(ad->conform); + + /* Base Layout */ + /* Create an actual view of the base gui. + Modify this part to change the view. */ + app_get_resource(EDJ_FILE, edj_path, (int)PATH_MAX); + ad->layout = elm_layout_add(ad->win); + elm_layout_file_set(ad->layout, edj_path, GRP_MAIN); + evas_object_size_hint_weight_set(ad->layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + eext_object_event_callback_add(ad->layout, EEXT_CALLBACK_BACK, layout_back_cb, ad); + elm_object_content_set(ad->conform, ad->layout); + + /* Show window after base gui is set up */ + evas_object_show(ad->win); + +} + +static bool +app_create(void *data) +{ + /* Hook to take necessary actions before main event loop starts + Initialize UI resources and application's data + If this function returns true, the main loop of application starts + If this function returns false, the application is terminated */ + appdata_s *ad = data; + + create_base_gui(ad); + + return true; +} + +static void +app_control(app_control_h app_control, void *data) +{ + /* Handle the launch request. */ +} + +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) +{ + /* Release all resources. */ +} + +static void +ui_app_lang_changed(app_event_info_h event_info, void *user_data) +{ + /*APP_EVENT_LANGUAGE_CHANGED*/ + + int ret; + char *language; + + ret = app_event_get_language(event_info, &language); + if (ret != APP_ERROR_NONE) { + dlog_print(DLOG_ERROR, LOG_TAG, "app_event_get_language() failed. Err = %d.", ret); + return; + } + + if (language != NULL) { + elm_language_set(language); + free(language); + } +} + +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[]) +{ + appdata_s ad = {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, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad); + ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad); + + ret = ui_app_main(argc, argv, &event_callback, &ad); + if (ret != APP_ERROR_NONE) { + dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main() is failed. err = %d", ret); + } + + return ret; +} diff --git a/ring/tizen-manifest.xml b/ring/tizen-manifest.xml new file mode 100644 index 0000000..0e6fd76 --- /dev/null +++ b/ring/tizen-manifest.xml @@ -0,0 +1,8 @@ + + + + + ring.png + + +