From ab0d01f9ebe96bebd96c7988173c9aa4d731d5ab Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Thu, 22 Dec 2016 17:36:47 +0900 Subject: [PATCH] [TSAM-11730] Apply custom genlist style The layout can resize internal contents. It makes list avoid overap by using layout. Change-Id: Ifc4f44bcfb934eed412dcd0ab8ee3ba19b9f8a84 Signed-off-by: Seonah Moon --- packaging/wifi-efl-ug.spec | 2 +- sources/libraries/Common/common_ip_info.c | 252 +++++++++++------------------- sources/libraries/Common/include/common.h | 3 + sources/ui-gadget/CMakeLists.txt | 10 ++ sources/ui-gadget/edcs/custom_genlist.edc | 113 ++++++++++++++ 5 files changed, 215 insertions(+), 165 deletions(-) create mode 100755 sources/ui-gadget/edcs/custom_genlist.edc diff --git a/packaging/wifi-efl-ug.spec b/packaging/wifi-efl-ug.spec index 08e066a..f6da33f 100644 --- a/packaging/wifi-efl-ug.spec +++ b/packaging/wifi-efl-ug.spec @@ -1,7 +1,7 @@ %define _unpackaged_files_terminate_build 0 Name: wifi-efl-ug Summary: Wi-Fi UI Gadget for TIZEN -Version: 1.0.223 +Version: 1.0.224 Release: 1 Group: App/Network License: Flora-1.1 diff --git a/sources/libraries/Common/common_ip_info.c b/sources/libraries/Common/common_ip_info.c index 90d264b..e4d68da 100755 --- a/sources/libraries/Common/common_ip_info.c +++ b/sources/libraries/Common/common_ip_info.c @@ -113,76 +113,36 @@ static Evas_Object *_ip_info_detail_description_content_get(void *data, retvm_if(NULL == data || NULL == part, NULL); _view_detail_description_data_t* det = - (_view_detail_description_data_t*) data; + (_view_detail_description_data_t*) data; - if (g_strcmp0(part, "elm.swallow.content") == 0) { - Evas_Object *entry = NULL; - Evas_Object *box1 = NULL; - Evas_Object *box2 = NULL; - Evas_Object *tpad = NULL; - Evas_Object *lpad = NULL; - Evas_Object *label1 = NULL; - Evas_Object *label2 = NULL; - int height = 60; - char buf[MAX_LABEL_LENGTH] = {0, }; - - 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); - - box1 = elm_box_add(entry); - evas_object_size_hint_align_set(box1, 0.0, 0.0); - elm_box_horizontal_set(box1, EINA_TRUE); - elm_box_pack_end(entry, box1); - evas_object_show(box1); - - lpad = evas_object_rectangle_add(box1); - evas_object_size_hint_min_set(lpad, ELM_SCALE_SIZE(15), 0); - evas_object_show(lpad); - elm_box_pack_end(box1, lpad); - evas_object_show(box1); - - label1 = elm_label_add(box1); - snprintf(buf, MAX_LABEL_LENGTH, "%s", - dgettext(PACKAGE, det->title)); - elm_object_text_set(label1, buf); - evas_object_size_hint_align_set(label1, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(label1, 0.9, EVAS_HINT_EXPAND); - elm_box_pack_end(box1, label1); - evas_object_show(label1); - - box2 = elm_box_add(entry); - evas_object_size_hint_align_set(box2, EVAS_HINT_FILL, EVAS_HINT_FILL); - elm_box_horizontal_set(box2, EINA_TRUE); - elm_box_pack_end(entry, box2); - - elm_box_pack_end(box2, lpad); - - label2 = elm_label_add(box2); - snprintf(buf, MAX_LABEL_LENGTH, "%s", - dgettext(PACKAGE, det->description)); - elm_object_text_set(label2, buf); - evas_object_size_hint_align_set(label2, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(label2, 0.9, EVAS_HINT_EXPAND); - elm_box_pack_end(box2, label2); - evas_object_show(label2); - - evas_object_show(box2); - elm_box_pack_end(entry, box2); - - evas_object_size_hint_min_set(entry, 0, ELM_SCALE_SIZE(height)); - elm_object_focus_set(entry, EINA_FALSE); - evas_object_show(entry); - - return entry; - } + Evas_Object *layout = NULL; + Evas_Object *title_label = NULL; + Evas_Object *description_label = NULL; + char buf[MAX_LABEL_LENGTH] = {0, }; + + layout = elm_layout_add(obj); + elm_layout_file_set(layout, CUSTOM_GENLIST_PATH, "gl_custom_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); + + title_label = elm_label_add(obj); + snprintf(buf, MAX_LABEL_LENGTH, "%s", dgettext(PACKAGE, det->title)); + + elm_object_text_set(title_label, buf); + evas_object_size_hint_weight_set(title_label, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(title_label, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_part_content_set(layout, "elm.swallow.label", title_label); + + description_label = elm_label_add(obj); + snprintf(buf, MAX_LABEL_LENGTH, "%s", dgettext(PACKAGE, det->description)); + + elm_object_text_set(description_label, buf); + evas_object_size_hint_weight_set(description_label, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(description_label, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_part_content_set(layout, "elm.swallow.content", description_label); __COMMON_FUNC_EXIT__; - return NULL; + return layout; } static void _ip_info_entry_key_enter_cb(void *data, Evas_Object *obj, void *event_info) @@ -481,23 +441,17 @@ static Evas_Object *_ip_info_entry_item_content_get(void *data, Evas_Object *obj return NULL; } - if (g_strcmp0(part, "elm.swallow.content") == 0) { - Evas_Object *entry = NULL; - 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 *guide_txt = NULL; - char *accepted = NULL; - Elm_Input_Panel_Layout panel_type; - int return_key_type; - int height = 60; - char buf[MAX_LABEL_LENGTH] = {0, }; - - switch (entry_info->entry_id) - { + 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; + int return_key_type; + char buf[MAX_LABEL_LENGTH] = {0, }; + + switch (entry_info->entry_id) + { case ENTRY_TYPE_IP_ADDR: case ENTRY_TYPE_SUBNET_MASK: case ENTRY_TYPE_GATEWAY: @@ -523,95 +477,65 @@ static Evas_Object *_ip_info_entry_item_content_get(void *data, Evas_Object *obj break; default: 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); + layout = elm_layout_add(obj); + elm_layout_file_set(layout, CUSTOM_GENLIST_PATH, "gl_custom_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); - label = elm_label_add(box); - snprintf(buf, MAX_LABEL_LENGTH, "%s", + 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); - - editfield = elm_entry_add(layout); - elm_entry_single_line_set(editfield, EINA_TRUE); - elm_entry_scrollable_set(editfield, EINA_TRUE); - - if (!g_strcmp0(entry_info->str_pkg_name, "wifi-qs")) { - elm_entry_input_panel_imdata_set(editfield, "type=systempopup", 16); - } - elm_entry_cnp_mode_set(editfield, ELM_CNP_MODE_PLAINTEXT); - elm_object_part_text_set(editfield, "elm.guide", 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); - } + label = elm_label_add(obj); + evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0); + evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_object_text_set(label, buf); + elm_object_part_content_set(layout, "elm.swallow.label", label); - 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); - } - } + editfield = elm_entry_add(obj); + elm_entry_single_line_set(editfield, EINA_TRUE); + elm_entry_scrollable_set(editfield, EINA_TRUE); - elm_entry_input_panel_return_key_type_set(editfield, return_key_type); - _ip_info_entry_add_callbacks(editfield, entry_info); - elm_object_part_content_set(layout, "elm.swallow.content", editfield); + if (!g_strcmp0(entry_info->str_pkg_name, "wifi-qs")) { + elm_entry_input_panel_imdata_set(editfield, "type=systempopup", 16); + } + elm_entry_cnp_mode_set(editfield, ELM_CNP_MODE_PLAINTEXT); - if (!net_get_device_policy_wifi_profile()) - elm_object_disabled_set(editfield, EINA_TRUE); - else - elm_object_disabled_set(editfield, EINA_FALSE); + elm_object_part_text_set(editfield, "elm.guide", 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); + } - evas_object_show(layout); - elm_box_pack_end(entry, layout); + 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); + } + } - evas_object_size_hint_min_set(entry, 0, ELM_SCALE_SIZE(height)); - elm_object_focus_set(entry, EINA_FALSE); - evas_object_show(entry); + elm_entry_input_panel_return_key_type_set(editfield, return_key_type); + _ip_info_entry_add_callbacks(editfield, entry_info); + elm_object_part_content_set(layout, "elm.swallow.content", editfield); - return entry; - } + if (!net_get_device_policy_wifi_profile()) + elm_object_disabled_set(editfield, EINA_TRUE); + else + elm_object_disabled_set(editfield, EINA_FALSE); - return NULL; + return layout; } static void _ip_info_entry_item_del(void *data, Evas_Object *obj) @@ -1243,14 +1167,14 @@ full_ip_info_t *ip_info_append_items(wifi_ap_h ap, const char *pkg_name, description_itc = elm_genlist_item_class_new(); description_itc->item_style = WIFI_GENLIST_FULL_STYLE; - description_itc->func.text_get = _ip_info_detail_description_text_get; + description_itc->func.text_get = NULL; description_itc->func.content_get = _ip_info_detail_description_content_get; description_itc->func.state_get = NULL; description_itc->func.del = _ip_info_detail_description_del; ip_entry_itc = elm_genlist_item_class_new(); ip_entry_itc->item_style = WIFI_GENLIST_FULL_STYLE; - ip_entry_itc->func.text_get = _ip_info_entry_item_text_get; + ip_entry_itc->func.text_get = NULL; ip_entry_itc->func.content_get = _ip_info_entry_item_content_get; ip_entry_itc->func.state_get = NULL; ip_entry_itc->func.del = _ip_info_entry_item_del; diff --git a/sources/libraries/Common/include/common.h b/sources/libraries/Common/include/common.h index 79ea2c7..109b79b 100755 --- a/sources/libraries/Common/include/common.h +++ b/sources/libraries/Common/include/common.h @@ -46,6 +46,9 @@ extern "C" #define CUSTOM_EDITFIELD_PATH \ "/usr/apps/wifi-efl-ug/res/edje/custom_editfield.edj" #endif +#define CUSTOM_GENLIST_PATH \ + "/usr/apps/wifi-efl-ug/res/edje/custom_genlist.edj" + #define SETUP_WIZARD_EDJ_PATH \ "/usr/apps/wifi-efl-ug/res/edje/setup_wizard.edj" diff --git a/sources/ui-gadget/CMakeLists.txt b/sources/ui-gadget/CMakeLists.txt index 804bd3f..212f44b 100644 --- a/sources/ui-gadget/CMakeLists.txt +++ b/sources/ui-gadget/CMakeLists.txt @@ -59,6 +59,15 @@ ADD_CUSTOM_TARGET(custom_editfield.edj ADD_DEPENDENCIES(${PROJECT_NAME} custom_editfield.edj) +ADD_CUSTOM_TARGET(custom_genlist.edj + COMMAND edje_cc -id ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images + ${CMAKE_CURRENT_SOURCE_DIR}/edcs/custom_genlist.edc + ${CMAKE_CURRENT_SOURCE_DIR}/edcs/custom_genlist.edj + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/edcs/custom_genlist.edc +) + +ADD_DEPENDENCIES(${PROJECT_NAME} custom_genlist.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 @@ -75,6 +84,7 @@ INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/ug/lib/) # install image files 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/setup_wizard.edj DESTINATION /usr/apps/wifi-efl-ug/res/edje) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../resources/images/setting_wifi.png DESTINATION /usr/apps/wifi-efl-ug/res/icons/) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../wifi-efl-ug.xml DESTINATION /usr/share/packages/) diff --git a/sources/ui-gadget/edcs/custom_genlist.edc b/sources/ui-gadget/edcs/custom_genlist.edc new file mode 100755 index 0000000..508bd72 --- /dev/null +++ b/sources/ui-gadget/edcs/custom_genlist.edc @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2015 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. + * + */ + +collections { +base_scale: 1.8; +group { name: "gl_custom_item"; + parts { + part { name: "base"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + min: 0 144; //GENLIST_ITEM_2LINE_HEIGHT + } + } + part { name: "left_padding"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + min: 32 0; + align: 0.0 0.5; + rel1 { to: "base"; relative: 0.0 0.0; } + rel2 { to: "base"; relative: 0.0 1.0; } + fixed: 1 0; + } + } + part { name: "right_padding"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + min: 32 0; + align: 1.0 0.5; + rel1 { to: "base"; relative: 1.0 0.0; } + rel2 { to: "base"; relative: 1.0 1.0; } + fixed: 1 0; + } + } + part { name: "top_padding"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + min: 0 17; + align: 0.5 0.0; + rel1 { to: "base"; } + rel2 { to: "base"; relative: 1.0 0.0; } + fixed: 0 1; + } + } + part { name: "elm.swallow.label"; + type: SWALLOW; + scale: 1; + mouse_events: 0; + description { state: "default" 0.0; + min: 0 41; + 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; + } + fixed: 1 1; + } + } + part { name: "elm.swallow.content"; + type: SWALLOW; + scale: 1; + description { state: "default" 0.0; + align: 0.5 0.0; + rel1 { + to_x: "left_padding"; + to_y: "elm.swallow.label"; + relative: 1.0 1.0; + } + rel2 { + to_x: "right_padding"; + to_y: "bottom_padding"; + relative: 0.0 0.0; + } + fixed: 1 1; + } + } + part { name: "bottom_padding"; + type: SPACER; + scale: 1; + description { state: "default" 0.0; + min: 0 24; + align: 0.5 1.0; + rel1 { to: "base"; relative: 0.0 1.0; } + rel2 { to: "base"; relative: 1.0 1.0; } + fixed: 0 1; + } + } + } +} +} -- 2.7.4