From 2b44f39b641452cf2b932ec18085d7dae9e8a336 Mon Sep 17 00:00:00 2001 From: Jiwan Kim Date: Wed, 9 Nov 2016 15:54:55 +0900 Subject: [PATCH] Add focusing effect on new network menu - Fix for TSAM-9658 - Add focusing effect into buttons - Handle button disable effect properly to prevent additional issues. Change-Id: I226e0d61e0ac9306be2c0cad6208a45d37ae6830 Signed-off-by: Jiwan Kim --- src/view/view_new_network.c | 56 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/src/view/view_new_network.c b/src/view/view_new_network.c index 6de82c8..a830d03 100644 --- a/src/view/view_new_network.c +++ b/src/view/view_new_network.c @@ -93,6 +93,8 @@ struct _priv { struct _connection_data *conn; }; +static bool _update_entry_input_state(struct _priv *priv); + static inline bool _check_entry_filled(Evas_Object *entry) { const char *str = elm_entry_entry_get(entry); @@ -264,6 +266,9 @@ static void _button_clicked(struct _priv *priv, int id, Evas_Object *obj) elm_object_focus_next_object_set(priv->btn_automatic, priv->content_automatic->radio1, ELM_FOCUS_DOWN); elm_object_focus_next_object_set(priv->content_automatic->radio1, priv->btn_automatic, ELM_FOCUS_UP); elm_object_focus_next_object_set(priv->btn_manual, priv->content_automatic->radio1, ELM_FOCUS_DOWN); + + /* Update done button state */ + _update_entry_input_state(priv); break; case EO_BTN_MANUAL: /* Store menu type */ @@ -280,9 +285,17 @@ static void _button_clicked(struct _priv *priv, int id, Evas_Object *obj) /* Prevent losing focus issue */ elm_object_focus_next_object_set(priv->btn_automatic, priv->content_manual->ip1, ELM_FOCUS_DOWN); elm_object_focus_next_object_set(priv->btn_manual, priv->content_manual->ip1, ELM_FOCUS_DOWN); + + /* Update done button state */ + _update_entry_input_state(priv); break; - case EO_BTN_CANCEL: case EO_BTN_DONE: + if (EINA_FALSE == elm_object_disabled_get(priv->btn_done)) { + _set_result(priv, id); + viewmgr_remove_view(VIEW_NEW_NETWORK); + } + break; + case EO_BTN_CANCEL: default: _set_result(priv, id); viewmgr_remove_view(VIEW_NEW_NETWORK); @@ -356,6 +369,7 @@ static input_handler _base_input_handler = { }; static input_handler _menu_btn_input_handler = { + .mouse_move = _mouse_move_cb, .mouse_down = _menu_btn_mouse_down_cb, .key_down = _menu_btn_key_down_cb, }; @@ -540,10 +554,20 @@ static void _key_down_cb(void *data, Evas *e, Evas_Object *obj, void *ei) elm_object_focus_set(priv->btn_done, EINA_TRUE); } } + + /* Update done button state */ + _update_entry_input_state(priv); } static bool _update_entry_input_state(struct _priv *priv) { + if (priv == NULL || + priv->content_manual == NULL || + priv->content_automatic == NULL) + { + return false; + } + if (priv->cur_menu == EO_BTN_AUTOMATIC) { if (elm_radio_value_get(priv->content_automatic->radio1) == 2) { if (!_check_entry_filled(priv->content_automatic->dns_ip1) || @@ -551,8 +575,7 @@ static bool _update_entry_input_state(struct _priv *priv) !_check_entry_filled(priv->content_automatic->dns_ip3) || !_check_entry_filled(priv->content_automatic->dns_ip4)) { - /* TODO: Change button style for disable state */ - //elm_object_disabled_set(priv->btn_done, EINA_TRUE); + elm_object_disabled_set(priv->btn_done, EINA_TRUE); return false; } } @@ -574,8 +597,7 @@ static bool _update_entry_input_state(struct _priv *priv) !_check_entry_filled(priv->content_manual->dns_ip3) || !_check_entry_filled(priv->content_manual->dns_ip4)) { - /* TODO: Change button style for disable state */ - //elm_object_disabled_set(priv->btn_done, EINA_TRUE); + elm_object_disabled_set(priv->btn_done, EINA_TRUE); return false; } } @@ -718,9 +740,15 @@ static void _markup_cb(void *data, Evas_Object *entry, char **text) free(tmp); return; } +} - /* Update done btn state */ - _update_entry_input_state(priv); +static void _imf_delete_event_cb(void *data, Ecore_IMF_Context *ctx, void *event_info) +{ + struct _priv *priv = data; + + /* Update done button state */ + if (priv) + _update_entry_input_state(priv); } static void _remove_ip_address_entry(Evas_Object *obj) @@ -765,7 +793,11 @@ static Evas_Object *_create_ip_address_entry(Evas_Object *parent, ctx = (Ecore_IMF_Context*)elm_entry_imf_context_get(obj); ecore_imf_context_input_panel_event_callback_add(ctx, - ECORE_IMF_INPUT_PANEL_STATE_EVENT, _imf_panel_event_cb, user_data); + ECORE_IMF_INPUT_PANEL_STATE_EVENT, _imf_panel_event_cb, user_data); + + /* Handle 'delete all' button event */ + ecore_imf_context_event_callback_add(ctx, + ECORE_IMF_CALLBACK_DELETE_SURROUNDING, _imf_delete_event_cb, user_data); return obj; } @@ -1134,7 +1166,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) } btn_automatic = utils_add_button(base, "part.new_network.btn.automatic", - STYLE_BASE_BTN, "Automatically"); + STYLE_DISABLE_BTN, "Automatically"); if (!btn_automatic) { _ERR("Add automatic button failed."); evas_object_del(base); @@ -1143,7 +1175,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) } btn_manual = utils_add_button(base, "part.new_network.btn.manual", - STYLE_BASE_BTN, "Enter manually"); + STYLE_DISABLE_BTN, "Enter manually"); if (!btn_manual) { _ERR("Add manual button failed."); evas_object_del(base); @@ -1152,7 +1184,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) } btn_cancel = utils_add_button(base, "part.new_network.btn.cancel", - STYLE_BASE_BTN, "Cancel"); + STYLE_DISABLE_BTN, "Cancel"); if (!btn_cancel) { _ERR("Add cancel button failed."); evas_object_del(base); @@ -1161,7 +1193,7 @@ static Evas_Object *_create(Evas_Object *win, void *data) } btn_done = utils_add_button(base, "part.new_network.btn.done", - STYLE_BASE_BTN, "Done"); + STYLE_DISABLE_BTN, "Done"); if (!btn_done) { _ERR("Add done button failed."); evas_object_del(base); -- 2.7.4