InputKeyboardData g_input_keyboard_data;
InputTypeData g_input_type_data;
+InputTemplateData g_input_template_data;
+
static Elm_Object_Item *it_empty;
static Elm_Object_Item *it_title;
void _update_genlist_items(void *user_data);
unsigned int _update_smartreply_items(void *user_data);
unsigned int _update_template_items(void *user_data);
+unsigned int _update_user_template_items(void *user_data);
static void _popup_close_cb(void *data, Evas_Object *obj, void *event_info);
static void _popup_back_cb(void *data, Evas_Object *obj, void *event_info);
static void input_type_deinit(void);
}
}
+static void __ise_user_template_gl_sel(void *data, Evas_Object *obj, void *event_info)
+{
+ Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+ int index = 0;
+
+ if (item) {
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ index = (uintptr_t) elm_object_item_data_get(item);
+
+ if (index < (int)g_input_template_data.input_template_array_len) {
+ reply_to_sender_by_callback(g_input_template_data.input_template_array[index], "user_template", NULL, NULL);
+ ui_app_exit();
+ }
+ }
+}
+
static char * __ise_template_gl_text_get(void *data, Evas_Object *obj, const char *part)
{
if (!strcmp(part, "elm.text")) {
return NULL;
}
+static char * __ise_user_template_gl_text_get(void *data, Evas_Object *obj, const char *part)
+{
+ if (!strcmp(part, "elm.text")) {
+ unsigned int index = (uintptr_t)data;
+ if (index < (unsigned int)g_input_template_data.input_template_array_len) {
+ if (g_input_template_data.input_template_array[index] != NULL) {
+ return strdup(g_input_template_data.input_template_array[index]);
+ }
+ }
+ }
+ return NULL;
+}
+
static Evas_Object * __ise_gl_2button_content_get(void *data, Evas_Object *obj, const char *part)
{
char *first_input_type = *(g_input_type_data.input_type_array + 0);
ELM_GENLIST_ITEM_NONE,
NULL, NULL);
}
+
elm_genlist_item_select_mode_set(it_title, ELM_OBJECT_SELECT_MODE_NONE);
g_template_item_size = _update_template_items(app_data);
g_template_item_size = _update_template_items(user_data);
+ if (g_input_template_data.input_template_array_len > 0) {
+ _update_user_template_items(user_data);
+ }
+
/* Update genlist item position */
Elm_Object_Item *item = elm_genlist_item_next_get(it_title);
elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
itc0->func.state_get = NULL;
itc0->func.del = NULL;
+ if (g_input_template_data.input_template_array_len < 1) {
+ it_empty = elm_genlist_item_append(app_data->genlist, itc0,
+ NULL, NULL,
+ ELM_GENLIST_ITEM_NONE,
+ NULL, NULL);
+ }
+ elm_genlist_item_class_free(itc0);
+ }
+
+ return item_size;
+}
+
+unsigned int _update_user_template_items(void *user_data)
+{
+ App_Data* app_data;
+
+ Elm_Object_Item *first;
+
+ unsigned int i = 0;
+ unsigned int item_size = 0;
+
+ app_data = (App_Data *)user_data;
+
+ if (app_data == NULL) {
+ PRINTFUNC(DLOG_ERROR, "Can not get app_data");
+ return item_size;
+ }
+
+ if (app_data->genlist == NULL) {
+ /* smartreply will update when genlist is exist only */
+ PRINTFUNC(DLOG_ERROR, "Can not get getlist");
+ return item_size;
+ }
+
+ first = elm_genlist_first_item_get(app_data->genlist);
+ if (first == NULL)
+ return 0;
+
+ if (g_input_template_data.input_template_array_len > 0) {
+ Elm_Genlist_Item_Class *itc;
+
+ itc = elm_genlist_item_class_new();
+
+ itc->item_style = "1text";
+ itc->func.text_get = __ise_user_template_gl_text_get;
+ itc->func.content_get = NULL;
+ itc->func.state_get = NULL;
+ itc->func.del = NULL;
+
+ for (i = 0; i < (unsigned int)g_input_template_data.input_template_array_len; i++) {
+ elm_genlist_item_append(app_data->genlist,
+ itc,
+ (void *)(uintptr_t)i,
+ NULL,
+ ELM_GENLIST_ITEM_NONE,
+ __ise_user_template_gl_sel,
+ app_data);
+ item_size++;
+ }
+ elm_genlist_item_class_free(itc);
+
+ // dummy item for empty space
+ Elm_Genlist_Item_Class * itc0 = elm_genlist_item_class_new();
+ itc0->item_style = "title";
+ itc0->func.text_get = NULL;
+ itc0->func.content_get = NULL;
+ itc0->func.state_get = NULL;
+ itc0->func.del = NULL;
+
it_empty = elm_genlist_item_append(app_data->genlist, itc0,
NULL, NULL,
ELM_GENLIST_ITEM_NONE,
int input_type_array_len = -1;
bool is_extra_data_array = false;
char *mime_type = NULL;
+ char **user_template_array = NULL;
+ int user_template_array_len = -1;
app_control_clone(&(app_data->source_app_control), service);
app_data->reply_type = REPLY_APP_NORMAL;
app_data->mime_type = MIME_TYPE_ALL;
+ ret = app_control_get_extra_data_array(service, "user_template", &user_template_array, &user_template_array_len);
+ g_input_template_data.input_template_array = user_template_array;
+ g_input_template_data.input_template_array_len = user_template_array_len;
+
ret = app_control_get_mime(service, &mime_type);
if (ret != APP_CONTROL_ERROR_NONE) {
LOGD("Fail to get mime type : %d", ret);