-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxemo.c
129 lines (108 loc) · 3.79 KB
/
proxemo.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#include <app.h>
#include <Elementary.h>
#include <system_settings.h>
#include <efl_extension.h>
#include <dlog.h>
#include <proxemo.h>
#include "view.h"
#include "data.h"
/*
* @brief Hook to take necessary actions before main event loop starts
* @param[in] user_data The user data to be passed to the callback function
* 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
*/
static bool app_create(void *user_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 */
char full_path[PATH_MAX] = { 0, };
/* Create main view */
view_create();
data_get_full_path(EDJ_FILE, full_path, (int) PATH_MAX);
view_dialer_create(full_path);
loadAllPictures();
/* Set full size Rectangle to catch circular dial button touch */
view_dialer_create_rectangle();
eext_rotary_event_handler_add(bezelRotationHandler, NULL);
return true;
}
/*
* @brief This callback function is called when another application
* @param[in] app_control The handle to the app_control
* @param[in] user_data The user data to be passed to the callback function
* sends the launch request to the application
*/
static void app_control(app_control_h app_control, void *user_data) {
/* Handle the launch request. */
}
/*
* @brief This callback function is called each time
* @param[in] user_data The user data to be passed to the callback function
* the application is completely obscured by another application
* and becomes invisible to the user
*/
static void app_pause(void *user_data) {
/* Take necessary actions when application becomes invisible. */
}
/*
* @brief This callback function is called each time
* @param[in] user_data The user data to be passed to the callback function
* the application becomes visible to the user
*/
static void app_resume(void *user_data) {
/* Take necessary actions when application becomes visible. */
}
/*
* @brief This callback function is called once after the main loop of the application exits
* @param[in] user_data The user data to be passed to the callback function
*/
static void app_terminate(void *user_data) {
/*
* Destroy window component.
*/
view_destroy();
eext_rotary_event_handler_del(bezelRotationHandler);
}
/*
* @brief This function will be called when the language is changed
* @param[in] event_info The system event information
* @param[in] user_data The user data to be passed to the callback function
*/
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);
if (locale != NULL) {
elm_language_set(locale);
free(locale);
}
return;
}
/*
* @brief Main function of the application
* @param[in] argc The argument count
* @param[in] argv The argument vector
*/
int main(int argc, char *argv[]) {
int ret;
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;
/*
* If you want to handling more events,
* Please check the application lifecycle guide
*/
ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, NULL);
ret = ui_app_main(argc, argv, &event_callback, NULL);
if (ret != APP_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main() is failed. err = %d", ret);
}
return ret;
}