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 int ret = app_control_get_extra_data(reply, APP_CONTROL_DATA_PATH, &path);
377 if (ret == APP_CONTROL_ERROR_NONE) {
379 PRINTFUNC(DLOG_DEBUG, "path=%s", path);
380 char *pathes[] = {path, };
381 reply_to_sender_by_callback(NULL, "image", (const char **)pathes, NULL);
388 static void _drawing_item_clicked_cb(void *data, Evas_Object * obj, void *event_info)
390 PRINTFUNC(DLOG_DEBUG, "%s", __func__);
391 App_Data* ad = (App_Data*) data;
395 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
397 elm_genlist_item_selected_set(item, EINA_FALSE);
400 app_control_h request = NULL;
401 app_control_create(&request);
402 app_control_set_app_id(request, "org.tizen.sketch");
404 int ret = app_control_send_launch_request(request, _drawing_app_control_reply_cb, NULL);
405 if (ret != APP_CONTROL_ERROR_NONE) {
406 PRINTFUNC(DLOG_DEBUG, "error code = 0x%x", ret);
408 app_control_destroy(request);
411 static void _emoticon_item_clicked_cb(void *data, Evas_Object * obj, void *event_info)
413 int index = (uintptr_t)data;
415 PRINTFUNC(DLOG_DEBUG, "index = %d", index);
417 // store in recents list
418 set_recent_emoticons(recent_emoji_list, index);
421 const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[index].code, 0 };
422 char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
424 reply_to_sender_by_callback((const char*)utf_8, "emoticon", NULL, NULL);
426 PRINTFUNC(SECURE_DEBUG, "[%d]%s", index, utf_8);
433 Evas_Object* get_emoticon_button(Evas_Object* parent, int index){
437 Evas_Object* btn = elm_button_add(parent);
438 elm_object_style_set(btn, "emoticon");
439 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
440 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
443 const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[index].code, 0 };
444 char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
445 elm_object_part_text_set(btn, "elm.text", utf_8);
450 evas_object_layer_set(btn, 32000);
452 evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void *)(uintptr_t)index);
457 Evas_Object* get_recent_emoticon_button(Evas_Object* parent, int index){
461 Evas_Object* btn = elm_button_add(parent);
462 elm_object_style_set(btn, "emoticon");
463 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
464 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
467 const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[recent_emoji_list.at(index)].code, 0 };
468 char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
469 elm_object_part_text_set(btn, "elm.text", utf_8);
471 evas_object_data_set(btn, "index", (void*)(uintptr_t) recent_emoji_list.at(index));
476 evas_object_layer_set(btn, 32000);
477 evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void*)(uintptr_t) recent_emoji_list.at(index));
482 static void _emoticon_gl_lang_changed(void *data, Evas_Object *obj, void *event_info)
484 elm_genlist_realized_items_update(obj);
487 static char * __emoticon_gl_text_get(void *data, Evas_Object *obj, const char *part)
489 //PRINTFUNC(DLOG_DEBUG,"part = %s", part);
490 const char* str = (const char*) data;
494 if (!strcmp(part, "elm.text")) {
495 //PRINTFUNC(DLOG_DEBUG,"str = %s", str);
496 return strdup(gettext(str));
501 static void _emoticon_gl_content_unswallowed_cb(void *data, Evas_Object *obj, void *event_info)
503 Elm_Object_Item *it = (Elm_Object_Item *)event_info;
505 const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(it);
507 //PRINTFUNC(DLOG_DEBUG,"%s - stype[%s]", __func__, itc->item_style);
508 if (!strcmp(itc->item_style, "3button_flat")) {
509 int index = (uintptr_t)elm_object_item_data_get(it);
510 //PRINTFUNC(DLOG_DEBUG,"it = %p", it);
511 PRINTFUNC(DLOG_DEBUG, "index = %d %d %d", index, index+1, index+2);
513 if (index < EMOTICON_CNT) {
514 emoticon_contents_pool[index].used = 0;
516 if (index + 1 < EMOTICON_CNT) {
517 emoticon_contents_pool[index+1].used = 0;
519 if (index + 2 < EMOTICON_CNT) {
520 emoticon_contents_pool[index+2].used = 0;
522 } else if (!strcmp(itc->item_style, "3button_flat_recent")) {
523 unsigned int index = (uintptr_t)elm_object_item_data_get(it);
524 //PRINTFUNC(DLOG_DEBUG,"index = %d",index);
526 if (index < recent_emoji_list.size()) {
527 emoticon_recents_pool[index].used = 0;
529 if (index + 1 < recent_emoji_list.size()) {
530 emoticon_recents_pool[index+1].used = 0;
532 if (index + 2 < recent_emoji_list.size()) {
533 emoticon_recents_pool[index+2].used = 0;
535 } else if (it_drawing == it) {
536 //PRINTFUNC(DLOG_DEBUG,"it_drawing = %p", it_drawing);
537 emoticon_drawing_pool.used = 0;
541 static Evas_Object * __emoticon_gl_1_content_get(void *data, Evas_Object *obj, const char *part)
543 if (!strcmp(part, "elm.icon")) {
544 Evas_Object* btn = elm_button_add(obj);
545 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
546 evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
547 Evas_Object* ic = elm_image_add(btn);
548 elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
550 string path = get_resource_path();
552 path = path + "wearable/";
556 path = path + "mobile/";
558 elm_object_style_set(btn, "ime_button_drawing");
559 string path_ic = path + "images/wi_drawing_icon.png";
560 PRINTFUNC(DLOG_DEBUG, "path_ic = %s", path_ic.c_str());
561 elm_image_file_set(ic, path_ic.c_str(), NULL);
562 elm_object_content_set(btn, ic);
563 evas_object_layer_set(btn, 32000);
565 emoticon_drawing_pool.index = 0;
566 emoticon_drawing_pool.content = btn;
567 emoticon_drawing_pool.used = 0;
569 } else if (!strcmp(part, "base")){
570 Evas_Object* btn = elm_button_add(obj);
571 elm_object_style_set(btn, "ime/transparent");
577 static Evas_Object * __emoticon_gl_recent_content_get(void *data, Evas_Object *obj, const char *part)
579 if (is_content_reuse_on) {
580 unsigned int index = (uintptr_t)data;
583 //PRINTFUNC(DLOG_DEBUG,"%s %d", part, index);
584 if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
585 if (!strcmp(part, "elm.icon.1")) {
586 if (index >= recent_emoji_list.size()) return NULL;
588 } else if (!strcmp(part, "elm.icon.2")) {
589 if (index + 1 >= recent_emoji_list.size()) return NULL;
590 new_index = index + 1;
591 } else if (!strcmp(part, "elm.icon.3")) {
592 if (index + 2 >= recent_emoji_list.size()) return NULL;
593 new_index = index + 2;
596 Evas_Object* btn = NULL;
597 btn = (Evas_Object*)emoticon_recents_pool[new_index].content;
598 emoticon_recents_pool[new_index].used = 1;
600 } else if (!strcmp(part, "base")) {
601 Evas_Object* btn = elm_button_add(obj);
602 elm_object_style_set(btn, "ime/transparent");
606 unsigned int index = (uintptr_t)data;
609 //PRINTFUNC(DLOG_DEBUG,"%s %d", part, index);
610 if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
611 if (!strcmp(part, "elm.icon.1")) {
612 if (index >= recent_emoji_list.size()) return NULL;
614 } else if (!strcmp(part, "elm.icon.2")) {
615 if (index + 1 >= recent_emoji_list.size()) return NULL;
616 new_index = index + 1;
617 } else if (!strcmp(part, "elm.icon.3")) {
618 if (index + 2 >= recent_emoji_list.size()) return NULL;
619 new_index = index + 2;
621 return get_recent_emoticon_button(obj, new_index);
622 } else if (!strcmp(part, "base")) {
623 Evas_Object* btn = elm_button_add(obj);
624 elm_object_style_set(btn, "ime/transparent");
631 static Evas_Object * __emoticon_gl_emoticon_content_get(void *data, Evas_Object *obj, const char *part)
633 //PRINTFUNC(DLOG_DEBUG,"%s", __func__);
634 if (is_content_reuse_on) {
635 int index = (uintptr_t)data;
638 if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
639 if (!strcmp(part, "elm.icon.1")) {
640 if (index >= EMOTICON_CNT) return NULL;
642 } else if (!strcmp(part, "elm.icon.2")) {
643 if (index + 1 >= EMOTICON_CNT) return NULL;
644 new_index = index + 1;
645 } else if (!strcmp(part, "elm.icon.3")) {
646 if (index + 2 >= EMOTICON_CNT) return NULL;
647 new_index = index + 2;
650 Evas_Object* btn = NULL;
651 btn = (Evas_Object*)emoticon_contents_pool[new_index].content;
652 emoticon_contents_pool[new_index].used = 1;
654 char utf_8[10] = {0, };
655 snprintf(utf_8, sizeof(utf_8), "%d", new_index);
656 elm_object_part_text_set(btn, "elm.text", strdup(utf_8));
659 const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[new_index].code, 0 };
660 char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
661 elm_object_part_text_set(btn, "elm.text", utf_8);
662 evas_object_data_set(btn, "index", (void*)(uintptr_t)new_index);
669 } else if (!strcmp(part, "base")) {
670 Evas_Object* btn = elm_button_add(obj);
671 elm_object_style_set(btn, "ime/transparent");
675 int index = (uintptr_t)data;
678 if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
679 if (!strcmp(part, "elm.icon.1")) {
680 if (index >= EMOTICON_CNT) return NULL;
682 } else if (!strcmp(part, "elm.icon.2")) {
683 if (index + 1 >= EMOTICON_CNT) return NULL;
684 new_index = index + 1;
685 } else if (!strcmp(part, "elm.icon.3")) {
686 if (index + 2 >= EMOTICON_CNT) return NULL;
687 new_index = index + 2;
689 return get_emoticon_button(obj, new_index);
690 } else if (!strcmp(part, "base")) {
691 Evas_Object* btn = elm_button_add(obj);
692 elm_object_style_set(btn, "ime/transparent");
699 void _create_reusable_recents(Evas_Object *parent)
702 PRINTFUNC(DLOG_ERROR, "parent is null");
707 for (i = 0; i < recent_emoji_list.size(); i++ ) {
708 emoticon_recents_pool[i].index = i;
709 emoticon_recents_pool[i].content = get_recent_emoticon_button(parent, i);
710 emoticon_recents_pool[i].used = 0;
714 static Eina_Bool _lazy_loader_cb_for_contents(void *data)
716 Evas_Object *gl = (Evas_Object *)data;
718 PRINTFUNC(DLOG_ERROR, "gl is null");
719 lazy_loading_timer_for_contents = NULL;
720 return ECORE_CALLBACK_CANCEL;
723 if (loading_done_for_contents == EMOTICON_CNT) {
724 PRINTFUNC(DLOG_DEBUG, "lazy loading contents done");
725 lazy_loading_timer_for_contents = NULL;
726 return ECORE_CALLBACK_CANCEL;
730 if (loading_done_for_contents + LOADING_CONTENT_UNIT > EMOTICON_CNT) {
731 loading_top = EMOTICON_CNT;
733 loading_top = loading_done_for_contents + LOADING_CONTENT_UNIT;
736 PRINTFUNC(DLOG_DEBUG, "_lazy_loader_cb_for_contents loading_done = %d", loading_done_for_contents);
739 for (i = loading_done_for_contents; i < loading_top; i++) {
740 emoticon_contents_pool[i].index = i;
741 emoticon_contents_pool[i].used = 0;
743 if (emoticon_contents_pool[i].content == NULL) { // reusable
744 emoticon_contents_pool[i].content = get_emoticon_button(gl, i);
748 loading_done_for_contents = loading_top;
750 return ECORE_CALLBACK_RENEW;
753 void create_reusable_button(Evas_Object *parent)
756 PRINTFUNC(DLOG_ERROR, "parent is null");
759 loading_done_for_contents = INITAL_CONTENT_UNIT;
762 for (i = 0; i < INITAL_CONTENT_UNIT; i++ ) {
763 emoticon_contents_pool[i].index = i;
764 emoticon_contents_pool[i].used = 0;
766 if (emoticon_contents_pool[i].content == NULL) { // reusable
767 emoticon_contents_pool[i].content = get_emoticon_button(parent, i);
771 lazy_loading_timer_for_contents = ecore_timer_add(0.25, _lazy_loader_cb_for_contents, (void *)parent);
774 static Eina_Bool _lazy_loader_cb_for_items(void *data)
776 Evas_Object *gl = (Evas_Object *)data;
778 PRINTFUNC(DLOG_ERROR, "gl is null");
779 lazy_loading_timer_for_items = NULL;
780 return ECORE_CALLBACK_CANCEL;
783 if (loading_done_for_item == EMOTICON_CNT) {
784 PRINTFUNC(DLOG_DEBUG, "lazy loading item done");
785 //elm_genlist_realized_items_update(gl);
786 elm_genlist_item_class_free(itc_emoticon);
787 lazy_loading_timer_for_items = NULL;
789 return ECORE_CALLBACK_CANCEL;
793 if (loading_done_for_item + LOADING_ITEM_UNIT > EMOTICON_CNT) {
794 loading_top = EMOTICON_CNT;
796 loading_top = loading_done_for_item + LOADING_ITEM_UNIT;
799 if (loading_top > loading_done_for_contents) {
800 PRINTFUNC(DLOG_DEBUG, "Wait for content loading");
801 return ECORE_CALLBACK_RENEW;
803 PRINTFUNC(DLOG_DEBUG, "_lazy_loader_cb_for_items loading_done_for_item = %d", loading_done_for_item);
806 for (i = loading_done_for_item; i < loading_top; i++ ) {
808 elm_genlist_item_append(gl, itc_emoticon, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i);
811 loading_done_for_item = loading_top;
812 return ECORE_CALLBACK_RENEW;
815 void _create_reusable_contents(Evas_Object *gl){
817 PRINTFUNC(DLOG_ERROR, "gl is null");
821 loading_done_for_item = INITAL_ITEM_UNIT;
823 for (i = 0; i < INITAL_ITEM_UNIT; i++ ) {
825 elm_genlist_item_append(gl, itc_emoticon, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i);
828 lazy_loading_timer_for_items = ecore_timer_add(0.1, _lazy_loader_cb_for_items, (void *)gl);
831 Evas_Object* _create_emoticon_genlist(void* data)
833 PRINTFUNC(DLOG_DEBUG, "%s", __func__);
834 App_Data* ad = (App_Data*) data;
838 Evas_Object* genlist = elm_genlist_add(ad->naviframe);
843 Evas_Object* circle_object_genlist = eext_circle_object_genlist_add(genlist, ad->circle_surface);
844 eext_circle_object_genlist_scroller_policy_set(circle_object_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
845 evas_object_data_set(genlist, "circle", (void *) circle_object_genlist);
846 eext_rotary_object_event_activated_set(circle_object_genlist, EINA_TRUE);
848 evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
849 evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
850 evas_object_show(genlist);
852 const char *item_style = NULL;
854 item_style = "empty";
855 Elm_Object_Item *nf_emoticon_item = elm_naviframe_item_push(ad->naviframe, NULL, NULL, NULL, genlist, item_style);
857 elm_naviframe_item_pop_cb_set(nf_emoticon_item, _custom_back_cb2, ad);
859 evas_object_smart_callback_add(genlist, "language,changed", _emoticon_gl_lang_changed, genlist);
861 if (is_content_reuse_on) {
862 evas_object_smart_callback_add(genlist, "content,unswallowed", _emoticon_gl_content_unswallowed_cb, NULL);
868 void _update_emoticon_items(void *data)
870 PRINTFUNC(DLOG_DEBUG, "%s", __func__);
871 Evas_Object* gl = (Evas_Object*) data;
876 Elm_Object_Item *it = NULL;
877 Elm_Object_Item *first_it = NULL;
879 Elm_Genlist_Item_Class * itc_dummy = elm_genlist_item_class_new();
880 itc_dummy->item_style = "title";
881 itc_dummy->func.text_get = NULL;
882 itc_dummy->func.content_get = NULL;
883 itc_dummy->func.state_get = NULL;
884 itc_dummy->func.del = NULL;
886 Elm_Genlist_Item_Class *itc_1text_1icon = NULL;
887 if (app_data->mime_type == MIME_TYPE_ALL) {
888 itc_1text_1icon = elm_genlist_item_class_new();
889 itc_1text_1icon->item_style = "drawing";
890 itc_1text_1icon->func.text_get = __emoticon_gl_text_get;
891 itc_1text_1icon->func.content_get = __emoticon_gl_1_content_get;
892 itc_1text_1icon->func.state_get = NULL;
893 itc_1text_1icon->func.del = NULL;
896 Elm_Genlist_Item_Class *itc_group = elm_genlist_item_class_new();
897 itc_group->item_style = "groupindex";
898 itc_group->func.text_get = __emoticon_gl_text_get;
899 itc_group->func.content_get = NULL;
900 itc_group->func.state_get = NULL;
901 itc_group->func.del = NULL;
903 Elm_Genlist_Item_Class *itc_recent = elm_genlist_item_class_new();
904 itc_recent->item_style = "3button_flat_recent";
905 itc_recent->func.text_get = NULL;
906 itc_recent->func.content_get = __emoticon_gl_recent_content_get;
907 itc_recent->func.state_get = NULL;
908 itc_recent->func.del = NULL;
910 itc_emoticon = elm_genlist_item_class_new();
911 itc_emoticon->item_style = "3button_flat";
912 itc_emoticon->func.text_get = NULL;
913 itc_emoticon->func.content_get = __emoticon_gl_emoticon_content_get;
914 itc_emoticon->func.state_get = NULL;
915 itc_emoticon->func.del = NULL;
917 // dummy title for empty space
918 it_emoticon_empty = elm_genlist_item_append(gl, itc_dummy, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
921 if (app_data->mime_type == MIME_TYPE_ALL) {
922 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);
923 first_it = it_drawing;
926 if (recent_emoji_list.size() > 0) {
927 if (is_content_reuse_on) {
928 _create_reusable_recents(gl);
932 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);
933 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
934 if (first_it == NULL)
935 first_it = it_emoticon_recent_group;
937 PRINTFUNC(DLOG_DEBUG, "size = %d", recent_emoji_list.size());
939 for (i=0;i < recent_emoji_list.size();i=i+3)
941 it = elm_genlist_item_append(gl, itc_recent, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i);
946 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);
947 elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
948 if (first_it == NULL)
949 first_it = it_emoticon_emoji_group;
951 if (is_content_reuse_on) {
952 _create_reusable_contents(gl);
955 for (i=0;i< EMOTICON_CNT;i=i+3) {
956 it = elm_genlist_item_append(gl, itc_emoticon, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i);
959 elm_genlist_item_class_free(itc_emoticon);
961 it = elm_genlist_item_next_get(first_it);
962 const Elm_Genlist_Item_Class *itc_temp = elm_genlist_item_item_class_get(it);
963 if (itc_temp == itc_group) {
964 it = elm_genlist_item_next_get(it);
966 elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
968 elm_genlist_item_class_free(itc_recent);
969 elm_genlist_item_class_free(itc_group);
970 elm_genlist_item_class_free(itc_1text_1icon);
971 elm_genlist_item_class_free(itc_dummy);
974 void ise_show_emoticon_list(void *data)
976 App_Data* ad = (App_Data*) data;
980 it_emoticon_empty = NULL;
981 it_emoticon_recent_group = NULL;
982 it_emoticon_emoji_group = NULL;
986 get_recent_emoticons(recent_emoji_list);
988 Evas_Object* emoticon_list = NULL;
990 emoticon_list = _create_emoticon_genlist(ad);
992 if (is_content_reuse_on) {
993 create_reusable_button(ad->naviframe); // button object need to survive even if genlist is deleted.
995 _update_emoticon_items(emoticon_list);
998 void launch_drawing_app(void *data)
1000 App_Data* ad = (App_Data*) data;
1004 _drawing_item_clicked_cb(ad, NULL, NULL);