From ca343cb081f0d6c8dffb2774e49b762207d02183 Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Wed, 5 Aug 2020 18:21:56 +0900 Subject: [PATCH] Fix EAP connect popup Change-Id: I98c217eb5facfb39f073bc8b15b482b6a7d4e580 --- common/common_eap_connect.c | 331 +++++++++++++++++---------------------- ui-gadget/edc/custom_genlist.edc | 39 ++++- 2 files changed, 182 insertions(+), 188 deletions(-) diff --git a/common/common_eap_connect.c b/common/common_eap_connect.c index 2b8bc47..87197c6 100644 --- a/common/common_eap_connect.c +++ b/common/common_eap_connect.c @@ -189,6 +189,7 @@ static void _eap_popup_keypad_on_cb(void *data, Evas_Object *obj, void *event_info); extern genlist_info_t g_genlist_info[WIFI_GENLIST_STYLE_MAX]; +extern content_size_info_t g_content_size_info; static void ctxpopup_dismissed_cb(void *data, Evas_Object *obj, void *event_info) @@ -222,7 +223,7 @@ static void move_dropdown(eap_connect_data_t *eap_data, Evas_Object *obj) Evas_Coord x, y, w , h; evas_object_geometry_get(obj, &x, &y, &w, &h); - evas_object_move(eap_data->sub_popup, x + (w / 2), y + h); + evas_object_move(eap_data->sub_popup, x + (w / 2), y); } static void _gl_editbox_sel_cb(void *data, Evas_Object *obj, void *event_info) @@ -605,80 +606,40 @@ static void _create_eap_type_list(eap_connect_data_t *eap_data, elm_object_item_disabled_set(it, EINA_TRUE); } - i++; } move_dropdown(eap_data, btn); evas_object_show(ctxpopup); } -static void _gl_eap_type_btn_cb(void *data, Evas_Object *obj, void *event_info) +static void _gl_eap_type_item_sel_cb(void *data, Evas_Object *obj, void *event_info) { Elm_Object_Item *item = (Elm_Object_Item *)event_info; - eap_connect_data_t *eap_data = (eap_connect_data_t *) data; + eap_connect_data_t *eap_data = (eap_connect_data_t *)data; - if (item) - elm_genlist_item_selected_set(item, EINA_FALSE); + if (!item || !eap_data) + return; - if (keypad_state == FALSE) { - _create_eap_type_list(eap_data, obj); + elm_genlist_item_selected_set(item, EINA_FALSE); - click.btn_click[EAP_TYPE_BTN] = FALSE; - click.btn_obj[EAP_TYPE_BTN] = NULL; - } else { - click.btn_click[EAP_TYPE_BTN] = TRUE; - click.btn_obj[EAP_TYPE_BTN] = obj; - } + if (keypad_state == FALSE) + _create_eap_type_list(eap_data, obj); } static char *_gl_eap_type_text_get(void *data, Evas_Object *obj, const char *part) { eap_connect_data_t *eap_data = (eap_connect_data_t *)data; + eap_type_t eap_type = __common_eap_connect_popup_get_eap_type(eap_data->ap); - if (!g_strcmp0(part, g_genlist_info[WIFI_GENLIST_2LINE_STYLE].sub_text_part)) - return g_strdup(sc(eap_data->str_pkg_name, I18N_TYPE_EAP_method)); - - return NULL; -} - -static Evas_Object *_gl_eap_type_content_get(void *data, - Evas_Object *obj, const char *part) -{ - eap_connect_data_t *eap_data = (eap_connect_data_t *)data; - eap_type_t sel_sub_item_id = __common_eap_connect_popup_get_eap_type(eap_data->ap); - Evas_Object *btn = NULL; - Evas_Object *ly = NULL; - char buf[100]; - int ug_type; + if (!eap_data) + return NULL; - if (!strcmp(part, "elm.swallow.icon.0")) { // TODO - ug_type = common_util_get_ug_type(); - if (ug_type != UG_VIEW_OOBE) { - ly = elm_layout_add(obj); - elm_layout_file_set(ly, CUSTOM_EDITFIELD_PATH, - "eap_dropdown_button"); - } - btn = elm_button_add(obj); - g_snprintf(buf, sizeof(buf), "%s", - list_eap_type[sel_sub_item_id].name); + if (!g_strcmp0(part, g_genlist_info[WIFI_GENLIST_2LINE_STYLE].text_part)) + return g_strdup(sc(eap_data->str_pkg_name, I18N_TYPE_EAP_method)); - elm_object_text_set(btn, buf); - elm_object_style_set(btn, ug_type == UG_VIEW_OOBE ? - "cancel" : "dropdown/label"); - evas_object_propagate_events_set(btn, EINA_FALSE); - 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_smart_callback_add(btn, "clicked", - _gl_eap_type_btn_cb, eap_data); + if (!g_strcmp0(part, g_genlist_info[WIFI_GENLIST_2LINE_STYLE].sub_text_part)) + return g_strdup(list_eap_type[eap_type].name); - if (ug_type != UG_VIEW_OOBE) { - elm_layout_content_set(ly, "btn", btn); - return ly; - } - return btn; - } return NULL; } @@ -757,82 +718,38 @@ static void _create_eap_auth_list(eap_connect_data_t *eap_data, evas_object_show(ctxpopup); } -static void _gl_eap_auth_btn_cb(void *data, Evas_Object *obj, void *event_info) +static void _gl_eap_auth_item_sel_cb(void *data, Evas_Object *obj, void *event_info) { Elm_Object_Item *item = (Elm_Object_Item *)event_info; - eap_connect_data_t *eap_data = (eap_connect_data_t *) data; + eap_connect_data_t *eap_data = (eap_connect_data_t *)data; - if (item) - elm_genlist_item_selected_set(item, EINA_FALSE); + if (!item || !eap_data) + return; - if (keypad_state == FALSE) { - _create_eap_auth_list(eap_data, obj); + elm_genlist_item_selected_set(item, EINA_FALSE); - click.btn_click[EAP_AUTH_BTN] = FALSE; - click.btn_obj[EAP_AUTH_BTN] = NULL; - } else { - click.btn_click[EAP_AUTH_BTN] = TRUE; - click.btn_obj[EAP_AUTH_BTN] = obj; - } + if (keypad_state == FALSE) + _create_eap_auth_list(eap_data, obj); } static char *_gl_eap_auth_text_get(void *data, Evas_Object *obj, const char *part) { eap_connect_data_t *eap_data = (eap_connect_data_t *)data; + eap_auth_t eap_auth = __common_eap_connect_popup_get_auth_type(eap_data->ap); + + if (!g_strcmp0(part, g_genlist_info[WIFI_GENLIST_2LINE_STYLE].text_part)) + return g_strdup(sc(eap_data->str_pkg_name, I18N_TYPE_Phase_2_authentication)); if (!g_strcmp0(part, g_genlist_info[WIFI_GENLIST_2LINE_STYLE].sub_text_part)) { - return g_strdup(sc(eap_data->str_pkg_name, - I18N_TYPE_Phase_2_authentication)); + if (eap_auth == EAP_SEC_AUTH_NONE) + return g_strdup(sc(PACKAGE, I18N_TYPE_None)); + else + return g_strdup(list_eap_auth[eap_auth].name); } return NULL; } -static Evas_Object *_gl_eap_auth_content_get(void *data, - Evas_Object *obj, const char *part) -{ - eap_connect_data_t *eap_data = (eap_connect_data_t *)data; - eap_auth_t sel_sub_item_id = __common_eap_connect_popup_get_auth_type(eap_data->ap); - Evas_Object *btn = NULL; - Evas_Object *ly = NULL; - char buf[100]; - int ug_type; - - if (!strcmp(part, "elm.swallow.icon.0")) { //TODO - ug_type = common_util_get_ug_type(); - if (ug_type != UG_VIEW_OOBE) { - ly = elm_layout_add(obj); - elm_layout_file_set(ly, CUSTOM_EDITFIELD_PATH, "eap_dropdown_button"); - } - - btn = elm_button_add(obj); - if (sel_sub_item_id == EAP_SEC_AUTH_NONE) { - g_snprintf(buf, sizeof(buf), "%s", - sc(PACKAGE, I18N_TYPE_None)); - } else { - g_snprintf(buf, sizeof(buf), "%s", - list_eap_auth[sel_sub_item_id].name); - } - - elm_object_domain_translatable_text_set(btn, PACKAGE, buf); - elm_object_style_set(btn, ug_type == UG_VIEW_OOBE ? "cancel" : "dropdown/label"); - evas_object_propagate_events_set(btn, EINA_FALSE); - 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_smart_callback_add(btn, "clicked", - _gl_eap_auth_btn_cb, eap_data); - - if (ug_type != UG_VIEW_OOBE) { - elm_layout_content_set(ly, "btn", btn); - return ly; - } - return btn; - } - return NULL; -} - static void _gl_eap_entry_key_enter_cb(void *data, Evas_Object *obj, void *event_info) { common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data; @@ -991,6 +908,102 @@ static char *_gl_eap_entry_item_text_get(void *data, Evas_Object *obj, const cha return NULL; } +// iot common +static Evas_Object *__get_eap_editfield_layout_common(Evas_Object *parent, const char *title_txt) +{ + Evas_Object *layout = elm_layout_add(parent); + + elm_layout_file_set(layout, CUSTOM_GENLIST_PATH, "gl_custom_common_item"); + evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + elm_object_part_text_set(layout, "elm.text.title", dgettext(PACKAGE, title_txt)); + + return layout; +} + +static Evas_Object *__get_eap_editfield_box(Evas_Object *parent, const char *title_txt) +{ + Evas_Object *entry = NULL; + Evas_Object *box = NULL; + Evas_Object *tpad = NULL; + Evas_Object *lpad = NULL; + Evas_Object *label = NULL; + char buf[MAX_LABEL_LENGTH] = {0, }; + + entry = elm_box_add(parent); + elm_box_align_set(entry, 0.0, 0.0); + evas_object_size_hint_min_set(entry, 0, ELM_SCALE_SIZE(60)); + elm_object_focus_set(entry, EINA_FALSE); + + tpad = evas_object_rectangle_add(entry); + evas_object_size_hint_min_set(tpad, 0, ELM_SCALE_SIZE(10)); + evas_object_show(tpad); + elm_box_pack_end(entry, tpad); + + box = elm_box_add(entry); + evas_object_size_hint_align_set(box, 0.0, 0.0); + elm_box_horizontal_set(box, EINA_TRUE); + elm_box_pack_end(entry, box); + evas_object_show(box); + + lpad = evas_object_rectangle_add(box); + evas_object_size_hint_min_set(lpad, ELM_SCALE_SIZE(15), 0); + evas_object_show(lpad); + elm_box_pack_end(box, lpad); + evas_object_show(box); + + label = elm_label_add(box); + snprintf(buf, MAX_LABEL_LENGTH, "%s", + g_content_size_info.mid_font, + dgettext(PACKAGE, title_txt)); + elm_object_text_set(label, buf); + evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(label, 0.9, EVAS_HINT_EXPAND); + elm_box_pack_end(box, label); + evas_object_show(label); + + return entry; +} + +static Evas_Object *__get_eap_editfield_layout(Evas_Object *box) +{ + Evas_Object *layout = NULL; + + layout = elm_layout_add(box); + elm_layout_theme_set(layout, "layout", "editfield", "singleline"); + evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + + elm_box_pack_end(box, layout); + + evas_object_show(layout); + evas_object_show(box); + + return layout; +} + +static int __get_eap_keypad_info(entry_id_type_t entry_id, eap_type_t eap_type, + Elm_Input_Panel_Layout *panel_type, int *return_key_type, Eina_Bool *hide_entry_txt) +{ + switch (entry_id) { + case ENTRY_TYPE_USER_ID: + *panel_type = ELM_INPUT_PANEL_LAYOUT_NORMAL; + *return_key_type = (eap_type == EAP_SEC_TYPE_TLS) + ? ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE + : ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT; + break; + case ENTRY_TYPE_PASSWORD: + *panel_type = ELM_INPUT_PANEL_LAYOUT_PASSWORD; + *hide_entry_txt = EINA_TRUE; + *return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE; + break; + default: + return -1; + } + return 0; +} + static Evas_Object *_gl_eap_entry_item_content_get(void *data, Evas_Object *obj, const char *part) { common_utils_entry_info_t *entry_info = (common_utils_entry_info_t *)data; @@ -998,80 +1011,35 @@ static Evas_Object *_gl_eap_entry_item_content_get(void *data, Evas_Object *obj, return NULL; if (g_strcmp0(part, g_genlist_info[WIFI_GENLIST_FULL_STYLE].content_part) == 0) { - Evas_Object *entry = NULL; + +// return __get_editfield(obj, "test tiltle", "test guide"); + Evas_Object *box = NULL; - Evas_Object *tpad = NULL; - Evas_Object *lpad = NULL; - Evas_Object *label = NULL; Evas_Object *layout = NULL; Evas_Object *editfield = NULL; - char buf[MAX_LABEL_LENGTH] = {0, }; - char *guide_txt = NULL; char *accepted = NULL; Eina_Bool hide_entry_txt = EINA_FALSE; Elm_Input_Panel_Layout panel_type; int return_key_type; eap_type_t eap_type; - int height = 60; + UG_TYPE ug_type = common_util_get_ug_type(); eap_type = __common_eap_connect_popup_get_eap_type(entry_info->ap); static Elm_Entry_Filter_Limit_Size limit_filter_data; - switch (entry_info->entry_id) { - case ENTRY_TYPE_USER_ID: - panel_type = ELM_INPUT_PANEL_LAYOUT_NORMAL; - guide_txt = entry_info->guide_txt; - - if (eap_type == EAP_SEC_TYPE_TLS) - return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE; - else - return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT; - - break; - case ENTRY_TYPE_PASSWORD: - panel_type = ELM_INPUT_PANEL_LAYOUT_PASSWORD; - guide_txt = entry_info->guide_txt; - hide_entry_txt = EINA_TRUE; - return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE; - break; - default: + if (__get_eap_keypad_info(entry_info->entry_id, eap_type, + &panel_type, &return_key_type, &hide_entry_txt) < 0) { + ERROR_LOG(UG_NAME_ERR, "Failed to get EAP keypad info"); return NULL; } - entry = elm_box_add(obj); - elm_box_align_set(entry, 0.0, 0.0); - - tpad = evas_object_rectangle_add(entry); - evas_object_size_hint_min_set(tpad, 0, ELM_SCALE_SIZE(10)); - evas_object_show(tpad); - elm_box_pack_end(entry, tpad); - - box = elm_box_add(entry); - evas_object_size_hint_align_set(box, 0.0, 0.0); - elm_box_horizontal_set(box, EINA_TRUE); - elm_box_pack_end(entry, box); - evas_object_show(box); - - lpad = evas_object_rectangle_add(box); - evas_object_size_hint_min_set(lpad, ELM_SCALE_SIZE(15), 0); - evas_object_show(lpad); - elm_box_pack_end(box, lpad); - evas_object_show(box); - - label = elm_label_add(box); - snprintf(buf, MAX_LABEL_LENGTH, "%s", - dgettext(PACKAGE, entry_info->title_txt)); - elm_object_text_set(label, buf); - evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(label, 0.9, EVAS_HINT_EXPAND); - elm_box_pack_end(box, label); - evas_object_show(label); - - layout = elm_layout_add(entry); - elm_layout_theme_set(layout, "layout", "editfield", "singleline"); - evas_object_size_hint_align_set(layout, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + if (ug_type == UG_VIEW_IOT_COMMON) { + layout = __get_eap_editfield_layout_common(obj, entry_info->title_txt); + } else { + box = __get_eap_editfield_box(obj, entry_info->title_txt); + layout = __get_eap_editfield_layout(box); + } editfield = elm_entry_add(layout); elm_entry_single_line_set(editfield, EINA_TRUE); @@ -1079,9 +1047,8 @@ static Evas_Object *_gl_eap_entry_item_content_get(void *data, Evas_Object *obj, elm_entry_password_set(editfield, hide_entry_txt); elm_entry_prediction_allow_set(editfield, EINA_FALSE); elm_entry_autocapital_type_set(editfield, ELM_AUTOCAPITAL_TYPE_NONE); - elm_object_domain_translatable_part_text_set(editfield, "elm.guide", - PACKAGE, guide_txt); + PACKAGE, entry_info->guide_txt); if (entry_info->entry_txt && (strlen(entry_info->entry_txt) > 0)) elm_entry_entry_set(editfield, entry_info->entry_txt); @@ -1113,17 +1080,11 @@ static Evas_Object *_gl_eap_entry_item_content_get(void *data, Evas_Object *obj, evas_object_smart_callback_add(editfield, "maxlength,reached", _gl_eap_entry_maxlength_reached, NULL); elm_object_part_content_set(layout, "elm.swallow.content", editfield); - evas_object_show(layout); - elm_box_pack_end(entry, layout); - - evas_object_size_hint_min_set(entry, 0, ELM_SCALE_SIZE(height)); - elm_object_focus_set(entry, EINA_FALSE); - evas_object_show(entry); if (entry_info->entry_id == ENTRY_TYPE_PASSWORD) g_pwd_entry = editfield; - return entry; + return (ug_type == UG_VIEW_IOT_COMMON ? layout : box); } else if (g_strcmp0(part, "elm.icon.eraser") == 0) { // TODO Evas_Object *btn = elm_button_add(obj); elm_object_style_set(btn, "editfield_clear"); @@ -1223,13 +1184,13 @@ static void __common_eap_connect_popup_init_item_class(void *data) { g_eap_type_itc.item_style = g_genlist_info[WIFI_GENLIST_2LINE_STYLE].style_name; g_eap_type_itc.func.text_get = _gl_eap_type_text_get; - g_eap_type_itc.func.content_get = _gl_eap_type_content_get; + g_eap_type_itc.func.content_get = NULL; g_eap_type_itc.func.state_get = NULL; g_eap_type_itc.func.del = NULL; g_eap_auth_itc.item_style = g_genlist_info[WIFI_GENLIST_2LINE_STYLE].style_name; g_eap_auth_itc.func.text_get = _gl_eap_auth_text_get; - g_eap_auth_itc.func.content_get = _gl_eap_auth_content_get; + g_eap_auth_itc.func.content_get = NULL; g_eap_auth_itc.func.state_get = NULL; g_eap_auth_itc.func.del = NULL; @@ -1406,7 +1367,7 @@ static void _create_and_update_list_items_based_on_rules(eap_type_t new_type, view_list, &g_eap_type_itc, eap_data, NULL, ELM_GENLIST_ITEM_NONE, - _gl_eap_item_sel_cb, eap_data); + _gl_eap_type_item_sel_cb, eap_data); } switch (new_type) { @@ -1478,7 +1439,7 @@ static void _create_and_update_list_items_based_on_rules(eap_type_t new_type, eap_data->eap_auth_item = elm_genlist_item_insert_after( view_list, &g_eap_auth_itc, eap_data, NULL, insert_after_item, ELM_GENLIST_ITEM_NONE, - _gl_eap_item_sel_cb, eap_data); + _gl_eap_auth_item_sel_cb, eap_data); } } else { _delete_eap_auth_item(eap_data); diff --git a/ui-gadget/edc/custom_genlist.edc b/ui-gadget/edc/custom_genlist.edc index bf7d52c..191487e 100644 --- a/ui-gadget/edc/custom_genlist.edc +++ b/ui-gadget/edc/custom_genlist.edc @@ -16,12 +16,18 @@ */ #define CUSTOM_GENLIST_LR_PADDING 60 -#define CUSTOM_GENLIST_TB_PADDING 20 +#define CUSTOM_GENLIST_TB_PADDING 30 + +#defien CUSTOM_GENLIST_TOP_PADDING 40 +#define CUSTOM_GENLIST_BOTTOM_PADDING 15 #define CUSTOM_GENLIST_BUTTON_LR_PADDING 400 #define CUSTOM_GENLIST_BUTTON_TOP_PADDING 100 #define CUSTOM_GENLIST_BUTTON_BOTTOM_PADDING 30 +#define CUSTOM_GENLIST_TITLE_TEXT_SIZE 36 +#define CUSTOM_GENLIST_TEXT_COLOR 0 20 71 255 + styles { style { "custom_textblock_style"; base: "font=Tizen:weight=Light font_size=40 color=#000 text_class=entry ellipsis=1.0 left_margin=5 right_margin=5"; @@ -33,7 +39,7 @@ styles { } style { "custom_common_textblock_style"; - base: "font=Tizen:weight=Light font_size=30 color=#000 text_class=entry ellipsis=1.0 left_margin=5 right_margin=5"; + base: "font=Tizen:weight=Light font_size=30 color=#001447 text_class=entry ellipsis=1.0 left_margin=5 right_margin=5"; tag: "br" "\n"; tag: "ps" "ps"; tag: "hilight" "+ font_weight=Bold"; @@ -226,6 +232,33 @@ group { name: "gl_custom_common_item"; fixed: 0 1; } } + part { name: "elm.text.title"; + type: TEXT; + scale: 1; + mouse_events: 0; + description { state: "default" 0.0; + align: 0.0 0.0; + rel1 { + to_x: "left_padding"; + to_y: "top_padding"; + relative: 1.0 1.0; + } + rel2 { + to_x: "right_padding"; + to_y: "top_padding"; + relative: 0.0 1.0; + } + text { + font: "Tizen:weight=Light"; + size: CUSTOM_GENLIST_TITLE_TEXT_SIZE; + min: 0 0; + align: 0.0 0.5; + text_class: "title_bar"; + } + fixed: 0 1; + color: CUSTOM_GENLIST_TEXT_COLOR; + } + } part { name: "elm.swallow.content"; type: SWALLOW; scale: 1; @@ -268,7 +301,7 @@ group { name: "gl_custom_common_item"; type: SPACER; scale: 1; description { state: "default" 0.0; - min: 0 CUSTOM_GENLIST_TB_PADDING; + min: 0 CUSTOM_GENLIST_BOTTOM_PADDING; align: 0.5 1.0; rel1 { to: "base"; relative: 0.0 1.0; } rel2 { to: "base"; relative: 1.0 1.0; } -- 2.7.4