[Email] Add magnifier icon into entry guide text for search style 44/84644/3
authorAndriy Kolesnichenko <a.kolesniche@samsung.com>
Fri, 19 Aug 2016 15:08:16 +0000 (18:08 +0300)
committerAndriy Kolesnichenko <a.kolesniche@samsung.com>
Thu, 25 Aug 2016 13:38:11 +0000 (16:38 +0300)
Change-Id: Ie06085139c97b28b73558abe900de85be4213c0a
Signed-off-by: Andriy Kolesnichenko <a.kolesniche@samsung.com>
common/src/email-editfield-utils.c

index 2b89dfe..e2c0f48 100644 (file)
@@ -23,6 +23,7 @@
 #define SEARCH_TITLE_COLOR_GUIDE_TEXT_FOCUSED "<font_size=40><color=#EAEAEA91>"
 #define SEARCH_TITLE_COLOR_GUIDE_TEXT_UNFOCUSED "<font_size=40><color=#EAEAEA6D>"
 #define SEARCH_TITLE_COLOR_GUIDE_TEXT_END_TEXT_TAG "</color></font_size>"
+#define SEARCH_ENTRY_GUIDE_SYMBOL_MAGNIFIER "\uf897"
 #define SEARCH_ENTRY_GUIDE_TEXT_SIZE 512
 
 static void _editfield_focused_cb(void *data, Evas_Object *obj, void *event_info);
@@ -34,6 +35,7 @@ static void _editfield_search_title_unfocused_cb(void *data, Evas_Object *obj, v
 static void _editfield_with_clear_btn_changed_cb(void *data, Evas_Object *obj, void *event_info);
 static void _clear_button_clicked_cb(void *data, Evas_Object *obj, void *event_info);
 static void _editfield_search_title_entry_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info);
+static void _editfield_search_title_guide_text_update(Evas_Object *entry, Eina_Bool is_entry_focused);
 static void _on_system_settings_change_cb(system_settings_key_e key, void *user_data);
 
 void email_common_util_editfield_create(Evas_Object *parent, int flags, email_editfield_t *editfield)
@@ -100,6 +102,9 @@ void email_common_util_editfield_create(Evas_Object *parent, int flags, email_ed
 
                /* additional callback for changing guide text color on unfocus event */
                evas_object_smart_callback_add(entry, "unfocused", _editfield_search_title_unfocused_cb, editfield);
+
+               /*set guide text "Search"*/
+               _editfield_search_title_guide_text_update(entry, EINA_FALSE);
        }
 
        if (flags & EF_PASSWORD) {
@@ -177,11 +182,8 @@ static void _editfield_search_title_focused_cb(void *data, Evas_Object *obj, voi
 {
        debug_enter();
        retm_if(!data, "Invalid parameter: data is NULL!");
-
        email_editfield_t *editfield = (email_editfield_t *)data;
-       char temp[SEARCH_ENTRY_GUIDE_TEXT_SIZE] = { 0 };
-       snprintf(temp, sizeof(temp), "%s%s%s", SEARCH_TITLE_COLOR_GUIDE_TEXT_FOCUSED, _("IDS_EMAIL_OPT_SEARCH"), SEARCH_TITLE_COLOR_GUIDE_TEXT_END_TEXT_TAG);
-       elm_object_part_text_set(editfield->entry, "elm.guide", temp);
+       _editfield_search_title_guide_text_update(editfield->entry, EINA_TRUE);
 
        debug_leave();
 }
@@ -190,11 +192,27 @@ static void _editfield_search_title_unfocused_cb(void *data, Evas_Object *obj, v
 {
        debug_enter();
        retm_if(!data, "Invalid parameter: data is NULL!");
-
        email_editfield_t *editfield = (email_editfield_t *)data;
+       _editfield_search_title_guide_text_update(editfield->entry, EINA_FALSE);
+
+       debug_leave();
+}
+
+static void _editfield_search_title_guide_text_update(Evas_Object *entry, Eina_Bool is_entry_focused)
+{
+       debug_enter();
+       retm_if(!entry, "Invalid parameter: data is NULL!");
+
        char temp[SEARCH_ENTRY_GUIDE_TEXT_SIZE] = { 0 };
-       snprintf(temp, sizeof(temp), "%s%s%s", SEARCH_TITLE_COLOR_GUIDE_TEXT_UNFOCUSED, _("IDS_EMAIL_OPT_SEARCH"), SEARCH_TITLE_COLOR_GUIDE_TEXT_END_TEXT_TAG);
-       elm_object_part_text_set(editfield->entry, "elm.guide", temp);
+       const char *start_tag_string = NULL;
+
+       if (is_entry_focused) {
+               start_tag_string = SEARCH_TITLE_COLOR_GUIDE_TEXT_FOCUSED;
+       } else {
+               start_tag_string = SEARCH_TITLE_COLOR_GUIDE_TEXT_UNFOCUSED;
+       }
+       snprintf(temp, sizeof(temp), "%s%s %s%s", start_tag_string, SEARCH_ENTRY_GUIDE_SYMBOL_MAGNIFIER, _("IDS_EMAIL_OPT_SEARCH"), SEARCH_TITLE_COLOR_GUIDE_TEXT_END_TEXT_TAG);
+       elm_object_part_text_set(entry, "elm.guide", temp);
 
        debug_leave();
 }
@@ -251,29 +269,23 @@ static void _editfield_unfocused_cb(void *data, Evas_Object *obj, void *event_in
 
 static void _editfield_search_title_entry_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
 {
+       debug_enter();
+       retm_if(!data, "Invalid parameter: data is NULL!");
        email_editfield_t *editfield = (email_editfield_t *)data;
        editfield->entry = NULL;
 
        email_unregister_accessibility_font_size_changed_callback(_on_system_settings_change_cb);
        email_unregister_language_changed_callback(_on_system_settings_change_cb);
+       debug_leave();
 }
 
 static void _on_system_settings_change_cb(system_settings_key_e key, void *data)
 {
-       email_editfield_t *editfield = (email_editfield_t *)data;
-
-       if (!editfield->entry) {
-               return;
-       }
+       debug_enter();
+       retm_if(!data, "Invalid parameter: data is NULL!");
 
-       char temp[SEARCH_ENTRY_GUIDE_TEXT_SIZE] = { 0 };
-       const char *start_tag_string = NULL;
+       email_editfield_t *editfield = (email_editfield_t *)data;
+       _editfield_search_title_guide_text_update(editfield->entry, elm_object_focus_get(editfield->entry));
 
-       if (elm_object_focus_get(editfield->entry)) {
-               start_tag_string = SEARCH_TITLE_COLOR_GUIDE_TEXT_FOCUSED;
-       } else {
-               start_tag_string = SEARCH_TITLE_COLOR_GUIDE_TEXT_UNFOCUSED;
-       }
-       snprintf(temp, sizeof(temp), "%s%s%s", start_tag_string, _("IDS_EMAIL_OPT_SEARCH"), SEARCH_TITLE_COLOR_GUIDE_TEXT_END_TEXT_TAG);
-       elm_object_part_text_set(editfield->entry, "elm.guide", temp);
+       debug_leave();
 }