2 * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 |R| #include "$(appName).h"
22 * @brief Hook to take necessary actions before main event loop starts
23 * Initialize UI resources and application's data
24 * If this function returns true, the main loop of application starts
25 * If this function returns false, the application is terminated
27 |R| static bool app_create(void *user_data)
33 * @brief This callback function is called when another application
34 * sends the launch request to the application
36 |R| static void app_control(app_control_h app_control, void *user_data)
38 /* Handle the launch request. */
42 * @brief This callback function is called each time
43 * the application is completely obscured by another application
44 * and becomes invisible to the user
46 |R| static void app_pause(void *user_data)
48 /* Take necessary actions when application becomes invisible. */
52 * @brief This callback function is called each time
53 * the application becomes visible to the user
55 |R| static void app_resume(void *user_data)
57 /* Take necessary actions when application becomes visible. */
61 * @brief This callback function is called once after the main loop of the application exits
63 |R| static void app_terminate(void *user_data)
65 /* Release all resources. */
69 * @brief This function will be called when the language is changed
71 |R| static void ui_app_lang_changed(app_event_info_h event_info, void *user_data)
73 /*APP_EVENT_LANGUAGE_CHANGED*/
74 |R| char *locale = NULL;
76 |R| system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
78 |R| if (locale != NULL) {
79 |R| elm_language_set(locale);
86 * @brief Main function of the application
88 |R| int main(int argc, char *argv[])
92 |R| ui_app_lifecycle_callback_s event_callback = {0, };
93 |R| app_event_handler_h handlers[5] = {NULL, };
95 |R| event_callback.create = app_create;
96 |R| event_callback.terminate = app_terminate;
97 |R| event_callback.pause = app_pause;
98 |R| event_callback.resume = app_resume;
99 |R| event_callback.app_control = app_control;
102 |R| * If you want to handling more events,
103 |R| * Please check the application lifecycle guide
105 ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, NULL);
107 |R| ret = ui_app_main(argc, argv, &event_callback, NULL);
108 |R| if (ret != APP_ERROR_NONE)
109 dlog_print(DLOG_ERROR, LOG_TAG, "ui_app_main() is failed. err = %d", ret);