From 362a999de8754588e7042db9a4056f0f3fb644d6 Mon Sep 17 00:00:00 2001 From: Priya Kohli Date: Mon, 3 Jul 2017 12:10:55 +0530 Subject: [PATCH] Fix for Gateway entry box not displaying completely. Added Done/Cancel button to content layout instead of Popup. Change-Id: I512b2029fdfae3626d0c1cf018c94f9e18e36d5d Signed-off-by: Priya Kohli --- res/layout/network.edc | 79 ++++++++++++++++++++++++++++++++++++++++++++- src/view/view_new_network.c | 77 +++++++++++++++++++++---------------------- 2 files changed, 117 insertions(+), 39 deletions(-) diff --git a/res/layout/network.edc b/res/layout/network.edc index ca35d8c..e84f885 100644 --- a/res/layout/network.edc +++ b/res/layout/network.edc @@ -1636,7 +1636,7 @@ group { state, "default" 0.0; rel1.relative, 0.0 0.0; rel2.relative, 1.0 1.0; - min, 1100 546; + min, 1100 678; visible, 0; } } @@ -2155,6 +2155,44 @@ group { name: "grp.content.ip_setting"; align, 0.0 0.0; } } + + part { + name, "padding.cancel.btn"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 0 52; + rel1 { + to, "part.swallow.gateway"; + relative, 0.0 1.0; + } + rel2.to, "part.swallow.gateway"; + fixed, 0 1; + align, 0.0 0.0; + } + } + + part { + name, "part.cancel.btn"; + type, SWALLOW; + scale, 1; + description { + state, "default" 0.0; + align, 1.0 0.0; + fixed, 0 1; + min, 300 80; + max, 300 80; + visible: 1; + rel1 { + relative, 0.0 1.0; + to, "padding.cancel.btn"; + } + rel2 { + to, "padding.cancel.btn"; + } + } + } } } @@ -2329,6 +2367,45 @@ group { name: "grp.content.dns_setting"; align, 0.0 0.0; } } + + part { + name, "padding.done.btn"; + type, SPACER; + scale, 1; + description { + state, "default" 0.0; + min, 0 328; + rel1 { + to, "part.swallow.dns_address"; + relative, 0.0 1.0; + } + rel2.to, "part.swallow.dns_address"; + fixed, 0 1; + align, 0.0 0.0; + } + } + + part { + name, "part.done.btn"; + type, SWALLOW; + scale, 1; + description { + state, "default" 0.0; + align, 0.0 0.0; + fixed, 0 1; + color: 255 0 0 255; + min, 300 80; + max, 300 80; + visible: 1; + rel1 { + relative, 0.0 1.0; + to, "padding.done.btn"; + } + rel2 { + to, "padding.done.btn"; + } + } + } } } diff --git a/src/view/view_new_network.c b/src/view/view_new_network.c index d5c8d22..10b5877 100644 --- a/src/view/view_new_network.c +++ b/src/view/view_new_network.c @@ -1220,6 +1220,7 @@ static bool _draw_config_buttons(struct _priv *priv) static void _create_content_manual(struct _priv *priv) { + Evas_Object *btn_cancel, *btn_done; struct _content_manual *content; if (!priv) { @@ -1373,6 +1374,43 @@ static void _create_content_manual(struct _priv *priv) elm_object_disabled_set(priv->content_manual->address_gateway, EINA_TRUE); elm_object_disabled_set(priv->content_manual->address_dns, EINA_TRUE); + /* Done and cancel button*/ + btn_cancel = elm_button_add(content->layout_content_ip); + if (!btn_cancel) { + _ERR("Add button failed."); + _remove_content_manual(content, priv); + evas_object_del(priv->new_network_popup); + return; + } + elm_object_text_set(btn_cancel, "CANCEL"); + elm_object_part_content_set(content->layout_content_ip, "part.cancel.btn", btn_cancel); + + + btn_done = elm_button_add(content->layout_content_dns); + if (!btn_done) { + _ERR("Add button failed."); + _remove_content_manual(content, priv); + evas_object_del(priv->new_network_popup); + return; + } + elm_object_text_set(btn_done, "DONE"); + elm_object_part_content_set(content->layout_content_dns, "part.done.btn", btn_done); + + priv->btn_cancel = btn_cancel; + priv->btn_done = btn_done; + + evas_object_smart_callback_add(btn_cancel, "focused", _focused_cb, priv); + evas_object_smart_callback_add(btn_cancel, "unfocused", _unfocused_cb, priv); + evas_object_smart_callback_add(btn_done, "focused", _focused_cb, priv); + evas_object_smart_callback_add(btn_done, "unfocused", _unfocused_cb, priv); + + inputmgr_add_callback(btn_cancel, EO_BTN_CANCEL, &_menu_btn_input_handler, priv); + inputmgr_add_callback(btn_done, EO_BTN_DONE, &_menu_btn_input_handler, priv); + + elm_object_focus_next_object_set(btn_cancel, btn_cancel, ELM_FOCUS_LEFT); + elm_object_focus_next_object_set(btn_cancel, btn_cancel, ELM_FOCUS_DOWN); + elm_object_focus_next_object_set(btn_done, btn_done, ELM_FOCUS_RIGHT); + elm_object_focus_next_object_set(btn_done, btn_done, ELM_FOCUS_DOWN); _draw_config_buttons(priv); @@ -1390,7 +1428,6 @@ static Evas_Object *_create(Evas_Object *win, void *data) struct _priv *priv; Evas_Object *base; Evas_Object *popup; - Evas_Object *btn_cancel, *btn_done; layoutmgr *lmgr; if (!win) { @@ -1409,7 +1446,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) return NULL; } - popup = utils_add_popup(win, STYLE_POPUP, STR_NEW_NETWORK, NULL); + popup = utils_add_popup(win, NULL, STR_NEW_NETWORK, NULL); base = utils_add_layout(popup, GRP_VIEW_NEW_NETWORK, EINA_FALSE); if (!base) { @@ -1418,43 +1455,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) return NULL; } - btn_cancel = elm_button_add(popup); - if (!btn_cancel) { - _ERR("Add button failed."); - evas_object_del(popup); - free(priv); - return NULL; - } - elm_object_text_set(btn_cancel, "CANCEL"); - elm_object_part_content_set(popup, "button1", btn_cancel); - - btn_done = elm_button_add(popup); - if (!btn_done) { - _ERR("Add button failed."); - evas_object_del(popup); - free(priv); - return NULL; - } - elm_object_text_set(btn_done, "DONE"); - elm_object_part_content_set(popup, "button2", btn_done); - elm_object_content_set(popup, base); - priv->btn_cancel = btn_cancel; - priv->btn_done = btn_done; - - evas_object_smart_callback_add(btn_cancel, "focused", _focused_cb, priv); - evas_object_smart_callback_add(btn_cancel, "unfocused", _unfocused_cb, priv); - evas_object_smart_callback_add(btn_done, "focused", _focused_cb, priv); - evas_object_smart_callback_add(btn_done, "unfocused", _unfocused_cb, priv); - - inputmgr_add_callback(btn_cancel, EO_BTN_CANCEL, &_menu_btn_input_handler, priv); - inputmgr_add_callback(btn_done, EO_BTN_DONE, &_menu_btn_input_handler, priv); - - elm_object_focus_next_object_set(btn_cancel, btn_cancel, ELM_FOCUS_LEFT); - elm_object_focus_next_object_set(btn_cancel, btn_cancel, ELM_FOCUS_DOWN); - elm_object_focus_next_object_set(btn_done, btn_done, ELM_FOCUS_RIGHT); - elm_object_focus_next_object_set(btn_done, btn_done, ELM_FOCUS_DOWN); - lmgr = layoutmgr_create(base); if (!lmgr) { _ERR("Create layoutmgr failed."); -- 2.7.4