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.
18 #include <app_preference.h>
19 #include <Elementary.h>
25 #include <vconf-keys.h>
28 #include "w-input-selector.h"
30 #define RECENT_EMOJI_LIST "recent_emoji_list"
32 #define EMOTICON_CNT 180
35 extern App_Data* app_data;
37 static int is_content_reuse_on = 0;
42 vector <int> recent_emoji_list;
49 static Elm_Object_Item *it_emoticon_empty = NULL;
50 static Elm_Object_Item *it_emoticon_recent_group = NULL;
51 static Elm_Object_Item *it_emoticon_emoji_group = NULL;
52 static Elm_Object_Item* it_drawing = NULL;
53 static Elm_Object_Item *it_last = NULL;
55 static Elm_Genlist_Item_Class *itc_emoticon = NULL;
57 #define INITAL_ITEM_UNIT 24
58 #define LOADING_ITEM_UNIT 27
59 static int loading_done_for_item = 0;
60 Ecore_Timer *lazy_loading_timer_for_items = NULL;
62 #define INITAL_CONTENT_UNIT 51
63 #define LOADING_CONTENT_UNIT 9
64 static int loading_done_for_contents = 0;
65 Ecore_Timer *lazy_loading_timer_for_contents = NULL;
68 typedef struct emoticon_content
75 static emoticon_content_s emoticon_contents_pool[EMOTICON_CNT] = { 0, };
76 static emoticon_content_s emoticon_drawing_pool = { 0, };
77 static emoticon_content_s emoticon_recents_pool[RECENT_CNT] = { 0, };
80 Emoticon emoticon_info[EMOTICON_CNT] = {
264 //---------------------------------------------------------------------------------------//
266 static Eina_Bool _custom_back_cb2(void *data, Elm_Object_Item *it)
268 PRINTFUNC(DLOG_DEBUG, "");
270 if (is_content_reuse_on) {
273 if (lazy_loading_timer_for_items != NULL) {
274 ecore_timer_del(lazy_loading_timer_for_items);
275 lazy_loading_timer_for_items = NULL;
278 if (lazy_loading_timer_for_contents != NULL) {
279 ecore_timer_del(lazy_loading_timer_for_contents);
280 lazy_loading_timer_for_contents = NULL;
283 if (emoticon_drawing_pool.used == 0){
284 evas_object_del(emoticon_drawing_pool.content);
286 emoticon_drawing_pool.content = NULL;
288 //Recent EMOTICONS : the recent emoiton need to be updated whenever emoticon view is generated, so deleted here.
289 for (i=0;i< RECENT_CNT;i++)
291 if (emoticon_recents_pool[i].used == 0 && emoticon_recents_pool[i].content) {
292 evas_object_del(emoticon_recents_pool[i].content);
294 emoticon_recents_pool[i].content = NULL;
298 _back_to_genlist_for_selector();
303 void get_recent_emoticons(vector <int> &emoticon_list)
305 int ret = PREFERENCE_ERROR_NONE;
308 ret = preference_get_string(RECENT_EMOJI_LIST, &str);
309 if (PREFERENCE_ERROR_NONE != ret) {
310 PRINTFUNC(DLOG_ERROR, "preference_get_string error!(%d)", ret);
313 emoticon_list.clear();
315 PRINTFUNC(DLOG_DEBUG, "str = %s", str);
319 tok = strtok_r(str, ",", &ptr);
320 while (tok != NULL) {
321 PRINTFUNC(DLOG_DEBUG, "tok = %s", tok);
322 emoticon_list.push_back(strtol(tok, (char **)NULL, 10));
323 tok = strtok_r(NULL, ",", &ptr);
333 void set_recent_emoticons(vector <int> &emoticon_list, int val)
336 int ret = PREFERENCE_ERROR_NONE;
338 if (emoticon_list.size() > 0) {
339 for (i = 0; i < emoticon_list.size(); i++) {
340 PRINTFUNC(DLOG_DEBUG, "%d == %d", emoticon_list.at(i), val);
342 if (emoticon_list.at(i) == val) {
343 emoticon_list.erase(emoticon_list.begin()+i);
348 if (emoticon_list.size() >= RECENT_CNT) {
349 emoticon_list.erase(emoticon_list.end());
353 emoticon_list.insert(emoticon_list.begin(), val);
356 char str[10] = {0, };
358 for (i = 0; i < emoticon_list.size(); i++) {
359 snprintf(str, sizeof(str), "%d", emoticon_list.at(i));
361 if (i+1 != emoticon_list.size())
365 PRINTFUNC(DLOG_DEBUG, "%s", stored.c_str());
367 ret = preference_set_string(RECENT_EMOJI_LIST, stored.c_str());
368 if (PREFERENCE_ERROR_NONE != ret) {
369 PRINTFUNC(DLOG_ERROR, "preference_set_string error!(%d)", ret);
373 static void _drawing_app_control_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
376 app_control_get_extra_data(reply, APP_CONTROL_DATA_PATH, &path);
379 PRINTFUNC(DLOG_DEBUG, "path=%s", path);
380 char *pathes[] = {path, };
381 reply_to_sender_by_callback(NULL, "image", (const char **)pathes, NULL);
387 static void _drawing_item_clicked_cb(void *data, Evas_Object * obj, void *event_info)
389 PRINTFUNC(DLOG_DEBUG, "%s", __func__);
390 App_Data* ad = (App_Data*) data;
394 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
396 elm_genlist_item_selected_set(item, EINA_FALSE);
399 app_control_h request = NULL;
400 app_control_create(&request);
401 app_control_set_app_id(request, "org.tizen.sketch");
403 int ret = app_control_send_launch_request(request, _drawing_app_control_reply_cb, NULL);
404 if (ret != APP_CONTROL_ERROR_NONE) {
405 PRINTFUNC(DLOG_DEBUG, "error code = 0x%x", ret);
407 app_control_destroy(request);
410 static void _emoticon_item_clicked_cb(void *data, Evas_Object * obj, void *event_info)
412 int index = (uintptr_t)data;
414 PRINTFUNC(DLOG_DEBUG, "index = %d", index);
416 // store in recents list
417 set_recent_emoticons(recent_emoji_list, index);
420 const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[index].code, 0 };
421 char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
423 reply_to_sender_by_callback((const char*)utf_8, "emoticon", NULL, NULL);
425 PRINTFUNC(SECURE_DEBUG, "[%d]%s", index, utf_8);
432 Evas_Object* get_emoticon_button(Evas_Object* parent, int index){
436 Evas_Object* btn = elm_button_add(parent);
437 elm_object_style_set(btn, "emoticon");
438 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
439 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
442 const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[index].code, 0 };
443 char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
444 elm_object_part_text_set(btn, "elm.text", utf_8);
449 evas_object_layer_set(btn, 32000);
451 evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void *)(uintptr_t)index);
456 Evas_Object* get_recent_emoticon_button(Evas_Object* parent, int index){
460 Evas_Object* btn = elm_button_add(parent);
461 elm_object_style_set(btn, "emoticon");
462 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
463 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
466 const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[recent_emoji_list.at(index)].code, 0 };
467 char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
468 elm_object_part_text_set(btn, "elm.text", utf_8);
470 evas_object_data_set(btn, "index", (void*)(uintptr_t) recent_emoji_list.at(index));
475 evas_object_layer_set(btn, 32000);
476 evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void*)(uintptr_t) recent_emoji_list.at(index));
481 static void _emoticon_gl_lang_changed(void *data, Evas_Object *obj, void *event_info)
483 elm_genlist_realized_items_update(obj);
486 static char * __emoticon_gl_text_get(void *data, Evas_Object *obj, const char *part)
488 //PRINTFUNC(DLOG_DEBUG,"part = %s", part);
489 const char* str = (const char*) data;
493 if (!strcmp(part, "elm.text")) {
494 //PRINTFUNC(DLOG_DEBUG,"str = %s", str);
495 return strdup(gettext(str));
500 static void _emoticon_gl_content_unswallowed_cb(void *data, Evas_Object *obj, void *event_info)
502 Elm_Object_Item *it = (Elm_Object_Item *)event_info;
504 const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(it);
506 //PRINTFUNC(DLOG_DEBUG,"%s - stype[%s]", __func__, itc->item_style);
507 if (!strcmp(itc->item_style, "3button_flat")) {
508 int index = (uintptr_t)elm_object_item_data_get(it);
509 //PRINTFUNC(DLOG_DEBUG,"it = %p", it);
510 PRINTFUNC(DLOG_DEBUG, "index = %d %d %d", index, index+1, index+2);
512 if (index < EMOTICON_CNT) {
513 emoticon_contents_pool[index].used = 0;
515 if (index + 1 < EMOTICON_CNT) {
516 emoticon_contents_pool[index+1].used = 0;
518 if (index + 2 < EMOTICON_CNT) {
519 emoticon_contents_pool[index+2].used = 0;
521 } else if (!strcmp(itc->item_style, "3button_flat_recent")) {
522 unsigned int index = (uintptr_t)elm_object_item_data_get(it);
523 //PRINTFUNC(DLOG_DEBUG,"index = %d",index);
525 if (index < recent_emoji_list.size()) {
526 emoticon_recents_pool[index].used = 0;
528 if (index + 1 < recent_emoji_list.size()) {
529 emoticon_recents_pool[index+1].used = 0;
531 if (index + 2 < recent_emoji_list.size()) {
532 emoticon_recents_pool[index+2].used = 0;
534 } else if (it_drawing == it) {
535 //PRINTFUNC(DLOG_DEBUG,"it_drawing = %p", it_drawing);
536 emoticon_drawing_pool.used = 0;
540 static Evas_Object * __emoticon_gl_1_content_get(void *data, Evas_Object *obj, const char *part)
542 if (!strcmp(part, "elm.icon")) {
543 Evas_Object* btn = elm_button_add(obj);
544 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
545 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
546 Evas_Object* ic = elm_image_add(btn);
547 elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
549 string path = get_resource_path();
551 path = path + "wearable/";
555 path = path + "mobile/";
557 elm_object_style_set(btn, "ime_button_drawing");
558 string path_ic = path + "images/wi_drawing_icon.png";
559 PRINTFUNC(DLOG_DEBUG, "path_ic = %s", path_ic.c_str());
560 elm_image_file_set(ic, path_ic.c_str(), NULL);
561 elm_object_content_set(btn, ic);
562 evas_object_layer_set(btn, 32000);
564 emoticon_drawing_pool.index = 0;
565 emoticon_drawing_pool.content = btn;
566 emoticon_drawing_pool.used = 0;
568 } else if (!strcmp(part, "base")){
569 Evas_Object* btn = elm_button_add(obj);
570 elm_object_style_set(btn, "ime/transparent");
576 static Evas_Object * __emoticon_gl_recent_content_get(void *data, Evas_Object *obj, const char *part)
578 if (is_content_reuse_on) {
579 unsigned int index = (uintptr_t)data;
582 //PRINTFUNC(DLOG_DEBUG,"%s %d", part, index);
583 if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
584 if (!strcmp(part, "elm.icon.1")) {
585 if (index >= recent_emoji_list.size()) return NULL;
587 } else if (!strcmp(part, "elm.icon.2")) {
588 if (index + 1 >= recent_emoji_list.size()) return NULL;
589 new_index = index + 1;
590 } else if (!strcmp(part, "elm.icon.3")) {
591 if (index + 2 >= recent_emoji_list.size()) return NULL;
592 new_index = index + 2;
595 Evas_Object* btn = NULL;
596 btn = (Evas_Object*)emoticon_recents_pool[new_index].content;
597 emoticon_recents_pool[new_index].used = 1;
599 } else if (!strcmp(part, "base")) {
600 Evas_Object* btn = elm_button_add(obj);
601 elm_object_style_set(btn, "ime/transparent");
605 unsigned int index = (uintptr_t)data;
608 //PRINTFUNC(DLOG_DEBUG,"%s %d", part, index);
609 if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
610 if (!strcmp(part, "elm.icon.1")) {
611 if (index >= recent_emoji_list.size()) return NULL;
613 } else if (!strcmp(part, "elm.icon.2")) {
614 if (index + 1 >= recent_emoji_list.size()) return NULL;
615 new_index = index + 1;
616 } else if (!strcmp(part, "elm.icon.3")) {
617 if (index + 2 >= recent_emoji_list.size()) return NULL;
618 new_index = index + 2;
620 return get_recent_emoticon_button(obj, new_index);
621 } else if (!strcmp(part, "base")) {
622 Evas_Object* btn = elm_button_add(obj);
623 elm_object_style_set(btn, "ime/transparent");
630 static Evas_Object * __emoticon_gl_emoticon_content_get(void *data, Evas_Object *obj, const char *part)
632 //PRINTFUNC(DLOG_DEBUG,"%s", __func__);
633 if (is_content_reuse_on) {
634 int index = (uintptr_t)data;
637 if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
638 if (!strcmp(part, "elm.icon.1")) {
639 if (index >= EMOTICON_CNT) return NULL;
641 } else if (!strcmp(part, "elm.icon.2")) {
642 if (index + 1 >= EMOTICON_CNT) return NULL;
643 new_index = index + 1;
644 } else if (!strcmp(part, "elm.icon.3")) {
645 if (index + 2 >= EMOTICON_CNT) return NULL;
646 new_index = index + 2;
649 Evas_Object* btn = NULL;
650 btn = (Evas_Object*)emoticon_contents_pool[new_index].content;
651 emoticon_contents_pool[new_index].used = 1;
653 char utf_8[10] = {0, };
654 snprintf(utf_8, sizeof(utf_8), "%d", new_index);
655 elm_object_part_text_set(btn, "elm.text", strdup(utf_8));
658 const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[new_index].code, 0 };
659 char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
660 elm_object_part_text_set(btn, "elm.text", utf_8);
661 evas_object_data_set(btn, "index", (void*)(uintptr_t)new_index);
668 } else if (!strcmp(part, "base")) {
669 Evas_Object* btn = elm_button_add(obj);
670 elm_object_style_set(btn, "ime/transparent");
674 int index = (uintptr_t)data;
677 if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
678 if (!strcmp(part, "elm.icon.1")) {
679 if (index >= EMOTICON_CNT) return NULL;
681 } else if (!strcmp(part, "elm.icon.2")) {
682 if (index + 1 >= EMOTICON_CNT) return NULL;
683 new_index = index + 1;
684 } else if (!strcmp(part, "elm.icon.3")) {
685 if (index + 2 >= EMOTICON_CNT) return NULL;
686 new_index = index + 2;
688 return get_emoticon_button(obj, new_index);
689 } else if (!strcmp(part, "base")) {
690 Evas_Object* btn = elm_button_add(obj);
691 elm_object_style_set(btn, "ime/transparent");
698 void _create_reusable_recents(Evas_Object *parent)
701 PRINTFUNC(DLOG_ERROR, "parent is null");
706 for (i = 0; i < recent_emoji_list.size(); i++ ) {
707 emoticon_recents_pool[i].index = i;
708 emoticon_recents_pool[i].content = get_recent_emoticon_button(parent, i);
709 emoticon_recents_pool[i].used = 0;
713 static Eina_Bool _lazy_loader_cb_for_contents(void *data)
715 Evas_Object *gl = (Evas_Object *)data;
717 PRINTFUNC(DLOG_ERROR, "gl is null");
718 lazy_loading_timer_for_contents = NULL;
719 return ECORE_CALLBACK_CANCEL;
722 if (loading_done_for_contents == EMOTICON_CNT) {
723 PRINTFUNC(DLOG_DEBUG, "lazy loading contents done");
724 lazy_loading_timer_for_contents = NULL;
725 return ECORE_CALLBACK_CANCEL;
729 if (loading_done_for_contents + LOADING_CONTENT_UNIT > EMOTICON_CNT) {
730 loading_top = EMOTICON_CNT;
732 loading_top = loading_done_for_contents + LOADING_CONTENT_UNIT;
735 PRINTFUNC(DLOG_DEBUG, "_lazy_loader_cb_for_contents loading_done = %d", loading_done_for_contents);
738 for (i = loading_done_for_contents; i < loading_top; i++) {
739 emoticon_contents_pool[i].index = i;
740 emoticon_contents_pool[i].used = 0;
742 if (emoticon_contents_pool[i].content == NULL) { // reusable
743 emoticon_contents_pool[i].content = get_emoticon_button(gl, i);
747 loading_done_for_contents = loading_top;
749 return ECORE_CALLBACK_RENEW;
752 void create_reusable_button(Evas_Object *parent)
755 PRINTFUNC(DLOG_ERROR, "parent is null");
758 loading_done_for_contents = INITAL_CONTENT_UNIT;
761 for (i = 0; i < INITAL_CONTENT_UNIT; i++ ) {
762 emoticon_contents_pool[i].index = i;
763 emoticon_contents_pool[i].used = 0;
765 if (emoticon_contents_pool[i].content == NULL) { // reusable
766 emoticon_contents_pool[i].content = get_emoticon_button(parent, i);
770 lazy_loading_timer_for_contents = ecore_timer_add(0.25, _lazy_loader_cb_for_contents, (void *)parent);
773 static Eina_Bool _lazy_loader_cb_for_items(void *data)
775 Evas_Object *gl = (Evas_Object *)data;
777 PRINTFUNC(DLOG_ERROR, "gl is null");
778 lazy_loading_timer_for_items = NULL;
779 return ECORE_CALLBACK_CANCEL;
782 if (loading_done_for_item == EMOTICON_CNT) {
783 PRINTFUNC(DLOG_DEBUG, "lazy loading item done");
784 //elm_genlist_realized_items_update(gl);
785 elm_genlist_item_class_free(itc_emoticon);
786 lazy_loading_timer_for_items = NULL;
788 return ECORE_CALLBACK_CANCEL;
792 if (loading_done_for_item + LOADING_ITEM_UNIT > EMOTICON_CNT) {
793 loading_top = EMOTICON_CNT;
795 loading_top = loading_done_for_item + LOADING_ITEM_UNIT;
798 if (loading_top > loading_done_for_contents) {
799 PRINTFUNC(DLOG_DEBUG, "Wait for content loading");
800 return ECORE_CALLBACK_RENEW;
802 PRINTFUNC(DLOG_DEBUG, "_lazy_loader_cb_for_items loading_done_for_item = %d", loading_done_for_item);
805 for (i = loading_done_for_item; i < loading_top; i++ ) {
807 elm_genlist_item_append(gl, itc_emoticon, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i);
810 loading_done_for_item = loading_top;
811 return ECORE_CALLBACK_RENEW;
814 void _create_reusable_contents(Evas_Object *gl){
816 PRINTFUNC(DLOG_ERROR, "gl is null");
820 loading_done_for_item = INITAL_ITEM_UNIT;
822 for (i = 0; i < INITAL_ITEM_UNIT; i++ ) {
824 elm_genlist_item_append(gl, itc_emoticon, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i);
827 lazy_loading_timer_for_items = ecore_timer_add(0.1, _lazy_loader_cb_for_items, (void *)gl);
830 Evas_Object* _create_emoticon_genlist(void* data)
832 PRINTFUNC(DLOG_DEBUG, "%s", __func__);
833 App_Data* ad = (App_Data*) data;
837 Evas_Object* genlist = elm_genlist_add(ad->naviframe);
842 Evas_Object* circle_object_genlist = eext_circle_object_genlist_add(genlist, ad->circle_surface);
843 eext_circle_object_genlist_scroller_policy_set(circle_object_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
844 evas_object_data_set(genlist, "circle", (void *) circle_object_genlist);
845 eext_rotary_object_event_activated_set(circle_object_genlist, EINA_TRUE);
847 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
848 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
849 evas_object_show(genlist);
851 const char *item_style = NULL;
853 item_style = "empty";
854 Elm_Object_Item *nf_emoticon_item = elm_naviframe_item_push(ad->naviframe, NULL, NULL, NULL, genlist, item_style);
856 elm_naviframe_item_pop_cb_set(nf_emoticon_item, _custom_back_cb2, ad);
858 evas_object_smart_callback_add(genlist, "language,changed", _emoticon_gl_lang_changed, genlist);
860 if (is_content_reuse_on) {
861 evas_object_smart_callback_add(genlist, "content,unswallowed", _emoticon_gl_content_unswallowed_cb, NULL);
867 void _update_emoticon_items(void *data)
869 PRINTFUNC(DLOG_DEBUG, "%s", __func__);
870 Evas_Object* gl = (Evas_Object*) data;
875 Elm_Object_Item *it = NULL;
876 Elm_Object_Item *first_it = NULL;
878 Elm_Genlist_Item_Class * itc_dummy = elm_genlist_item_class_new();
879 itc_dummy->item_style = "title";
880 itc_dummy->func.text_get = NULL;
881 itc_dummy->func.content_get = NULL;
882 itc_dummy->func.state_get = NULL;
883 itc_dummy->func.del = NULL;
885 Elm_Genlist_Item_Class *itc_1text_1icon = NULL;
886 if (app_data->mime_type == MIME_TYPE_ALL) {
887 itc_1text_1icon = elm_genlist_item_class_new();
888 itc_1text_1icon->item_style = "drawing";
889 itc_1text_1icon->func.text_get = __emoticon_gl_text_get;
890 itc_1text_1icon->func.content_get = __emoticon_gl_1_content_get;
891 itc_1text_1icon->func.state_get = NULL;
892 itc_1text_1icon->func.del = NULL;
895 Elm_Genlist_Item_Class *itc_group = elm_genlist_item_class_new();
896 itc_group->item_style = "groupindex";
897 itc_group->func.text_get = __emoticon_gl_text_get;
898 itc_group->func.content_get = NULL;
899 itc_group->func.state_get = NULL;
900 itc_group->func.del = NULL;
902 Elm_Genlist_Item_Class *itc_recent = elm_genlist_item_class_new();
903 itc_recent->item_style = "3button_flat_recent";
904 itc_recent->func.text_get = NULL;
905 itc_recent->func.content_get = __emoticon_gl_recent_content_get;
906 itc_recent->func.state_get = NULL;
907 itc_recent->func.del = NULL;
909 itc_emoticon = elm_genlist_item_class_new();
910 itc_emoticon->item_style = "3button_flat";
911 itc_emoticon->func.text_get = NULL;
912 itc_emoticon->func.content_get = __emoticon_gl_emoticon_content_get;
913 itc_emoticon->func.state_get = NULL;
914 itc_emoticon->func.del = NULL;
916 // dummy title for empty space
917 it_emoticon_empty = elm_genlist_item_append(gl, itc_dummy, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
920 if (app_data->mime_type == MIME_TYPE_ALL) {
921 it_drawing = elm_genlist_item_append(gl, itc_1text_1icon, (void*)"WDS_IME_MBODY_DRAWING_M_EMOTICON_ABB", NULL, ELM_GENLIST_ITEM_NONE, _drawing_item_clicked_cb, (void *)app_data);
922 first_it = it_drawing;
925 if (recent_emoji_list.size() > 0) {
926 if (is_content_reuse_on) {
927 _create_reusable_recents(gl);
931 it_emoticon_recent_group = elm_genlist_item_append(gl, itc_group, (void*)"WDS_IME_HEADER_RECENT_M_RECETLY_SENT_EMOJIS_ABB", NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)2);
932 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
933 if (first_it == NULL)
934 first_it = it_emoticon_recent_group;
936 PRINTFUNC(DLOG_DEBUG, "size = %d", recent_emoji_list.size());
938 for (i=0;i < recent_emoji_list.size();i=i+3)
940 it = elm_genlist_item_append(gl, itc_recent, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i);
945 it_emoticon_emoji_group = elm_genlist_item_append(gl, itc_group, (void*)"WDS_IME_HEADER_EMOJIS_ABB", NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)2);
946 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
947 if (first_it == NULL)
948 first_it = it_emoticon_emoji_group;
950 if (is_content_reuse_on) {
951 _create_reusable_contents(gl);
954 for (i=0;i< EMOTICON_CNT;i=i+3) {
955 it = elm_genlist_item_append(gl, itc_emoticon, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i);
958 elm_genlist_item_class_free(itc_emoticon);
960 it = elm_genlist_item_next_get(first_it);
961 const Elm_Genlist_Item_Class *itc_temp = elm_genlist_item_item_class_get(it);
962 if (itc_temp == itc_group) {
963 it = elm_genlist_item_next_get(it);
965 elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
967 elm_genlist_item_class_free(itc_recent);
968 elm_genlist_item_class_free(itc_group);
969 elm_genlist_item_class_free(itc_1text_1icon);
970 elm_genlist_item_class_free(itc_dummy);
973 void ise_show_emoticon_list(void *data)
975 App_Data* ad = (App_Data*) data;
979 it_emoticon_empty = NULL;
980 it_emoticon_recent_group = NULL;
981 it_emoticon_emoji_group = NULL;
985 get_recent_emoticons(recent_emoji_list);
987 Evas_Object* emoticon_list = NULL;
989 emoticon_list = _create_emoticon_genlist(ad);
991 if (is_content_reuse_on) {
992 create_reusable_button(ad->naviframe); // button object need to survive even if genlist is deleted.
994 _update_emoticon_items(emoticon_list);
997 void launch_drawing_app(void *data)
999 App_Data* ad = (App_Data*) data;
1003 _drawing_item_clicked_cb(ad, NULL, NULL);