[TBT][autofill][Non-ACR][TFDF-10661, Fixed text field box overlap issue ] 82/237282/1
authorNibha Sharma <nibha.sharma@samsung.com>
Fri, 26 Jun 2020 14:35:13 +0000 (20:05 +0530)
committerNibha Sharma <nibha.sharma@samsung.com>
Fri, 26 Jun 2020 14:35:13 +0000 (20:05 +0530)
Change-Id: Ic010dd9ff0a65d7a1778bac6870fab32b3884325
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/2.3.1/wearable_360_360/autofill_viewer.edc
tbtcoreapp/src/model/tbt-list.c
tbtcoreapp/src/view/tbt-autofill-view.c

index 154bac54b96314d4677b9ba72b8d5a874f795493..209e36dd45eb8cae18d3aaae25ff868c6634344b 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 65f3de839e19f345e6fce06fa317672c82ecee10..95fd7a8b5f8b30b9e6f0664f5868ff703cc1592d 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 c67cbc5e9ac652d93069fc7ccbf1084eaa754b78..722f0a55d577d013833828baf7f0504a0615c108 100755 (executable)
@@ -37,6 +37,20 @@ collections
                                        visible: 1;
                                }
                        }
+                       part { name: "main_button";
+                               type: SWALLOW;
+                               description {
+                                       state: "default" 0.0;
+                                       align: 0.0 0.0;
+                                       rel1 {
+                                               relative: 0.3 0.20;
+                                       }
+                                       rel2 {
+                                               relative: 1.0 0.30;
+                                       }
+                                       visible: 1;
+                               }
+                       }
                        WEARABLE_TOOLBAR_PART
                }
        }
index 017ab104d85666434d6a947898e951d92cc1dc6b..40eaf0406087b5dec8f3851689e3de2d01441783 100644 (file)
@@ -2560,7 +2560,7 @@ static tbt_info tbtapps[] =
                        .parent = "Autofill",
                        .apptype = TBT_APP_AUTOFILL,
                        .icon_name = "dummy",
-                       .info = "1. In 'Settings' select 'Autofill service' and then 'Tizen autofill service.'.<br/>2.Launch Autofill TC, enter any string in each field, exit by pressing back key.<br/>3.Lauch Autofill TC again, click on 'Login with Autofill' button.<br/>4.The data entered before will be filled in the entry boxes",
+                       .info = "1. In 'Settings' select 'Autofill service' and then 'Tizen autofill service.'.<br/>2.Launch Autofill TC, enter any string in given field, exit by pressing back key.<br/>3.Lauch Autofill TC again, click on 'Login with Autofill' button.<br/>4.The data entered before will be filled in the entry box",
                        .result = 0
                },
        #endif
index 80d00402229544a32f881aedca62f06bf3b68e94..b3ba0e143aedd296bd8f2fd27cb05b330b51fabb 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");
@@ -74,15 +72,14 @@ static void connection_status_changed_cb(autofill_h ah, autofill_connection_stat
 
 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,7 @@ 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_part_text_set(input_entry1_handle, PART_ENTRY_GUIDE, value);/* show last group item */
 
        if (id)
                free(id);
@@ -108,15 +103,14 @@ 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)
 {
+       DBG("fill_response_multi_item_cb");
        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;
-
-       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);
@@ -138,6 +132,7 @@ static bool fill_response_multi_item_cb(autofill_fill_response_item_h item, void
 
 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 +145,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 +159,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);
@@ -173,8 +171,7 @@ static autofill_view_info_h create_autofill_view_info()
        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);
+       autofill_view_info_add_item(vi_h, ai_h);
 
        if (app_id)
                free(app_id);
@@ -184,6 +181,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 +197,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, 100, 100, 100);
-       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 +217,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 +225,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 +234,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,39 +252,42 @@ 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");
-
-       Evas_Object *table = elm_table_add(parent);
-
-       evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL);
-       evas_object_show(table);
-
-       elm_table_padding_set(table, TABLE_PADDING_HORIZONTAL, TABLE_PADDING_VERTICAL);
-
-       this->btn_autofill = ui_utils_push_button_add(this, table, "Login with Autofill", autofill_app_launch_button_pressed_cb);
-       elm_table_pack(table, this->btn_autofill, 0, 0, 1, 1);
-       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, 80, 280, 40);
-       create_input_field(this->view->layout, &en[1], "password", "Password", true, AUTOFILL_HINT_PASSWORD, 40, 130, 280, 40);
+       DBG("editfield_changed_cb");
+}
 
-       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);
 }
 
+
 autofill_view *autofill_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item)
 {
        RETVM_IF(NULL == navi, NULL, "navi is null");
@@ -372,7 +306,32 @@ 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);
+       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);
+       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);
@@ -395,6 +354,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;
@@ -411,6 +371,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);