From 7a95a8f1458712f72d18589dc4414db26256e13a Mon Sep 17 00:00:00 2001 From: Jiwoong Im Date: Mon, 29 Aug 2016 18:16:57 +0900 Subject: [PATCH 01/16] include app_preference.h to fix build break Change-Id: Ibf925dec4a45e970f57455c6c0c73024fa9c3307 Signed-off-by: Jiwoong Im --- src/w-input-stt-voice.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/w-input-stt-voice.cpp b/src/w-input-stt-voice.cpp index 40dab3e..0f14f77 100755 --- a/src/w-input-stt-voice.cpp +++ b/src/w-input-stt-voice.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include -- 2.7.4 From 71cb4fbf92107088a3c677a9700aed39a9c05290 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 31 Aug 2016 13:25:48 +0900 Subject: [PATCH 02/16] Update package version to 0.1.160831 Change-Id: I27f9e652291890f65ba3ce25b9ee35dfed8deaa5 Signed-off-by: Jihoon Kim --- org.tizen.inputdelegator.xml | 2 +- packaging/org.tizen.inputdelegator.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.inputdelegator.xml b/org.tizen.inputdelegator.xml index e001d06..dd5485e 100755 --- a/org.tizen.inputdelegator.xml +++ b/org.tizen.inputdelegator.xml @@ -1,5 +1,5 @@ - + diff --git a/packaging/org.tizen.inputdelegator.spec b/packaging/org.tizen.inputdelegator.spec index c68b3de..77c1575 100755 --- a/packaging/org.tizen.inputdelegator.spec +++ b/packaging/org.tizen.inputdelegator.spec @@ -1,6 +1,6 @@ Name: org.tizen.inputdelegator Summary: Input Delegator Application -Version: 0.1.160818 +Version: 0.1.160831 Release: 1 Group: Applications License: Apache-2.0 -- 2.7.4 From 75c40942e44c112450d943b0a61aae6ff8414af6 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Wed, 7 Sep 2016 19:26:31 +0900 Subject: [PATCH 03/16] Remove unused code Change-Id: I44d6b7578cfb32c118bbe2bc704c465cf331b49b Signed-off-by: sungwook79.park --- inc/w-input-stt-engine.h | 2 -- src/w-input-stt-engine.cpp | 87 ---------------------------------------------- 2 files changed, 89 deletions(-) diff --git a/inc/w-input-stt-engine.h b/inc/w-input-stt-engine.h index 8dbb1df..0cf85e1 100755 --- a/inc/w-input-stt-engine.h +++ b/inc/w-input-stt-engine.h @@ -98,10 +98,8 @@ typedef enum _Feedback_Type{ void set_animation_state(VoiceData *ud); -const char * error_string(int ecode); // STT functions bool _app_stt_initialize(VoiceData *user_data); -void on_feedback(stt_h handle); #if 0 diff --git a/src/w-input-stt-engine.cpp b/src/w-input-stt-engine.cpp index 92075d5..be508bf 100755 --- a/src/w-input-stt-engine.cpp +++ b/src/w-input-stt-engine.cpp @@ -41,93 +41,6 @@ static stt_h g_stt; -const char * error_string(int ecode) -{ - const char *str = NULL; - switch (ecode) { - case STT_ERROR_OUT_OF_MEMORY: - str = "STT_ERROR_OUT_OF_MEMORY"; - break; - case STT_ERROR_IO_ERROR: - str = "STT_ERROR_IO_ERROR"; - break; - case STT_ERROR_INVALID_PARAMETER: - str = "STT_ERROR_INVALID_PARAMETER"; - break; - case STT_ERROR_TIMED_OUT: - str = "STT_ERROR_TIMED_OUT"; - break; - case STT_ERROR_RECORDER_BUSY: - str = "STT_ERROR_RECORDER_BUSY"; - break; - case STT_ERROR_OUT_OF_NETWORK: - str = "STT_ERROR_OUT_OF_NETWORK"; - break; - case STT_ERROR_INVALID_STATE: - str = " STT_ERROR_INVALID_STATE"; - break; - case STT_ERROR_INVALID_LANGUAGE: - str = "STT_ERROR_INVALID_LANGUAGE"; - break; - case STT_ERROR_ENGINE_NOT_FOUND: - str = "STT_ERROR_ENGINE_NOT_FOUND"; - break; - case STT_ERROR_OPERATION_FAILED: - str = "STT_ERROR_OPERATION_FAILED"; - break; - case STT_ERROR_NOT_SUPPORTED_FEATURE: - str = "STT_ERROR_NOT_SUPPORTED_FEATURE"; - break; - } - return str; -} - -void voice_stt_set_silence_detection_func(bool bEnable) -{ - int ret = STT_ERROR_NONE; - - stt_option_silence_detection_e s_option; - - if(bEnable) - s_option = STT_OPTION_SILENCE_DETECTION_TRUE; - else - s_option = STT_OPTION_SILENCE_DETECTION_FALSE; - - ret = stt_set_silence_detection(g_stt, s_option); - if (STT_ERROR_NONE != ret) { - PRINTFUNC(DLOG_ERROR, "stt_set_silence_detection Failed : error(%d) = %s", ret, error_string((stt_error_e)ret)); - } else { - PRINTFUNC(NO_PRINT, "stt_set_silence_detection Successful"); - } -} - - -//////////////////////////////////////////////////////////////////////////////// -// STT Callback functions -//////////////////////////////////////////////////////////////////////////////// - -void on_feedback(stt_h handle) -{ - int is_sound = 0; - int is_sound_vibe = 0; - - if(vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &is_sound)) { - PRINTFUNC(DLOG_ERROR, "get sound status failed."); - } - - if(vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &is_sound_vibe)) { - PRINTFUNC(DLOG_ERROR, "get vibe status failed."); - } - - if (is_sound || is_sound_vibe) { - stt_set_start_sound(handle, "/usr/share/ise-voice-input/audio/voice_start.wav"); - stt_set_stop_sound(handle, "/usr/share/ise-voice-input/audio/voice_stop.wav"); - } else { - stt_unset_start_sound(handle); - stt_unset_stop_sound(handle); - } -} - //////////////////////////////////////////////////////////////////////////////// // STT APIs callers //////////////////////////////////////////////////////////////////////////////// -- 2.7.4 From 410e0b28138643ae6e7024eead5ef301581fcca4 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Thu, 8 Sep 2016 14:59:38 +0900 Subject: [PATCH 04/16] Fix wrong display issue of radio button group in language selection Change-Id: I5445b67d6c4a35dcefe6e9c03eeae6a6a06c7568 Signed-off-by: sungwook79.park --- src/w-input-stt-voice.cpp | 107 +++++++++++++++++++++++----------------------- 1 file changed, 54 insertions(+), 53 deletions(-) diff --git a/src/w-input-stt-voice.cpp b/src/w-input-stt-voice.cpp index 0f14f77..72b7792 100755 --- a/src/w-input-stt-voice.cpp +++ b/src/w-input-stt-voice.cpp @@ -67,7 +67,7 @@ static Elm_Genlist_Item_Class itc_2text; static void set_guide_text(VoiceData *vd, const char* text, bool translatable = false); -const char *supported_language[7] = { +const char *supported_language[] = { "auto", "en_US", "es_US", @@ -78,7 +78,7 @@ const char *supported_language[7] = { }; -const char *disp_lang_array[7] = { +const char *disp_lang_array[] = { "", "English (United States)", "Español (América Latina)", @@ -961,47 +961,38 @@ char *__get_genlist_item_label(void *data, Evas_Object *obj, const char *part) static Evas_Object *__get_genlist_item_content(void *data, Evas_Object *obj, const char *part) { - int index = (int)data; + int index = (intptr_t)data; Evas_Object * content = NULL; - if (!strcmp(part, "elm.icon")) { + if (!strcmp(part, "elm.icon") || + !strcmp(part, "elm.swallow.end")) { content = elm_radio_add(obj); + elm_object_style_set(content, "list"); elm_radio_state_value_set(content, index); elm_radio_group_add(content, radio_gp); evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_propagate_events_set(content, EINA_TRUE); evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_object_style_set(content, "list"); } return content; } static int get_language_value() { -#if 1 int lang = 0, ret = 0; ret = preference_get_int(PREFERENCE_ISE_STT_LANGUAGE, &lang); - if(PREFERENCE_ERROR_NONE != ret){ + if (PREFERENCE_ERROR_NONE != ret) { PRINTFUNC(DLOG_ERROR, "preference_get_int error!(%d)", ret); - preference_set_int(PREFERENCE_ISE_STT_LANGUAGE, (int)2); //auto - lang = 2; + preference_set_int(PREFERENCE_ISE_STT_LANGUAGE, STT_VOICE_N66_AUTO); //auto + lang = STT_VOICE_N66_AUTO; } -#else - int lang = 0, ret = 0; - ret = vconf_get_int(VCONFKEY_ISE_STT_LANGUAGE, &lang); - if (ret !=0) { - PRINTFUNC(DLOG_ERROR, "Vconf_get_int error!(%d)", ret); - } -#endif - if(g_is_n66) { - if(lang < 0 || lang > 6) { - PRINTFUNC(DLOG_WARN, "vconf lang orig(%d) to be 0", lang); - lang = 0; - } - PRINTFUNC(DLOG_DEBUG, "n66 current language value for stt (%s).", disp_lang_array[lang]); + if (lang < 0 || lang > (int)(sizeof(supported_language)/sizeof(supported_language[0])-1)) { + PRINTFUNC(DLOG_WARN, "vconf lang orig(%d) to be 0", lang); + lang = 0; } + PRINTFUNC(DLOG_DEBUG, "n66 current language value for stt (%s).", disp_lang_array[lang]); return lang; } @@ -1011,19 +1002,11 @@ static void set_language_value(int type) // Add implementation to store language type. int ret = 0; -#if 1 ret = preference_set_int(PREFERENCE_ISE_STT_LANGUAGE, (int)type); if(PREFERENCE_ERROR_NONE != ret){ PRINTFUNC(DLOG_ERROR, "preference_set_int error!(%d)", ret); } -#else - ret = vconf_set_int(VCONFKEY_ISE_STT_LANGUAGE, (int) type); - if (ret != 0) { - PRINTFUNC(DLOG_ERROR, "Vconf_set_int error!(%d)", ret); - return; - } -#endif PRINTFUNC(DLOG_DEBUG, "language type (%d)", type); // Update string @@ -1157,14 +1140,15 @@ static Evas_Object *create_language_list(Evas_Object *parent) elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); elm_genlist_homogeneous_set(genlist, EINA_TRUE); -// uxt_genlist_set_bottom_margin_enabled(genlist, EINA_TRUE); - +#ifdef _CIRCLE Evas_Object *circle_language_genlist = eext_circle_object_genlist_add(genlist, NULL); eext_circle_object_genlist_scroller_policy_set(circle_language_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); evas_object_resize(circle_language_genlist, 360, 360); evas_object_show(circle_language_genlist); eext_rotary_object_event_activated_set(circle_language_genlist, EINA_TRUE); - +#else + evas_object_show(genlist); +#endif int i = 0; int lang_val = 0; Elm_Object_Item * item = NULL; @@ -1176,16 +1160,21 @@ static Evas_Object *create_language_list(Evas_Object *parent) elm_radio_state_value_set(radio_gp, -1); lang_val = get_language_value(); - +#ifdef _WEARABLE //Title itc_title.item_style = "title"; itc_title.func.text_get = __get_genlist_title_label; itc_title.func.content_get = NULL; item = elm_genlist_item_append(genlist, &itc_title, (void *)-1, NULL, ELM_GENLIST_ITEM_GROUP, NULL, genlist); +#endif // 2 line text +#ifdef _WEARABLE itc_2text.item_style = "2text.1icon.1/sub1.multiline"; +#else + itc_2text.item_style = "type1"; +#endif itc_2text.func.text_get = __get_genlist_item_label; itc_2text.func.content_get = __get_genlist_item_content; @@ -1202,40 +1191,52 @@ static Evas_Object *create_language_list(Evas_Object *parent) } // 1 line text +#ifdef _WEARABLE itc_1text.item_style = "1text.1icon.1"; +#else + itc_1text.item_style = "type1"; +#endif itc_1text.func.text_get = __get_genlist_item_label; itc_1text.func.content_get = __get_genlist_item_content; - if(g_is_n66) { - for (i = 1; i < 7; i++) - { - char *s = (char *)disp_lang_array[i]; + for (i = 1; i < (long)(sizeof(disp_lang_array)/sizeof(disp_lang_array[0])); i++) + { + char *s = (char *)disp_lang_array[i]; - if(strchr(s, '(')){ - item = item_append(genlist, itc_2text, i, language_set_genlist_radio_cb, genlist); - } else { - item = item_append(genlist, itc_1text, i, language_set_genlist_radio_cb, genlist); - } + if(strchr(s, '(')){ + item = item_append(genlist, itc_2text, i, language_set_genlist_radio_cb, genlist); + } else { + item = item_append(genlist, itc_1text, i, language_set_genlist_radio_cb, genlist); + } - if(lang_val == i) { - PRINTFUNC(DLOG_DEBUG, "%d item is choiced.", i); - elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); - } + if(lang_val == i) { + PRINTFUNC(DLOG_DEBUG, "%d item is choiced.", i); + elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); + } - if ( item == NULL ) { - PRINTFUNC(DLOG_DEBUG, "elm_genlist_item_append was failed"); - break; - } + if ( item == NULL ) { + PRINTFUNC(DLOG_DEBUG, "elm_genlist_item_append was failed"); + break; } } + Elm_Object_Item *dummy; + Elm_Genlist_Item_Class *itc_dummy = elm_genlist_item_class_new(); + if (itc_dummy) { + itc_dummy->item_style = "title"; + itc_dummy->func.text_get = NULL; + itc_dummy->func.content_get = NULL; + } + dummy = elm_genlist_item_append(genlist, itc_dummy, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + elm_genlist_item_select_mode_set(dummy, ELM_OBJECT_SELECT_MODE_NONE); + LOGD("before elm_radio_value_set > lang_val = %d", lang_val); + radio_gp = elm_radio_add(genlist); + elm_radio_state_value_set(radio_gp, lang_val); elm_radio_value_set(radio_gp, lang_val); elm_object_signal_callback_add(genlist, "elm,system,language,change", "elm", language_changed_cb, NULL); -// eext_rotary_event_callback_set(genlist, _language_list_rotary_cb, NULL); evas_object_smart_callback_add(genlist, "realized", _language_list_item_realized, NULL); - g_evt_key_down = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, _ise_keydown_cb, NULL); return genlist; } -- 2.7.4 From 5afadd075dcbf4ea93b09075c41d8bb20d4e1147 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Fri, 9 Sep 2016 13:45:08 +0900 Subject: [PATCH 05/16] Fix build warning Change-Id: I63d2d4fd6257b504b47f911b9f71b2cb77278a59 Signed-off-by: sungwook79.park --- inc/Debug.h | 4 ++-- src/w-input-emoticon.cpp | 2 +- src/w-input-stt-engine.cpp | 1 - src/w-input-stt-voice.cpp | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/inc/Debug.h b/inc/Debug.h index 393f5a3..d7759ed 100755 --- a/inc/Debug.h +++ b/inc/Debug.h @@ -17,10 +17,10 @@ #ifndef __DEBUG_HEAD__ #define __DEBUG_HEAD__ -#define LOG_TAG "INPUT_DELEGATOR" - #include +#undef LOG_TAG +#define LOG_TAG "INPUT_DELEGATOR" /*************************************************************************************************** diff --git a/src/w-input-emoticon.cpp b/src/w-input-emoticon.cpp index 7f96a37..aec6abf 100755 --- a/src/w-input-emoticon.cpp +++ b/src/w-input-emoticon.cpp @@ -114,7 +114,7 @@ static void _rotary_selector_item_clicked(void *data, Evas_Object *obj, void *ev } int length; - const Eina_Unicode unicode_event[2] = { emoticon_info[i].code, 0 }; + const Eina_Unicode unicode_event[2] = { (unsigned int)emoticon_info[i].code, 0 }; char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); reply_to_sender_by_callback((const char*)utf_8, "emoticon"); diff --git a/src/w-input-stt-engine.cpp b/src/w-input-stt-engine.cpp index be508bf..1a69ad7 100755 --- a/src/w-input-stt-engine.cpp +++ b/src/w-input-stt-engine.cpp @@ -38,7 +38,6 @@ } while (0); -static stt_h g_stt; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/w-input-stt-voice.cpp b/src/w-input-stt-voice.cpp index 72b7792..bac5865 100755 --- a/src/w-input-stt-voice.cpp +++ b/src/w-input-stt-voice.cpp @@ -1160,12 +1160,12 @@ static Evas_Object *create_language_list(Evas_Object *parent) elm_radio_state_value_set(radio_gp, -1); lang_val = get_language_value(); -#ifdef _WEARABLE + //Title itc_title.item_style = "title"; itc_title.func.text_get = __get_genlist_title_label; itc_title.func.content_get = NULL; - +#ifdef _WEARABLE item = elm_genlist_item_append(genlist, &itc_title, (void *)-1, NULL, ELM_GENLIST_ITEM_GROUP, NULL, genlist); #endif -- 2.7.4 From b5785e77040b6af74073062ce5f7ae163596a07b Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Tue, 27 Sep 2016 10:38:54 +0900 Subject: [PATCH 06/16] Fix indentation Change-Id: I88461756a840f51a31ef6378a2fa4ee4960bc4b5 Signed-off-by: Jihoon Kim --- src/w-input-stt-voice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/w-input-stt-voice.cpp b/src/w-input-stt-voice.cpp index bac5865..c135e4c 100755 --- a/src/w-input-stt-voice.cpp +++ b/src/w-input-stt-voice.cpp @@ -965,7 +965,7 @@ static Evas_Object *__get_genlist_item_content(void *data, Evas_Object *obj, con Evas_Object * content = NULL; if (!strcmp(part, "elm.icon") || - !strcmp(part, "elm.swallow.end")) { + !strcmp(part, "elm.swallow.end")) { content = elm_radio_add(obj); elm_object_style_set(content, "list"); elm_radio_state_value_set(content, index); -- 2.7.4 From bd177afb66ea629362e42035485b0905b2dc4a73 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Tue, 27 Sep 2016 10:34:09 +0900 Subject: [PATCH 07/16] Update package version to 0.1.160927 Change-Id: I4b397dd755e1ce3bde335e292ccfbe25846f9057 Signed-off-by: sungwook79.park --- org.tizen.inputdelegator.xml | 2 +- packaging/org.tizen.inputdelegator.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.inputdelegator.xml b/org.tizen.inputdelegator.xml index dd5485e..c27dfd7 100755 --- a/org.tizen.inputdelegator.xml +++ b/org.tizen.inputdelegator.xml @@ -1,5 +1,5 @@ - + diff --git a/packaging/org.tizen.inputdelegator.spec b/packaging/org.tizen.inputdelegator.spec index 77c1575..9a74048 100755 --- a/packaging/org.tizen.inputdelegator.spec +++ b/packaging/org.tizen.inputdelegator.spec @@ -1,6 +1,6 @@ Name: org.tizen.inputdelegator Summary: Input Delegator Application -Version: 0.1.160831 +Version: 0.1.160927 Release: 1 Group: Applications License: Apache-2.0 -- 2.7.4 From 4cb6ec37bad0f23e5afa7a7a8f54320ce91750b1 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Fri, 7 Oct 2016 14:10:08 +0900 Subject: [PATCH 08/16] Support maximum text length in keyboard edit Change-Id: I8250e0cea92a9d12efacce16dfb2f9a81c5fdc96 Signed-off-by: sungwook79.park --- inc/w-input-keyboard.h | 1 + src/w-input-keyboard.cpp | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/inc/w-input-keyboard.h b/inc/w-input-keyboard.h index 4cff081..a04fccd 100755 --- a/inc/w-input-keyboard.h +++ b/inc/w-input-keyboard.h @@ -21,6 +21,7 @@ #include #include +const int KEYBOARD_EDITOR_CHAR_COUNT_MAX = 50; bool input_keyboard_init(app_control_h app_control); void input_keyboard_deinit(void); bool input_keyboard_launch(Evas_Object *window, void * data); diff --git a/src/w-input-keyboard.cpp b/src/w-input-keyboard.cpp index 943ab3b..0bfa13f 100755 --- a/src/w-input-keyboard.cpp +++ b/src/w-input-keyboard.cpp @@ -92,6 +92,11 @@ static Eina_Bool custom_back_cb(void *data, Elm_Object_Item *it) return EINA_TRUE; } +static void maxlength_cb(void *data, Evas_Object *obj, void *event_info) +{ + LOGD("maxlength_cb : size = %d", KEYBOARD_EDITOR_CHAR_COUNT_MAX); +} + void create_fullscreen_editor(void *data) { App_Data *ad = (App_Data *)data; @@ -102,6 +107,12 @@ void create_fullscreen_editor(void *data) elm_win_resize_object_add(ad->naviframe, box); entry = elm_entry_add(box); + + static Elm_Entry_Filter_Limit_Size limit_filter_data; + limit_filter_data.max_char_count = KEYBOARD_EDITOR_CHAR_COUNT_MAX; + elm_entry_markup_filter_append(entry, elm_entry_filter_limit_size, &limit_filter_data); + evas_object_smart_callback_add(entry, "maxlength,reached", maxlength_cb, data); + elm_entry_single_line_set(entry, EINA_TRUE); elm_entry_scrollable_set(entry, EINA_TRUE); elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); -- 2.7.4 From 58e0319b831eb27bbe283d895e2df9f2477a35ce Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Fri, 7 Oct 2016 15:39:53 +0900 Subject: [PATCH 09/16] Stop playing sound when starting STT Change-Id: I3426487ad9ac3b90430748ca09654e71c950583f Signed-off-by: sungwook79.park --- inc/SttManager.h | 1 + packaging/org.tizen.inputdelegator.spec | 1 + src/CMakeLists.txt | 6 +++++- src/SttManager.cpp | 36 ++++++++++++++++++++++++++++++++- 4 files changed, 42 insertions(+), 2 deletions(-) diff --git a/inc/SttManager.h b/inc/SttManager.h index 68a9a24..8b76f5e 100755 --- a/inc/SttManager.h +++ b/inc/SttManager.h @@ -221,6 +221,7 @@ class SttManager static void PrintErrorState(stt_error_e reason); static void PrintState(stt_state_e previous, stt_state_e current); static void PrintResultState(stt_result_event_e result_type); + static void ReleaseSoundFocus(); }; }} /** end of is::stt */ diff --git a/packaging/org.tizen.inputdelegator.spec b/packaging/org.tizen.inputdelegator.spec index 9a74048..efc6250 100755 --- a/packaging/org.tizen.inputdelegator.spec +++ b/packaging/org.tizen.inputdelegator.spec @@ -30,6 +30,7 @@ BuildRequires: pkgconfig(stt) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(db-util) BuildRequires: pkgconfig(sqlite3) +BuildRequires: pkgconfig(capi-media-audio-io) %if %{enable_log_manager} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 01749a5..74963d3 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,6 +11,7 @@ PKG_CHECK_MODULES(STT REQUIRED stt) PKG_CHECK_MODULES(VCONF REQUIRED vconf) PKG_CHECK_MODULES(DB_UTIL_PKG REQUIRED db-util) PKG_CHECK_MODULES(SQLITE3_PKG REQUIRED sqlite3) +pkg_check_modules(CAPI_MEDIA_AUDIO_IO REQUIRED capi-media-audio-io) #PKG_CHECK_MODULES(GRAPHICS_EXTENSION REQUIRED graphics-extension) #PKG_CHECK_MODULES(WNOTI_SERVICE REQUIRED wnoti-service2) #PKG_CHECK_MODULES(SAP_CLIENT_STUB_API REQUIRED sap-client-stub-api) @@ -37,7 +38,8 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${SQLITE3_PKG_INCLUDE_DIRS} ${DATA_CONTROL_INCLUDE_DIRS} ${WNOTI_SERVICE_INCLUDE_DIRS} - ${SAP_CLIENT_STUB_API_INCLUDE_DIRS}) + ${SAP_CLIENT_STUB_API_INCLUDE_DIRS} + ${CAPI_MEDIA_AUDIO_IO_INCLUDE_DIRS}) LINK_DIRECTORIES(${DLOG_LIBRARY_DIRS} @@ -56,6 +58,7 @@ LINK_DIRECTORIES(${DLOG_LIBRARY_DIRS} ${VCONF_LIBRARY_DIRS} ${WNOTI_SERVICE_LIBRARY_DIRS} ${SAP_CLIENT_STUB_API_LIBRARY_DIRS} + ${CAPI_MEDIA_AUDIO_IO_LIBRARY_DIRS} ) ADD_EXECUTABLE(${W_INPUT_SELECTOR} @@ -75,6 +78,7 @@ TARGET_LINK_LIBRARIES(${W_INPUT_SELECTOR} ${DB_UTIL_PKG_LIBRARIES} ${SQLITE3_PKG_LIBRARIES} ${VCONF_LIBRARIES} + ${CAPI_MEDIA_AUDIO_IO_LIBRARIES} ) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall -fPIE") diff --git a/src/SttManager.cpp b/src/SttManager.cpp index 1be05a3..c4a080e 100755 --- a/src/SttManager.cpp +++ b/src/SttManager.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include "Debug.h" #include "SttManager.h" @@ -30,6 +31,8 @@ enum { CREATE = 0x1000 }; +static sound_stream_info_h g_stream_info_h = NULL; + static inline const char *stt_state_str(stt_state_e cur) { if (cur == STT_STATE_CREATED) return (const char *) "STT_STATE_CREATED"; @@ -47,6 +50,10 @@ static inline const char *stt_state_str(stt_state_e cur) { return (const char *) "ABNORMAL CASE"; } +static void player_focus_state_cb(sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason_for_change, const char *extra_info, void *user_data) +{ +} + SttManager::SttManager(ISttFeedback& feedback) : ifeedback(feedback), iscancelled(false) @@ -61,6 +68,11 @@ SttManager::SttManager(ISttFeedback& feedback) if(ret != STT_ERROR_NONE) throw SttException(ret, ErrorString((stt_error_e)ret)); + ret = sound_manager_create_stream_information(SOUND_STREAM_TYPE_VOICE_RECOGNITION, player_focus_state_cb, NULL, &g_stream_info_h); + if (SOUND_MANAGER_ERROR_NONE != ret) { + LOGW("Fail to create stream info. ret : %d", ret); + } + /** * Set default properties * @@ -84,6 +96,10 @@ SttManager::~SttManager() { PRINTFUNC(DLOG_ERROR, "reason : %s", e.what()); stt_destroy(handle); } + + ReleaseSoundFocus(); + + sound_manager_destroy_stream_information(g_stream_info_h); } void SttManager::Prepare() { @@ -123,7 +139,13 @@ void SttManager::Start() { */ asrtype = STT_RECOGNITION_TYPE_FREE_PARTIAL; int ret; - ret = stt_start(handle, language.c_str(), asrtype.c_str()); + + ret = sound_manager_acquire_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL); + if (SOUND_MANAGER_ERROR_NONE != ret) { + LOGW("Fail to acquire focus. ret : %d, stream handle : %p", ret, g_stream_info_h); + } + + ret = stt_start(handle, language.c_str(), asrtype.c_str()); if(ret != STT_ERROR_NONE) throw SttException(ret, ErrorString((stt_error_e)ret)); @@ -318,6 +340,11 @@ void SttManager::on_state_changed( SttManager& manager = *((SttManager *) user_data); if (current== STT_STATE_READY) { + if (previous == STT_STATE_RECORDING || + previous == STT_STATE_PROCESSING) { + ReleaseSoundFocus(); + } + if (previous == STT_STATE_CREATED) { manager.EnableSilenceDetection(); manager.ifeedback.AutoStart(); @@ -525,3 +552,10 @@ void SttManager::EnableSilenceDetection(bool enabled) { } } +void SttManager::ReleaseSoundFocus() +{ + int ret = sound_manager_release_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL); + if (SOUND_MANAGER_ERROR_NONE != ret) { + LOGW("Fail to release focus. ret : %d", ret); + } +} -- 2.7.4 From 5906bc8d71f6c4e322ac1777584dfc62827d1cf1 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Wed, 12 Oct 2016 11:35:34 +0900 Subject: [PATCH 10/16] Acquire recognition sound focus before starting STT Change-Id: I662783dc5bfc6c3d7bb7700e7f77c1e218233310 Signed-off-by: sungwook79.park --- src/SttManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SttManager.cpp b/src/SttManager.cpp index c4a080e..d8c53b5 100755 --- a/src/SttManager.cpp +++ b/src/SttManager.cpp @@ -140,9 +140,9 @@ void SttManager::Start() { asrtype = STT_RECOGNITION_TYPE_FREE_PARTIAL; int ret; - ret = sound_manager_acquire_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL); + ret = sound_manager_acquire_focus(g_stream_info_h, (sound_stream_focus_mask_e)(SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING), NULL); if (SOUND_MANAGER_ERROR_NONE != ret) { - LOGW("Fail to acquire focus. ret : %d, stream handle : %p", ret, g_stream_info_h); + LOGW("Fail to acquire playback or recording focus. ret : %d, stream handle : %p", ret, g_stream_info_h); } ret = stt_start(handle, language.c_str(), asrtype.c_str()); @@ -554,8 +554,8 @@ void SttManager::EnableSilenceDetection(bool enabled) { void SttManager::ReleaseSoundFocus() { - int ret = sound_manager_release_focus(g_stream_info_h, SOUND_STREAM_FOCUS_FOR_PLAYBACK, NULL); + int ret = sound_manager_release_focus(g_stream_info_h, (sound_stream_focus_mask_e)(SOUND_STREAM_FOCUS_FOR_PLAYBACK | SOUND_STREAM_FOCUS_FOR_RECORDING), NULL); if (SOUND_MANAGER_ERROR_NONE != ret) { - LOGW("Fail to release focus. ret : %d", ret); + LOGW("Fail to release playback or recording focus. ret : %d", ret); } } -- 2.7.4 From 76cd03d710da8dc07fc05d873c60b6512a8241bc Mon Sep 17 00:00:00 2001 From: Ji-hoon Lee Date: Thu, 20 Oct 2016 15:08:54 +0900 Subject: [PATCH 11/16] Fixed defect detected by static analysis tool Change-Id: I5c3acc19e4478b2c3421b68b203b0a5e08f1bb16 --- src/MicEffector.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/MicEffector.cpp b/src/MicEffector.cpp index f2602d1..9010026 100755 --- a/src/MicEffector.cpp +++ b/src/MicEffector.cpp @@ -408,7 +408,8 @@ void MicEffector::VolumeCheck(bool fake) volumes = ieffect.GetVolume(); } else { for(unsigned int i = 0; i < spectrum_count; i++) { - volumes.push_back(rand_r((unsigned int*)time(NULL)) % 2); + unsigned int seed = time(NULL); + volumes.push_back(rand_r(&seed) % 2); } } -- 2.7.4 From f3dca6f38fb2e27facf1aa7ce8745bad19477108 Mon Sep 17 00:00:00 2001 From: InHong Han Date: Wed, 2 Nov 2016 19:08:00 +0900 Subject: [PATCH 12/16] Update package version to 0.1.161102 Change-Id: I8db8f6b7373f503a898ed7b75c3b4e121d2e1c5c --- org.tizen.inputdelegator.xml | 2 +- packaging/org.tizen.inputdelegator.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/org.tizen.inputdelegator.xml b/org.tizen.inputdelegator.xml index c27dfd7..e0dd87d 100755 --- a/org.tizen.inputdelegator.xml +++ b/org.tizen.inputdelegator.xml @@ -1,5 +1,5 @@ - + diff --git a/packaging/org.tizen.inputdelegator.spec b/packaging/org.tizen.inputdelegator.spec index efc6250..f8cbf92 100755 --- a/packaging/org.tizen.inputdelegator.spec +++ b/packaging/org.tizen.inputdelegator.spec @@ -1,6 +1,6 @@ Name: org.tizen.inputdelegator Summary: Input Delegator Application -Version: 0.1.160927 +Version: 0.1.161102 Release: 1 Group: Applications License: Apache-2.0 -- 2.7.4 From c5f086ad392fec078b6ca2fbe4f041b869ccac72 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Fri, 18 Nov 2016 16:03:49 +0900 Subject: [PATCH 13/16] Remove unused code Change-Id: I7e0c5c5432000b2cfde3592c1e3c678d49c2873a Signed-off-by: sungwook79.park --- res/edje/w-input-selector.edc | 301 ------------------------------------------ 1 file changed, 301 deletions(-) diff --git a/res/edje/w-input-selector.edc b/res/edje/w-input-selector.edc index a436e58..c00e082 100755 --- a/res/edje/w-input-selector.edc +++ b/res/edje/w-input-selector.edc @@ -368,308 +368,7 @@ collections { } \ ) - group { - name: "elm/genlist/item/3button/default"; - data.item: "treesize" 0; - data.item: "flips" "elm.flip.icon elm.flip.content"; - data.item: "contents" "base elm.icon.1.touch_area elm.icon.2.touch_area elm.icon.3.touch_area elm.icon.1 elm.icon.2 elm.icon.3 elm.swallow.center_check"; - data.item: "vi_effect" "off"; - - parts { - PART_LIST_BG - PART_LIST_PADDINGS( - LIST_BUTTON_PADDING_LEFT_SIZE_INC, LIST_BUTTON_PADDING_RIGHT_SIZE_INC, - LIST_BUTTON_PADDING_2BUTTON_TOP_SIZE_INC, LIST_BUTTON_PADDING_BOTTOM_SIZE_INC - ) - PART(SWALLOW, "base", - DESC_LRTB("elm.padding.left", "elm.padding.right", "elm.padding.top", "elm.padding.bottom", - min: 360 0; - fixed: 1 0; - visible: 1; - ) - ) - part { name: "elm.icon.1.touch_area"; // left icon -// type: RECT; - type: SWALLOW; - repeat_events, 0; - description { - state: "default" 0.0; - color: 255 0 0 100; - visible: 1; - align: 0.5 0.5; - fixed: 1 1; - rel1 { relative: 0.0 0.0; to: "elm.icon.1"; offset: -5 -5;} - rel2 { relative: 1.0 1.0; to: "elm.icon.1"; offset: +5 +5;} - } - description { - state: "default" 0.1; - inherit: "default" 0.0; - rel1 { relative: 0.0 0.0; to: "elm.icon.1"; offset: -7 -7;} - rel2 { relative: 1.0 1.0; to: "elm.icon.1"; offset: +7 +7;} - } - description { - state: "default" 0.9; - inherit: "default" 0.0; - rel1 { relative: 0.0 0.0; to: "elm.icon.1"; offset: -8 -8;} - rel2 { relative: 1.0 1.0; to: "elm.icon.1"; offset: +8 +8;} - } - } - part { name: "elm.icon.2.touch_area"; // center icon -// type: RECT; - type: SWALLOW; - repeat_events, 0; - description { - state: "default" 0.0; - color: 0 255 0 100; - visible: 1; - align: 0.5 0.5; - fixed: 1 1; - rel1 { relative: 0.0 0.0; to: "elm.icon.2"; offset: -5 -5;} - rel2 { relative: 1.0 1.0; to: "elm.icon.2"; offset: +5 +5;} - } - description { - state: "default" 0.1; - inherit: "default" 0.0; - rel1 { relative: 0.0 0.0; to: "elm.icon.2"; offset: -7 -7;} - rel2 { relative: 1.0 1.0; to: "elm.icon.2"; offset: +7 +7;} - } - description { - state: "default" 0.9; - inherit: "default" 0.0; - rel1 { relative: 0.0 0.0; to: "elm.icon.2"; offset: -8 -8;} - rel2 { relative: 1.0 1.0; to: "elm.icon.2"; offset: +8 +8;} - } - - } - part { name: "elm.icon.3.touch_area"; // right icon -// type: RECT; - type: SWALLOW; - repeat_events, 0; - description { - state: "default" 0.0; - color: 0 0 255 100; - visible: 1; - align: 0.5 0.5; - fixed: 1 1; - rel1 { relative: 0.0 0.0; to: "elm.icon.3"; offset: -6 -5;} - rel2 { relative: 1.0 1.0; to: "elm.icon.3"; offset: +6 +5;} - } - description { - state: "default" 0.1; - inherit: "default" 0.0; - rel1 { relative: 0.0 0.0; to: "elm.icon.3"; offset: -7 -7;} - rel2 { relative: 1.0 1.0; to: "elm.icon.3"; offset: +7 +7;} - } - description { - state: "default" 0.9; - inherit: "default" 0.0; - rel1 { relative: 0.0 0.0; to: "elm.icon.3"; offset: -9 -8;} - rel2 { relative: 1.0 1.0; to: "elm.icon.3"; offset: +9 +8;} - } - } - part { name: "elm.icon.1"; // left icon - type: SWALLOW; - repeat_events, 1; - description { - state: "default" 0.0; - //color: 255 0 0 255; - visible: 1; - align: 0.5 0; - fixed: 1 1; - min: 57 57; - max: 57 57; - rel1 { relative: 112/360 0; to: "base"; offset: 0 35;} - rel2 { relative: 112/360 0; to: "base"; offset: 0 35;} - } - description { - state: "default" 0.1; - inherit: "default" 0.0; - min: 57+(99-57)/2 57+(99-57)/2; - max: 57+(99-57)/2 57+(99-57)/2; - rel1 { relative: ((64+112)/2)/360 0; to: "base"; offset: 0 (35+12)/2;} - rel2 { relative: ((64+112)/2)/360 0; to: "base"; offset: 0 (35+12)/2;} - } - description { - state: "default" 0.9; - inherit: "default" 0.0; - min: 99 99; - max: 99 99; - rel1 { relative: 64/360 0; to: "base"; offset: 0 12;} - rel2 { relative: 64/360 0; to: "base"; offset: 0 12;} - } - } - part { name: "elm.icon.2"; // center icon - type: SWALLOW; - repeat_events, 1; - description { - state: "default" 0.0; - visible: 1; - align: 0.5 0; - fixed: 1 1; - min: 57 57; - max: 57 57; - rel1 { relative: 0.5 0; to: "bg"; offset: 0 20;} - rel2 { relative: 0.5 0; to: "bg"; offset: 0 20;} - } - description { - state: "default" 0.1; - inherit: "default" 0.0; - min: 57+(99-57)/2 57+(99-57)/2; - max: 57+(99-57)/2 57+(99-57)/2; - rel1 { relative: 0.5 0; to: "bg"; offset: 0 (20+12)/2;} - rel2 { relative: 0.5 0; to: "bg"; offset: 0 (20+12)/2;} - } - description { - state: "default" 0.9; - inherit: "default" 0.0; - min: 99 99; - max: 99 99; - rel1 { relative: 0.5 0; to: "base"; offset: 0 12;} - rel2 { relative: 0.5 0; to: "base"; offset: 0 12;} - } - } - part { name: "elm.icon.3"; // right icon - type: SWALLOW; - repeat_events, 1; - description { - state: "default" 0.0; - //color: 255 0 0 255; - visible: 1; - align: 0.5 0; - fixed: 1 1; - min: 57 57; - max: 57 57; - rel1 { relative: 249/360 0; to: "base"; offset: 0 35;} - rel2 { relative: 249/360 0; to: "base"; offset: 0 35;} - } - description { - state: "default" 0.1; - inherit: "default" 0.0; - min: 57+(99-57)/2 57+(99-57)/2; - max: 57+(99-57)/2 57+(99-57)/2; - rel1 { relative: ((249+297)/2)/360 0; to: "base"; offset: 0 (35+12)/2;} - rel2 { relative: ((249+297)/2)/360 0; to: "base"; offset: 0 (35+12)/2;} - } - description { - state: "default" 0.9; - inherit: "default" 0.0; - min: 99 99; - max: 99 99; - rel1 { relative: 297/360 0; to: "base"; offset: 0 12;} - rel2 { relative: 297/360 0; to: "base"; offset: 0 12;} - } - } - - PART(SPACER, "elm.padding.fake", - DESC_TB("elm.padding.top","elm.padding.bottom", - min: LIST_BUTTON_PADDING_CENTER_SIZE_INC 0; - max: LIST_BUTTON_PADDING_CENTER_SIZE_INC -1; - fixed: 1 0; - ) - ) - PART(SPACER, "elm.padding.center", - DESC_LTB("elm.padding.fake", "elm.padding.top", "elm.padding.bottom", - min: LIST_BUTTON_PADDING_CENTER_SIZE_INC 0; - max: LIST_BUTTON_PADDING_CENTER_SIZE_INC -1; - fixed: 1 0; - ) - ) - PART(SWALLOW, "elm.swallow.center_check", - description { state: "default" 0.0; - align: 0.5 0.5; - } - ) - } -//Gesture VI - program { name: "do_start_expand_0.0"; - action: STATE_SET "default" 0.0; - target: "elm.icon.1"; - target: "elm.icon.2"; - target: "elm.icon.3"; - target: "elm.icon.1.touch_area"; - target: "elm.icon.2.touch_area"; - target: "elm.icon.3.touch_area"; - transition: LINEAR 0.3; - } - program { name: "do_start_expand_0.1"; - action: STATE_SET "default" 0.1; - target: "elm.icon.1"; - target: "elm.icon.2"; - target: "elm.icon.3"; - target: "elm.icon.1.touch_area"; - target: "elm.icon.2.touch_area"; - target: "elm.icon.3.touch_area"; - transition: LINEAR 0.3; - } - program { name: "do_start_expand_0.9"; - action: STATE_SET "default" 0.9; - target: "elm.icon.1"; - target: "elm.icon.2"; - target: "elm.icon.3"; - target: "elm.icon.1.touch_area"; - target: "elm.icon.2.touch_area"; - target: "elm.icon.3.touch_area"; - transition: LINEAR 0.3; - } - program { name: "start_expand_0.0"; - source: "elm"; - signal: "elm,action,ime,0.0"; - script { - run_program(PROGRAM:"do_start_expand_0.0"); - } - } - program { name: "start_expand_0.1"; - source: "elm"; - signal: "elm,action,ime,0.1"; - script { - run_program(PROGRAM:"do_start_expand_0.1"); - } - } - program { name: "start_expand_0.9"; - source: "elm"; - signal: "elm,action,ime,0.9"; - script { - run_program(PROGRAM:"do_start_expand_0.9"); - } - } -//Rotary VI - program { name: "do_rotary_start_expand_0.9"; - action: STATE_SET "default" 0.9; - target: "elm.icon.1"; - target: "elm.icon.2"; - target: "elm.icon.3"; - target: "elm.icon.1.touch_area"; - target: "elm.icon.2.touch_area"; - target: "elm.icon.3.touch_area"; - transition: LINEAR 0.5; - } - program { name: "do_rotary_start_expand_0.0"; - action: STATE_SET "default" 0.0; - target: "elm.icon.1"; - target: "elm.icon.2"; - target: "elm.icon.3"; - target: "elm.icon.1.touch_area"; - target: "elm.icon.2.touch_area"; - target: "elm.icon.3.touch_area"; - transition: LINEAR 0.5; - } - program { name: "rotary_start_expand_0.9"; - source: "elm"; - signal: "elm,action,rotary,ime,0.9"; - script { - run_program(PROGRAM:"do_rotary_start_expand_0.9"); - } - } - program { name: "rotary_start_expand_0.0"; - source: "elm"; - signal: "elm,action,rotary,ime,0.0"; - script { - run_program(PROGRAM:"do_rotary_start_expand_0.0"); - } - } - - } // 3 button group { -- 2.7.4 From 74353db9442ec97b8f1d092c0462df42e1c9c950 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Fri, 18 Nov 2016 17:24:12 +0900 Subject: [PATCH 14/16] Change emoticon mode form rotary selector to list UI Change-Id: I6bc986252e1d9a3b1ceeb948483993fe72fb0b63 Signed-off-by: sungwook79.park --- inc/w-input-emoticon.h | 3 +- org.tizen.inputdelegator.xml | 2 +- po/en_US.po | 5 + res/edje/w-input-stt.edc | 220 ++++++++++- src/w-input-emoticon.cpp | 915 ++++++++++++++++++++++++++++++++++++++----- src/w-input-selector.cpp | 3 +- 6 files changed, 1039 insertions(+), 109 deletions(-) diff --git a/inc/w-input-emoticon.h b/inc/w-input-emoticon.h index 45ede7b..709fd76 100755 --- a/inc/w-input-emoticon.h +++ b/inc/w-input-emoticon.h @@ -16,6 +16,7 @@ #ifndef W_INPUT_EMOTICON_H_ #define W_INPUT_EMOTICON_H_ -void ise_show_emoticon_popup_rotary(void *data); +void ise_show_emoticon_list(void *data); + #endif /* W_INPUT_EMOTICON_H_ */ diff --git a/org.tizen.inputdelegator.xml b/org.tizen.inputdelegator.xml index e0dd87d..87d0348 100755 --- a/org.tizen.inputdelegator.xml +++ b/org.tizen.inputdelegator.xml @@ -2,7 +2,7 @@ - + w-input-selector.png diff --git a/po/en_US.po b/po/en_US.po index 27d5438..8f90a0a 100644 --- a/po/en_US.po +++ b/po/en_US.po @@ -256,3 +256,8 @@ msgstr "Gear Input" msgid "WDS_WMGR_POP_MAKE_SURE_THE_PS_APP_IS_ACTIVE_ON_YOUR_PHONE" msgstr "Make sure the %s app is active on your phone." +msgid "IDS_IME_HEADER_EMOJIS_ABB" +msgstr "Emojis" + +msgid "IDS_IME_HEADER_RECENT_M_RECETLY_SENT_EMOJIS_ABB" +msgstr "Recent" diff --git a/res/edje/w-input-stt.edc b/res/edje/w-input-stt.edc index 8eda165..b123590 100755 --- a/res/edje/w-input-stt.edc +++ b/res/edje/w-input-stt.edc @@ -1,6 +1,7 @@ #include "w-input-stt-button.edc" #define VOICE_CANDIDATE_AREA_HEIGHT 56 +#define BUTTON_TEXT_SIZE_INC 85 collections { @@ -436,22 +437,31 @@ collections styles { - style { name, "textblock_style"; - base, "font=Tizen:style=Regular font_size=36 align=center color=#FFFFFF text_class=text_class wrap=word ellipsis=1.0"; - tag, "br" "\n"; - tag, "ps" "ps"; - tag, "hilight" "+ font=Tizen:style=Bold"; - tag, "b" "+ font=Tizen:style=Bold"; - tag, "tab" "\t"; - } - style { name, "textblock_style_bottom"; - base, "font=Tizen:style=Regular font_size=36 align=center color=#FFFFFF text_class=text_class wrap=word ellipsis=1.0"; - tag, "br" "\n"; - tag, "ps" "ps"; - tag, "hilight" "+ font=Tizen:style=Bold"; - tag, "b" "+ font=Tizen:style=Bold"; - tag, "tab" "\t"; - } + style { name, "textblock_style"; + base, "font=Tizen:style=Regular font_size=36 align=center color=#FFFFFF text_class=text_class wrap=word ellipsis=1.0"; + tag, "br" "\n"; + tag, "ps" "ps"; + tag, "hilight" "+ font=Tizen:style=Bold"; + tag, "b" "+ font=Tizen:style=Bold"; + tag, "tab" "\t"; + } + style { name, "textblock_style_bottom"; + base, "font=Tizen:style=Regular font_size=36 align=center color=#FFFFFF text_class=text_class wrap=word ellipsis=1.0"; + tag, "br" "\n"; + tag, "ps" "ps"; + tag, "hilight" "+ font=Tizen:style=Bold"; + tag, "b" "+ font=Tizen:style=Bold"; + tag, "tab" "\t"; + } + style { name: "button_general_text_dim"; + base: "font=Tizen:style=Regular font_size="BUTTON_TEXT_SIZE_INC" align=center color=#FFFFFF ellipsis=0.0 wrap=mixed"; + } + style { name: "button_general_text_press"; + base: "font=Tizen:style=Regular font_size="BUTTON_TEXT_SIZE_INC" align=center color=#888888 ellipsis=0.0 wrap=mixed"; + } + style { name: "button_general_text_normal"; + base: "font=Tizen:style=Regular font_size="BUTTON_TEXT_SIZE_INC" align=center color=#FFFFFF ellipsis=0.0 wrap=mixed"; + } } group @@ -1947,6 +1957,184 @@ collections } } + group { name: "elm/button/base/emoticon"; + + script { + public mouse_down = 0; + public multi_down = 0; + } + parts { + part { name: "bg"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + min: 0 0; + } + description { state: "pressed" 0.0; + inherit: "default" 0.0; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + } + } + part { name: "padding_left_top"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + align: 0.0 0.0; + rel2.relative: 0.0 0.0; + min: 0 0; + fixed: 1 1; + //visible: 1; + //color: 255 0 0 100; + } + } + part { name: "padding_right_bottom"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + align: 1.0 1.0; + rel1.relative: 1.0 1.0; + min: 0 0; + fixed: 1 1; + //visible: 1; + //color: 0 255 0 100; + } + } + part { name: "elm.text"; + type: TEXTBLOCK; + mouse_events: 0; + scale: 1; + description { state: "default" 0.0; + fixed: 1 1; + rel1 { + relative: 1.0 1.0; + to: "padding_left_top"; + } + rel2 { + relative: 0.0 0.0; + to: "padding_right_bottom"; + } + text { + max: 1 0; + style: "button_general_text_normal"; + } + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + text.style: "button_general_text_dim"; + } + description { state: "pressed" 0.0; + inherit: "default" 0.0; + text.style: "button_general_text_press"; + } + } + part { name: "event"; + type: RECT; + scale: 1; + description { state: "default" 0.0; + color: 0 0 0 0; + rel1.to: "bg"; + rel2.to: "bg"; + } + } + } + programs { + program { name: "pressed"; + signal: "mouse,down,1*"; + source: "event"; + script { + if ((get_int(multi_down) == 0) && (get_int(mouse_down) == 0)) + { + set_int(mouse_down, 1); + run_program(PROGRAM:"button_press1"); + } + } + } + program { name: "button_press1"; + script { + new st[31]; + new Float:vl; + get_state(PART:"bg", st, 30, vl); + if (strcmp(st, "disabled")) { + set_state(PART:"bg", "pressed", 0.0); + set_state(PART:"elm.text", "pressed", 0.0); + emit("elm,action,press", ""); + } + } + } + program { name: "unpressed"; + signal: "mouse,up,1"; + source: "event"; + script { + if (get_int(mouse_down) == 1) { + set_int(mouse_down, 0); + run_program(PROGRAM:"button_unpress1"); + } + } + } + program { name: "button_unpress1"; + script { + new st[31]; + new Float:vl; + get_state(PART:"bg", st, 30, vl); + if (strcmp(st, "disabled")) { + set_state(PART:"bg", "default", 0.0); + set_state(PART:"elm.text", "default", 0.0); + emit("elm,action,unpress", ""); + } + } + } + program { name: "touch_snd"; + signal: "mouse,clicked,1"; + source: "event"; + script { + new st[31]; + new Float:vl; + if (get_int(multi_down) == 0) { + get_state(PART:"bg", st, 30, vl); + if (strcmp(st, "disabled")) { + run_program(PROGRAM:"play_sample"); + emit("elm,action,click", ""); + } + } + } + } + program { + name: "play_sample"; + action: RUN_PLUGIN "touch_sound"; + } + program { name: "disable"; + signal: "elm,state,disabled"; + source: "elm"; + action: STATE_SET "disabled" 0.0; + target: "bg"; + target: "elm.text"; + } + program { name: "enable"; + signal: "elm,state,enabled"; + source: "elm"; + action: STATE_SET "default" 0.0; + target: "bg"; + target: "elm.text"; + } + program { name: "multi_down"; + signal: "elm,action,multi,down"; + source: "elm"; + script { + set_int(multi_down, 1); + } + } + program { name: "multi_up"; + signal: "elm,action,multi,up"; + source: "elm"; + script { + set_int(multi_down, 0); + } + } + } + } + #define NAVIFRAME_VIEW_TRANS_TIME 0.4 //time for push and pop #define NAVIFRAME_TITLE_TRANS_TIME 0.5 //Title transition time #define NAVIFRAME_TITLE_EXPAND_TRANS_TIME 0.5 //Title Expansion transition time diff --git a/src/w-input-emoticon.cpp b/src/w-input-emoticon.cpp index aec6abf..e3b9b9d 100755 --- a/src/w-input-emoticon.cpp +++ b/src/w-input-emoticon.cpp @@ -14,155 +14,892 @@ * limitations under the License. */ -#include +#include #include #include +#include + +#include +#include #include "Debug.h" #include "w-input-selector.h" -#define EMOTICON_CNT 27 +#define RECENT_EMOJI_LIST "recent_emoji_list" + +#define EMOTICON_CNT 180 +#define RECENT_CNT 9 + +extern App_Data* app_data; + +static int is_content_reuse_on = 0; + using namespace std; +vector recent_emoji_list; + typedef struct { int code; - const char* name; + char* name; }Emoticon; +static Elm_Object_Item *it_emoticon_empty = NULL; +static Elm_Object_Item *it_emoticon_recent_group = NULL; +static Elm_Object_Item *it_emoticon_emoji_group = NULL; +static Elm_Object_Item *it_last = NULL; + +static Elm_Genlist_Item_Class *itc_emoticon = NULL; + +#define INITAL_ITEM_UNIT 24 +#define LOADING_ITEM_UNIT 27 +static int loading_done_for_item = 0; +Ecore_Timer *lazy_loading_timer_for_items = NULL; + +#define INITAL_CONTENT_UNIT 51 +#define LOADING_CONTENT_UNIT 9 +static int loading_done_for_contents = 0; +Ecore_Timer *lazy_loading_timer_for_contents = NULL; + + +typedef struct emoticon_content +{ + int index; + Evas_Object *content; + int used; +} emoticon_content_s; + +static emoticon_content_s emoticon_contents_pool[EMOTICON_CNT] = { 0, }; +static emoticon_content_s emoticon_recents_pool[RECENT_CNT] = { 0, }; + + Emoticon emoticon_info[EMOTICON_CNT] = { - {0x1f44c, "IDS_IME_BODY_OK_HAND_SIGN_M_EMOTICON_NAME_TTS"}, - {0x1f44d, "IDS_IME_BODY_THUMBS_UP_SIGN_M_EMOTICON_NAME"}, - {0x1f44e, "IDS_IME_BODY_THUMBS_DOWN_SIGN_M_EMOTICON_NAME"}, - {0x1f604, "IDS_IME_BODY_SMILING_FACE_WITH_OPEN_MOUTH_AND_SMILING_EYES_M_EMOTICON_NAME"}, - {0x1f606, "IDS_IME_BODY_SMILING_FACE_WITH_OPEN_MOUTH_AND_TIGHTLY_CLOSED_EYES_M_EMOTICON_NAME"}, - {0x1f60a, "IDS_IME_BODY_SMILING_FACE_WITH_SMILING_EYES_M_EMOTICON_NAME"}, - {0x1f60d, "IDS_IME_BODY_SMILING_FACE_WITH_HEART_SHAPED_EYES_M_EMOTICON_NAME"}, - {0x1f61a, "IDS_IME_BODY_KISSING_FACE_WITH_CLOSED_EYES_M_EMOTICON_NAME"}, - {0x1f61c, "IDS_IME_BODY_FACE_WITH_STUCK_OUT_TONGUE_AND_WINKING_EYE_M_EMOTICON_NAME"}, - {0x1f620, "IDS_IME_BODY_ANGRY_FACE_M_EMOTICON_NAME"}, - {0x1f621, "IDS_IME_BODY_POUTING_FACE_M_EMOTICON_NAME"}, - {0x1f622, "IDS_IME_BODY_CRYING_FACE_M_EMOTICON_NAME"}, - {0x1f624, "IDS_IME_BODY_FACE_WITH_LOOK_OF_TRIUMPH_M_EMOTICON_NAME"}, - {0x1f625, "IDS_IME_BODY_DISAPPOINTED_BUT_RELIEVED_FACE_M_EMOTICON_NAME"}, - {0x1f62a, "IDS_IME_BODY_SLEEPY_FACE_M_EMOTICON_NAME"}, - {0x1f62b, "IDS_IME_BODY_TIRED_FACE_M_EMOTICON_NAME"}, - {0x1f631, "IDS_IME_BODY_FACE_SCREAMING_IN_FEAR_M_EMOTICON_NAME"}, - {0x1f632, "IDS_IME_BODY_ASTONISHED_FACE_M_EMOTICON_NAME"}, - {0x1f637, "IDS_IME_BODY_FACE_WITH_MEDICAL_MASK_M_EMOTICON_NAME"}, - {0x1f495, "IDS_IME_BODY_TWO_HEARTS_M_EMOTICON_NAME"}, - {0x1f43d, "IDS_IME_BODY_PIG_NOSE_M_EMOTICON_NAME"}, - {0x1f415, "IDS_IME_BODY_DOG_M_EMOTICON_NAME"}, - {0x1f408, "IDS_IME_BODY_CAT_M_EMOTICON_NAME"}, - {0x1f414, "IDS_IME_BODY_CHICKEN_M_EMOTICON_NAME"}, - {0x1f433, "IDS_IME_BODY_SPOUTING_WHALE_M_EMOTICON_NAME"}, - {0x1f43c, "IDS_IME_BODY_PANDA_FACE_M_EMOTICON_NAME"}, - {0x1f42f, "IDS_IME_BODY_TIGER_FACE_M_EMOTICON_NAME"}, + {0x1f600, ""}, + {0x1f601, ""}, + {0x1f602, ""}, + {0x1f603, ""}, + {0x1f604, ""}, + {0x1f605, ""}, + {0x1f606, ""}, + {0x1f609, ""}, + {0x1f60a, ""}, + {0x1f60b, ""}, + {0x1f60e, ""}, + {0x1f60d, ""}, + {0x1f618, ""}, + {0x1f617, ""}, + {0x1f619, ""}, + {0x1f61a, ""}, + {0x263a, ""}, + {0x1f642, ""}, + {0x1f917, ""}, + {0x1f607, ""}, + {0x1f914, ""}, + {0x1f610, ""}, + {0x1f611, ""}, + {0x1f636, ""}, + {0x1f644, ""}, + {0x1f60f, ""}, + {0x1f623, ""}, + {0x1f625, ""}, + {0x1f62e, ""}, + {0x1f910, ""}, + {0x1f62f, ""}, + {0x1f634, ""}, + {0x1f62a, ""}, + {0x1f62b, ""}, + {0x1f60c, ""}, + {0x1f913, ""}, + {0x1f61b, ""}, + {0x1f61c, ""}, + {0x1f61d, ""}, + {0x1f641, ""}, + {0x1f612, ""}, + {0x1f613, ""}, + {0x1f614, ""}, + {0x1f615, ""}, + {0x1f616, ""}, + {0x1f643, ""}, + {0x1f637, ""}, + {0x1f912, ""}, + {0x1f915, ""}, + {0x1f911, ""}, + {0x1f632, ""}, + {0x1f61e, ""}, + {0x1f61f, ""}, + {0x1f624, ""}, + {0x1f622, ""}, + {0x1f62d, ""}, + {0x1f626, ""}, + {0x1f627, ""}, + {0x1f628, ""}, + {0x1f629, ""}, + {0x1f62c, ""}, + {0x1f630, ""}, + {0x1f631, ""}, + {0x1f633, ""}, + {0x1f635, ""}, + {0x1f621, ""}, + {0x1f620, ""}, + {0x1f608, ""}, + {0x1f648, ""}, + {0x1f649, ""}, + {0x1f64a, ""}, + {0x1f448, ""}, + {0x1f449, ""}, + {0x261d, ""}, + {0x1f446, ""}, + {0x1f595, ""}, + {0x1f447, ""}, + {0x270c, ""}, + {0x1f596, ""}, + {0x1f918, ""}, + {0x1f591, ""}, + {0x1f590, ""}, + {0x270a, ""}, + {0x270b, ""}, + {0x1f44a, ""}, + {0x1f44c, ""}, + {0x1f44d, ""}, + {0x1f44e, ""}, + {0x1f592, ""}, + {0x1f593, ""}, + {0x1f44b, ""}, + {0x1f44f, ""}, + {0x1f450, ""}, + {0x1f493, ""}, + {0x1f494, ""}, + {0x1f495, ""}, + {0x1f496, ""}, + {0x1f497, ""}, + {0x1f49d, ""}, + {0x1f49e, ""}, + {0x1f49f, ""}, + {0x2763, ""}, + {0x1f35e, ""}, + {0x1f9c0, ""}, + {0x1f356, ""}, + {0x1f357, ""}, + {0x1f354, ""}, + {0x1f35f, ""}, + {0x1f355, ""}, + {0x1f32d, ""}, + {0x1f32e, ""}, + {0x1f32f, ""}, + {0x1f37f, ""}, + {0x1f372, ""}, + {0x1f371, ""}, + {0x1f358, ""}, + {0x1f359, ""}, + {0x1f35a, ""}, + {0x1f35c, ""}, + {0x1f35b, ""}, + {0x1f35d, ""}, + {0x1f360, ""}, + {0x1f362, ""}, + {0x1f363, ""}, + {0x1f364, ""}, + {0x1f365, ""}, + {0x1f361, ""}, + {0x1f366, ""}, + {0x1f368, ""}, + {0x1f367, ""}, + {0x1f369, ""}, + {0x1f36a, ""}, + {0x1f382, ""}, + {0x1f370, ""}, + {0x1f36b, ""}, + {0x1f36c, ""}, + {0x1f36d, ""}, + {0x1f36e, ""}, + {0x1f36f, ""}, + {0x1f37c, ""}, + {0x2615, ""}, + {0x1f375, ""}, + {0x1f376, ""}, + {0x1f37e, ""}, + {0x1f377, ""}, + {0x1f378, ""}, + {0x1f379, ""}, + {0x1f37a, ""}, + {0x1f37b, ""}, + {0x1f383, ""}, + {0x1f384, ""}, + {0x1f388, ""}, + {0x1f389, ""}, + {0x1f38a, ""}, + {0x26bd, ""}, + {0x26be, ""}, + {0x1f3c0, ""}, + {0x1f3c8, ""}, + {0x1f3c9, ""}, + {0x1f3be, ""}, + {0x1f3b1, ""}, + {0x1f3b3, ""}, + {0x26f3, ""}, + {0x26f8, ""}, + {0x1f3a3, ""}, + {0x1f3bf, ""}, + {0x1f3cf, ""}, + {0x1f3d0, ""}, + {0x1f3d1, ""}, + {0x1f3d2, ""}, + {0x1f3d3, ""}, + {0x1f3f8, ""}, + {0x1f3af, ""}, + {0x1f3b2, ""}, + {0x1f3df, ""}, + {0x1f3db, ""}, + {0x1f3e0, ""}, + {0x1f3e2, ""}, + {0x1f3e5, ""}, + {0x1f3eb, ""}, }; -const char * get_emoticon_file_name(int index) -{ - static string path = get_resource_path() + string("images/u00000.png"); - int ipos = path.size()-9; - char str_emoticon_code[10] = {0}; - snprintf(str_emoticon_code, sizeof(str_emoticon_code), "%x", emoticon_info[index].code); - path.erase(ipos, 5); - path.insert(ipos, str_emoticon_code); - return path.c_str(); +static Eina_Bool _custom_back_cb(void *data, Elm_Object_Item *it) +{ + _back_to_genlist_for_selector(); + return EINA_TRUE; } -static Eina_Bool _custom_back_cb(void *data, Elm_Object_Item *it) + +//---------------------------------------------------------------------------------------// + +static Eina_Bool _custom_back_cb2(void *data, Elm_Object_Item *it) { + PRINTFUNC(DLOG_DEBUG, ""); + + if (is_content_reuse_on) { + int i; + + if (lazy_loading_timer_for_items != NULL) { + ecore_timer_del(lazy_loading_timer_for_items); + lazy_loading_timer_for_items = NULL; + } + + if (lazy_loading_timer_for_contents != NULL) { + ecore_timer_del(lazy_loading_timer_for_contents); + lazy_loading_timer_for_contents = NULL; + } + + //Recent EMOTICONS : the recent emoiton need to be updated whenever emoticon view is generated, so deleted here. + for (i=0;i< RECENT_CNT;i++) + { + if (emoticon_recents_pool[i].used == 0 && emoticon_recents_pool[i].content) { + evas_object_del(emoticon_recents_pool[i].content); + } + emoticon_recents_pool[i].content = NULL; + } + } + _back_to_genlist_for_selector(); return EINA_TRUE; } -static Eina_Bool -_rotary_selector_rotary_cb(void *data, Evas_Object *obj, Eext_Rotary_Event_Info *info) + +void get_recent_emoticons(vector &emoticon_list) { - PRINTFUNC(DLOG_DEBUG, "%s", __func__); + int ret = PREFERENCE_ERROR_NONE; + char *str = NULL; + + ret = preference_get_string(RECENT_EMOJI_LIST, &str); + if (PREFERENCE_ERROR_NONE != ret) { + PRINTFUNC(DLOG_ERROR, "preference_get_string error!(%d)", ret); + } + + emoticon_list.clear(); + + PRINTFUNC(DLOG_DEBUG, "str = %s", str); + + if (str != NULL) { + char *tok; + tok = strtok(str, ","); + while (tok != NULL) { + PRINTFUNC(DLOG_DEBUG, "tok = %s", tok); + emoticon_list.push_back(strtol(tok, (char **)NULL, 10)); + tok = strtok(NULL, ","); + } + } - if (info->direction == EEXT_ROTARY_DIRECTION_CLOCKWISE){ - evas_object_smart_callback_call(obj, "item,selected", (void*)data); - eext_rotary_object_event_callback_del(obj, _rotary_selector_rotary_cb); - } + if (str) + free(str); - return ECORE_CALLBACK_PASS_ON; + return; } -static void _rotary_selector_item_clicked(void *data, Evas_Object *obj, void *event_info) +void set_recent_emoticons(vector &emoticon_list, int val) { - PRINTFUNC(DLOG_DEBUG, "%s", __func__); - App_Data* ad = (App_Data*) data; - if (!ad) - return; + int i; + int ret = PREFERENCE_ERROR_NONE; + + if (emoticon_list.size() > 0) { + for (i = 0; i < emoticon_list.size(); i++) { + PRINTFUNC(DLOG_DEBUG, "%d == %d", emoticon_list.at(i), val); - Eext_Object_Item *selected_item = (Eext_Object_Item *)event_info; - Eina_List *rotary_selector_list = (Eina_List *)eext_rotary_selector_items_get(obj); + if (emoticon_list.at(i) == val) { + emoticon_list.erase(emoticon_list.begin()+i); + break; + } + } - int i = 0; - Eina_List *l = rotary_selector_list; - Eext_Object_Item *item = (Eext_Object_Item *)eina_list_data_get(l); + if (emoticon_list.size() >= RECENT_CNT) { + emoticon_list.erase(emoticon_list.end()); + } + } + + emoticon_list.insert(emoticon_list.begin(), val); + + string stored; + char str[10] = {0, }; - for (i = 0; l != NULL; i++) { - if (selected_item == item) - break; + for (i = 0; i < emoticon_list.size(); i++) { + snprintf(str, sizeof(str), "%d", emoticon_list.at(i)); + stored += str; + if (i+1 != emoticon_list.size()) + stored += ","; + } + + PRINTFUNC(DLOG_DEBUG, "%s", stored.c_str()); - l = eina_list_next(l); - item = (Eext_Object_Item *)eina_list_data_get(l); + ret = preference_set_string(RECENT_EMOJI_LIST, stored.c_str()); + if (PREFERENCE_ERROR_NONE != ret) { + PRINTFUNC(DLOG_ERROR, "preference_set_string error!(%d)", ret); } +} + +static void _emoticon_item_clicked_cb(void *data, Evas_Object * obj, void *event_info) +{ + int index = (int)data; + + PRINTFUNC(DLOG_DEBUG, "index = %d", index); + + // store in recents list + set_recent_emoticons(recent_emoji_list, index); int length; - const Eina_Unicode unicode_event[2] = { (unsigned int)emoticon_info[i].code, 0 }; + const Eina_Unicode unicode_event[2] = { emoticon_info[index].code, 0 }; char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); reply_to_sender_by_callback((const char*)utf_8, "emoticon"); - PRINTFUNC(SECURE_DEBUG, "[%d]%s", i, utf_8); + PRINTFUNC(SECURE_DEBUG, "[%d]%s", index, utf_8); if (utf_8) free(utf_8); - if(ad->reply_type == REPLY_APP_NORMAL) - elm_exit(); + elm_exit(); +} + +Evas_Object* get_emoticon_button(Evas_Object* parent, int index){ + if (parent == NULL) + return NULL; + + Evas_Object* btn = elm_button_add(parent); + elm_object_style_set(btn, "emoticon"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); + + int length; + const Eina_Unicode unicode_event[2] = { emoticon_info[index].code, 0 }; + char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); + elm_object_part_text_set(btn, "elm.text", utf_8); + + if (utf_8) + free(utf_8); + + evas_object_layer_set(btn, 32000); + + evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void *)index); + + return btn; } -static void _rotary_selector_item_selected(void *data, Evas_Object *obj, void *event_info) +Evas_Object* get_recent_emoticon_button(Evas_Object* parent, int index){ + if (parent == NULL) + return NULL; + + Evas_Object* btn = elm_button_add(parent); + elm_object_style_set(btn, "emoticon"); + evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL); + + int length; + const Eina_Unicode unicode_event[2] = { emoticon_info[recent_emoji_list.at(index)].code, 0 }; + char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); + elm_object_part_text_set(btn, "elm.text", utf_8); + + evas_object_data_set(btn, "index", (void*) recent_emoji_list.at(index)); + + if (utf_8) + free(utf_8); + + evas_object_layer_set(btn, 32000); + evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void*) recent_emoji_list.at(index)); + + return btn; +} + +static void _emoticon_gl_lang_changed(void *data, Evas_Object *obj, void *event_info) { - PRINTFUNC(DLOG_DEBUG, "%s", __func__); + elm_genlist_realized_items_update(obj); } -void ise_show_emoticon_popup_rotary(void *data) +static char * __emoticon_gl_text_get(void *data, Evas_Object *obj, const char *part) +{ + //PRINTFUNC(DLOG_DEBUG,"part = %s", part); + + const char* str = (const char*) data; + if (!str) + return NULL; + + if (!strcmp(part, "elm.text")) { + //PRINTFUNC(DLOG_DEBUG,"str = %s", str); + return strdup(gettext(str)); + } + return NULL; +} + +static void _emoticon_gl_content_unswallowed_cb(void *data, Evas_Object *obj, void *event_info) +{ + Elm_Object_Item *it = (Elm_Object_Item *)event_info; + + const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(it); + +// PRINTFUNC(DLOG_DEBUG,"%s - stype[%s]", __func__, itc->item_style); + if (!strcmp(itc->item_style, "3button_flat")) { + int index = (int)elm_object_item_data_get(it); + //PRINTFUNC(DLOG_DEBUG,"it = %p", it); + PRINTFUNC(DLOG_DEBUG, "index = %d %d %d", index, index+1, index+2); + + if (index < EMOTICON_CNT) { + emoticon_contents_pool[index].used = 0; + } + if (index + 1 < EMOTICON_CNT) { + emoticon_contents_pool[index+1].used = 0; + } + if (index + 2 < EMOTICON_CNT) { + emoticon_contents_pool[index+2].used = 0; + } + } else if (!strcmp(itc->item_style, "3button_flat_recent")) { + int index = (int)elm_object_item_data_get(it); + //PRINTFUNC(DLOG_DEBUG,"index = %d",index); + + if (index < recent_emoji_list.size()) { + emoticon_recents_pool[index].used = 0; + } + if (index + 1 < recent_emoji_list.size()) { + emoticon_recents_pool[index+1].used = 0; + } + if (index + 2 < recent_emoji_list.size()) { + emoticon_recents_pool[index+2].used = 0; + } + } +} + +static Evas_Object * __emoticon_gl_recent_content_get(void *data, Evas_Object *obj, const char *part) +{ + if (is_content_reuse_on) { + int index = (int)data; + int new_index = 0; + + //PRINTFUNC(DLOG_DEBUG,"%s %d", part, index); + if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) { + if (!strcmp(part, "elm.icon.1")) { + if (index >= recent_emoji_list.size()) return NULL; + new_index = index; + } else if (!strcmp(part, "elm.icon.2")) { + if (index + 1 >= recent_emoji_list.size()) return NULL; + new_index = index + 1; + } else if (!strcmp(part, "elm.icon.3")) { + if (index + 2 >= recent_emoji_list.size()) return NULL; + new_index = index + 2; + } + + Evas_Object* btn = NULL; + btn = (Evas_Object*)emoticon_recents_pool[new_index].content; + emoticon_recents_pool[new_index].used = 1; + return btn; + } else if (!strcmp(part, "base")) { + Evas_Object* btn = elm_button_add(obj); + elm_object_style_set(btn, "ime/transparent"); + return btn; + } + } else { + int index = (int)data; + int new_index = 0; + + // PRINTFUNC(DLOG_DEBUG,"%s %d", part, index); + if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) { + if (!strcmp(part, "elm.icon.1")) { + if (index >= recent_emoji_list.size()) return NULL; + new_index = index; + } else if (!strcmp(part, "elm.icon.2")) { + if (index + 1 >= recent_emoji_list.size()) return NULL; + new_index = index + 1; + } else if (!strcmp(part, "elm.icon.3")) { + if (index + 2 >= recent_emoji_list.size()) return NULL; + new_index = index + 2; + } + return get_recent_emoticon_button(obj, new_index); + } else if (!strcmp(part, "base")) { + Evas_Object* btn = elm_button_add(obj); + elm_object_style_set(btn, "ime/transparent"); + return btn; + } + } + return NULL; +} + +static Evas_Object * __emoticon_gl_emoticon_content_get(void *data, Evas_Object *obj, const char *part) +{ + //PRINTFUNC(DLOG_DEBUG,"%s", __func__); + + if (is_content_reuse_on) { + int index = (int)data; + int new_index = 0; + + if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) { + if (!strcmp(part, "elm.icon.1")) { + if (index >= EMOTICON_CNT) return NULL; + new_index = index; + } else if (!strcmp(part, "elm.icon.2")) { + if (index + 1 >= EMOTICON_CNT) return NULL; + new_index = index + 1; + } else if (!strcmp(part, "elm.icon.3")) { + if (index + 2 >= EMOTICON_CNT) return NULL; + new_index = index + 2; + } + + Evas_Object* btn = NULL; + btn = (Evas_Object*)emoticon_contents_pool[new_index].content; + emoticon_contents_pool[new_index].used = 1; +#if 0 + char utf_8[10] = {0, }; + snprintf(utf_8, sizeof(utf_8), "%d", new_index); + elm_object_part_text_set(btn, "elm.text", strdup(utf_8)); +#else + int length; + const Eina_Unicode unicode_event[2] = { emoticon_info[new_index].code, 0 }; + char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length); + elm_object_part_text_set(btn, "elm.text", utf_8); + evas_object_data_set(btn, "index", (void*)new_index); + + if (utf_8) + free(utf_8); +#endif + return btn; + + } else if (!strcmp(part, "base")) { + Evas_Object* btn = elm_button_add(obj); + elm_object_style_set(btn, "ime/transparent"); + return btn; + } + } else { + int index = (int)data; + int new_index = 0; + + if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) { + if (!strcmp(part, "elm.icon.1")) { + if (index >= EMOTICON_CNT) return NULL; + new_index = index; + } else if (!strcmp(part, "elm.icon.2")) { + if (index + 1 >= EMOTICON_CNT) return NULL; + new_index = index + 1; + } else if (!strcmp(part, "elm.icon.3")) { + if (index + 2 >= EMOTICON_CNT) return NULL; + new_index = index + 2; + } + return get_emoticon_button(obj, new_index); + } else if (!strcmp(part, "base")) { + Evas_Object* btn = elm_button_add(obj); + elm_object_style_set(btn, "ime/transparent"); + return btn; + } + } + return NULL; +} + + +void _create_reusable_recents(Evas_Object *parent) +{ + if (!parent) { + PRINTFUNC(DLOG_ERROR, "parent is null"); + return; + } + + int i; + for (i = 0; i < recent_emoji_list.size(); i++ ) { + emoticon_recents_pool[i].index = i; + emoticon_recents_pool[i].content = get_recent_emoticon_button(parent, i); + emoticon_recents_pool[i].used = 0; + } +} + +static Eina_Bool _lazy_loader_cb_for_contents(void *data) +{ + Evas_Object *gl = (Evas_Object *)data; + if (!gl) { + PRINTFUNC(DLOG_ERROR, "gl is null"); + lazy_loading_timer_for_contents = NULL; + return ECORE_CALLBACK_CANCEL; + } + + if (loading_done_for_contents == EMOTICON_CNT) { + PRINTFUNC(DLOG_DEBUG, "lazy loading contents done"); + lazy_loading_timer_for_contents = NULL; + return ECORE_CALLBACK_CANCEL; + } + + int loading_top = 0; + if (loading_done_for_contents + LOADING_CONTENT_UNIT > EMOTICON_CNT) { + loading_top = EMOTICON_CNT; + } else { + loading_top = loading_done_for_contents + LOADING_CONTENT_UNIT; + } + + PRINTFUNC(DLOG_DEBUG, "_lazy_loader_cb_for_contents loading_done = %d", loading_done_for_contents); + + int i; + for (i = loading_done_for_contents; i < loading_top; i++) { + emoticon_contents_pool[i].index = i; + emoticon_contents_pool[i].used = 0; + + if (emoticon_contents_pool[i].content == NULL) { // reusable + emoticon_contents_pool[i].content = get_emoticon_button(gl, i); + } + } + + loading_done_for_contents = loading_top; + + return ECORE_CALLBACK_RENEW; +} + +void create_reusable_button(Evas_Object *parent) +{ + if (!parent) { + PRINTFUNC(DLOG_ERROR, "parent is null"); + return; + } + loading_done_for_contents = INITAL_CONTENT_UNIT; + + int i; + for (i = 0; i < INITAL_CONTENT_UNIT; i++ ) { + emoticon_contents_pool[i].index = i; + emoticon_contents_pool[i].used = 0; + + if (emoticon_contents_pool[i].content == NULL) { // reusable + emoticon_contents_pool[i].content = get_emoticon_button(parent, i); + } + } + + lazy_loading_timer_for_contents = ecore_timer_add(0.25, _lazy_loader_cb_for_contents, (void *)parent); +} + +static Eina_Bool _lazy_loader_cb_for_items(void *data) +{ + Evas_Object *gl = (Evas_Object *)data; + if (!gl) { + PRINTFUNC(DLOG_ERROR, "gl is null"); + lazy_loading_timer_for_items = NULL; + return ECORE_CALLBACK_CANCEL; + } + + if (loading_done_for_item == EMOTICON_CNT) { + PRINTFUNC(DLOG_DEBUG, "lazy loading item done"); + //elm_genlist_realized_items_update(gl); + elm_genlist_item_class_free(itc_emoticon); + lazy_loading_timer_for_items = NULL; + + return ECORE_CALLBACK_CANCEL; + } + + int loading_top = 0; + if (loading_done_for_item + LOADING_ITEM_UNIT > EMOTICON_CNT) { + loading_top = EMOTICON_CNT; + } else { + loading_top = loading_done_for_item + LOADING_ITEM_UNIT; + } + + if (loading_top > loading_done_for_contents) { + PRINTFUNC(DLOG_DEBUG, "Wait for content loading"); + return ECORE_CALLBACK_RENEW; + } + PRINTFUNC(DLOG_DEBUG, "_lazy_loader_cb_for_items loading_done_for_item = %d", loading_done_for_item); + + int i; + for (i = loading_done_for_item; i < loading_top; i++ ) { + if (i%3 == 0) + elm_genlist_item_append(gl, itc_emoticon, (void*)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)i); + } + + loading_done_for_item = loading_top; + return ECORE_CALLBACK_RENEW; +} + +void _create_reusable_contents(Evas_Object *gl){ + if (!gl) { + PRINTFUNC(DLOG_ERROR, "gl is null"); + return; + } + int i; + loading_done_for_item = INITAL_ITEM_UNIT; + + for (i = 0; i < INITAL_ITEM_UNIT; i++ ) { + if (i%3 == 0) + elm_genlist_item_append(gl, itc_emoticon, (void*)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)i); + } + + lazy_loading_timer_for_items = ecore_timer_add(0.1, _lazy_loader_cb_for_items, (void *)gl); +} + +Evas_Object* _create_emoticon_genlist(void* data) { PRINTFUNC(DLOG_DEBUG, "%s", __func__); App_Data* ad = (App_Data*) data; if (!ad) + return NULL; + + Evas_Object* genlist = elm_genlist_add(ad->naviframe); + if (NULL == genlist) + return NULL; + + Evas_Object* circle_object_genlist = eext_circle_object_genlist_add(genlist, ad->circle_surface); + eext_circle_object_genlist_scroller_policy_set(circle_object_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); + evas_object_data_set(genlist, "circle", (void *) circle_object_genlist); + eext_rotary_object_event_activated_set(circle_object_genlist, EINA_TRUE); + + evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(genlist); + + Elm_Object_Item *nf_emoticon_item = elm_naviframe_item_push(ad->naviframe, NULL, NULL, NULL, genlist, "empty"); + + elm_naviframe_item_pop_cb_set(nf_emoticon_item, _custom_back_cb2, ad); + + evas_object_smart_callback_add(genlist, "language,changed", _emoticon_gl_lang_changed, genlist); + + if (is_content_reuse_on) { + evas_object_smart_callback_add(genlist, "content,unswallowed", _emoticon_gl_content_unswallowed_cb, NULL); + } + + return genlist; +} + +void _update_emoticon_items(void *data) +{ + PRINTFUNC(DLOG_DEBUG, "%s", __func__); + Evas_Object* gl = (Evas_Object*) data; + if (!gl) return; + int i; + Elm_Object_Item *it = NULL; + Elm_Object_Item *first_it = NULL; + + Elm_Genlist_Item_Class * itc_dummy = elm_genlist_item_class_new(); + itc_dummy->item_style = "title"; + itc_dummy->func.text_get = NULL; + itc_dummy->func.content_get = NULL; + itc_dummy->func.state_get = NULL; + itc_dummy->func.del = NULL; - Evas_Object *rotary_selector = eext_rotary_selector_add(ad->naviframe); -// uxt_theme_object_replace_color(rotary_selector, "B01153", "AO0117"); - PRINTFUNC(DLOG_DEBUG, "replace color"); - for (int i = 0; i < EMOTICON_CNT; ++i) - { - Evas_Object *img = NULL; - Eext_Object_Item *item = eext_rotary_selector_item_append(rotary_selector); + Elm_Genlist_Item_Class *itc_group = elm_genlist_item_class_new(); - img = elm_image_add(rotary_selector); - elm_image_file_set(img, get_emoticon_file_name(i), NULL); - eext_rotary_selector_item_part_content_set(item, "item,bg_image", EEXT_ROTARY_SELECTOR_ITEM_STATE_NORMAL, img); + itc_group->item_style = "groupindex"; + itc_group->func.text_get = __emoticon_gl_text_get; + itc_group->func.content_get = NULL; + itc_group->func.state_get = NULL; + itc_group->func.del = NULL; - img = elm_image_add(rotary_selector); - elm_image_file_set(img, get_emoticon_file_name(i), NULL); - eext_rotary_selector_item_part_content_set(item, "selector,icon", EEXT_ROTARY_SELECTOR_ITEM_STATE_NORMAL, img); + Elm_Genlist_Item_Class *itc_recent = elm_genlist_item_class_new(); + if (is_content_reuse_on) { +// itc_recent->content_reusable = EINA_TRUE; } + itc_recent->item_style = "3button_flat_recent"; + itc_recent->func.text_get = NULL; + itc_recent->func.content_get = __emoticon_gl_recent_content_get; + itc_recent->func.state_get = NULL; + itc_recent->func.del = NULL; - evas_object_smart_callback_add(rotary_selector, "item,selected", _rotary_selector_item_selected, rotary_selector); - evas_object_smart_callback_add(rotary_selector, "item,clicked", _rotary_selector_item_clicked, (void*)ad); + itc_emoticon = elm_genlist_item_class_new(); + if (is_content_reuse_on) { +// itc_emoticon->content_reusable = EINA_TRUE; + } + itc_emoticon->item_style = "3button_flat"; + itc_emoticon->func.text_get = NULL; + itc_emoticon->func.content_get = __emoticon_gl_emoticon_content_get; + itc_emoticon->func.state_get = NULL; + itc_emoticon->func.del = NULL; - Elm_Object_Item *nf_item = elm_naviframe_item_push(ad->naviframe, NULL, NULL, NULL, rotary_selector, "empty"); - elm_naviframe_item_pop_cb_set(nf_item, _custom_back_cb, NULL); - eext_rotary_object_event_activated_set(rotary_selector, EINA_TRUE); + // dummy title for empty space + it_emoticon_empty = elm_genlist_item_append(gl, itc_dummy, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); - PRINTFUNC(DLOG_DEBUG, "%s", __func__); + if (recent_emoji_list.size() > 0) { + if (is_content_reuse_on) { + _create_reusable_recents(gl); + } + + // Group Recents + it_emoticon_recent_group = elm_genlist_item_append(gl, itc_group, (void*)"IDS_IME_HEADER_RECENT_M_RECETLY_SENT_EMOJIS_ABB", NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)2); + elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + if (first_it == NULL) + first_it = it_emoticon_recent_group; + + PRINTFUNC(DLOG_DEBUG, "size = %d", recent_emoji_list.size()); + + for (i=0;i < recent_emoji_list.size();i=i+3) + { + it = elm_genlist_item_append(gl, itc_recent, (void*)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)i); + } + } + + // Group Emoticons + it_emoticon_emoji_group = elm_genlist_item_append(gl, itc_group, (void*)"IDS_IME_HEADER_EMOJIS_ABB", NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)2); + elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + if (first_it == NULL) + first_it = it_emoticon_emoji_group; + + if (is_content_reuse_on) { + _create_reusable_contents(gl); + } else { + // Emoticons + for (i=0;i< EMOTICON_CNT;i=i+3) { + it = elm_genlist_item_append(gl, itc_emoticon, (void*)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)i); + it_last = it; + } + elm_genlist_item_class_free(itc_emoticon); + } + it = elm_genlist_item_next_get(first_it); + const Elm_Genlist_Item_Class *itc_temp = elm_genlist_item_item_class_get(it); + if (itc_temp == itc_group) { + it = elm_genlist_item_next_get(it); + } + elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); + + elm_genlist_item_class_free(itc_recent); + elm_genlist_item_class_free(itc_group); + elm_genlist_item_class_free(itc_dummy); +} + +void ise_show_emoticon_list(void *data) +{ + App_Data* ad = (App_Data*) data; + if (!ad) + return; + + it_emoticon_empty = NULL; + it_emoticon_recent_group = NULL; + it_emoticon_emoji_group = NULL; + it_last = NULL; + + get_recent_emoticons(recent_emoji_list); + + Evas_Object* emoticon_list = NULL; + + emoticon_list = _create_emoticon_genlist(ad); + + if (is_content_reuse_on) { + create_reusable_button(ad->naviframe); // button object need to survive even if genlist is deleted. + } + _update_emoticon_items(emoticon_list); } diff --git a/src/w-input-selector.cpp b/src/w-input-selector.cpp index 8eb09bd..828c9a5 100755 --- a/src/w-input-selector.cpp +++ b/src/w-input-selector.cpp @@ -147,8 +147,7 @@ static void _emoticon_clicked_cb(void *data, Evas_Object * obj, void *event_info if(!ad) return; -// ise_show_emoticon_popup(ad); - ise_show_emoticon_popup_rotary(ad); + ise_show_emoticon_list(ad); } static void _keyboard_clicked_cb(void *data, Evas_Object * obj, void *event_info) -- 2.7.4 From 9496d3676727d41903b8e5f15f3c9efe183b5c74 Mon Sep 17 00:00:00 2001 From: "sungwook79.park" Date: Mon, 21 Nov 2016 12:00:06 +0900 Subject: [PATCH 15/16] Fix issue about strtok detected by static analysis tool Change-Id: I3aa91b54122d8f06028f9f0d310dc451babb0f8d Signed-off-by: sungwook79.park --- src/w-input-emoticon.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/w-input-emoticon.cpp b/src/w-input-emoticon.cpp index e3b9b9d..d6e17bf 100755 --- a/src/w-input-emoticon.cpp +++ b/src/w-input-emoticon.cpp @@ -313,12 +313,12 @@ void get_recent_emoticons(vector &emoticon_list) PRINTFUNC(DLOG_DEBUG, "str = %s", str); if (str != NULL) { - char *tok; - tok = strtok(str, ","); + char *tok, *ptr; + tok = strtok_r(str, ",", &ptr); while (tok != NULL) { PRINTFUNC(DLOG_DEBUG, "tok = %s", tok); emoticon_list.push_back(strtol(tok, (char **)NULL, 10)); - tok = strtok(NULL, ","); + tok = strtok_r(NULL, ",", &ptr); } } -- 2.7.4 From d73a6a8d94060ce2a4035d4a00ef0004bf4faa0f Mon Sep 17 00:00:00 2001 From: MyungJoo Ham Date: Tue, 22 Nov 2016 13:53:59 +0900 Subject: [PATCH 16/16] Remove Profile Build Dependency (trivial) - This is for Tizen 4.0. : Tizen 4.0 Configurability and Build Blocks require to remove all profile-depending build options in spec files. (No More profile macros) : However, this %if/%endif is not removed because this breaks build compatibility with old conventional project-based OBS projects (common only) : The form of %if/%endif and its comments are added/modified to support 4.0 unified build environment. - If you do not want to include this in a specific profile's build project, you can do so by removing this from OBS profile-project. : However, it is already done so for mobile/tv/ivi. Therefore these %if/%endif are useless. Change-Id: I38b75ed2bebd40f1731e5a3e83368e3ef88ce7a5 Signed-off-by: MyungJoo Ham --- packaging/org.tizen.inputdelegator.spec | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/packaging/org.tizen.inputdelegator.spec b/packaging/org.tizen.inputdelegator.spec index f8cbf92..1f93e38 100755 --- a/packaging/org.tizen.inputdelegator.spec +++ b/packaging/org.tizen.inputdelegator.spec @@ -1,3 +1,12 @@ +# For the backward compatibility, this is to be built for +# wearable profile or 4.0 unified building environment. +# This cannot be built for non-wearable in conventional 3.0 build environment. +# Note that it is not a good idea to limit building with ExcludeArch because there are new architectures being tested. +# Use ExclusiveArch istead. +%if "%{?profile}" == "mobile" || "%{?profile}" == "tv" || "%{?profile}" == "ivi" || "%{?profile}" == "common" +ExclusiveArch: none +%endif + Name: org.tizen.inputdelegator Summary: Input Delegator Application Version: 0.1.161102 @@ -37,22 +46,6 @@ BuildRequires: pkgconfig(capi-media-audio-io) BuildRequires: pkgconfig(bundle) %endif -%if "%{?profile}" == "mobile" -ExcludeArch: %{arm} aarch64 %ix86 x86_64 -%endif - -%if "%{?profile}" == "tv" -ExcludeArch: %{arm} aarch64 %ix86 x86_64 -%endif - -%if "%{?profile}" == "common" -ExcludeArch: %{arm} aarch64 %ix86 x86_64 -%endif - -%if "%{?profile}" == "ivi" -ExcludeArch: %{arm} aarch64 %ix86 x86_64 -%endif - %define _appdir /usr/apps %define _app_destdir %{_appdir}/%{name} -- 2.7.4