2 * Copyright (c) 2014 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.
19 #include <vconf-keys.h>
21 #include "input_method_setting_selector.h"
22 #include "input_method_setting_selector_ui.h"
25 app_create(void *data)
28 /* Hook to take necessary actions before main event loop starts
29 Initialize UI resources and application's data
30 If this function returns true, the main loop of application starts
31 If this function returns false, the application is terminated */
37 app_control(app_control_h app_control, void *data)
39 /* Handle the launch request. */
40 appdata *ad = (appdata *)data;
48 ad->app_type = APP_TYPE_NORMAL;
49 ad->app_state = APP_STATE_SERVICE;
50 im_setting_selector_app_create(ad);
56 appdata *ad = (appdata *)data;
58 /* Take necessary actions when application becomes invisible. */
62 ad->app_state = APP_STATE_PAUSE;
63 im_setting_selector_app_pause(ad);
67 app_resume(void *data)
69 appdata *ad = (appdata *)data;
71 /* Take necessary actions when application becomes visible. */
75 ad->app_state = APP_STATE_RESUME;
79 app_terminate(void *data)
81 appdata *ad = (appdata *)data;
83 /* Release all resources. */
87 ad->app_state = APP_STATE_TERMINATE;
88 im_setting_selector_app_terminate(ad);
92 ui_app_lang_changed(app_event_info_h event_info, void *user_data)
95 /*APP_EVENT_LANGUAGE_CHANGED*/
99 ui_app_orient_changed(app_event_info_h event_info, void *user_data)
102 /*APP_EVENT_DEVICE_ORIENTATION_CHANGED*/
106 ui_app_region_changed(app_event_info_h event_info, void *user_data)
109 /*APP_EVENT_REGION_FORMAT_CHANGED*/
113 ui_app_low_battery(app_event_info_h event_info, void *user_data)
116 /*APP_EVENT_LOW_BATTERY*/
120 ui_app_low_memory(app_event_info_h event_info, void *user_data)
123 /*APP_EVENT_LOW_MEMORY*/
127 main(int argc, char *argv[])
132 ui_app_lifecycle_callback_s event_callback = {0,};
133 app_event_handler_h handlers[5] = {NULL, };
135 event_callback.create = app_create;
136 event_callback.terminate = app_terminate;
137 event_callback.pause = app_pause;
138 event_callback.resume = app_resume;
139 event_callback.app_control = app_control;
141 ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, ui_app_low_battery, &ad);
142 ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, ui_app_low_memory, &ad);
143 ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, ui_app_orient_changed, &ad);
144 ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, ui_app_lang_changed, &ad);
145 ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, ui_app_region_changed, &ad);
147 ret = ui_app_main(argc, argv, &event_callback, &ad);
148 if (ret != APP_ERROR_NONE) {
149 LOGW("ui_app_main failed, Err=%d\n", ret);