From: Seonah Moon Date: Mon, 25 May 2020 11:15:03 +0000 (+0900) Subject: iot common: use a input popup for static ip X-Git-Tag: accepted/tizen/unified/20200528.133002^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=02c00b9304a3c018d040bc822c120bc391d1052d;p=apps%2Fnative%2Fug-wifi-efl.git iot common: use a input popup for static ip Change-Id: Ia517a70c094e613b04cc53cf28aa55153e23aeeb --- diff --git a/sources/libraries/Common/common_ip_info.c b/sources/libraries/Common/common_ip_info.c index 55691a6..2b1fa56 100755 --- a/sources/libraries/Common/common_ip_info.c +++ b/sources/libraries/Common/common_ip_info.c @@ -18,6 +18,7 @@ */ #include +#include #include "common.h" #include "common_utils.h" @@ -39,6 +40,8 @@ typedef struct { static Elm_Object_Item* _add_description(Evas_Object* genlist, char* title, char* description, Elm_Object_Item* insert_after); +static void _ip_info_entry_add_callbacks(Evas_Object *entry, + common_utils_entry_info_t *entry_info); static Elm_Genlist_Item_Class *ip_toggle_itc; static Elm_Genlist_Item_Class *description_itc; @@ -72,10 +75,171 @@ static void _ip_info_reset_current_unfocused_entry(void) curr_unfocuc_cursor_pos = 0; } +static void _popup_deleted_cb(void *data, Evas_Object *obj, void *event_info) +{ + evas_object_del(obj); +} + +static void _popup_cancel_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + common_utils_entry_info_t *entry_info = NULL; + Evas_Object *popup = NULL; + + entry_info = (common_utils_entry_info_t *)data; + retm_if(NULL == entry_info); + retm_if(NULL == entry_info->popup); + + popup = entry_info->popup; + entry_info->popup = NULL; + evas_object_del(popup); +} + +static void _popup_ok_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *popup, *entry, *layout; + common_utils_entry_info_t *entry_info = NULL; + + entry_info = (common_utils_entry_info_t *)data; + retm_if(NULL == entry_info); + + retm_if(NULL == entry_info->popup); + popup = entry_info->popup; + + layout = elm_object_content_get(popup); + retm_if(NULL == layout); + + entry = elm_layout_content_get(layout, "elm.swallow.content"); + retm_if(NULL == entry); + + entry_info->entry_txt = elm_entry_markup_to_utf8(elm_entry_entry_get(entry)); + if (entry_info->entry_txt == NULL) { + entry_info->popup = NULL; + evas_object_del(popup); + return; + } + + if (entry_info->entry_txt && entry_info->entry_txt[0] == '\0') { + free(entry_info->entry_txt); + entry_info->entry_txt = NULL; + } else { + elm_genlist_item_update(entry_info->item); + } + + entry_info->popup = NULL; + evas_object_del(popup); +} + +static void _update_input_panel(Evas_Object *entry, entry_id_type_t id, imf_ctxt_panel_cb_t callback, void *data) +{ + Elm_Input_Panel_Layout panel_type; + Elm_Input_Panel_Return_Key_Type return_key_type; + char *accepted = NULL; + UG_TYPE ug_type = common_util_get_ug_type(); + + switch (id) { + case ENTRY_TYPE_PASSWORD: + case ENTRY_TYPE_IP_ADDR: + case ENTRY_TYPE_SUBNET_MASK: + case ENTRY_TYPE_GATEWAY: + case ENTRY_TYPE_DNS_1: + case ENTRY_TYPE_DNS_2: + panel_type = ELM_INPUT_PANEL_LAYOUT_IP; + return_key_type + = (ug_type == UG_VIEW_IOT_COMMON) ? + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE : ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT; + accepted = "0123456789."; + break; + case ENTRY_TYPE_PROXY_ADDR: + panel_type = ELM_INPUT_PANEL_LAYOUT_URL; + return_key_type + = (ug_type == UG_VIEW_IOT_COMMON) ? + ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE : ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT; + break; + case ENTRY_TYPE_PROXY_PORT: + panel_type = ELM_INPUT_PANEL_LAYOUT_URL; + return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE; + accepted = "0123456789"; + break; + default: + return; + } + + elm_entry_input_panel_layout_set(entry, panel_type); + elm_entry_input_panel_return_key_type_set(entry, return_key_type); + + Elm_Entry_Filter_Accept_Set digits_filter_data; + memset(&digits_filter_data, 0, sizeof(Elm_Entry_Filter_Accept_Set)); + digits_filter_data.accepted = accepted; + elm_entry_markup_filter_append(entry, elm_entry_filter_accept_set, &digits_filter_data); + + if (callback) { + Ecore_IMF_Context *imf_ctxt = elm_entry_imf_context_get(entry); + if (imf_ctxt) { + ecore_imf_context_input_panel_event_callback_add( + imf_ctxt, + ECORE_IMF_INPUT_PANEL_STATE_EVENT, + callback, data); + } + } +} + +static void _create_input_popup(common_utils_entry_info_t *entry_info) +{ + Evas_Object *popup, *btn; + Evas_Object *entry; + Evas_Object *layout; + + retm_if(NULL == entry_info); + retm_if(NULL == entry_info->win); + + popup = elm_popup_add(entry_info->win); + elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); + evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_domain_translatable_part_text_set(popup, "title,text", + PACKAGE, entry_info->title_txt); + + evas_object_smart_callback_add(popup, "dismissed", _popup_deleted_cb, NULL); + evas_object_smart_callback_add(popup, "block,clicked", _popup_deleted_cb, NULL); + + layout = elm_layout_add(popup); + elm_layout_file_set(layout, CUSTOM_POPUP_PATH, "custom_popup_input_text"); + evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_object_content_set(popup, layout); + + entry = elm_entry_add(layout); + elm_entry_single_line_set(entry, EINA_TRUE); + elm_entry_scrollable_set(entry, EINA_TRUE); + evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL); + eext_entry_selection_back_event_allow_set(entry, EINA_TRUE); + elm_object_part_text_set(entry, "elm.guide", entry_info->guide_txt); + elm_object_part_content_set(layout, "elm.swallow.content", entry); + + _update_input_panel(entry, entry_info->entry_id, NULL, NULL); + _ip_info_entry_add_callbacks(entry, entry_info); + + btn = elm_button_add(popup); + elm_object_style_set(btn, "border"); + elm_object_text_set(btn, sc(PACKAGE, I18N_TYPE_Cancel)); + elm_object_part_content_set(popup, "button1", btn); + evas_object_smart_callback_add(btn, "clicked", _popup_cancel_btn_clicked_cb, entry_info); + + btn = elm_button_add(popup); + elm_object_text_set(btn, sc(PACKAGE, I18N_TYPE_Ok)); + elm_object_part_content_set(popup, "button2", btn); + evas_object_smart_callback_add(btn, "clicked", _popup_ok_btn_clicked_cb, entry_info); + + entry_info->popup = popup; + evas_object_show(popup); +} + static void _gl_editbox_sel_cb(void *data, Evas_Object *obj, void *event_info) { Elm_Object_Item *item = (Elm_Object_Item *)event_info; elm_genlist_item_selected_set(item, FALSE); + + if (data && common_util_get_ug_type() == UG_VIEW_IOT_COMMON) + _create_input_popup((common_utils_entry_info_t *)data); } static void _ip_info_detail_description_del(void *data, Evas_Object *obj) @@ -425,42 +589,10 @@ static Evas_Object *_ip_info_entry_item_content_get(void *data, Evas_Object *obj Evas_Object *layout = NULL; Evas_Object *label = NULL; Evas_Object *editfield = NULL; - char *guide_txt = NULL; - char *accepted = NULL; - Elm_Input_Panel_Layout panel_type; UG_TYPE ug_type = common_util_get_ug_type(); - int return_key_type; char buf[MAX_LABEL_LENGTH] = {0, }; int font_size = ug_type == UG_VIEW_IOT_COMMON ? 20 : 40; - switch (entry_info->entry_id) { - case ENTRY_TYPE_IP_ADDR: - case ENTRY_TYPE_SUBNET_MASK: - case ENTRY_TYPE_GATEWAY: - case ENTRY_TYPE_DNS_1: - case ENTRY_TYPE_DNS_2: - guide_txt = entry_info->guide_txt; - panel_type = ELM_INPUT_PANEL_LAYOUT_IP; - return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT; - accepted = "0123456789."; - break; - case ENTRY_TYPE_PROXY_ADDR: - guide_txt = DEFAULT_GUIDE_PROXY_IP; - panel_type = ELM_INPUT_PANEL_LAYOUT_URL; - return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_NEXT; - /* Temporary fix */ - /* accepted = "0123456789.abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ"; */ - break; - case ENTRY_TYPE_PROXY_PORT: - guide_txt = DEFAULT_GUIDE_PROXY_PORT; - panel_type = ELM_INPUT_PANEL_LAYOUT_NUMBERONLY; - return_key_type = ECORE_IMF_INPUT_PANEL_RETURN_KEY_TYPE_DONE; - accepted = "0123456789"; - break; - default: - return NULL; - } - layout = elm_layout_add(obj); if (ug_type == UG_VIEW_IOT_COMMON) elm_layout_file_set(layout, CUSTOM_GENLIST_PATH, "gl_custom_common_item"); @@ -488,31 +620,17 @@ static Evas_Object *_ip_info_entry_item_content_get(void *data, Evas_Object *obj elm_entry_cnp_mode_set(editfield, ELM_CNP_MODE_PLAINTEXT); - elm_object_part_text_set(editfield, "elm.guide", guide_txt); + elm_object_part_text_set(editfield, "elm.guide", entry_info->guide_txt); if (entry_info->entry_txt && (strlen(entry_info->entry_txt) > 0) && g_strcmp0(entry_info->entry_txt, DEFAULT_GUIDE_IP) != 0) { elm_entry_entry_set(editfield, entry_info->entry_txt); } - elm_entry_input_panel_layout_set(editfield, panel_type); - - Elm_Entry_Filter_Accept_Set digits_filter_data; - memset(&digits_filter_data, 0, sizeof(Elm_Entry_Filter_Accept_Set)); - digits_filter_data.accepted = accepted; - elm_entry_markup_filter_append(editfield, elm_entry_filter_accept_set, &digits_filter_data); - - if (entry_info->input_panel_cb) { - Ecore_IMF_Context *imf_ctxt = elm_entry_imf_context_get(editfield); - if (imf_ctxt) { - ecore_imf_context_input_panel_event_callback_add( - imf_ctxt, - ECORE_IMF_INPUT_PANEL_STATE_EVENT, - entry_info->input_panel_cb, - entry_info->input_panel_cb_data); - } - } + if (ug_type == UG_VIEW_IOT_COMMON) + elm_entry_editable_set(editfield, EINA_FALSE); // use input popup. - elm_entry_input_panel_return_key_type_set(editfield, return_key_type); + _update_input_panel(editfield, entry_info->entry_id, + entry_info->input_panel_cb, entry_info->input_panel_cb_data); _ip_info_entry_add_callbacks(editfield, entry_info); elm_object_part_content_set(layout, "elm.swallow.content", editfield); @@ -589,10 +707,11 @@ static void _create_static_ip_table(full_ip_info_t *ip_data) edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name; edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb; edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data; + edit_box_details->win = ip_info_list_data->win; edit_box_details->item = elm_genlist_item_insert_after( ip_info_list_data->genlist, ip_entry_itc, edit_box_details, NULL, ip_info_list_data->ip_toggle_item, - ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL); + ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, edit_box_details); #ifdef ACCESSIBLITY_FEATURE Evas_Object *ao = elm_object_item_access_object_get(edit_box_details->item); elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details); @@ -621,10 +740,11 @@ static void _create_static_ip_table(full_ip_info_t *ip_data) edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name; edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb; edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data; + edit_box_details->win = ip_info_list_data->win; edit_box_details->item = elm_genlist_item_insert_after( ip_info_list_data->genlist, ip_entry_itc, edit_box_details, NULL, ip_info_list_data->ip_addr_item, - ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL); + ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, edit_box_details); #ifdef ACCESSIBLITY_FEATURE ao = elm_object_item_access_object_get(edit_box_details->item); elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details); @@ -650,10 +770,11 @@ static void _create_static_ip_table(full_ip_info_t *ip_data) edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name; edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb; edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data; + edit_box_details->win = ip_info_list_data->win; edit_box_details->item = elm_genlist_item_insert_after( ip_info_list_data->genlist, ip_entry_itc, edit_box_details, NULL, ip_info_list_data->subnet_mask_item, - ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL); + ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, edit_box_details); #ifdef ACCESSIBLITY_FEATURE ao = elm_object_item_access_object_get(edit_box_details->item); elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details); @@ -693,10 +814,11 @@ static void _create_static_ip_table(full_ip_info_t *ip_data) edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name; edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb; edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data; + edit_box_details->win = ip_info_list_data->win; edit_box_details->item = elm_genlist_item_insert_after( ip_info_list_data->genlist, ip_entry_itc, edit_box_details, NULL, ip_info_list_data->prefix_length_item, - ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL); + ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, edit_box_details); #ifdef ACCESSIBLITY_FEATURE ao = elm_object_item_access_object_get(edit_box_details->item); elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details); @@ -722,10 +844,11 @@ static void _create_static_ip_table(full_ip_info_t *ip_data) edit_box_details->str_pkg_name = ip_info_list_data->str_pkg_name; edit_box_details->input_panel_cb = ip_info_list_data->input_panel_cb; edit_box_details->input_panel_cb_data = ip_info_list_data->input_panel_cb_data; + edit_box_details->win = ip_info_list_data->win; edit_box_details->item = elm_genlist_item_insert_after( ip_info_list_data->genlist, ip_entry_itc, edit_box_details, NULL, ip_info_list_data->dns_1_item, - ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, NULL); + ELM_GENLIST_ITEM_NONE, _gl_editbox_sel_cb, edit_box_details); #ifdef ACCESSIBLITY_FEATURE ao = elm_object_item_access_object_get(edit_box_details->item); elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details); @@ -931,7 +1054,6 @@ static void __ip_info_toggle_item_sel_cb(void* data, wifi_manager_ap_foreach_ipv6_address(ap, __ap_foreach_ipv6_callback, &ipv6_addr); /* Dynamic IP Address */ - if (g_strcmp0(ip_addr, IPV4_DEFAULT_ADDR) || (!g_strcmp0(ip_addr, IPV4_DEFAULT_ADDR) && !g_strcmp0(ipv6_addr, IPV6_DEFAULT_ADDR))) ip_info_list_data->ipv4_addr_item = _add_description( ip_info_list_data->genlist, @@ -1015,77 +1137,6 @@ static Evas_Object *_ip_info_iptoggle_content_get(void *data, return toggle_btn; } -#if 0 -static void ip_info_print_values(wifi_manager_ap_h ap) -{ - char *txt; - wifi_manager_ip_config_type_e type = WIFI_MANAGER_IP_CONFIG_TYPE_NONE; - - wifi_manager_ap_get_ip_config_type(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &type); - if (WIFI_MANAGER_IP_CONFIG_TYPE_STATIC == type) { - DEBUG_LOG(UG_NAME_NORMAL, "* STATIC CONFIGURATION *"); - - /* IP Address */ - wifi_manager_ap_get_ip_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt); - SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* IP address [%s]", txt); - g_free(txt); - - /* Subnet Mask */ - wifi_manager_ap_get_subnet_mask(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt); - SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* Subnet Mask [%s]", txt); - g_free(txt); - - /* Gateway Address */ - wifi_manager_ap_get_gateway_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt); - SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* Gateway address [%s]", txt); - g_free(txt); - - /* DNS 1 */ - wifi_manager_ap_get_dns_address(ap, 1, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt); - SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* DNS-1 address [%s]", txt); - g_free(txt); - - /* DNS 2 */ - wifi_manager_ap_get_dns_address(ap, 2, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt); - SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* DNS-2 address [%s]", txt); - g_free(txt); - - } else if (WIFI_MANAGER_IP_CONFIG_TYPE_DYNAMIC == type) { - DEBUG_LOG(UG_NAME_NORMAL, "* DYNAMIC CONFIGURATION *"); - - /* Dynamic IP Address */ - wifi_manager_ap_get_ip_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt); - SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* IP address [%s]", txt); - g_free(txt); - } - - /* Mac address */ - wifi_get_mac_address(&txt); - SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* MAC address [%s]", txt); - g_free(txt); - txt = NULL; - - wifi_manager_ap_get_proxy_address(ap, WIFI_MANAGER_ADDRESS_FAMILY_IPV4, &txt); - assertm_if(NULL == txt, "NULL!!"); - - if (!txt || !strlen(txt)) { - if (txt) - g_free(txt); - txt = g_strdup(DEFAULT_PROXY_ADDR); - } - - /* Proxy Address */ - char *save_str = NULL; - char *proxy_addr = strtok_r(txt, ":", &save_str); - SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* PROXY ADDR [%s]", proxy_addr); - - /* Proxy port */ - char *proxy_port = strtok_r(NULL, ":", &save_str); - SECURE_DEBUG_LOG(UG_NAME_NORMAL, "* PROXY PORT [%s]", proxy_port); - g_free(txt); -} -#endif - #define EMULATOR_MAC_ADDR_SIZE 6 #define EMULATOR_MAC_ADDR_MAX 20 static int ip_info_emulator_get_random_mac(unsigned char *buf) @@ -1126,7 +1177,8 @@ void ip_info_delete_prev(prev_ip_info_t *prev_ip_info) } full_ip_info_t *ip_info_append_items(wifi_manager_ap_h ap, const char *pkg_name, - Evas_Object *genlist, imf_ctxt_panel_cb_t input_panel_cb, void *input_panel_cb_data) + Evas_Object *genlist, imf_ctxt_panel_cb_t input_panel_cb, void *input_panel_cb_data, + Evas_Object *win) { __COMMON_FUNC_ENTER__; int ret = WIFI_MANAGER_ERROR_NONE; @@ -1171,6 +1223,7 @@ full_ip_info_t *ip_info_append_items(wifi_manager_ap_h ap, const char *pkg_name, ip_info_list_data->ap = ap; ip_info_list_data->str_pkg_name = pkg_name; + ip_info_list_data->win = win; ip_info_list_data->genlist = genlist; ip_info_list_data->input_panel_cb = input_panel_cb; ip_info_list_data->input_panel_cb_data = input_panel_cb_data; @@ -1308,9 +1361,10 @@ full_ip_info_t *ip_info_append_items(wifi_manager_ap_h ap, const char *pkg_name, edit_box_details->guide_txt = DEFAULT_GUIDE_PROXY_IP; edit_box_details->input_panel_cb = input_panel_cb; edit_box_details->input_panel_cb_data = input_panel_cb_data; + edit_box_details->win = win; edit_box_details->item = elm_genlist_item_append(genlist, ip_entry_itc, edit_box_details, NULL, ELM_GENLIST_ITEM_NONE, - _gl_editbox_sel_cb, NULL); + _gl_editbox_sel_cb, edit_box_details); #ifdef ACCESSIBLITY_FEATURE Evas_Object *ao = elm_object_item_access_object_get(edit_box_details->item); elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details); @@ -1325,9 +1379,10 @@ full_ip_info_t *ip_info_append_items(wifi_manager_ap_h ap, const char *pkg_name, edit_box_details->guide_txt = DEFAULT_GUIDE_PROXY_PORT; edit_box_details->input_panel_cb = input_panel_cb; edit_box_details->input_panel_cb_data = input_panel_cb_data; + edit_box_details->win = win; edit_box_details->item = elm_genlist_item_append(genlist, ip_entry_itc, edit_box_details, NULL, ELM_GENLIST_ITEM_NONE, - _gl_editbox_sel_cb, NULL); + _gl_editbox_sel_cb, edit_box_details); #ifdef ACCESSIBLITY_FEATURE ao = elm_object_item_access_object_get(edit_box_details->item); elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _access_info_cb, edit_box_details); diff --git a/sources/libraries/Common/include/common.h b/sources/libraries/Common/include/common.h index 6c9721f..3497f58 100755 --- a/sources/libraries/Common/include/common.h +++ b/sources/libraries/Common/include/common.h @@ -49,6 +49,9 @@ extern "C" #define CUSTOM_GENLIST_PATH \ "/usr/apps/wifi-efl-ug/res/edje/custom_genlist.edj" +#define CUSTOM_POPUP_PATH \ + "/usr/apps/wifi-efl-ug/res/edje/custom_popup.edj" + #define SETUP_WIZARD_EDJ_PATH \ "/usr/apps/wifi-efl-ug/res/edje/setup_wizard.edj" diff --git a/sources/libraries/Common/include/common_ip_info.h b/sources/libraries/Common/include/common_ip_info.h index 5b5cf08..043396e 100755 --- a/sources/libraries/Common/include/common_ip_info.h +++ b/sources/libraries/Common/include/common_ip_info.h @@ -36,6 +36,7 @@ extern "C" typedef struct ip_info_list { const char *str_pkg_name; + Evas_Object *win; Evas_Object *genlist; Elm_Object_Item *ip_toggle_item; Elm_Object_Item *ip_addr_item; @@ -79,7 +80,7 @@ typedef struct full_ip_info { full_ip_info_t *ip_info_append_items(wifi_manager_ap_h ap, const char *pkg_name, Evas_Object *genlist, - imf_ctxt_panel_cb_t input_panel_cb, void *input_panel_cb_data); + imf_ctxt_panel_cb_t input_panel_cb, void *input_panel_cb_data, Evas_Object *win); void ip_info_save_data(full_ip_info_t *ipdata); void ip_info_remove(ip_info_list_t *ip_info_list); void ip_info_close_all_keypads(ip_info_list_t *ip_info_list); diff --git a/sources/libraries/Common/include/common_utils.h b/sources/libraries/Common/include/common_utils.h index 8038c94..94eb616 100755 --- a/sources/libraries/Common/include/common_utils.h +++ b/sources/libraries/Common/include/common_utils.h @@ -62,6 +62,10 @@ typedef struct { void *input_panel_cb_data; const char *str_pkg_name; wifi_manager_ap_h ap; + + /* IoT Common profile only */ + Evas_Object *win; + Evas_Object *popup; } common_utils_entry_info_t; typedef struct { diff --git a/sources/ui-gadget/CMakeLists.txt b/sources/ui-gadget/CMakeLists.txt index ce011ee..c2cb03a 100644 --- a/sources/ui-gadget/CMakeLists.txt +++ b/sources/ui-gadget/CMakeLists.txt @@ -77,6 +77,15 @@ ADD_CUSTOM_TARGET(custom_genlist.edj ADD_DEPENDENCIES(${PROJECT_NAME} custom_genlist.edj) +ADD_CUSTOM_TARGET(custom_popup.edj + COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images + ${CMAKE_CURRENT_SOURCE_DIR}/edcs/custom_popup.edc + ${CMAKE_CURRENT_SOURCE_DIR}/edcs/custom_popup.edj + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/edcs/custom_popup.edc +) + +ADD_DEPENDENCIES(${PROJECT_NAME} custom_popup.edj) + ADD_CUSTOM_TARGET(setup_wizard.edj COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images ${CMAKE_CURRENT_SOURCE_DIR}/edcs/setup_wizard.edc @@ -105,6 +114,7 @@ INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/ug/lib/) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/edcs/main_layout.edj DESTINATION /usr/apps/wifi-efl-ug/res/edje) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/edcs/custom_editfield.edj DESTINATION /usr/apps/wifi-efl-ug/res/edje) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/edcs/custom_genlist.edj DESTINATION /usr/apps/wifi-efl-ug/res/edje) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/edcs/custom_popup.edj DESTINATION /usr/apps/wifi-efl-ug/res/edje) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/edcs/setup_wizard.edj DESTINATION /usr/apps/wifi-efl-ug/res/edje) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/edcs/oobe_buttons.edj DESTINATION /usr/apps/wifi-efl-ug/res/edje) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../wifi-efl-ug.xml DESTINATION /usr/share/packages/) diff --git a/sources/ui-gadget/edcs/custom_popup.edc b/sources/ui-gadget/edcs/custom_popup.edc new file mode 100755 index 0000000..9e90ccd --- /dev/null +++ b/sources/ui-gadget/edcs/custom_popup.edc @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#define CUSTOM_POPUP_LEFT_PADDING 15 +#define CUSTOM_POPUP_EDITFIELD_HEIGHT 96 + +collections { + base_scale: 2.6; + group { name: "custom_popup_input_text"; + parts { + part { name: "pad_l"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + min: CUSTOM_POPUP_LEFT_PADDING 0; + fixed: 1 0; + rel1.relative: 0.0 0.0; + rel2.relative: 0.0 1.0; + align: 0.0 0.0; + } + } + part { name: "pad_r"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + min: CUSTOM_POPUP_LEFT_PADDING 0; + fixed: 1 0; + rel1.relative: 1.0 0.0; + rel2.relative: 1.0 1.0; + align: 1.0 0.0; + } + } + part { name: "elm.swallow.content"; + type: SWALLOW; + scale: 1; + description { state: "default" 0.0; + min: 0 CUSTOM_POPUP_EDITFIELD_HEIGHT; + max: -1 CUSTOM_POPUP_EDITFIELD_HEIGHT; + align: 0.5 0.5; + rel1{ + relative: 1.0 0.0 ; + to_x: "pad_l"; + } + rel2{ + relative: 0.0 1.0; + to_x: "pad_r"; + } + } + } + } + } +} diff --git a/sources/ui-gadget/viewers-layout/view_advanced.c b/sources/ui-gadget/viewers-layout/view_advanced.c index f5b9a48..3413e56 100755 --- a/sources/ui-gadget/viewers-layout/view_advanced.c +++ b/sources/ui-gadget/viewers-layout/view_advanced.c @@ -56,6 +56,7 @@ struct _private_data { struct _private_data g_pd; extern genlist_info_t g_genlist_info[WIFI_GENLIST_STYLE_MAX]; +extern content_size_info_t g_content_size_info; /* Prototype */ static char *_gl_network_notification_text_get(void *data, Evas_Object *obj, const char *part); @@ -278,7 +279,8 @@ static char *_gl_network_notification_text_get(void *data, Evas_Object *obj, con snprintf(buf, 1023, "%s", sc(PACKAGE, I18N_TYPE_Network_notification)); return strdup(buf); } else if (!strcmp(g_genlist_info[WIFI_GENLIST_MULTILINE_STYLE].sub_text_part, part)) { - snprintf(buf, 1023, "%s", + snprintf(buf, 1023, "%s", + g_content_size_info.small_font, sc(PACKAGE, I18N_TYPE_Network_notify_me_later)); return strdup(buf); } diff --git a/sources/ui-gadget/viewers-layout/view_detail.c b/sources/ui-gadget/viewers-layout/view_detail.c index 145ce93..ccc5a47 100755 --- a/sources/ui-gadget/viewers-layout/view_detail.c +++ b/sources/ui-gadget/viewers-layout/view_detail.c @@ -553,8 +553,12 @@ static gboolean __view_detail_load_ip_info_list_cb(void *data) list = elm_object_part_content_get(layout, "elm.swallow.content"); /* Append ip info list */ - _detail_data->ip_info = ip_info_append_items(_detail_data->ap, - PACKAGE, list, __view_detail_imf_ctxt_evnt_cb, navi_it); + if (ug_app_state->ug_type == UG_VIEW_IOT_COMMON) + _detail_data->ip_info = ip_info_append_items(_detail_data->ap, + PACKAGE, list, NULL, NULL, _detail_data->win); + else + _detail_data->ip_info = ip_info_append_items(_detail_data->ap, + PACKAGE, list, __view_detail_imf_ctxt_evnt_cb, navi_it, _detail_data->win); /* Append forget button */ if (ug_app_state->ug_type == UG_VIEW_IOT_COMMON) {