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.
24 #include <vconf-keys.h>
26 #include <system_info.h>
28 #include "w-input-selector.h"
29 #include "w-input-template.h"
30 #include "w-input-keyboard.h"
31 #include "w-input-stt-ise.h"
32 #include "w-input-emoticon.h"
33 #include "w-input-smartreply.h"
40 App_Data* app_data = NULL;
42 InputKeyboardData g_input_keyboard_data;
43 InputTypeData g_input_type_data;
44 InputTemplateData g_input_template_data;
47 static Elm_Object_Item *it_empty;
48 static Elm_Object_Item *it_title;
50 static unsigned int g_smartreply_item_size = 0; /* Current Smartreply item size */
51 static unsigned int g_template_item_size = 0; /* Current Template item size */
53 Evas_Coord last_step; // 0 ~ 9 for gesture, 10~11 for rotary
55 tizen_profile_t _get_tizen_profile()
57 static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
58 if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
62 system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
67 profile = TIZEN_PROFILE_MOBILE;
71 profile = TIZEN_PROFILE_WEARABLE;
75 profile = TIZEN_PROFILE_TV;
79 profile = TIZEN_PROFILE_IVI;
81 default: // common or unknown ==> ALL ARE COMMON.
82 profile = TIZEN_PROFILE_COMMON;
89 void _init_app_data(App_Data* app_data);
90 static void _app_language_changed(app_event_info_h event_info, void *user_data);
92 Evas_Object* _create_genlist(Evas_Object* parent);
93 void _create_genlist_items(void* user_data);
94 void _create_header_items(void *user_data);
95 void _update_genlist_items(void *user_data);
96 unsigned int _update_smartreply_items(void *user_data);
97 unsigned int _update_template_items(void *user_data);
98 unsigned int _update_user_template_items(void *user_data);
99 static void _popup_close_cb(void *data, Evas_Object *obj, void *event_info);
100 static void _popup_back_cb(void *data, Evas_Object *obj, void *event_info);
101 static void input_type_deinit(void);
103 bool __compare_string(const char * src, const char * dst);
105 void _init_app_data(App_Data* app_data)
107 app_data->win_main = NULL;
108 app_data->layout_main = NULL;
109 app_data->conform = NULL;
110 app_data->naviframe = NULL;
111 app_data->genlist = NULL;
113 app_data->res_path = NULL;
116 Evas_Object* load_edj(Evas_Object* parent, const char* file, const char* group)
119 Evas_Object* content;
122 window = elm_layout_add(parent);
124 ret = elm_layout_file_set(window, file, group);
126 evas_object_del(window);
130 content = elm_layout_add(parent);
131 elm_layout_theme_set(content, "layout", "application", "default");
132 elm_object_part_content_set(window, "elm.swallow.content", content);
134 evas_object_size_hint_weight_set(window, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
139 void init_customizing_theme(void)
141 string stt_edj_path = get_resource_path();
142 string app_edj_path = get_resource_path();
145 stt_edj_path = stt_edj_path + STT_EDJ_FILE_WEARABLE;
146 app_edj_path = app_edj_path + APP_EDJ_FILE_WEARABLE;
148 stt_edj_path = stt_edj_path + STT_EDJ_FILE_TV;
149 app_edj_path = app_edj_path + APP_EDJ_FILE_TV;
151 stt_edj_path = stt_edj_path + STT_EDJ_FILE_MOBILE;
152 app_edj_path = app_edj_path + APP_EDJ_FILE_MOBILE;
155 elm_theme_extension_add(NULL, stt_edj_path.c_str());
156 elm_theme_extension_add(NULL, app_edj_path.c_str());
160 static Eina_Bool back_cb(void *data, Elm_Object_Item *it)
162 reply_to_sender_by_callback_for_back();
167 static void _stt_clicked_cb(void *data, Evas_Object * obj, void *event_info)
169 App_Data* ad = (App_Data*)data;
171 PRINTFUNC(DLOG_DEBUG, "");
176 ise_show_stt_popup(ad);
179 static void _input_smartreply_notify_cb(void *user_data)
181 ecore_main_loop_iterate();
182 _update_genlist_items((void *)app_data);
185 static void _input_template_notify_cb(void *user_data)
187 _update_genlist_items((void *)app_data);
190 static void _emoticon_clicked_cb(void *data, Evas_Object * obj, void *event_info)
192 App_Data* ad = (App_Data*)data;
194 PRINTFUNC(DLOG_DEBUG, "");
199 ise_show_emoticon_list(ad);
202 static void _keyboard_clicked_cb(void *data, Evas_Object * obj, void *event_info)
204 App_Data* ad = (App_Data *)data;
206 PRINTFUNC(DLOG_DEBUG, "");
211 input_keyboard_launch(ad->win_main, data);
214 static void __ise_smartreply_gl_sel(void *data, Evas_Object *obj, void *event_info)
216 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
219 elm_genlist_item_selected_set(item, EINA_FALSE);
221 int index = (intptr_t) elm_object_item_data_get(item);
224 char *reply = input_smartreply_get_nth_item(index, &type);
226 input_smartreply_send_feedback(reply);
227 reply_to_sender_by_callback(reply, "smartreply", NULL, NULL);
234 static void __ise_template_gl_sel(void *data, Evas_Object *obj, void *event_info)
236 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
240 elm_genlist_item_selected_set(item, EINA_FALSE);
242 index = (uintptr_t) elm_object_item_data_get(item);
243 const std::vector<TemplateData> template_list = input_template_get_list();
245 if (index < (int)template_list.size()) {
246 reply_to_sender_by_callback(gettext(template_list[index].text.c_str()), "template", NULL, NULL);
252 static void __ise_user_template_gl_sel(void *data, Evas_Object *obj, void *event_info)
254 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
258 elm_genlist_item_selected_set(item, EINA_FALSE);
260 index = (uintptr_t) elm_object_item_data_get(item);
262 if (index < (int)g_input_template_data.input_template_array_len) {
263 reply_to_sender_by_callback(g_input_template_data.input_template_array[index], "user_template", NULL, NULL);
269 static char * __ise_template_gl_text_get(void *data, Evas_Object *obj, const char *part)
271 if (!strcmp(part, "elm.text")) {
272 unsigned int index = (uintptr_t)data;
273 const std::vector<TemplateData> template_list = input_template_get_list();
275 if (index < template_list.size()) {
276 if (template_list[index].use_gettext) {
277 return strdup(gettext(template_list[index].text.c_str()));
279 Eina_Strbuf *buf = NULL;
280 const char *str = NULL;
283 buf = eina_strbuf_new();
285 eina_strbuf_append(buf, template_list[index].text.c_str());
286 eina_strbuf_replace_all(buf, "\n", "");
287 eina_strbuf_replace_all(buf, "\r", "");
289 str = eina_strbuf_string_get(buf);
292 markup = elm_entry_utf8_to_markup(str);
294 eina_strbuf_free(buf);
303 static char * __ise_user_template_gl_text_get(void *data, Evas_Object *obj, const char *part)
305 if (!strcmp(part, "elm.text")) {
306 unsigned int index = (uintptr_t)data;
307 if (index < (unsigned int)g_input_template_data.input_template_array_len) {
308 if (g_input_template_data.input_template_array[index] != NULL) {
309 return strdup(g_input_template_data.input_template_array[index]);
316 static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj, const char *part)
318 char *first_input_type = *(g_input_type_data.input_type_array + 0);
319 char *second_input_type = *(g_input_type_data.input_type_array + 1);
321 if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2"))) {
322 Evas_Object* btn = elm_button_add(obj);
323 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
324 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
326 Evas_Object* ic = elm_image_add(btn);
327 elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
328 string path = get_resource_path();
330 path = path + "wearable/";
334 path = path + "mobile/";
336 if (!strcmp(part, "elm.icon.1")) {
338 if (!strcmp(first_input_type, "input_voice")) {
339 elm_object_style_set(btn, "ime_button_stt");
340 path_ic = path + "images/w_mode_stt_ic.png";
341 evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
342 elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
343 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
344 } else if (!strcmp(first_input_type, "input_emoticon")) {
345 elm_object_style_set(btn, "ime_button_emoticon");
346 path_ic = path + "images/Delta_w_mode_emoticon_ic.png";
347 evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
348 elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
349 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
350 } else if (!strcmp(first_input_type, "input_keyboard")) {
351 elm_object_style_set(btn, "ime_button_keyboard");
352 path_ic = path + "images/w_mode_keyboard_ic.png";
353 evas_object_propagate_events_set(btn, EINA_FALSE);
354 evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
355 elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
356 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
358 elm_image_file_set(ic, path_ic.c_str(), NULL);
359 elm_object_content_set(btn, ic);
360 evas_object_layer_set(btn, 32000);
361 } else if (!strcmp(part, "elm.icon.2")){
363 if (!strcmp(second_input_type, "input_voice")) {
364 elm_object_style_set(btn, "ime_button_stt");
365 path_ic = path + "images/w_mode_stt_ic.png";
366 evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
367 elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
368 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
369 } else if (!strcmp(second_input_type, "input_emoticon")) {
370 elm_object_style_set(btn, "ime_button_emoticon");
371 path_ic = path + "images/Delta_w_mode_emoticon_ic.png";
372 evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
373 elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
374 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
375 } else if (!strcmp(second_input_type, "input_keyboard")) {
376 elm_object_style_set(btn, "ime_button_keyboard");
377 path_ic = path + "images/w_mode_keyboard_ic.png";
378 evas_object_propagate_events_set(btn, EINA_FALSE);
379 evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
380 elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
381 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
383 elm_image_file_set(ic, path_ic.c_str(), NULL);
384 elm_object_content_set(btn, ic);
385 evas_object_layer_set(btn, 32000);
388 } else if (!strcmp(part, "elm.icon.1.touch_area") || (!strcmp(part, "elm.icon.2.touch_area"))) {
389 Evas_Object* btn = elm_button_add(obj);
390 elm_object_style_set(btn, "touch_area");
391 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
392 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
393 string path = get_resource_path();
394 if (!strcmp(part, "elm.icon.1.touch_area")) {
395 evas_object_layer_set(btn, 32000);
396 if (!strcmp(first_input_type, "input_voice")) {
397 evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
398 elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
399 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
400 } else if (!strcmp(first_input_type, "input_emoticon")) {
401 evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
402 elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
403 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
404 } else if (!strcmp(first_input_type, "input_keyboard")) {
405 evas_object_propagate_events_set(btn, EINA_FALSE);
406 evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
407 elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
408 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
410 } else if (!strcmp(part, "elm.icon.2.touch_area")){
411 evas_object_layer_set(btn, 32000);
412 if (!strcmp(second_input_type, "input_voice")) {
413 evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
414 elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
415 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
416 } else if (!strcmp(second_input_type, "input_emoticon")) {
417 evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
418 elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
419 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
420 } else if (!strcmp(second_input_type, "input_keyboard")) {
421 evas_object_propagate_events_set(btn, EINA_FALSE);
422 evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
423 elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
424 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
428 } else if (!strcmp(part, "base")) {
429 Evas_Object* btn = elm_button_add(obj);
430 elm_object_style_set(btn, "ime_transparent");
436 static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj, const char *part)
438 if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
439 Evas_Object* btn = elm_button_add(obj);
440 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
441 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
442 Evas_Object* ic = elm_image_add(btn);
443 elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
444 string path = get_resource_path();
446 path = path + "wearable/";
450 path = path + "mobile/";
452 if (!strcmp(part, "elm.icon.1")) {
453 elm_object_style_set(btn, "ime_button_stt");
454 string path_ic = path + "images/w_mode_stt_ic.png";
455 elm_image_file_set(ic, path_ic.c_str(), NULL);
456 elm_object_content_set(btn, ic);
457 evas_object_layer_set(btn, 32000);
458 evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
459 elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
460 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
462 } else if (!strcmp(part, "elm.icon.2")){
463 elm_object_style_set(btn, "ime_button_emoticon");
464 string path_ic = path + "images/Delta_w_mode_emoticon_ic.png";
465 elm_image_file_set(ic, path_ic.c_str(), NULL);
466 elm_object_content_set(btn, ic);
467 evas_object_layer_set(btn, 32000);
468 evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
469 elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
470 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
472 } else if (!strcmp(part, "elm.icon.3")){
473 elm_object_style_set(btn, "ime_button_keyboard");
474 string path_ic = path + "images/w_mode_keyboard_ic.png";
475 elm_image_file_set(ic, path_ic.c_str(), NULL);
476 elm_object_content_set(btn, ic);
477 evas_object_layer_set(btn, 32000);
478 evas_object_propagate_events_set(btn, EINA_FALSE);
479 evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
480 elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
481 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
485 } else if (!strcmp(part, "elm.icon.1.touch_area") || (!strcmp(part, "elm.icon.2.touch_area")) || (!strcmp(part, "elm.icon.3.touch_area"))) {
486 Evas_Object* btn = elm_button_add(obj);
487 elm_object_style_set(btn, "touch_area");
488 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
489 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
490 string path = get_resource_path();
491 if (!strcmp(part, "elm.icon.1.touch_area")) {
492 evas_object_layer_set(btn, 32000);
493 evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
494 elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
495 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
497 } else if (!strcmp(part, "elm.icon.2.touch_area")){
498 evas_object_layer_set(btn, 32000);
499 evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
500 elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
501 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
502 } else if (!strcmp(part, "elm.icon.3.touch_area")) {
503 evas_object_layer_set(btn, 32000);
504 evas_object_propagate_events_set(btn, EINA_FALSE);
505 evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
506 elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
507 elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
511 } else if (!strcmp(part, "base")) {
512 Evas_Object* btn = elm_button_add(obj);
513 elm_object_style_set(btn, "ime_transparent");
519 static char * __ise_smartreply_gl_text_get(void *data, Evas_Object *obj, const char *part)
521 if(!strcmp(part, "elm.text")) {
524 index = (intptr_t)data;
528 reply = input_smartreply_get_nth_item(index, NULL);
537 static void __ise_gl_lang_changed(void *data, Evas_Object *obj, void *event_info)
539 //Update genlist items. The Item texts will be translated in the _gl_text_get().
540 elm_genlist_realized_items_update(obj);
543 static char * __ise_drawing_text_get(void *data, Evas_Object *obj, const char *part)
545 if(!strcmp(part, "elm.text")) {
546 return(strdup(gettext("WDS_IME_MBODY_DRAWING_M_EMOTICON_ABB")));
551 static Evas_Object * __ise_drawing_content_get(void *data, Evas_Object *obj, const char *part)
553 if (!strcmp(part, "elm.icon")) {
554 Evas_Object* btn = elm_button_add(obj);
555 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
556 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
557 Evas_Object* ic = elm_image_add(btn);
558 elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
559 string path = get_resource_path();
561 path = path + "wearable/";
565 path = path + "mobile/";
566 elm_object_style_set(btn, "ime_button_drawing");
567 string path_ic = path + "images/wi_drawing_icon.png";
568 elm_image_file_set(ic, path_ic.c_str(), NULL);
569 elm_object_content_set(btn, ic);
570 evas_object_layer_set(btn, 32000);
576 void set_source_caller_app_id(app_control_h app_control)
579 PRINTFUNC(DLOG_ERROR, "can't get app_control");
584 app_control_get_caller(app_data->source_app_control, &caller);
587 PRINTFUNC(DLOG_DEBUG, "caller = %s", caller);
588 app_control_add_extra_data(app_control, "caller_appid", caller);
593 void reply_to_sender_by_callback(const char *value, const char *type, const char *path[], const char *cursor_position)
595 PRINTFUNC(DLOG_DEBUG, "");
597 app_control_h app_control;
599 if (app_control_create(&app_control) == 0) {
603 app_control_add_extra_data(app_control, APP_CONTROL_DATA_TEXT, value);
606 app_control_add_extra_data(app_control, "reply_type", type);
609 app_control_add_extra_data_array(app_control, APP_CONTROL_DATA_PATH, path, 1);
612 if (cursor_position != NULL)
613 app_control_add_extra_data(app_control, "cursor_position_get", cursor_position);
615 set_source_caller_app_id(app_control);
617 ret = app_control_reply_to_launch_request(app_control, app_data->source_app_control, APP_CONTROL_RESULT_SUCCEEDED);
618 if (ret != APP_CONTROL_ERROR_NONE)
619 PRINTFUNC(DLOG_ERROR, "reply failed : %d", ret);
621 app_control_destroy(app_control);
622 app_control_destroy(app_data->source_app_control);
623 app_data->source_app_control = NULL;
627 void reply_to_sender_by_callback_for_back()
629 PRINTFUNC(DLOG_DEBUG, "");
631 app_control_h app_control;
633 if (app_control_create(&app_control) == 0) {
636 app_control_add_extra_data(app_control, "back_to_composer", "yes");
638 ret = app_control_reply_to_launch_request(app_control, app_data->source_app_control, APP_CONTROL_RESULT_SUCCEEDED);
639 if (ret != APP_CONTROL_ERROR_NONE)
640 PRINTFUNC(DLOG_ERROR, "reply failed : %d", ret);
642 app_control_destroy(app_control);
643 app_control_destroy(app_data->source_app_control);
644 app_data->source_app_control = NULL;
648 char* get_resource_path()
650 if (NULL == app_data->res_path) {
651 app_data->res_path = app_get_resource_path();
652 PRINTFUNC(DLOG_INFO, "set resource path = %s", app_data->res_path);
654 return (app_data->res_path);
657 char* get_shared_resource_path()
659 if (NULL == app_data->shared_res_path) {
660 app_data->shared_res_path = app_get_shared_resource_path();
661 PRINTFUNC(DLOG_INFO, "set shared resource path = %s", app_data->shared_res_path);
663 return (app_data->shared_res_path);
666 void show_gl_focus(Eina_Bool bVisible){
667 if (app_data->genlist == NULL)
670 if (bVisible == EINA_TRUE){
671 elm_object_signal_emit(app_data->genlist, "elm,state,focus_bg,enable", "elm");
672 //elm_layout_theme_set(app_data->genlist, "genlist", "base", "focus_bg");
673 //elm_object_signal_emit(app_data->genlist, "elm,state,focus_bg,show", "elm");
675 elm_object_signal_emit(app_data->genlist, "elm,state,focus_bg,disable", "elm");
676 //elm_layout_theme_set(app_data->genlist, "genlist", "base", "default");
677 //elm_object_signal_emit(app_data->genlist, "elm,state,focus_bg,hide", "elm");
681 void show_popup_toast(const char *text, bool check_img)
683 PRINTFUNC(DLOG_ERROR, "show_popup_toast");
687 popup = elm_popup_add(app_data->win_main);
688 elm_object_style_set(popup, "toast/circle");
689 elm_popup_orient_set(popup, ELM_POPUP_ORIENT_BOTTOM);
690 evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
693 string path = get_resource_path();
695 path = path + "wearable/";
699 path = path + "mobile/";
700 string path_ic = path + "/images/toast_check_icon.png";
701 Evas_Object * img = elm_image_add(popup);
702 elm_image_file_set(img, path_ic.c_str(), NULL);
703 elm_object_part_content_set(popup, "toast,icon", img);
706 elm_object_part_text_set(popup, "elm.text", text);
709 eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _popup_back_cb, NULL);
710 evas_object_smart_callback_add(popup, "dismissed", _popup_close_cb, NULL);
711 evas_object_smart_callback_add(popup, "block,clicked", _popup_back_cb, NULL);
713 elm_popup_timeout_set(popup, 2.0);
714 evas_object_show(popup);
717 static void _popup_close_cb(void *data, Evas_Object *obj, void *event_info)
720 evas_object_hide(obj);
721 evas_object_del(obj);
725 static void _popup_back_cb(void *data, Evas_Object *obj, void *event_info)
728 elm_popup_dismiss(obj);
732 void _back_to_genlist_for_selector()
734 PRINTFUNC(DLOG_DEBUG, "");
736 if (!app_data) return;
739 Evas_Object *circle_genlist = (Evas_Object *) evas_object_data_get(app_data->genlist, "circle");
740 eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
742 if (app_data->app_type == APP_TYPE_STT || app_data->app_type == APP_TYPE_EMOTICON || app_data->app_type == APP_TYPE_KEYBOARD){
743 PRINTFUNC(DLOG_DEBUG, "launched as STT/EMOTICON/KEYBOARD mode, So exit here.");
744 reply_to_sender_by_callback(NULL, NULL, NULL, NULL);
749 static void _item_realized(void *data, Evas_Object *obj, void *event_info) //called when list scrolled
751 PRINTFUNC(DLOG_DEBUG, "%s", __func__);
754 Evas_Object* _create_genlist(Evas_Object* navi)
756 Evas_Object* genlist = elm_genlist_add(navi);
760 elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
762 Evas_Object* circle_object_genlist = eext_circle_object_genlist_add(genlist, app_data->circle_surface);
763 eext_circle_object_genlist_scroller_policy_set(circle_object_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
764 evas_object_data_set(genlist, "circle", (void *) circle_object_genlist);
765 eext_rotary_object_event_activated_set(circle_object_genlist, EINA_TRUE);
767 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
768 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
770 evas_object_smart_callback_add(genlist, "language,changed", __ise_gl_lang_changed, genlist);
771 evas_object_show(genlist);
773 // uxt_genlist_set_bottom_margin_enabled(genlist, EINA_TRUE);
775 show_gl_focus(EINA_FALSE);
777 const char *item_style = NULL;
779 item_style = "empty";
780 Elm_Object_Item *nf_main_item = elm_naviframe_item_push(navi,
787 elm_naviframe_item_pop_cb_set(nf_main_item, back_cb, app_data);
788 evas_object_smart_callback_add(genlist, "realized", _item_realized, NULL);
793 static void _item_position_changed_cb(void *data, Evas_Object *obj, void *event_info)
798 Evas_Object *genlist = (Evas_Object *)obj;
799 Elm_Object_Item *gen_item = (Elm_Object_Item *)data;
802 elm_scroller_region_get(genlist, NULL, &y, NULL, NULL);
804 // PRINTFUNC(DLOG_DEBUG,"y=%d",y);
806 if (250 > y && y >= 100){
807 if (last_step == 0) return;
809 elm_object_item_signal_emit(gen_item, "elm,action,ime,0.0", "elm");
810 show_gl_focus(EINA_TRUE);
811 } else if (100 > y && y >= 50){
812 if (last_step == 1) return;
814 elm_object_item_signal_emit(gen_item, "elm,action,ime,0.1", "elm");
815 show_gl_focus(EINA_TRUE);
816 } else if (y < 50 && y >=0){
817 if (last_step == 2) return;
819 elm_object_item_signal_emit(gen_item, "elm,action,ime,0.9", "elm");
820 show_gl_focus(EINA_FALSE);
824 void _create_genlist_items(void* user_data)
826 App_Data* app_data = (App_Data*) user_data;
828 if (NULL == app_data->genlist) {
829 app_data->genlist = _create_genlist(app_data->naviframe);
830 if (NULL == app_data->genlist)
834 elm_genlist_clear(app_data->genlist);
836 Elm_Genlist_Item_Class * itc0 = elm_genlist_item_class_new();
837 itc0->item_style = NULL;
838 itc0->func.text_get = NULL;
839 itc0->func.content_get = NULL;
840 itc0->func.state_get = NULL;
841 itc0->func.del = NULL;
843 Elm_Genlist_Item_Class * itc1 = elm_genlist_item_class_new();
844 if (g_input_type_data.input_type_array_len == 2){
845 itc1->item_style = "2button_flat";
846 itc1->func.text_get = NULL;
847 itc1->func.content_get = __ise_gl_2button_content_get;
848 itc1->func.state_get = NULL;
849 itc1->func.del = NULL;
851 itc1->item_style = "3button_flat";
852 itc1->func.text_get = NULL;
853 itc1->func.content_get = __ise_gl_3button_content_get;
854 itc1->func.state_get = NULL;
855 itc1->func.del = NULL;
858 // dummy title for empty space
859 it_empty = elm_genlist_item_append(app_data->genlist, itc0,
861 ELM_GENLIST_ITEM_NONE,
864 if (app_data->app_type != APP_TYPE_REPLY) {
866 it_title = elm_genlist_item_append(app_data->genlist, itc1,
868 ELM_GENLIST_ITEM_NONE,
872 elm_genlist_item_select_mode_set(it_title, ELM_OBJECT_SELECT_MODE_NONE);
874 g_template_item_size = _update_template_items(app_data);
876 Elm_Object_Item *item = elm_genlist_item_next_get(it_title);
877 elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
879 evas_object_smart_callback_add(app_data->genlist, "elm,item,position,changed", _item_position_changed_cb, it_title);
881 elm_genlist_item_class_free(itc0);
882 elm_genlist_item_class_free(itc1);
885 void _create_header_items(void *user_data)
887 Elm_Genlist_Item_Class * itc0 = elm_genlist_item_class_new();
888 itc0->item_style = "title";
889 itc0->func.text_get = NULL;
890 itc0->func.content_get = NULL;
891 itc0->func.state_get = NULL;
892 itc0->func.del = NULL;
894 Elm_Genlist_Item_Class * itc1 = elm_genlist_item_class_new();
895 if (g_input_type_data.input_type_array_len == 2) {
896 itc1->item_style = "2button_flat";
897 itc1->func.text_get = NULL;
898 itc1->func.content_get = __ise_gl_2button_content_get;
899 itc1->func.state_get = NULL;
900 itc1->func.del = NULL;
902 itc1->item_style = "3button_flat";
903 itc1->func.text_get = NULL;
904 itc1->func.content_get = __ise_gl_3button_content_get;
905 itc1->func.state_get = NULL;
906 itc1->func.del = NULL;
909 // dummy title for empty space
910 it_empty = elm_genlist_item_append(app_data->genlist, itc0,
912 ELM_GENLIST_ITEM_NONE,
916 it_title = elm_genlist_item_append(app_data->genlist, itc1,
918 ELM_GENLIST_ITEM_NONE,
921 elm_genlist_item_select_mode_set(it_title, ELM_OBJECT_SELECT_MODE_NONE);
923 elm_genlist_item_class_free(itc0);
924 elm_genlist_item_class_free(itc1);
927 void _update_genlist_items(void *user_data)
929 elm_genlist_clear(app_data->genlist);
931 _create_header_items(user_data);
933 if (input_smartreply_is_enabled())
934 g_smartreply_item_size = _update_smartreply_items(user_data);
936 g_smartreply_item_size = 0;
938 g_template_item_size = _update_template_items(user_data);
940 if (g_input_template_data.input_template_array_len > 0) {
941 _update_user_template_items(user_data);
944 /* Update genlist item position */
945 Elm_Object_Item *item = elm_genlist_item_next_get(it_title);
946 elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
949 unsigned int _update_smartreply_items(void *user_data)
953 Elm_Object_Item *first;
956 unsigned int len = 0;
957 unsigned int item_size = 0;
959 app_data = (App_Data *)user_data;
961 if (app_data == NULL) {
962 PRINTFUNC(DLOG_ERROR, "Can not get app_data");
966 if (app_data->genlist == NULL) {
967 /* smartreply will update when genlist is exist only */
968 PRINTFUNC(DLOG_ERROR, "Can not get getlist");
972 /* Move to smartreply */
973 first = elm_genlist_first_item_get(app_data->genlist);
974 elm_genlist_item_next_get(first);
976 if (input_smartreply_is_enabled() == false)
979 /* Append newly added smartreply list */
980 len = input_smartreply_get_reply_num();
983 const std::vector<TemplateData> template_list = input_template_get_list();
985 Elm_Genlist_Item_Class *itc;
987 itc = elm_genlist_item_class_new();
988 itc->item_style = "1text";
989 itc->func.text_get = __ise_smartreply_gl_text_get;
990 itc->func.content_get = NULL;
991 itc->func.state_get = NULL;
992 itc->func.del = NULL;
994 for (i = 0; i < len; i++) {
995 char *reply = (char *)"hello";
1002 reply = input_smartreply_get_nth_item(i, &type);
1005 SECURE_LOGD("SmartReply = [%d]%s", i, reply);
1007 for (j = 0; j < template_list.size(); j++) {
1008 const char *template_str;
1010 if (template_list[j].use_gettext)
1011 template_str = gettext(template_list[j].text.c_str());
1013 template_str = template_list[j].text.c_str();
1015 if (!__compare_string(reply, template_str)) {
1021 if (matched == true)
1024 elm_genlist_item_append(app_data->genlist,
1026 (void *)(uintptr_t)i,
1028 ELM_GENLIST_ITEM_NONE,
1029 __ise_smartreply_gl_sel,
1036 elm_genlist_item_class_free(itc);
1041 static void _drawing_item_clicked_cb(void *data, Evas_Object * obj, void *event_info)
1043 PRINTFUNC(DLOG_DEBUG, "%s", __func__);
1044 App_Data* ad = (App_Data*) data;
1048 launch_drawing_app(ad);
1051 unsigned int _update_template_items(void *user_data)
1055 Elm_Object_Item *first;
1056 Elm_Object_Item *menu;
1057 Elm_Object_Item *pos;
1060 unsigned int item_size = 0;
1062 app_data = (App_Data *)user_data;
1064 if (app_data == NULL) {
1065 PRINTFUNC(DLOG_ERROR, "Can not get app_data");
1069 if (app_data->genlist == NULL) {
1070 /* smartreply will update when genlist is exist only */
1071 PRINTFUNC(DLOG_ERROR, "Can not get getlist");
1075 first = elm_genlist_first_item_get(app_data->genlist);
1078 menu = elm_genlist_item_next_get(first);
1081 /* move to smartreply next if it need */
1082 if (input_smartreply_is_enabled()) {
1085 for (j = 0; j < g_smartreply_item_size; j++) {
1089 pos = elm_genlist_item_next_get(pos);
1093 /* Append New Template list */
1094 const std::vector<TemplateData> template_list = input_template_get_list();
1096 if (template_list.size() > 0) {
1097 Elm_Genlist_Item_Class *itc;
1099 itc = elm_genlist_item_class_new();
1101 itc->item_style = "1text";
1102 itc->func.text_get = __ise_template_gl_text_get;
1103 itc->func.content_get = NULL;
1104 itc->func.state_get = NULL;
1105 itc->func.del = NULL;
1107 for (i = 0; i < template_list.size(); i++) {
1108 pos = elm_genlist_item_append(app_data->genlist,
1110 (void *)(uintptr_t)i,
1112 ELM_GENLIST_ITEM_NONE,
1113 __ise_template_gl_sel,
1117 elm_genlist_item_class_free(itc);
1119 // drawing button (+)
1120 if (app_data->mime_type == MIME_TYPE_ALL) {
1121 Elm_Genlist_Item_Class *itc;
1122 itc = elm_genlist_item_class_new();
1124 itc->item_style = "1text.1icon";
1125 itc->func.text_get = __ise_drawing_text_get;;
1126 itc->func.content_get = __ise_drawing_content_get;
1127 itc->func.state_get = NULL;
1128 itc->func.del = NULL;
1130 elm_genlist_item_append(app_data->genlist,
1134 ELM_GENLIST_ITEM_NONE,
1135 _drawing_item_clicked_cb,
1138 elm_genlist_item_class_free(itc);
1141 // dummy item for empty space
1142 Elm_Genlist_Item_Class * itc0 = elm_genlist_item_class_new();
1143 itc0->item_style = "title";
1144 itc0->func.text_get = NULL;
1145 itc0->func.content_get = NULL;
1146 itc0->func.state_get = NULL;
1147 itc0->func.del = NULL;
1149 if (g_input_template_data.input_template_array_len < 1) {
1150 it_empty = elm_genlist_item_append(app_data->genlist, itc0,
1152 ELM_GENLIST_ITEM_NONE,
1155 elm_genlist_item_class_free(itc0);
1161 unsigned int _update_user_template_items(void *user_data)
1165 Elm_Object_Item *first;
1168 unsigned int item_size = 0;
1170 app_data = (App_Data *)user_data;
1172 if (app_data == NULL) {
1173 PRINTFUNC(DLOG_ERROR, "Can not get app_data");
1177 if (app_data->genlist == NULL) {
1178 /* smartreply will update when genlist is exist only */
1179 PRINTFUNC(DLOG_ERROR, "Can not get getlist");
1183 first = elm_genlist_first_item_get(app_data->genlist);
1187 if (g_input_template_data.input_template_array_len > 0) {
1188 Elm_Genlist_Item_Class *itc;
1190 itc = elm_genlist_item_class_new();
1192 itc->item_style = "1text";
1193 itc->func.text_get = __ise_user_template_gl_text_get;
1194 itc->func.content_get = NULL;
1195 itc->func.state_get = NULL;
1196 itc->func.del = NULL;
1198 for (i = 0; i < (unsigned int)g_input_template_data.input_template_array_len; i++) {
1199 elm_genlist_item_append(app_data->genlist,
1201 (void *)(uintptr_t)i,
1203 ELM_GENLIST_ITEM_NONE,
1204 __ise_user_template_gl_sel,
1208 elm_genlist_item_class_free(itc);
1210 // dummy item for empty space
1211 Elm_Genlist_Item_Class * itc0 = elm_genlist_item_class_new();
1212 itc0->item_style = "title";
1213 itc0->func.text_get = NULL;
1214 itc0->func.content_get = NULL;
1215 itc0->func.state_get = NULL;
1216 itc0->func.del = NULL;
1218 it_empty = elm_genlist_item_append(app_data->genlist, itc0,
1220 ELM_GENLIST_ITEM_NONE,
1222 elm_genlist_item_class_free(itc0);
1228 bool __compare_string(const char * smart_str, const char * template_str)
1234 if(!smart_str||!template_str)
1237 src_len = strlen(smart_str);
1238 dst_len = strlen(template_str);
1240 if(smart_str[src_len-1] == '.')
1243 while(template_str[dst_len-1] == ' ')
1245 if(template_str[dst_len-1] == '.')
1248 dst_len = (dst_len > src_len)? dst_len : src_len;
1250 if(!strncmp(smart_str, template_str, (size_t)dst_len))
1256 bool _app_create(void* user_data)
1258 int width = 1000, height = 1000;
1259 // App_Data* app_data = NULL;
1260 Evas_Object* layout = NULL;
1261 Evas_Object* conform = NULL;
1262 Evas_Object* bg = NULL;
1263 Evas_Object* window = NULL;
1264 Eext_Circle_Surface *surface = NULL;
1270 _app_language_changed(NULL, NULL);
1272 app_data = (App_Data*)user_data;
1274 elm_app_base_scale_set(1.3);
1276 window = elm_win_add(NULL, PACKAGE, ELM_WIN_BASIC);
1278 init_customizing_theme();
1280 elm_win_title_set(window, PACKAGE);
1281 elm_win_borderless_set(window, EINA_TRUE);
1282 // ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
1283 evas_object_resize(window, width, height);
1284 elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW);
1286 LOGE("elm_win_add() is failed.");
1290 bg = elm_bg_add(window);
1291 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1292 elm_win_resize_object_add(window, bg);
1293 evas_object_show(bg);
1295 layout = elm_layout_add(window);
1296 elm_layout_theme_set(layout, "layout", "application", "default");
1297 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1299 conform = elm_conformant_add(window);
1301 surface = eext_circle_surface_conformant_add(conform);
1303 evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1305 elm_win_resize_object_add(window, conform);
1306 elm_object_content_set(conform, layout);
1308 evas_object_show(layout);
1309 evas_object_show(conform);
1310 evas_object_show(window);
1311 app_data->win_main = window;
1312 app_data->conform = conform;
1313 app_data->layout_main = layout;
1314 app_data->circle_surface = surface;
1315 app_data->app_type = APP_TYPE_SELECT_MODE;
1317 Evas_Object *naviframe = elm_naviframe_add(layout);
1318 elm_naviframe_prev_btn_auto_pushed_set(naviframe, EINA_FALSE);
1319 eext_object_event_callback_add(naviframe, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
1320 elm_object_part_content_set(layout, "elm.swallow.content", naviframe);
1321 evas_object_show(naviframe);
1323 app_data->naviframe = naviframe;
1328 void _app_service(app_control_h service, void* user_data)
1331 char *context = NULL;
1332 char **input_type_array = NULL;
1333 int input_type_array_len = -1;
1334 bool is_extra_data_array = false;
1335 char *mime_type = NULL;
1336 char **user_template_array = NULL;
1337 int user_template_array_len = -1;
1339 app_control_clone(&(app_data->source_app_control), service);
1340 app_data->reply_type = REPLY_APP_NORMAL;
1341 app_data->mime_type = MIME_TYPE_ALL;
1343 ret = app_control_get_extra_data_array(service, "user_template", &user_template_array, &user_template_array_len);
1344 g_input_template_data.input_template_array = user_template_array;
1345 g_input_template_data.input_template_array_len = user_template_array_len;
1347 ret = app_control_get_mime(service, &mime_type);
1348 if (ret != APP_CONTROL_ERROR_NONE) {
1349 LOGD("Fail to get mime type : %d", ret);
1352 LOGD("mime type = %s", mime_type);
1353 if (!strncmp(mime_type, "image/", strlen("image/"))) {
1354 app_data->mime_type = MIME_TYPE_IMAGE;
1355 app_data->app_type = APP_TYPE_DRAWING;
1356 launch_drawing_app((void *)app_data);
1360 } else if (!strncmp(mime_type, "audio/", strlen("audio/"))) {
1361 app_data->mime_type = MIME_TYPE_AUDIO;
1362 app_data->app_type = APP_TYPE_STT;
1363 _stt_clicked_cb((void *)app_data, NULL, NULL);
1367 } else if (!strncmp(mime_type, "text/", strlen("text/"))) {
1368 app_data->mime_type = MIME_TYPE_TEXT;
1375 if (_TV || _MOBILE) {
1376 app_data->app_type = APP_TYPE_KEYBOARD;
1377 input_keyboard_init(service);
1378 _keyboard_clicked_cb((void *)app_data, NULL, NULL);
1382 ret = app_control_is_extra_data_array(service, APP_CONTROL_DATA_INPUT_TYPE, &is_extra_data_array);
1383 if ( is_extra_data_array == true) {
1384 ret = app_control_get_extra_data_array(service, APP_CONTROL_DATA_INPUT_TYPE, &input_type_array, &input_type_array_len);
1385 g_input_type_data.input_type_array = input_type_array;
1386 g_input_type_data.input_type_array_len = input_type_array_len;
1388 ret = app_control_get_extra_data(service, APP_CONTROL_DATA_INPUT_TYPE, &context);
1389 if (ret == APP_CONTROL_ERROR_NONE) {
1390 if (!strcmp(context, "input_voice")) {
1391 app_data->app_type = APP_TYPE_STT;
1392 _stt_clicked_cb((void *)app_data, NULL, NULL);
1394 } else if (!strcmp(context, "input_recording")) {
1395 app_data->app_type = APP_TYPE_RECORDING;
1396 _stt_clicked_cb((void *)app_data, NULL, NULL);
1398 } else if (!strcmp(context, "input_emoticon")) {
1399 app_data->app_type = APP_TYPE_EMOTICON;
1400 _emoticon_clicked_cb((void *)app_data, NULL, NULL);
1402 } else if (!strcmp(context, "input_keyboard")) {
1403 app_data->app_type = APP_TYPE_KEYBOARD;
1404 input_keyboard_init(service);
1405 _keyboard_clicked_cb((void *)app_data, NULL, NULL);
1407 } else if (!strcmp(context, "input_drawing")) {
1408 app_data->app_type = APP_TYPE_DRAWING;
1409 _drawing_item_clicked_cb((void *)app_data, NULL, NULL);
1411 } else if (!strcmp(context, "input_reply")) {
1412 app_data->app_type = APP_TYPE_REPLY;
1417 if (app_data->genlist == NULL)
1418 app_data->genlist = _create_genlist(app_data->naviframe);
1420 input_keyboard_init(service);
1422 input_smartreply_init(service);
1423 input_smartreply_set_notify(_input_smartreply_notify_cb, NULL);
1425 if (input_smartreply_is_enabled())
1426 input_smartreply_get_reply_async();
1428 input_template_init(service);
1429 input_template_set_notify(_input_template_notify_cb, NULL);
1431 _create_genlist_items(app_data);
1434 elm_win_activate(app_data->win_main);
1441 void _app_pause(void* user_data)
1443 PRINTFUNC(DLOG_DEBUG, "");
1447 void _app_resume(void* user_data)
1449 PRINTFUNC(DLOG_DEBUG, "");
1453 void _app_terminate(void* user_data)
1455 App_Data* app_data = NULL;
1456 app_data = (App_Data*)user_data;
1458 if (app_data->genlist){
1459 evas_object_smart_callback_del(app_data->genlist, "elm,item,position,changed", _item_position_changed_cb);
1462 if (app_data->res_path)
1463 free(app_data->res_path);
1465 if (app_data->shared_res_path)
1466 free(app_data->shared_res_path);
1468 input_keyboard_deinit();
1469 input_smartreply_deinit();
1471 input_template_unset_notify();
1472 input_template_deinit();
1474 input_type_deinit();
1477 static int init_i18n(const char *domain, const char *dir, char *lang_str)
1479 if (setlocale(LC_ALL, "") == NULL) {
1480 PRINTFUNC(DLOG_INFO, "Some environment variable is invalid, setlocale(LC_ALL, \"\") has returns\ed a null pointer");
1481 if (setlocale(LC_ALL, lang_str) == NULL)
1484 if (bindtextdomain(domain, dir) == NULL)
1486 if (textdomain(domain) == NULL)
1493 * @brief Set language and locale.
1497 static void _app_language_changed(app_event_info_h event_info, void *user_data)
1499 char* lang_str = vconf_get_str(VCONFKEY_LANGSET);
1501 setenv("LANG", lang_str, 1);
1502 setenv("LC_MESSAGES", lang_str, 1);
1504 setenv("LANG", "en_GB.utf8", 1);
1505 setenv("LC_MESSAGES", "en_GB.utf8", 1);
1506 lang_str = strdup("en_GB.UTF-8");
1509 init_i18n(PACKAGE, LOCALEDIR, lang_str);
1512 elm_language_set(lang_str);
1517 void input_type_deinit(void)
1520 char **data_array = NULL;
1522 data_array = g_input_type_data.input_type_array;
1524 for (i = 0; i < g_input_type_data.input_type_array_len; i++) {
1525 if (*(data_array + i))
1526 free(*(data_array + i));
1530 g_input_type_data.input_type_array = NULL;
1531 g_input_type_data.input_type_array_len = 0;
1534 EXPORTED int main(int argc, char* argv[])
1536 App_Data app_data = {0, };
1537 ui_app_lifecycle_callback_s event_callback = {0, };
1538 app_event_handler_h handlers[5] = {NULL, };
1540 event_callback.create = _app_create;
1541 event_callback.terminate = _app_terminate;
1542 event_callback.pause = _app_pause;
1543 event_callback.resume = _app_resume;
1544 event_callback.app_control = _app_service;
1546 ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, NULL, &app_data);
1547 ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, NULL, &app_data);
1548 ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, NULL, &app_data);
1549 ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, _app_language_changed, &app_data);
1550 ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, NULL, &app_data);
1552 _init_app_data(&app_data);
1554 int ret = ui_app_main(argc, argv, &event_callback, &app_data);
1555 if (ret != APP_ERROR_NONE) {
1556 LOGD("ui_app_main() is failed. err = %d", ret);