From: sungwook79.park Date: Wed, 27 Jul 2016 07:59:04 +0000 (+0900) Subject: Add the feature to select multi input type X-Git-Tag: accepted/tizen/common/20160805.130050~5 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Finputdelegator.git;a=commitdiff_plain;h=fc3850e8fefca87b30bd95be25565cc31046f36b Add the feature to select multi input type Change-Id: I73ac7f7e14e6301a31d687bb6adace79bbeeb46c Signed-off-by: sungwook79.park --- diff --git a/inc/w-input-selector.h b/inc/w-input-selector.h index 83c1799..3fcd43b 100755 --- a/inc/w-input-selector.h +++ b/inc/w-input-selector.h @@ -82,10 +82,14 @@ struct _InputKeyboardData char *guide_text; char *default_text; }; - typedef struct _InputKeyboardData InputKeyboardData; - +struct _InputTypeData +{ + char **input_type_array; + int input_type_array_len; +}; +typedef struct _InputTypeData InputTypeData; void _app_terminate(void* user_data); void reply_to_sender_by_callback_for_back(); diff --git a/res/edje/w-input-selector.edc b/res/edje/w-input-selector.edc old mode 100644 new mode 100755 index 1afb4d2..d9e9fd3 --- a/res/edje/w-input-selector.edc +++ b/res/edje/w-input-selector.edc @@ -580,6 +580,7 @@ collections { } ) } + //Gesture VI program { name: "do_start_expand_0.0"; action: STATE_SET "default" 0.0; @@ -671,4 +672,155 @@ collections { } + group { + name: "elm/genlist/item/2button/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.1 elm.icon.2 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"; + 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"; + 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.2"; offset: -6 -5;} + rel2 { relative: 1.0 1.0; to: "elm.icon.2"; offset: +6 +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: -9 -8;} + rel2 { relative: 1.0 1.0; to: "elm.icon.2"; offset: +9 +8;} + } + } + part { name: "elm.icon.1"; + type: SWALLOW; + repeat_events, 1; + description { + state: "default" 0.0; + visible: 1; + align: 0.5 0; + fixed: 1 1; + min: 114 114; + max: 114 114; + 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: 114+(198-114)/2 114+(198-114)/2; + max: 114+(198-114)/2 114+(198-114)/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: 198 198; + max: 198 198; + rel1 { relative: 128/360 0; to: "base"; offset: 0 12;} + rel2 { relative: 128/360 0; to: "base"; offset: 0 12;} + } + } + part { name: "elm.icon.2"; + type: SWALLOW; + repeat_events, 1; + description { + state: "default" 0.0; + visible: 1; + align: 0.5 0; + fixed: 1 1; + min: 114 114; + max: 114 114; + 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: 114+(198-114)/2 114+(99-114)/2; + max: 114+(198-114)/2 114+(198-114)/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: 198 198; + max: 198 198; + 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; + } + ) + } } diff --git a/src/w-input-selector.cpp b/src/w-input-selector.cpp index 5ce1a98..021f6cd 100755 --- a/src/w-input-selector.cpp +++ b/src/w-input-selector.cpp @@ -39,6 +39,7 @@ using namespace std; App_Data* app_data = NULL; InputKeyboardData g_input_keyboard_data; +InputTypeData g_input_type_data; static Elm_Object_Item *it_empty; static Elm_Object_Item *it_title; @@ -52,9 +53,10 @@ static void _app_language_changed(app_event_info_h event_info, void *user_data); static char *_genlist_text_set_theme_color(const char *str, const char *code); Evas_Object* _create_genlist(Evas_Object* parent); -void _create_genlist_items(void* user_data, bool is_type_reply); +void _create_genlist_items(void* user_data); static void _popup_close_cb(void *data, Evas_Object *obj, void *event_info); static void _popup_back_cb(void *data, Evas_Object *obj, void *event_info); +static void input_type_deinit(void); @@ -185,6 +187,92 @@ static void __bt_connection_result_cb(app_control_h request, app_control_h reply } } +static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj, const char *part) +{ + char *first_input_type = *(g_input_type_data.input_type_array + 0); + char *second_input_type = *(g_input_type_data.input_type_array + 1); + + if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2"))) { + 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 (!strcmp(part, "elm.icon.1")) { + elm_object_style_set(btn, "anchor"); + string path_ic; + if(!strcmp(first_input_type, "input_voice")) { + path_ic = path + "images/w_mode_stt_ic.png"; + } + else if(!strcmp(first_input_type, "input_emoticon")) { + path_ic = path + "images/Delta_w_mode_emoticon_ic.png"; + } + else if(!strcmp(first_input_type, "input_keyboard")) { + path_ic = path + "images/w_mode_keyboard_ic.png"; + evas_object_propagate_events_set(btn, EINA_FALSE); + } + elm_image_file_set(ic, path_ic.c_str(), NULL); + elm_object_content_set(btn, ic); + evas_object_layer_set(btn, 32000); + } else if (!strcmp(part, "elm.icon.2")){ + elm_object_style_set(btn, "anchor"); + string path_ic; + if(!strcmp(second_input_type, "input_voice")) { + path_ic = path + "images/w_mode_stt_ic.png"; + } + else if(!strcmp(second_input_type, "input_emoticon")) { + path_ic = path + "images/Delta_w_mode_emoticon_ic.png"; + } + else if(!strcmp(second_input_type, "input_keyboard")) { + path_ic = path + "images/w_mode_keyboard_ic.png"; + evas_object_propagate_events_set(btn, EINA_FALSE); + } + elm_image_file_set(ic, path_ic.c_str(), NULL); + elm_object_content_set(btn, ic); + evas_object_layer_set(btn, 32000); + } + return btn; + } else if (!strcmp(part, "elm.icon.1.touch_area") || (!strcmp(part, "elm.icon.2.touch_area"))) { + Evas_Object* btn = elm_button_add(obj); + elm_object_style_set(btn, "touch_area"); + 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); + string path = get_resource_path(); + if (!strcmp(part, "elm.icon.1.touch_area")) { + evas_object_layer_set(btn, 32000); + if(!strcmp(first_input_type, "input_voice")) { + evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data); + } + else if(!strcmp(first_input_type, "input_emoticon")) { + evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data); + } + else if(!strcmp(first_input_type, "input_keyboard")) { + evas_object_propagate_events_set(btn, EINA_FALSE); + evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data); + } + } else if (!strcmp(part, "elm.icon.2.touch_area")){ + evas_object_layer_set(btn, 32000); + if(!strcmp(second_input_type, "input_voice")) { + evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data); + } + else if(!strcmp(second_input_type, "input_emoticon")) { + evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data); + } + else if(!strcmp(second_input_type, "input_keyboard")) { + evas_object_propagate_events_set(btn, EINA_FALSE); + evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data); + } + } + 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 * __ise_gl_3button_content_get(void *data, Evas_Object *obj, const char *part) { @@ -536,7 +624,7 @@ _main_menu_title_text_get(void *data, Evas_Object *obj, const char *part) return strdup(buf); } -void _create_genlist_items(void* user_data, bool is_type_reply) +void _create_genlist_items(void* user_data) { LOGD("[psw] _create_genlist_items"); @@ -558,12 +646,19 @@ void _create_genlist_items(void* user_data, bool is_type_reply) itc0->func.del = NULL; Elm_Genlist_Item_Class * itc1 = elm_genlist_item_class_new(); - itc1->item_style = "3button"; - itc1->func.text_get = NULL; - itc1->func.content_get = __ise_gl_3button_content_get; - itc1->func.state_get = NULL; - itc1->func.del = NULL; - + if(g_input_type_data.input_type_array_len == 2){ + itc1->item_style = "2button"; + itc1->func.text_get = NULL; + itc1->func.content_get = __ise_gl_2button_content_get; + itc1->func.state_get = NULL; + itc1->func.del = NULL; + }else{ + itc1->item_style = "3button"; + itc1->func.text_get = NULL; + itc1->func.content_get = __ise_gl_3button_content_get; + itc1->func.state_get = NULL; + itc1->func.del = NULL; + } // dummy title for empty space it_empty = elm_genlist_item_append(app_data->genlist, itc0, @@ -571,15 +666,13 @@ void _create_genlist_items(void* user_data, bool is_type_reply) ELM_GENLIST_ITEM_NONE, NULL, NULL); - if (!is_type_reply) { - // 3 Buttons - it_title = elm_genlist_item_append(app_data->genlist, itc1, - NULL, NULL, - ELM_GENLIST_ITEM_NONE, - NULL, NULL); + // 3 Buttons + it_title = elm_genlist_item_append(app_data->genlist, itc1, + NULL, NULL, + ELM_GENLIST_ITEM_NONE, + NULL, NULL); - elm_genlist_item_select_mode_set(it_title, ELM_OBJECT_SELECT_MODE_NONE); - } + elm_genlist_item_select_mode_set(it_title, ELM_OBJECT_SELECT_MODE_NONE); Elm_Object_Item *item = elm_genlist_item_next_get(it_title); elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); @@ -666,29 +759,37 @@ void _app_service(app_control_h service, void* user_data) int ret; bool b_ret; char *context = NULL; + char **input_type_array = NULL; + int input_type_array_len = -1; + bool is_extra_data_array = false; app_control_clone(&(app_data->source_app_control), service); app_data->reply_type = REPLY_APP_NORMAL; - bool is_type_reply = false; - ret = app_control_get_extra_data(service, APP_CONTROL_DATA_INPUT_TYPE, &context); - if (ret == APP_CONTROL_ERROR_NONE) { - if (!strcmp(context, "input_voice")) { - app_data->app_type = APP_TYPE_STT; - _stt_clicked_cb((void *)app_data, NULL, NULL); - goto ACTIVATE; - } else if (!strcmp(context, "input_emoticon")) { - app_data->app_type = APP_TYPE_EMOTICON; - _emoticon_clicked_cb((void *)app_data, NULL, NULL); - goto ACTIVATE; - } else if (!strcmp(context, "input_keyboard")) { - app_data->app_type = APP_TYPE_KEYBOARD; - input_keyboard_init(service); - _keyboard_clicked_cb((void *)app_data, NULL, NULL); - goto ACTIVATE; - } else if (!strcmp(context, "input_reply")) { - app_data->app_type = APP_TYPE_REPLY; - is_type_reply = true; + ret = app_control_is_extra_data_array(service, APP_CONTROL_DATA_INPUT_TYPE, &is_extra_data_array); + if( is_extra_data_array == true) { + ret = app_control_get_extra_data_array(service, APP_CONTROL_DATA_INPUT_TYPE, &input_type_array, &input_type_array_len); + g_input_type_data.input_type_array = input_type_array; + g_input_type_data.input_type_array_len = input_type_array_len; + }else{ + ret = app_control_get_extra_data(service, APP_CONTROL_DATA_INPUT_TYPE, &context); + if (ret == APP_CONTROL_ERROR_NONE) { + if (!strcmp(context, "input_voice")) { + app_data->app_type = APP_TYPE_STT; + _stt_clicked_cb((void *)app_data, NULL, NULL); + goto ACTIVATE; + } else if (!strcmp(context, "input_emoticon")) { + app_data->app_type = APP_TYPE_EMOTICON; + _emoticon_clicked_cb((void *)app_data, NULL, NULL); + goto ACTIVATE; + } else if (!strcmp(context, "input_keyboard")) { + app_data->app_type = APP_TYPE_KEYBOARD; + input_keyboard_init(service); + _keyboard_clicked_cb((void *)app_data, NULL, NULL); + goto ACTIVATE; + } else if (!strcmp(context, "input_reply")) { + app_data->app_type = APP_TYPE_REPLY; + } } } @@ -697,7 +798,7 @@ void _app_service(app_control_h service, void* user_data) input_keyboard_init(service); - _create_genlist_items(app_data, is_type_reply); + _create_genlist_items(app_data); ACTIVATE : elm_win_activate(app_data->win_main); @@ -734,6 +835,7 @@ void _app_terminate(void* user_data) free(app_data->shared_res_path); input_keyboard_deinit(); + input_type_deinit(); } static int init_i18n(const char *domain, const char *dir, char *lang_str) @@ -776,7 +878,22 @@ static void _app_language_changed(app_event_info_h event_info, void *user_data) } } +void input_type_deinit(void) +{ + int i = 0; + char **data_array = NULL; + data_array = g_input_type_data.input_type_array; + if (data_array) { + for (i = 0; i < g_input_type_data.input_type_array_len; i++) { + if (*(data_array + i)) + free(*(data_array + i)); + } + free(data_array); + } + g_input_type_data.input_type_array = NULL; + g_input_type_data.input_type_array_len = 0; +} int main(int argc, char* argv[]) {