From da284dbea244efd29cfa6fcd4c949ae77d644066 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 6 Dec 2017 19:10:24 +0900 Subject: [PATCH] Add demo code for prediction hint data Change-Id: Ie29a777ae1c50dcfd4b36f42741113ce3c7e3fd0 Signed-off-by: Jihoon Kim --- ism/demos/isf_prediction_hint_efl.cpp | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/ism/demos/isf_prediction_hint_efl.cpp b/ism/demos/isf_prediction_hint_efl.cpp index fb8098e..58736fa 100644 --- a/ism/demos/isf_prediction_hint_efl.cpp +++ b/ism/demos/isf_prediction_hint_efl.cpp @@ -25,7 +25,7 @@ #include "isf_demo_efl.h" #include "isf_prediction_hint_efl.h" -static Evas_Object *_create_ef_layout (Evas_Object *parent, const char *label, const char *guide_text, const char *prediction_hint) +static Evas_Object *_create_ef_layout (Evas_Object *parent, const char *label, const char *guide_text, const char *prediction_hint, const char *res_id, Ecore_IMF_Input_Hints input_hints = ECORE_IMF_INPUT_HINT_NONE) { Evas_Object *en; Evas_Object *ef = create_ef (parent, label, guide_text, &en); @@ -33,8 +33,19 @@ static Evas_Object *_create_ef_layout (Evas_Object *parent, const char *label, c Ecore_IMF_Context *ic = NULL; ic = (Ecore_IMF_Context *)elm_entry_imf_context_get (en); + if (ic) { + if (prediction_hint) + ecore_imf_context_prediction_hint_set (ic, prediction_hint); - ecore_imf_context_prediction_hint_set (ic, prediction_hint); + ecore_imf_context_prediction_hint_hash_set (ic, "appid", "isf-demo-efl"); + if (res_id) + ecore_imf_context_prediction_hint_hash_set (ic, "res_id", res_id); + + if (input_hints != ECORE_IMF_INPUT_HINT_NONE) { + input_hints = (Ecore_IMF_Input_Hints)(ecore_imf_context_input_hint_get(ic) | input_hints); + ecore_imf_context_input_hint_set(ic, input_hints); + } + } return ef; } @@ -55,12 +66,24 @@ static Evas_Object * create_inner_layout (void *data) /* Prediction hint = How are you? */ const char *prediction_hint; prediction_hint = "How are you?"; - ef = _create_ef_layout (parent, _("Text: How are you?"), _("click to enter"), prediction_hint); + ef = _create_ef_layout (parent, _("Text: How are you?"), _("click to enter"), prediction_hint, NULL); elm_box_pack_end (bx, ef); /* Prediction hint = What's the weather? */ prediction_hint = "What's the weather?"; - ef = _create_ef_layout (parent, _("Text: What's the weather?"), _("click to enter"), prediction_hint); + ef = _create_ef_layout (parent, _("Text: What's the weather?"), _("click to enter"), prediction_hint, NULL); + elm_box_pack_end (bx, ef); + + /* Name */ + ef = _create_ef_layout (parent, _("Name"), _("click to enter"), NULL, "name", ECORE_IMF_INPUT_HINT_AUTOFILL_NAME); + elm_box_pack_end (bx, ef); + + /* Email */ + ef = _create_ef_layout (parent, _("Email"), _("click to enter"), NULL, "email", ECORE_IMF_INPUT_HINT_AUTOFILL_EMAIL_ADDRESS); + elm_box_pack_end (bx, ef); + + /* Address */ + ef = _create_ef_layout (parent, _("Address"), _("click to enter"), NULL, "address", ECORE_IMF_INPUT_HINT_AUTOFILL_POSTAL_ADDRESS); elm_box_pack_end (bx, ef); return bx; -- 2.7.4