[TBT][NonACR][Autofill][TFDF-10661,Textbox overlapping issue fix] 64/237464/2
authorNibha Sharma <nibha.sharma@samsung.com>
Tue, 30 Jun 2020 12:35:41 +0000 (18:05 +0530)
committerNibha Sharma <nibha.sharma@samsung.com>
Tue, 30 Jun 2020 12:41:07 +0000 (12:41 +0000)
Change-Id: I178a6ec2b86125bc3b450a6f29e030338086a0dd
Signed-off-by: Nibha Sharma <nibha.sharma@samsung.com>
release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk
release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk
tbtcoreapp/res/edje/3.0/mobile/autofill_viewer.edc
tbtcoreapp/src/model/tbt-list.c
tbtcoreapp/src/view/tbt-autofill-view.c

index 175c1da..ce509f9 100755 (executable)
Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk differ
index 2c1c578..5b63d35 100755 (executable)
Binary files a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk differ
index 81268b4..98ad294 100755 (executable)
@@ -34,7 +34,7 @@ collections
                                        visible: 1;
                                }
                        }
-                       part { name: "textbox_part";
+                       part { name: "main_button";
                                type: SWALLOW;
                                description {
                                        state: "default" 0.0;
index 5935b71..a03661a 100755 (executable)
@@ -2938,7 +2938,7 @@ static tbt_info tbtapps[] =
                        .parent = "Autofill",
                        .apptype = TBT_APP_AUTOFILL,
                        .icon_name = "dummy",
-                       .info = "1. In 'Settings' select 'Language and input'.<br/>2.Select 'Autofill service' menu and then 'Tizen autofill service sample'.<br/>3.Launch Autofill TC, enter any string in each field, exit by pressing back key.<br/>4.Lauch Autofill TC again, click on 'Login with Autofill' button.<br/>5.The data entered before will be filled in the entry boxes",
+                       .info = "1. In 'Settings' select 'Language and input'.<br/>2.Select 'Autofill service' menu and then 'Tizen autofill service sample'.<br/>3.Launch Autofill TC, enter any string on the label, exit by pressing back key.<br/>4.Lauch Autofill TC again, click on 'Login with Autofill' button.<br/>5.The data entered before will be filled on the label",
                        .result = 0
                },
        #endif
index 13be90f..b638ed5 100755 (executable)
@@ -38,25 +38,23 @@ struct _autofill_view
 {
        common_view* view;
        Evas_Object* btn_autofill;
+       Evas_Object* btn_main;
+       Evas_Object *input_entry1;
+       Evas_Object* input_field_entry;
 };
 
-struct _Entry
-{
-       Evas_Object                             *entry_bg;
-       Evas_Object                             *entry_obj;
-       autofill_item_h                 ai_h;
-       autofill_save_item_h    si_h;
-};
-typedef struct _Entry Entry;
-static Entry en[2];
-
+Evas_Object *input_entry1_handle;
+static autofill_item_h        ai_h;
+static autofill_save_item_h   si_h;
 static autofill_h g_ah = NULL;
+char *value = NULL;
 
 static void _app_destroy_cb(void* this);
 static void save_autofill_view_info(autofill_h ah);
 
 static void connection_status_changed_cb(autofill_h ah, autofill_connection_status_e status, void *user_data)
 {
+       DBG("connection_status_changed_cb");
        switch (status) {
                case AUTOFILL_CONNECTION_STATUS_CONNECTED:
                        DBG("connected");
@@ -69,20 +67,19 @@ static void connection_status_changed_cb(autofill_h ah, autofill_connection_stat
                        break;
                default:
                        break;
-       }
+    }
 }
 
 static bool fill_response_item_cb(autofill_fill_response_item_h item, void *user_data)
 {
+       DBG("fill_response_item_cb");
        char *id = NULL;
        char *value = NULL;
        char *presentation_text = NULL;
 
        char *id1 = NULL, *id2 = NULL;
-
-       autofill_item_get_id(en[0].ai_h, &id1);
-       autofill_item_get_id(en[1].ai_h, &id2);
-
+  
+       autofill_item_get_id(ai_h, &id1);
        autofill_fill_response_item_get_id(item, &id);
        autofill_fill_response_item_get_presentation_text(item, &presentation_text);
        autofill_fill_response_item_get_value(item, &value);
@@ -90,9 +87,8 @@ static bool fill_response_item_cb(autofill_fill_response_item_h item, void *user
        DBG("id : %s, value : %s, presentation text : %s", id, value, presentation_text);
 
        if (id1 && strcmp(id, id1) == 0)
-               elm_object_text_set(en[0].entry_obj, value);/* show last group item */
-       else if (id2 && strcmp(id, id2) == 0)
-               elm_object_text_set(en[1].entry_obj, value);
+               elm_object_text_set(input_entry1_handle, value);
+               // elm_object_part_text_set(input_entry1_handle, PART_ENTRY_GUIDE, value);/* show last group item */
 
        if (id)
                free(id);
@@ -108,36 +104,36 @@ static bool fill_response_item_cb(autofill_fill_response_item_h item, void *user
 
 static bool fill_response_multi_item_cb(autofill_fill_response_item_h item, void *user_data)
 {
-    char *id = NULL;
-    char *value = NULL;
-    char *presentation_text = NULL;
-    char *id1 = NULL, *id2 = NULL;
-
-    autofill_fill_response_group_h group_h = (autofill_fill_response_group_h)user_data;
+       DBG("fill_response_multi_item_cb");
+       char *id = NULL;
+       char *value = NULL;
+       char *presentation_text = NULL;
+       char *id1 = NULL, *id2 = NULL;
 
-    autofill_item_get_id(en[0].ai_h, &id1);
-    autofill_item_get_id(en[1].ai_h, &id2);
+       autofill_fill_response_group_h group_h = (autofill_fill_response_group_h)user_data;
+       autofill_item_get_id(ai_h, &id1);
 
-    autofill_fill_response_item_get_id(item, &id);
-    autofill_fill_response_item_get_presentation_text(item, &presentation_text);
-    autofill_fill_response_item_get_value(item, &value);
+       autofill_fill_response_item_get_id(item, &id);
+       autofill_fill_response_item_get_presentation_text(item, &presentation_text);
+       autofill_fill_response_item_get_value(item, &value);
 
-    DBG("id : %s, value : %s, presentation text : %s", id, value, presentation_text);
+       DBG("id : %s, value : %s, presentation text : %s", id, value, presentation_text);
 
-    if (id)
-        free(id);
+       if (id)
+               free(id);
 
-    if (value)
-        free(value);
+       if (value)
+               free(value);
 
-    if (presentation_text)
-        free(presentation_text);
+       if (presentation_text)
+               free(presentation_text);
 
-    return true;
+       return true;
 }
 
 static bool fill_response_group_cb(autofill_fill_response_group_h group_h, void *user_data)
 {
+       DBG("fill_response_group_cb");
        int count = *(int *)user_data;
 
        if (count == 1)
@@ -150,6 +146,7 @@ static bool fill_response_group_cb(autofill_fill_response_group_h group_h, void
 
 static void fill_response_received_cb(autofill_h ah, autofill_fill_response_h fill_response, void *data)
 {
+       DBG("fill_response_received_cb");
        if (!fill_response)
                return;
 
@@ -163,6 +160,8 @@ static void fill_response_received_cb(autofill_h ah, autofill_fill_response_h fi
 
 static autofill_view_info_h create_autofill_view_info()
 {
+       
+       DBG("create_autofill_view_info");
        autofill_view_info_h vi_h;
        char *app_id = NULL;
        app_get_id(&app_id);
@@ -172,9 +171,8 @@ static autofill_view_info_h create_autofill_view_info()
        autofill_view_info_set_app_id(vi_h, app_id);
        autofill_view_info_set_view_id(vi_h, "login");
 
-    /* append autofill item in autofill view */
-       autofill_view_info_add_item(vi_h, en[0].ai_h);
-       autofill_view_info_add_item(vi_h, en[1].ai_h);
+       /* append autofill item in autofill view */
+       autofill_view_info_add_item(vi_h, ai_h);
 
        if (app_id)
                free(app_id);
@@ -184,6 +182,7 @@ static autofill_view_info_h create_autofill_view_info()
 
 static void send_fill_request(autofill_h ah)
 {
+       DBG("send_fill_request");
        autofill_view_info_h vi_h = create_autofill_view_info();
 
        /* Set callback function for receiving autofill fill response */
@@ -199,87 +198,19 @@ static void send_fill_request(autofill_h ah)
        autofill_view_info_destroy(vi_h);
 }
 
-static void delete_input_field(Entry *en)
-{
-       if (!en) return;
-
-       if (en->ai_h) {
-               autofill_item_destroy(en->ai_h);
-               en->ai_h = NULL;
-       }
-
-       if (en->si_h) {
-               autofill_save_item_destroy(en->si_h);
-               en->si_h = NULL;
-       }
-
-       if (en->entry_bg) {
-               evas_object_del(en->entry_bg);
-               en->entry_bg = NULL;
-       }
-
-       if (en->entry_obj) {
-               evas_object_del(en->entry_obj);
-               en->entry_obj = NULL;
-       }
-}
-
-static void entry_del_cb(void *data, Evas *e, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED)
-{
-       Entry *en = data;
-       save_autofill_view_info(g_ah);
-       delete_input_field(en);
-}
-
-static void
-create_input_field(Evas_Object *win, Entry *en, const char *id, const char *label, bool sensitive, autofill_hint_e autofill_hint, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
-{
-       if (!en) return;
-
-       // create the background for text input field
-       en->entry_bg = elm_bg_add(win);
-       elm_bg_color_set(en->entry_bg, 200, 200, 200);
-       elm_object_focus_allow_set(en->entry_bg, EINA_TRUE);
-       evas_object_move(en->entry_bg, x, y);
-       evas_object_resize(en->entry_bg, w, h);
-       evas_object_show(en->entry_bg);
-       evas_object_data_set(en->entry_bg, "Entry", en);
-
-       en->entry_obj = elm_entry_add(win);
-       evas_object_move(en->entry_obj, x, y);
-       evas_object_resize(en->entry_obj, w, h);
-       evas_object_show(en->entry_obj);
-
-       // create autofill item
-       autofill_item_create(&en->ai_h);
-       autofill_item_set_autofill_hint(en->ai_h, autofill_hint);
-       autofill_item_set_id(en->ai_h, id);
-       autofill_item_set_label(en->ai_h, label);
-       autofill_item_set_sensitive_data(en->ai_h, sensitive);
-       DBG("en : %p, ai_h : %p\n", &en, en->ai_h);
-
-       // create autofill item for save
-       autofill_save_item_create(&en->si_h);
-       autofill_save_item_set_autofill_hint(en->si_h, autofill_hint);
-       autofill_save_item_set_id(en->si_h, id);
-       autofill_save_item_set_label(en->si_h, label);
-       autofill_save_item_set_sensitive_data(en->si_h, sensitive);
-       DBG("en : %p, si_h : %p\n", &en, en->si_h);
-
-       // register callback
-       evas_object_event_callback_add(en->entry_obj, EVAS_CALLBACK_DEL, entry_del_cb, en);
-}
-
-static void save_autofill_item(Entry *en)
+static void save_autofill_item()
 {
+       DBG("save_autofill_item");
        const char *str;
        char *plain_str;
-
-       str = elm_object_text_get(en->entry_obj);
+       str = elm_entry_entry_get(input_entry1_handle);
+   if (!str || (strlen(str) == 0))
+      return;
+       // str = elm_object_text_get(en->entry_obj);
        DBG("str = %s\n", str);
        plain_str = elm_entry_markup_to_utf8(str);
        DBG("plain_str = %s\n", plain_str);
-       autofill_save_item_set_value(en->si_h, plain_str ? plain_str : "");
+       autofill_save_item_set_value(si_h, plain_str ? plain_str : "");
 
        if (plain_str)
                free(plain_str);
@@ -287,6 +218,7 @@ static void save_autofill_item(Entry *en)
 
 static void save_autofill_view_info(autofill_h ah)
 {
+       DBG("save_autofill_view_info");
        int ret;
        char *app_id;
        autofill_save_view_info_h svi_h = NULL;
@@ -294,8 +226,8 @@ static void save_autofill_view_info(autofill_h ah)
        app_get_id(&app_id);
 
        /* create autofill item for saving */
-       save_autofill_item(&en[0]);
-       save_autofill_item(&en[1]);
+       save_autofill_item();
+       // save_autofill_item(&en[1]);
 
        /* create autofill save view info */
        autofill_save_view_info_create(&svi_h);
@@ -303,8 +235,8 @@ static void save_autofill_view_info(autofill_h ah)
        autofill_save_view_info_set_view_id(svi_h, "login");
 
        /* append autofill save item in autofill save view */
-       autofill_save_view_info_add_item(svi_h, en[0].si_h);
-       autofill_save_view_info_add_item(svi_h, en[1].si_h);
+       autofill_save_view_info_add_item(svi_h, si_h);
+       // autofill_save_view_info_add_item(svi_h, en[1].si_h);
 
        if (app_id)
                free(app_id);
@@ -321,30 +253,44 @@ static void save_autofill_view_info(autofill_h ah)
 
 static void win_focus_out_cb(void *data, Evas_Object *obj, void *event_info)
 {
+       DBG("win_focus_out_cb");
        RETM_IF(NULL == g_ah, "g_ah is NULL");
        save_autofill_view_info(g_ah);
+       // evas_object_hide(obj);
 }
 
-static void autofill_app_launch_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
+static void entry_del_cb(void *data, Evas *e, Evas_Object *o EINA_UNUSED, void *event_info EINA_UNUSED)
 {
-       send_fill_request(g_ah);
+       DBG("Entry delete");
+       save_autofill_view_info(g_ah);
+       if (ai_h) {
+               autofill_item_destroy(ai_h);
+               ai_h = NULL;
+       }
+
+       if (si_h) {
+               autofill_save_item_destroy(si_h);
+               si_h = NULL;
+       }
 }
 
-static void add_control_layout(autofill_view *this, Evas_Object *parent)
+static void editfield_changed_cb(void *data, Evas_Object *obj, void *event_info)
 {
-       RETM_IF(NULL == this, "view is NULL");
-
-       this->btn_autofill = ui_utils_push_button_add(this, parent, "Login with Autofill", autofill_app_launch_button_pressed_cb);
-       elm_object_part_content_set(this->view->layout, "controller_part", this->btn_autofill);
-
-       memset(&en[0], 0, sizeof(en[0]));
-       memset(&en[1], 0, sizeof(en[1]));
-       create_input_field(this->view->layout, &en[0], "id", "ID", false, AUTOFILL_HINT_ID, 40, 150, 640, 60);
-       create_input_field(this->view->layout, &en[1], "password", "Password", true, AUTOFILL_HINT_PASSWORD, 40, 230, 640, 60);
+       DBG("editfield_changed_cb");
+       save_autofill_view_info(g_ah);
+}
 
-       evas_object_smart_callback_add(parent, "unfocused", win_focus_out_cb, NULL);
+static void autofill_app_launch_button_pressed_cb(void *data, Evas_Object *obj, void *event_info)
+{
+       autofill_view *this = NULL;
+       this = (autofill_view*)data;
+       RETM_IF(NULL == this, "autofill_view is NULL");
+       DBG("autofill_app_launch_button_pressed_cb");
+       send_fill_request(g_ah);
+       save_autofill_view_info(g_ah);
 }
 
+
 autofill_view *autofill_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item)
 {
        RETVM_IF(NULL == navi, NULL, "navi is null");
@@ -363,7 +309,34 @@ autofill_view *autofill_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Obje
        common_view_add(navi, tbt_info, item, this->view, _app_destroy_cb, this);
        RETVM_IF(NULL == this->view, NULL, "navi is null");
 
-       add_control_layout(this, this->view->layout);
+       this->input_entry1 = ui_utils_entry_add(this, this->view->layout,  ELM_INPUT_PANEL_LAYOUT_NORMAL, "");
+       elm_entry_input_panel_language_set(this->input_entry1, ELM_INPUT_PANEL_LANG_AUTOMATIC);
+       Elm_Input_Panel_Lang lang = elm_entry_input_panel_language_get(this->input_entry1);
+       char msg[100];
+       snprintf(msg, sizeof(msg), "Autofill Input : %d", lang );
+       elm_object_part_text_set(this->input_entry1, PART_ENTRY_GUIDE, msg);
+       // elm_object_text_set(this->input_entry1, ui_utils_text_add(PART_ENTRY_GUIDE, msg));
+       input_entry1_handle = this->input_entry1;
+       elm_object_part_content_set(this->view->layout, "main_button", this->input_entry1);
+       evas_object_smart_callback_add(this->input_entry1, "changed", editfield_changed_cb, this->view->layout);
+       evas_object_smart_callback_add(this->input_entry1, "preedit,changed", editfield_changed_cb, this->view->layout);
+
+       this->btn_autofill = ui_utils_push_button_add(this, this->view->layout, "Login with Autofill", autofill_app_launch_button_pressed_cb);
+       elm_object_part_content_set(this->view->layout, "controller_part", this->btn_autofill);
+       evas_object_event_callback_add(this->input_entry1, EVAS_CALLBACK_DEL, entry_del_cb, this->view->layout);
+       evas_object_smart_callback_add(this->view->layout, "unfocused", win_focus_out_cb, NULL);
+       autofill_item_create(&ai_h);
+       autofill_item_set_autofill_hint(ai_h, AUTOFILL_HINT_ID);
+       autofill_item_set_id(ai_h, "id");
+       autofill_item_set_label(ai_h, "ID");
+       autofill_item_set_sensitive_data(ai_h, false);
+
+       // create autofill item for save
+       autofill_save_item_create(&si_h);
+       autofill_save_item_set_autofill_hint(si_h, AUTOFILL_HINT_ID);
+       autofill_save_item_set_id(si_h, "id");
+       autofill_save_item_set_label(si_h, "ID");
+       autofill_save_item_set_sensitive_data(si_h, false);
 
        int ret;
        ret = autofill_create(&g_ah);
@@ -386,6 +359,7 @@ autofill_view *autofill_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Obje
 
 static void _app_destroy_cb(void* this)
 {
+       DBG("_app_destroy_cb");
        RETM_IF(NULL == this, "data is NULL");
 
        autofill_view *view = NULL;
@@ -402,6 +376,7 @@ static void _app_destroy_cb(void* this)
 
 static void app_terminate(void *data)
 {
+       DBG("app_terminate");
        RETM_IF(NULL == g_ah, "g_ah is NULL");
        save_autofill_view_info(g_ah);
        autofill_destroy(g_ah);