summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJihoon Kim <jihoon48.kim@samsung.com>2017-06-26 13:44:58 +0900
committerJihoon Kim <jihoon48.kim@samsung.com>2017-06-26 13:44:58 +0900
commit1dcf2c814c74e060f9424117690e5a9a72ef3b90 (patch)
treedff6c6c4ee30669a43aab7a139265ce1f3097d5c
parent06d2d040920b8b205d3cae533cd75fddf82ee925 (diff)
downloadefl-1dcf2c814c74e060f9424117690e5a9a72ef3b90.tar.gz
elm_entry: Add prediction hint API
prediction hint can be used to provide an intelligent reply suggestion. @feature
-rw-r--r--src/lib/edje/edje_entry.c17
-rw-r--r--src/lib/edje/edje_object.eo13
-rw-r--r--src/lib/edje/edje_private.h1
-rw-r--r--src/lib/edje/edje_util.c14
-rw-r--r--src/lib/elementary/elm_entry.c20
-rw-r--r--src/lib/elementary/elm_entry.eo6
-rw-r--r--src/lib/elementary/elm_widget_entry.h1
7 files changed, 72 insertions, 0 deletions
diff --git a/src/lib/edje/edje_entry.c b/src/lib/edje/edje_entry.c
index d215a7f40e..8dcc2af1ec 100644
--- a/src/lib/edje/edje_entry.c
+++ b/src/lib/edje/edje_entry.c
@@ -4557,6 +4557,23 @@ _edje_entry_imf_cursor_info_set(Entry *en)
#endif
}
+void
+_edje_entry_prediction_hint_set(Edje_Real_Part *rp, const char *prediction_hint)
+{
+ Entry *en;
+
+ if ((rp->type != EDJE_RP_TYPE_TEXT) ||
+ (!rp->typedata.text)) return;
+ en = rp->typedata.text->entry_data;
+ if (!en) return;
+#ifdef HAVE_ECORE_IMF
+ if (en->imf_context)
+ ecore_imf_context_prediction_hint_set(en->imf_context, prediction_hint);
+#else
+ (void)prediction_hint;
+#endif
+}
+
#ifdef HAVE_ECORE_IMF
static Edje_Real_Part *
diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo
index c2613d1013..42314c3555 100644
--- a/src/lib/edje/edje_object.eo
+++ b/src/lib/edje/edje_object.eo
@@ -1120,6 +1120,19 @@ class Edje.Object (Efl.Canvas.Group.Clipped, Efl.File, Efl.Container, Efl.Part,
ondemand: bool; [[If $true, the input panel will be shown in case of only Mouse up event. (Focus event will be ignored.)]]
}
}
+ @property part_text_prediction_hint {
+ set {
+ [[Sets the prediction hint to use an intelligent reply suggestion service.
+
+ @since 1.20.0]]
+ }
+ keys {
+ part: string; [[The part name]]
+ }
+ values {
+ prediction_hint: string; [[Prediction hint]]
+ }
+ }
/* TEXT PART APIS END ------------------------------------------------ */
@property seat {
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index e255358763..1868f7625d 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -2844,6 +2844,7 @@ void _edje_entry_input_panel_return_key_disabled_set(Edje_Real_Part *rp, Eina_Bo
Eina_Bool _edje_entry_input_panel_return_key_disabled_get(Edje_Real_Part *rp);
void _edje_entry_input_panel_show_on_demand_set(Edje_Real_Part *rp, Eina_Bool ondemand);
Eina_Bool _edje_entry_input_panel_show_on_demand_get(Edje_Real_Part *rp);
+void _edje_entry_prediction_hint_set(Edje_Real_Part *rp, const char *prediction_hint);
Eina_Bool _edje_entry_hide_visible_password(Edje *edje, Edje_Real_Part *rp);
void _edje_external_init(void);
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index e76077e50a..7fd145c85b 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -2672,6 +2672,20 @@ _edje_object_part_text_input_panel_show_on_demand_get(Eo *obj EINA_UNUSED, Edje
return ret;
}
+EOLIAN void
+_edje_object_part_text_prediction_hint_set(Eo *obj EINA_UNUSED, Edje *ed, const char *part, const char *prediction_hint)
+{
+ Edje_Real_Part *rp;
+
+ if ((!ed) || (!part)) return;
+ rp = _edje_real_part_recursive_get(&ed, part);
+ if (!rp) return;
+ if (rp->part->entry_mode > EDJE_ENTRY_EDIT_MODE_NONE)
+ {
+ _edje_entry_prediction_hint_set(rp, prediction_hint);
+ }
+}
+
Eina_Bool
_edje_efl_container_content_set(Edje *ed, const char *part, Efl_Gfx *obj_swallow)
{
diff --git a/src/lib/elementary/elm_entry.c b/src/lib/elementary/elm_entry.c
index c3d36dc84e..0be4d08248 100644
--- a/src/lib/elementary/elm_entry.c
+++ b/src/lib/elementary/elm_entry.c
@@ -907,6 +907,8 @@ _elm_entry_elm_widget_theme_apply(Eo *obj, Elm_Entry_Data *sd)
(sd->entry_edje, "elm.text", sd->input_panel_return_key_disabled);
edje_object_part_text_input_panel_show_on_demand_set
(sd->entry_edje, "elm.text", sd->input_panel_show_on_demand);
+ edje_object_part_text_prediction_hint_set
+ (sd->entry_edje, "elm.text", sd->prediction_hint);
// elm_entry_cursor_pos_set -> cursor,changed -> widget_show_region_set
// -> smart_objects_calculate will call all smart calculate functions,
@@ -3915,6 +3917,12 @@ _elm_entry_efl_canvas_group_group_del(Eo *obj, Elm_Entry_Data *sd)
}
ELM_SAFE_FREE(sd->delay_write, ecore_timer_del);
free(sd->input_panel_imdata);
+
+ if (sd->prediction_hint)
+ {
+ ELM_SAFE_FREE(sd->prediction_hint, free);
+ }
+
eina_stringshare_del(sd->anchor_hover.hover_style);
evas_event_thaw(evas_object_evas_get(obj));
@@ -5216,6 +5224,18 @@ _elm_entry_input_hint_get(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
}
EOLIAN static void
+_elm_entry_prediction_hint_set(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd, const char *prediction_hint)
+{
+ if (sd->prediction_hint)
+ free(sd->prediction_hint);
+
+ sd->prediction_hint = strdup(prediction_hint);
+
+ edje_object_part_text_prediction_hint_set
+ (sd->entry_edje, "elm.text", prediction_hint);
+}
+
+EOLIAN static void
_elm_entry_imf_context_reset(Eo *obj EINA_UNUSED, Elm_Entry_Data *sd)
{
edje_object_part_text_imf_context_reset(sd->entry_edje, "elm.text");
diff --git a/src/lib/elementary/elm_entry.eo b/src/lib/elementary/elm_entry.eo
index cb028fa282..04b43ecc1c 100644
--- a/src/lib/elementary/elm_entry.eo
+++ b/src/lib/elementary/elm_entry.eo
@@ -937,6 +937,12 @@ class Elm.Entry (Elm.Layout, Elm.Interface_Scrollable, Efl.Ui.Clickable,
@in data: void_ptr @optional; [[User data to pass to $func.]]
}
}
+ prediction_hint_set {
+ [[Sets the prediction hint to use an intelligent reply suggestion service.]]
+ params {
+ prediction_hint: string; [[The prediction hint text.]]
+ }
+ }
}
implements {
class.constructor;
diff --git a/src/lib/elementary/elm_widget_entry.h b/src/lib/elementary/elm_widget_entry.h
index e3edb8fd56..10aa893ef8 100644
--- a/src/lib/elementary/elm_widget_entry.h
+++ b/src/lib/elementary/elm_widget_entry.h
@@ -43,6 +43,7 @@ struct _Elm_Entry_Data
/* for deferred appending */
Ecore_Idler *append_text_idler;
char *append_text_left;
+ char *prediction_hint;
int append_text_position;
int append_text_len;
/* Only for clipboard */