From: sungwook79.park Date: Tue, 25 Jul 2017 04:35:20 +0000 (+0900) Subject: Add drawing feature in emoticon input mode X-Git-Tag: accepted/tizen/4.0/unified/20170829.020421~8 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Finputdelegator.git;a=commitdiff_plain;h=14f0deffe01d498bf18693417fac9f5b9a38ad0a Add drawing feature in emoticon input mode Change-Id: I58785c2289022243bc36a36e6623403c32d3abef Signed-off-by: sungwook79.park --- diff --git a/res/wearable/edje/w-input-selector.edc b/res/wearable/edje/w-input-selector.edc index c00e082..9be1ffa 100755 --- a/res/wearable/edje/w-input-selector.edc +++ b/res/wearable/edje/w-input-selector.edc @@ -805,4 +805,145 @@ collections { } ) } -} + } + +// ------------------------------------------------Drawing ---------------------------------------------// + styles{ + style { + name: "list_text_drawing_normal"; + base: "font=Tizen:style=Regular font_size=36 align=left color=#FFFFFF color_class=AT021 wrap=word text_class=AT021"; + } + } + + images { + image, "./fadeout_masking.#.png" COMP; + } + + group { + name: "elm/genlist/item/drawing/default"; + data.item: "treesize" 0; + data.item: "flips" "elm.flip.icon elm.flip.content"; + data.item: "texts" "elm.text"; + data.item: "contents" "base elm.icon"; + data.item: "vi_effect" "on"; + data.item: "dim" "off"; + data.item: "focus_bg" "off"; + + parts { + PART_LIST_BG + PART_LIST_PADDINGS( + 0, 0, + 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.padding.text.left_a"; + type: SPACER; + scale: 1; + mouse_events: 0; + repeat_events: 0; + description { + state: "default" 0.0; + min: (30+76+24) 0; + max: (30+76+24) 51; + fixed: 1 0; + align: 0.0 0.5; + rel1 { relative: 1.0 1.0; to_x: "elm.padding.left"; to_y: "elm.padding.top"; } + rel2 { relative: 1.0 0.0; to_x: "elm.padding.left"; to_y: "elm.padding.bottom"; } + } + } + part { + name: "elm.padding.text.left_b"; + type: SPACER; + scale: 1; + mouse_events: 0; + repeat_events: 0; + description { + state: "default" 0.0; + min: (360-30) 0; + max: (360-30) 51; + fixed: 1 0; + align: 0.0 0.5; + rel1 { relative: 1.0 1.0; to_x: "elm.padding.left"; to_y: "elm.padding.top"; } + rel2 { relative: 1.0 0.0; to_x: "elm.padding.left"; to_y: "elm.padding.bottom"; } + } + } + + part { + name: "elm.text"; + type: TEXTBLOCK; + scale: 1; + mouse_events: 0; + repeat_events: 0; + description { + state: "default" 0.0; + min: 0 48; + max: -1 48; + fixed: 0 1; + align: 0.5 0.5; + text { + min: 0 1; + max: 1 1; + ellipsis: -1.0; + fade_ellipsis: 1.0; + style: "list_text_drawing_normal"; + } + rel1 { relative: 1.0 1.0; to_x: "elm.padding.text.left_a"; to_y: "elm.padding.top"; } + rel2 { relative: 1.0 0.0; to_x: "elm.padding.text.left_b"; to_y: "elm.padding.bottom"; } + } + } + + part { + name: "fadeout"; + type: IMAGE; + scale: 1; + mouse_events: 0; + repeat_events: 0; + description { + state: "default" 0.0; + align: 1.0 0.5; + min: 49 44; + max: 49 44; + fixed: 1 1; + rel1 { relative: 1.0 1.0; to_x: "elm.padding.text.left_b"; to_y: "elm.padding.top"; } + rel2 { relative: 1.0 0.0; to_x: "elm.padding.text.left_b"; to_y: "elm.padding.bottom"; } + image.normal: "./fadeout_masking.#.png"; + color: 0 0 0 10; + } + } + + part { + name: "elm.padding.icon.left"; + type: SPACER; + scale: 1; + mouse_events: 0; + repeat_events: 0; + description { + state: "default" 0.0; + min: 24 0; + max: 24 51; + fixed: 1 1; + align: 1.0 0.5; + rel1 { relative: 0.0 1.0; to_x: "elm.text"; to_y: "elm.padding.top"; } + rel2 { relative: 0.0 0.0; to_x: "elm.text"; to_y: "elm.padding.bottom"; } + } + } + + part { + name: "elm.icon"; + type: SWALLOW; + description { + state: "default" 0.0; + visible: 1; + align: 1.0 0.5; + fixed: 1 1; + min: 76 76; + max: 76 76; + rel1 { relative: 0.0 1.0; to_x: "elm.padding.icon.left"; to_y: "elm.padding.top"; } + rel2 { relative: 0.0 0.0; to_x: "elm.padding.icon.left"; to_y: "elm.padding.bottom"; } + } + } + } + } diff --git a/res/wearable/edje/w-input-stt.edc b/res/wearable/edje/w-input-stt.edc index 082731d..13168ba 100755 --- a/res/wearable/edje/w-input-stt.edc +++ b/res/wearable/edje/w-input-stt.edc @@ -58,6 +58,7 @@ collections image, "./tw_bottom_btn_bg.png" COMP; image, "./w_mode_ic_bg.png" COMP; + image, "./wi_drawing_bg.png" COMP; image, "./b_stt_text_fade_out.png" COMP; image, "./b_stt_icon_btn.png" COMP; @@ -433,6 +434,21 @@ collections name: "AT023D"; color: 0 0 0 40; } + color_class + { + name: "AO0391"; + color: 0 151 207 100; + } + color_class + { + name: "AO0391P"; + color: 0 0 0 50; + } + color_class + { + name: "AO0391D"; + color: 0 0 0 40; + } } styles @@ -1903,6 +1919,31 @@ collections } } + group { name: "elm/button/base/ime_button_drawing"; + inherit: "elm/button/base/ime_button"; + parts { + part { name: "bg"; + type: IMAGE; + scale: 1; + description { state: "default" 0.0; + min: 76 76; + max: 76 76; + color_class: "AO0391"; + visible: 1; + image.normal: "./wi_drawing_bg.png"; + } + description { state: "pressed" 0.0; + inherit: "default" 0.0; + color_class: "AO0391P"; + } + description { state: "disabled" 0.0; + inherit: "default" 0.0; + color_class: "AO0391D"; + } + } + } + } + group { name: "elm/button/base/ime_button_stt_confirm"; inherit: "elm/button/base/ime_button"; parts { diff --git a/src/w-input-emoticon.cpp b/src/w-input-emoticon.cpp index 4bd585b..a7f9a9c 100755 --- a/src/w-input-emoticon.cpp +++ b/src/w-input-emoticon.cpp @@ -49,6 +49,7 @@ typedef struct { 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_drawing = NULL; static Elm_Object_Item *it_last = NULL; static Elm_Genlist_Item_Class *itc_emoticon = NULL; @@ -72,6 +73,7 @@ typedef struct emoticon_content } emoticon_content_s; static emoticon_content_s emoticon_contents_pool[EMOTICON_CNT] = { 0, }; +static emoticon_content_s emoticon_drawing_pool = { 0, }; static emoticon_content_s emoticon_recents_pool[RECENT_CNT] = { 0, }; @@ -278,6 +280,11 @@ static Eina_Bool _custom_back_cb2(void *data, Elm_Object_Item *it) lazy_loading_timer_for_contents = NULL; } + if(emoticon_drawing_pool.used == 0){ + evas_object_del(emoticon_drawing_pool.content); + } + emoticon_drawing_pool.content = 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++) { @@ -361,6 +368,44 @@ void set_recent_emoticons(vector &emoticon_list, int val) if (PREFERENCE_ERROR_NONE != ret) { PRINTFUNC(DLOG_ERROR, "preference_set_string error!(%d)", ret); } + +} + +static void _drawing_app_control_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data) +{ + char* path = NULL; + app_control_get_extra_data(reply, APP_CONTROL_DATA_PATH, &path); + + if(path){ + PRINTFUNC(DLOG_DEBUG, "path=%s", path); + free(path); + reply_to_sender_by_callback((const char*)path, "image", NULL); + } + ui_app_exit(); +} + +static void _drawing_item_clicked_cb(void *data, Evas_Object * obj, void *event_info) +{ + PRINTFUNC(DLOG_DEBUG, "%s", __func__); + App_Data* ad = (App_Data*) data; + if (!ad) + return; + + Elm_Object_Item *item = (Elm_Object_Item *) event_info; + if (item) + elm_genlist_item_selected_set(item, EINA_FALSE); + + /* launch */ + app_control_h request = NULL; + app_control_create(&request); + app_control_set_app_id(request, "com.samsung.sketch"); + //app_control_set_app_id(request, "wearable-input.sketch"); + + int ret = app_control_send_launch_request(request, _drawing_app_control_reply_cb, NULL); + if (ret != APP_CONTROL_ERROR_NONE) { + PRINTFUNC(DLOG_DEBUG, "error code = 0x%x", ret); + } + app_control_destroy(request); } static void _emoticon_item_clicked_cb(void *data, Evas_Object * obj, void *event_info) @@ -442,7 +487,6 @@ static void _emoticon_gl_lang_changed(void *data, Evas_Object *obj, void *event_ 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; @@ -460,7 +504,7 @@ static void _emoticon_gl_content_unswallowed_cb(void *data, Evas_Object *obj, vo const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(it); -// PRINTFUNC(DLOG_DEBUG,"%s - stype[%s]", __func__, itc->item_style); + //PRINTFUNC(DLOG_DEBUG,"%s - stype[%s]", __func__, itc->item_style); if (!strcmp(itc->item_style, "3button_flat")) { int index = (uintptr_t)elm_object_item_data_get(it); //PRINTFUNC(DLOG_DEBUG,"it = %p", it); @@ -488,16 +532,55 @@ static void _emoticon_gl_content_unswallowed_cb(void *data, Evas_Object *obj, vo if (index + 2 < recent_emoji_list.size()) { emoticon_recents_pool[index+2].used = 0; } + } else if (it_drawing == it) { + //PRINTFUNC(DLOG_DEBUG,"it_drawing = %p", it_drawing); + emoticon_drawing_pool.used = 0; } } +static Evas_Object * __emoticon_gl_1_content_get(void *data, Evas_Object *obj, const char *part) +{ + if (!strcmp(part, "elm.icon")) { + Evas_Object* btn = elm_button_add(obj); + 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); + Evas_Object* ic = elm_image_add(btn); + elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE); + + string path = get_resource_path(); + if (_WEARABLE) + path = path + "wearable/"; + else if (_TV) + path = path + "tv/"; + else + path = path + "mobile/"; + + elm_object_style_set(btn, "ime_button_drawing"); + string path_ic = path + "images/wi_drawing_icon.png"; + PRINTFUNC(DLOG_DEBUG, "path_ic = %s", path_ic.c_str()); + elm_image_file_set(ic, path_ic.c_str(), NULL); + elm_object_content_set(btn, ic); + evas_object_layer_set(btn, 32000); + + emoticon_drawing_pool.index = 0; + emoticon_drawing_pool.content = btn; + emoticon_drawing_pool.used = 0; + return btn; + } 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_recent_content_get(void *data, Evas_Object *obj, const char *part) { if (is_content_reuse_on) { unsigned int index = (uintptr_t)data; int new_index = 0; - //PRINTFUNC(DLOG_DEBUG,"%s %d", part, index); + //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; @@ -523,7 +606,7 @@ static Evas_Object * __emoticon_gl_recent_content_get(void *data, Evas_Object *o unsigned int index = (uintptr_t)data; int new_index = 0; - // PRINTFUNC(DLOG_DEBUG,"%s %d", part, index); + //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; @@ -548,7 +631,6 @@ static Evas_Object * __emoticon_gl_recent_content_get(void *data, Evas_Object *o 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 = (uintptr_t)data; int new_index = 0; @@ -614,7 +696,6 @@ static Evas_Object * __emoticon_gl_emoticon_content_get(void *data, Evas_Object return NULL; } - void _create_reusable_recents(Evas_Object *parent) { if (!parent) { @@ -802,8 +883,14 @@ void _update_emoticon_items(void *data) itc_dummy->func.state_get = NULL; itc_dummy->func.del = NULL; - Elm_Genlist_Item_Class *itc_group = elm_genlist_item_class_new(); + Elm_Genlist_Item_Class *itc_1text_1icon = elm_genlist_item_class_new(); + itc_1text_1icon->item_style = "drawing"; + itc_1text_1icon->func.text_get = __emoticon_gl_text_get; + itc_1text_1icon->func.content_get = __emoticon_gl_1_content_get; + itc_1text_1icon->func.state_get = NULL; + itc_1text_1icon->func.del = NULL; + Elm_Genlist_Item_Class *itc_group = elm_genlist_item_class_new(); itc_group->item_style = "groupindex"; itc_group->func.text_get = __emoticon_gl_text_get; itc_group->func.content_get = NULL; @@ -811,9 +898,6 @@ void _update_emoticon_items(void *data) itc_group->func.del = NULL; 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; @@ -821,9 +905,6 @@ void _update_emoticon_items(void *data) itc_recent->func.del = NULL; 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; @@ -833,6 +914,10 @@ void _update_emoticon_items(void *data) // dummy title for empty space it_emoticon_empty = elm_genlist_item_append(gl, itc_dummy, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL); + // Drawing + it_drawing = elm_genlist_item_append(gl, itc_1text_1icon, "Doodle", NULL, ELM_GENLIST_ITEM_NONE, _drawing_item_clicked_cb, (void *)app_data); + first_it = it_drawing; + if (recent_emoji_list.size() > 0) { if (is_content_reuse_on) { _create_reusable_recents(gl); @@ -877,6 +962,7 @@ void _update_emoticon_items(void *data) elm_genlist_item_class_free(itc_recent); elm_genlist_item_class_free(itc_group); + elm_genlist_item_class_free(itc_1text_1icon); elm_genlist_item_class_free(itc_dummy); } @@ -889,6 +975,7 @@ void ise_show_emoticon_list(void *data) it_emoticon_empty = NULL; it_emoticon_recent_group = NULL; it_emoticon_emoji_group = NULL; + it_drawing = NULL; it_last = NULL; get_recent_emoticons(recent_emoji_list);