#include <dlog.h>
#include <Eina.h>
#include <string>
-#include <efl_assist.h>
#include <vconf.h>
#include <vconf-keys.h>
+#include <stdint.h>
+#include <system_info.h>
-//#include "ui_extension.h"
#include "w-input-selector.h"
#include "w-input-template.h"
-#include "w-input-smartreply.h"
#include "w-input-keyboard.h"
#include "w-input-stt-ise.h"
#include "w-input-emoticon.h"
-#include "w-input-stt-tos.h"
-
-#ifdef SUPPORT_LOG_MANAGER
-#include <samsung_log_manager.h>
-#include <samsung_log_manager_uri.h>
-#endif
+#include "w-input-smartreply.h"
#include <stt.h>
using namespace std;
App_Data* app_data = NULL;
-#ifdef SUPPORT_LOG_MANAGER
-static samsung_log_manager_h g_log_manager = NULL;
-#endif
InputKeyboardData g_input_keyboard_data;
+InputTypeData g_input_type_data;
+InputTemplateData g_input_template_data;
+
+static bool g_set_mimetype_in_app_service = false;
+static bool g_set_mimetype_in_app_resume = false;
static Elm_Object_Item *it_empty;
static Elm_Object_Item *it_title;
-static Elm_Object_Item *it_plus;
-static int g_smartreply_current_number = 0; /* currently loaded smartreply number */
-static unsigned int g_template_current_number = 0; /* currnetly loaded template number */
+
+static unsigned int g_smartreply_item_size = 0; /* Current Smartreply item size */
+static unsigned int g_template_item_size = 0; /* Current Template item size */
Evas_Coord last_step; // 0 ~ 9 for gesture, 10~11 for rotary
-static Eina_Bool force_highlight_to_top = EINA_FALSE;
-static Eina_Bool force_highlight_to_bottom = EINA_FALSE;
-static Eina_Bool is_genlist_highlighed = EINA_FALSE;
+tizen_profile_t _get_tizen_profile()
+{
+ static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+ if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
+ return profile;
+
+ char *profileName;
+ system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+ switch (*profileName)
+ {
+ case 'm':
+ case 'M':
+ profile = TIZEN_PROFILE_MOBILE;
+ break;
+ case 'w':
+ case 'W':
+ profile = TIZEN_PROFILE_WEARABLE;
+ break;
+ case 't':
+ case 'T':
+ profile = TIZEN_PROFILE_TV;
+ break;
+ case 'i':
+ case 'I':
+ profile = TIZEN_PROFILE_IVI;
+ break;
+ default: // common or unknown ==> ALL ARE COMMON.
+ profile = TIZEN_PROFILE_COMMON;
+ }
+ free(profileName);
+
+ return profile;
+}
void _init_app_data(App_Data* app_data);
static void _app_language_changed(app_event_info_h event_info, void *user_data);
-static int _app_control_request_transient_app_cb(void *data);
-#ifdef SUPPORT_LOG_MANAGER
-static void log_manager_init(void);
-static void log_manager_exit(void);
-static void log_manager_set(const char *feature, const char *extra, const char *value);
-#endif
-
-static char *_genlist_text_set_theme_color(const char *str, const char *code);
Evas_Object* _create_genlist(Evas_Object* parent);
-void _create_genlist_items(void* user_data, bool is_type_reply);
+void _create_genlist_items(void* user_data);
+void _create_header_items(void *user_data);
void _update_genlist_items(void *user_data);
-void _update_smartreply_items(void *user_data);
-void _update_template_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);
-char * _toast_delete_popup_access_info_cb(void *data, Evas_Object *obj);
-
+static void input_type_deinit(void);
+bool __compare_string(const char * src, const char * dst);
void _init_app_data(App_Data* app_data)
{
- app_data->win_main = NULL;
- app_data->layout_main = NULL;
- app_data->conform = NULL;
- app_data->naviframe = NULL;
- app_data->genlist = NULL;
+ app_data->win_main = NULL;
+ app_data->layout_main = NULL;
+ app_data->conform = NULL;
+ app_data->naviframe = NULL;
+ app_data->genlist = NULL;
- app_data->res_path = NULL;
+ app_data->res_path = NULL;
}
-
-
Evas_Object* load_edj(Evas_Object* parent, const char* file, const char* group)
{
Evas_Object* window;
evas_object_size_hint_weight_set(window, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
}
-
return window;
}
string stt_edj_path = get_resource_path();
string app_edj_path = get_resource_path();
- stt_edj_path = stt_edj_path + STT_EDJ_FILE;
- app_edj_path = app_edj_path + APP_EDJ_FILE;
+ if (_WEARABLE) {
+ stt_edj_path = stt_edj_path + STT_EDJ_FILE_WEARABLE;
+ app_edj_path = app_edj_path + APP_EDJ_FILE_WEARABLE;
+ } else if (_TV) {
+ stt_edj_path = stt_edj_path + STT_EDJ_FILE_TV;
+ app_edj_path = app_edj_path + APP_EDJ_FILE_TV;
+ } else {
+ stt_edj_path = stt_edj_path + STT_EDJ_FILE_MOBILE;
+ app_edj_path = app_edj_path + APP_EDJ_FILE_MOBILE;
+ }
elm_theme_extension_add(NULL, stt_edj_path.c_str());
elm_theme_extension_add(NULL, app_edj_path.c_str());
}
-
static Eina_Bool back_cb(void *data, Elm_Object_Item *it)
{
- reply_to_sender_by_callback_for_back();
- elm_exit();
- return EINA_FALSE;
+ reply_to_sender_by_callback_for_back();
+ ui_app_exit();
+ return EINA_FALSE;
}
static void _stt_clicked_cb(void *data, Evas_Object * obj, void *event_info)
PRINTFUNC(DLOG_DEBUG, "");
- if(!ad)
+ if (!ad)
return;
-#if 0
- bool bAgreed = false;
- stt_get_user_agreement(&bAgreed);
- if(!bAgreed){
-#endif
- if(is_tos_N66_agreed() == EINA_FALSE){
- if(is_sap_connection() == EINA_TRUE){
- ise_show_tos_n66_popup(ad);
- } else {
- launch_bt_connection_popup(ad);
- }
- }
- else {
- ise_show_stt_popup(ad);
- }
-
-
-#ifdef SUPPORT_LOG_MANAGER
- log_manager_set("IM01", "STT", NULL);
-#endif
+ ise_show_stt_popup(ad);
}
static void _input_smartreply_notify_cb(void *user_data)
_update_genlist_items((void *)app_data);
}
-
static void _emoticon_clicked_cb(void *data, Evas_Object * obj, void *event_info)
{
App_Data* ad = (App_Data*)data;
PRINTFUNC(DLOG_DEBUG, "");
- if(!ad)
+ if (!ad)
return;
-// ise_show_emoticon_popup(ad);
- ise_show_emoticon_popup_rotary(ad);
-
-#ifdef SUPPORT_LOG_MANAGER
- log_manager_set("IM01", "Emoticon", NULL);
-#endif
+ ise_show_emoticon_list(ad);
}
static void _keyboard_clicked_cb(void *data, Evas_Object * obj, void *event_info)
if (!ad)
return;
-#ifdef SUPPORT_LOG_MANAGER
- log_manager_set("IM01", "Keypad", NULL);
-#endif
-
- if(app_data->app_type == APP_TYPE_KEYBOARD_FROM_SMS)
- input_keyboard_launch(ad->win_main);
- else
- input_keyboard_launch_with_ui(ad->win_main, data);
+ input_keyboard_launch(ad->win_main, data);
}
-static void __bt_connection_result_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
-{
- char *val = NULL;
-
- if (reply == NULL) {
- PRINTFUNC(DLOG_ERROR, "service_h is NULL");
- return;
- }
-
- app_control_get_extra_data(reply, "__BT_CONNECTION__", &val);
- if (val) {
- if( strcmp(val, "Connected") == 0 )
- {
- PRINTFUNC(DLOG_ERROR, "BT Connected");
- }
- else
- {
- PRINTFUNC(DLOG_ERROR, "BT Not Connected");
- }
-
- free(val);
- }
-}
-
-
static void __ise_smartreply_gl_sel(void *data, Evas_Object *obj, void *event_info)
{
- App_Data* app_data = (App_Data*) data;
Elm_Object_Item *item = (Elm_Object_Item *) event_info;
if (item) {
elm_genlist_item_selected_set(item, EINA_FALSE);
- int index = (unsigned int) elm_object_item_data_get(item);
+ int index = (intptr_t) elm_object_item_data_get(item);
-#ifdef SUPPORT_LOG_MANAGER
- log_manager_set("IM01", "Preset", NULL);
- log_manager_set("IM02", "Smart Reply", NULL);
-#endif
- char *reply = input_smartreply_get_nth_item(index);
+ int type;
+ char *reply = input_smartreply_get_nth_item(index, &type);
if (reply) {
input_smartreply_send_feedback(reply);
- if(app_data->reply_type == REPLY_APP_CONTROL){
- reply_to_sender_by_appcontrol((void*)app_data, reply, "smartreply");
- free(reply);
- } else {
- reply_to_sender_by_callback(reply, "smartreply");
- free(reply);
- elm_exit();
- }
-
+ reply_to_sender_by_callback(reply, "smartreply", NULL, NULL);
+ free(reply);
+ elm_exit();
}
}
}
-static void __ise_template_add_gl_sel(void *data, Evas_Object *obj, void *event_info)
+static void __ise_template_gl_sel(void *data, Evas_Object *obj, void *event_info)
{
- App_Data* app_data = (App_Data*) data;
Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+ int index = 0;
if (item) {
elm_genlist_item_selected_set(item, EINA_FALSE);
- if(is_sap_connection() == EINA_TRUE){
- // Show toast popup
- show_popup_toast(gettext("WDS_IME_TPOP_ADD_TEMPLATE_ON_YOUR_PHONE_ABB"), true);
-
- // send message to Host
- app_control_h appctrl;
- app_control_create( &appctrl );
- app_control_set_app_id(appctrl, "com.samsung.w-manager-service");
- app_control_add_extra_data(appctrl, "type", "gm_setting");
- app_control_add_extra_data(appctrl, "data/setting_menu", "texttemplate_setting");
- app_control_send_launch_request(appctrl, NULL, NULL);
- app_control_destroy(appctrl);
- } else {
- app_control_h app_control;
- app_control_create(&app_control);
- app_control_set_app_id(app_control, "com.samsung.bt-connection-popup");
- app_control_add_extra_data(app_control,"msg", "perform");
- app_control_send_launch_request(app_control, __bt_connection_result_cb, NULL);
- app_control_destroy(app_control);
+ index = (uintptr_t) elm_object_item_data_get(item);
+ const std::vector<TemplateData> template_list = input_template_get_list();
+
+ if (index < (int)template_list.size()) {
+ reply_to_sender_by_callback(gettext(template_list[index].text.c_str()), "template", NULL, NULL);
+ ui_app_exit();
}
}
}
-static void __ise_template_gl_sel(void *data, Evas_Object *obj, void *event_info)
+static void __ise_user_template_gl_sel(void *data, Evas_Object *obj, void *event_info)
{
- App_Data* app_data = (App_Data*) data;
Elm_Object_Item *item = (Elm_Object_Item *) event_info;
int index = 0;
if (item) {
elm_genlist_item_selected_set(item, EINA_FALSE);
- index = (unsigned int) elm_object_item_data_get(item);
+ 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")) {
+ unsigned int index = (uintptr_t)data;
const std::vector<TemplateData> template_list = input_template_get_list();
- //@ToDo : should call reply function when any template string is selected and confirmed.
- // Here reply string will be template_list[index].text.c_str();
- if( index < template_list.size()) {
-#ifdef SUPPORT_LOG_MANAGER
- log_manager_set("IM01", "Preset", NULL);
- log_manager_set("IM02", "Preset except smart reply", NULL);
-#endif
- if(app_data->reply_type == REPLY_APP_CONTROL){
- reply_to_sender_by_appcontrol((void*)app_data, gettext(template_list[index].text.c_str()), "template");
+ if (index < template_list.size()) {
+ if (template_list[index].use_gettext) {
+ return strdup(gettext(template_list[index].text.c_str()));
} else {
- reply_to_sender_by_callback(gettext(template_list[index].text.c_str()), "template");
- elm_exit();
+ Eina_Strbuf *buf = NULL;
+ const char *str = NULL;
+ char *markup = NULL;
+
+ buf = eina_strbuf_new();
+ if (buf) {
+ eina_strbuf_append(buf, template_list[index].text.c_str());
+ eina_strbuf_replace_all(buf, "\n", "");
+ eina_strbuf_replace_all(buf, "\r", "");
+
+ str = eina_strbuf_string_get(buf);
+
+ if (str) {
+ markup = elm_entry_utf8_to_markup(str);
+ }
+ eina_strbuf_free(buf);
+ }
+ return markup;
+ }
+ }
+ }
+ 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);
+ char *second_input_type = *(g_input_type_data.input_type_array + 1);
+
+ if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2"))) {
+ Evas_Object* btn = elm_button_add(obj);
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ Evas_Object* ic = elm_image_add(btn);
+ elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
+ string path = get_resource_path();
+ if (_WEARABLE)
+ path = path + "wearable/";
+ else if (_TV)
+ path = path + "tv/";
+ else
+ path = path + "mobile/";
+
+ if (!strcmp(part, "elm.icon.1")) {
+ string path_ic;
+ if (!strcmp(first_input_type, "input_voice")) {
+ elm_object_style_set(btn, "ime_button_stt");
+ path_ic = path + "images/w_mode_stt_ic.png";
+ evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
+ } else if (!strcmp(first_input_type, "input_emoticon")) {
+ elm_object_style_set(btn, "ime_button_emoticon");
+ path_ic = path + "images/Delta_w_mode_emoticon_ic.png";
+ evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
+ } else if (!strcmp(first_input_type, "input_keyboard")) {
+ elm_object_style_set(btn, "ime_button_keyboard");
+ path_ic = path + "images/w_mode_keyboard_ic.png";
+ evas_object_propagate_events_set(btn, EINA_FALSE);
+ evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
+ }
+ elm_image_file_set(ic, path_ic.c_str(), NULL);
+ elm_object_content_set(btn, ic);
+ evas_object_layer_set(btn, 32000);
+ } else if (!strcmp(part, "elm.icon.2")){
+ string path_ic;
+ if (!strcmp(second_input_type, "input_voice")) {
+ elm_object_style_set(btn, "ime_button_stt");
+ path_ic = path + "images/w_mode_stt_ic.png";
+ evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
+ } else if (!strcmp(second_input_type, "input_emoticon")) {
+ elm_object_style_set(btn, "ime_button_emoticon");
+ path_ic = path + "images/Delta_w_mode_emoticon_ic.png";
+ evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
+ } else if (!strcmp(second_input_type, "input_keyboard")) {
+ elm_object_style_set(btn, "ime_button_keyboard");
+ path_ic = path + "images/w_mode_keyboard_ic.png";
+ evas_object_propagate_events_set(btn, EINA_FALSE);
+ evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
+ }
+ elm_image_file_set(ic, path_ic.c_str(), NULL);
+ elm_object_content_set(btn, ic);
+ evas_object_layer_set(btn, 32000);
+ }
+ return btn;
+ } else if (!strcmp(part, "elm.icon.1.touch_area") || (!strcmp(part, "elm.icon.2.touch_area"))) {
+ Evas_Object* btn = elm_button_add(obj);
+ elm_object_style_set(btn, "touch_area");
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ string path = get_resource_path();
+ if (!strcmp(part, "elm.icon.1.touch_area")) {
+ evas_object_layer_set(btn, 32000);
+ if (!strcmp(first_input_type, "input_voice")) {
+ evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
+ } else if (!strcmp(first_input_type, "input_emoticon")) {
+ evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
+ } else if (!strcmp(first_input_type, "input_keyboard")) {
+ evas_object_propagate_events_set(btn, EINA_FALSE);
+ evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
+ }
+ } else if (!strcmp(part, "elm.icon.2.touch_area")){
+ evas_object_layer_set(btn, 32000);
+ if (!strcmp(second_input_type, "input_voice")) {
+ evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
+ } else if (!strcmp(second_input_type, "input_emoticon")) {
+ evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
+ } else if (!strcmp(second_input_type, "input_keyboard")) {
+ evas_object_propagate_events_set(btn, EINA_FALSE);
+ evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
+ }
+ }
+ return btn;
+ } else if (!strcmp(part, "base")) {
+ Evas_Object* btn = elm_button_add(obj);
+ elm_object_style_set(btn, "ime_transparent");
+ return btn;
+ }
+ return NULL;
}
static Evas_Object * __ise_gl_3button_content_get(void *data, Evas_Object *obj, const char *part)
{
- if (!strcmp(part,"elm.icon.1") || (!strcmp(part,"elm.icon.2")) || (!strcmp(part,"elm.icon.3"))) {
+ if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
Evas_Object* btn = elm_button_add(obj);
evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
Evas_Object* ic = elm_image_add(btn);
elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
string path = get_resource_path();
- if (!strcmp(part,"elm.icon.1")) {
- elm_object_style_set(btn, "anchor");
+ if (_WEARABLE)
+ path = path + "wearable/";
+ else if (_TV)
+ path = path + "tv/";
+ else
+ path = path + "mobile/";
+
+ if (!strcmp(part, "elm.icon.1")) {
+ elm_object_style_set(btn, "ime_button_stt");
string path_ic = path + "images/w_mode_stt_ic.png";
elm_image_file_set(ic, path_ic.c_str(), NULL);
- elm_object_content_set(btn,ic);
+ elm_object_content_set(btn, ic);
evas_object_layer_set(btn, 32000);
- if (elm_config_access_get())
- elm_access_object_unregister(btn);
-
- int powerSavingMode = -1;
- int ret;
- // Power Saving mode check
- ret = vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &powerSavingMode);
- if ( ret != 0 )
- {
- PRINTFUNC(DLOG_ERROR,"VCONFKEY_SETAPPL_PSMODE FAILED");
- }
+ evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
- if (powerSavingMode == SETTING_PSMODE_WEARABLE_ENHANCED) {
- PRINTFUNC(DLOG_ERROR,"Power Saving mode, disable stt !!!");
- elm_object_disabled_set(btn, EINA_TRUE);
- }
- } else if (!strcmp(part,"elm.icon.2")){
- elm_object_style_set(btn, "anchor");
+ } else if (!strcmp(part, "elm.icon.2")){
+ elm_object_style_set(btn, "ime_button_emoticon");
string path_ic = path + "images/Delta_w_mode_emoticon_ic.png";
elm_image_file_set(ic, path_ic.c_str(), NULL);
- elm_object_content_set(btn,ic);
+ elm_object_content_set(btn, ic);
evas_object_layer_set(btn, 32000);
- if (elm_config_access_get())
- elm_access_object_unregister(btn);
+ evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
- } else if (!strcmp(part,"elm.icon.3")){
- elm_object_style_set(btn, "anchor");
+ } else if (!strcmp(part, "elm.icon.3")){
+ elm_object_style_set(btn, "ime_button_keyboard");
string path_ic = path + "images/w_mode_keyboard_ic.png";
elm_image_file_set(ic, path_ic.c_str(), NULL);
- elm_object_content_set(btn,ic);
+ elm_object_content_set(btn, ic);
evas_object_layer_set(btn, 32000);
evas_object_propagate_events_set(btn, EINA_FALSE);
- if (elm_config_access_get())
- elm_access_object_unregister(btn);
-
+ evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
+ elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
}
return btn;
- }
- else if (!strcmp(part,"elm.icon.1.touch_area") || (!strcmp(part,"elm.icon.2.touch_area")) || (!strcmp(part,"elm.icon.3.touch_area"))) {
+ } else if (!strcmp(part, "elm.icon.1.touch_area") || (!strcmp(part, "elm.icon.2.touch_area")) || (!strcmp(part, "elm.icon.3.touch_area"))) {
Evas_Object* btn = elm_button_add(obj);
elm_object_style_set(btn, "touch_area");
evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
string path = get_resource_path();
- if (!strcmp(part,"elm.icon.1.touch_area")) {
-
- int powerSavingMode = -1;
- int ret;
- // Power Saving mode check
- ret = vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &powerSavingMode);
- if ( ret != 0 )
- {
- PRINTFUNC(DLOG_ERROR,"VCONFKEY_SETAPPL_PSMODE FAILED");
- }
-
- if (powerSavingMode == SETTING_PSMODE_WEARABLE_ENHANCED) {
- PRINTFUNC(DLOG_ERROR,"Power Saving mode, disable stt !!!");
- elm_object_disabled_set(btn, EINA_TRUE);
- }
-
+ if (!strcmp(part, "elm.icon.1.touch_area")) {
evas_object_layer_set(btn, 32000);
evas_object_smart_callback_add(btn, "clicked", _stt_clicked_cb, app_data);
- if (elm_config_access_get()){
- elm_access_info_set(btn, ELM_ACCESS_INFO, gettext("IDS_IME_MBODY_VOICE_INPUT"));
-// elm_access_chain_end_set(btn, ELM_HIGHLIGHT_DIR_PREVIOUS);
- }
+ elm_atspi_accessible_name_set(btn, "IDS_IME_MBODY_VOICE_INPUT");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
- } else if (!strcmp(part,"elm.icon.2.touch_area")){
+ } else if (!strcmp(part, "elm.icon.2.touch_area")){
evas_object_layer_set(btn, 32000);
evas_object_smart_callback_add(btn, "clicked", _emoticon_clicked_cb, app_data);
- if (elm_config_access_get())
- elm_access_info_set(btn, ELM_ACCESS_INFO, gettext("IDS_COM_HEADER_EMOTICON"));
- } else if (!strcmp(part,"elm.icon.3.touch_area")){
+ elm_atspi_accessible_name_set(btn, "IDS_COM_HEADER_EMOTICON");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
+ } else if (!strcmp(part, "elm.icon.3.touch_area")) {
evas_object_layer_set(btn, 32000);
evas_object_propagate_events_set(btn, EINA_FALSE);
evas_object_smart_callback_add(btn, "clicked", _keyboard_clicked_cb, app_data);
- if (elm_config_access_get())
- elm_access_info_set(btn, ELM_ACCESS_INFO, gettext("IDS_COM_OPT_KEYBOARD"));
+ elm_atspi_accessible_name_set(btn, "IDS_COM_OPT_KEYBOARD");
+ elm_atspi_accessible_translation_domain_set(btn, PACKAGE);
}
return btn;
- }
- else if(!strcmp(part,"base")){
+ } else if (!strcmp(part, "base")) {
Evas_Object* btn = elm_button_add(obj);
- if (elm_config_access_get())
- elm_access_object_unregister(btn);
elm_object_style_set(btn, "ime_transparent");
return btn;
}
if(!strcmp(part, "elm.text")) {
int index;
char *reply = NULL;
-
- index = (int)data;
+ index = (intptr_t)data;
if (index < 0)
return NULL;
- reply = input_smartreply_get_nth_item(index);
+ reply = input_smartreply_get_nth_item(index, NULL);
if (reply == NULL)
return NULL;
- /* Set hightlight color on first 3 smartreply items */
- if (index < 3) {
- char *colored = _genlist_text_set_theme_color(reply, "AT0113");
-
- if (colored == NULL)
- return reply;
- else {
- free(reply);
- return colored;
- }
- }
-
return reply;
}
return NULL;
}
-static char * __ise_template_gl_text_get(void *data, Evas_Object *obj, const char *part)
+static void __ise_gl_lang_changed(void *data, Evas_Object *obj, void *event_info)
{
- if(!strcmp(part, "elm.text")) {
- unsigned int index = (unsigned int)data;
- const std::vector<TemplateData> template_list = input_template_get_list();
-
- if(index < template_list.size()) {
- if(template_list[index].use_gettext)
- return strdup(gettext(template_list[index].text.c_str()));
- else {
- Eina_Strbuf *buf = NULL;
- const char *str = NULL;
- char *markup = NULL;
-
- buf = eina_strbuf_new();
- if(buf) {
- eina_strbuf_append(buf, template_list[index].text.c_str());
- eina_strbuf_replace_all(buf, "\n", "");
- eina_strbuf_replace_all(buf, "\r", "");
-
- str = eina_strbuf_string_get(buf);
-
- if (str) {
- markup = elm_entry_utf8_to_markup(str);
- }
- eina_strbuf_free(buf);
- }
-
- return markup;
- }
- }
-
- }
- return NULL;
+ //Update genlist items. The Item texts will be translated in the _gl_text_get().
+ elm_genlist_realized_items_update(obj);
}
-static char * __ise_addtemplate_gl_text_get(void *data, Evas_Object *obj, const char *part)
+static char * __ise_drawing_text_get(void *data, Evas_Object *obj, const char *part)
{
if(!strcmp(part, "elm.text")) {
- return(strdup(gettext("WDS_IME_MBODY_ADD_TEMPLATE_ABB")));
+ return(strdup(gettext("WDS_IME_MBODY_DRAWING_M_EMOTICON_ABB")));
}
return NULL;
}
-static Evas_Object * __ise_gl_1button_content_get(void *data, Evas_Object *obj, const char *part)
+static Evas_Object * __ise_drawing_content_get(void *data, Evas_Object *obj, const char *part)
{
- if (!strcmp(part,"elm.icon")) {
+ if (!strcmp(part, "elm.icon")) {
Evas_Object* btn = elm_button_add(obj);
evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
Evas_Object* ic = elm_image_add(btn);
elm_image_resizable_set(ic, EINA_TRUE, EINA_TRUE);
string path = get_resource_path();
- elm_object_style_set(btn, "ime_button_template");
- string path_ic = path + "/images/w_list_add_ic.png";
+ if (_WEARABLE)
+ path = path + "wearable/";
+ else if (_TV)
+ path = path + "tv/";
+ else
+ path = path + "mobile/";
+ elm_object_style_set(btn, "ime_button_drawing");
+ string path_ic = path + "images/wi_drawing_icon.png";
elm_image_file_set(ic, path_ic.c_str(), NULL);
- elm_object_content_set(btn,ic);
+ elm_object_content_set(btn, ic);
evas_object_layer_set(btn, 32000);
- if (elm_config_access_get())
- elm_access_object_unregister(btn);
-
return btn;
}
return NULL;
}
-static void __ise_gl_lang_changed(void *data, Evas_Object *obj, void *event_info)
-{
- //Update genlist items. The Item texts will be translated in the _gl_text_get().
- elm_genlist_realized_items_update(obj);
-}
-
-static int _app_control_request_transient_app_cb(void *data)
-{
- return 0;
-}
-
-
-static char *_genlist_text_set_theme_color(const char *str, const char *code)
-{
- int r, g, b, a;
- Eina_Strbuf *buf = NULL;
- char *colored = NULL;
-
- if (code == NULL)
- return NULL;
-
- buf = eina_strbuf_new();
- if (buf == NULL) {
- PRINTFUNC(DLOG_ERROR, "Can not get create strbuf");
- return NULL;
- }
-
-// ea_theme_color_get(code,
-// &r, &g, &b, &a,
-// NULL, NULL, NULL, NULL,
-// NULL, NULL, NULL, NULL);
-
- eina_strbuf_append_printf(buf, "<color=#%02x%02x%02x%02x>%s</color>",
- r, g, b, a, str);
-
- colored = eina_strbuf_string_steal(buf);
-
- eina_strbuf_free(buf);
-
- return colored;
-}
-
-
-static void _app_control_send_reply_cb(app_control_h request, app_control_h reply,
- app_control_result_e result, void *user_data)
-{
- PRINTFUNC(DLOG_DEBUG, "");
- reply_to_sender_by_callback(NULL, NULL);
- elm_exit();
-}
-
void set_source_caller_app_id(app_control_h app_control)
{
- if(!app_control){
- PRINTFUNC(DLOG_ERROR,"can't get app_control");
+ if (!app_control){
+ PRINTFUNC(DLOG_ERROR, "can't get app_control");
return;
}
-// CscFeatureBool is_security_permission_manager = CSC_FEATURE_BOOL_FALSE;
-// is_security_permission_manager = csc_feature_get_bool(CSC_FEATURE_DEF_BOOL_SECURITY_PERMISSION_MANAGER);
-
-// if(is_security_permission_manager == CSC_FEATURE_BOOL_TRUE){
-
- char *caller = NULL;
- app_control_get_caller(app_data->source_app_control, &caller);
-
- if(caller){
- PRINTFUNC(DLOG_DEBUG,"caller = %s", caller);
- app_control_add_extra_data(app_control, "caller_appid", caller);
- free(caller);
- }
-// }
-
-}
-
-void reply_to_sender_by_appcontrol(void *data, const char *value, const char *type)
-{
-
- PRINTFUNC(DLOG_DEBUG, "");
-
- int ret;
- char *app_id;
+ char *caller = NULL;
+ app_control_get_caller(app_data->source_app_control, &caller);
- app_control_h app_control;
-
- App_Data *appdata = (App_Data *)data;
-
- if(!appdata){
- PRINTFUNC(DLOG_ERROR,"Null pointer");
- return;
- }
-
- ret = app_control_create(&app_control);
- if (ret != APP_CONTROL_ERROR_NONE) {
- PRINTFUNC(DLOG_ERROR, "Can not create app_control : %d", ret);
- return;
- }
-
- app_id = g_input_keyboard_data.app_id;
- if (app_id == NULL) {
- PRINTFUNC(DLOG_INFO, "app id is undefined, use defualt");
- app_id = "com.samsung.message.appcontrol.compose";
- }
-
- if(!strcmp(app_id, "com.samsung.message.appcontrol.compose")){
- app_id = "com.samsung.msg-send";
- }
-
- app_control_set_app_id(app_control, app_id);
- app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
-/*
- ret = app_control_set_window(app_control,
- elm_win_xwindow_get(appdata->win_main));
- if (ret != APP_CONTROL_ERROR_NONE) {
- PRINTFUNC(DLOG_ERROR, "Can not app control set window : %d", ret);
- app_control_destroy(app_control);
- return;
+ if (caller){
+ PRINTFUNC(DLOG_DEBUG, "caller = %s", caller);
+ app_control_add_extra_data(app_control, "caller_appid", caller);
+ free(caller);
}
-*/
- if (g_input_keyboard_data.data_array && g_input_keyboard_data.data_array_len > 0) {
- app_control_add_extra_data_array(app_control,
- "selector_keyboard_data_array",
- (const char**)(g_input_keyboard_data.data_array),
- g_input_keyboard_data.data_array_len);
- }
-
- app_control_add_extra_data(app_control, "selector_send_data_array", "sending_popup");
-
- if (value)
- app_control_add_extra_data(app_control, "selected_context", value);
-
- if (type)
- app_control_add_extra_data(app_control, "reply_type", type);
-
- set_source_caller_app_id(app_control);
-
- ret = app_control_send_launch_request(app_control,
- _app_control_send_reply_cb,
- NULL);
-
- if (ret != APP_CONTROL_ERROR_NONE)
- PRINTFUNC(DLOG_ERROR, "Can not launch app_control: %d", ret);
-
- app_control_destroy(app_control);
-
- return;
-
-
}
-void reply_to_sender_by_callback(const char *value, const char *type)
+void reply_to_sender_by_callback(const char *value, const char *type, const char *path[], const char *cursor_position)
{
-
PRINTFUNC(DLOG_DEBUG, "");
app_control_h app_control;
- if(app_control_create(&app_control) == 0) {
+ if (app_control_create(&app_control) == 0) {
int ret;
if (value)
- app_control_add_extra_data(app_control, "selected_context", value);
+ app_control_add_extra_data(app_control, APP_CONTROL_DATA_TEXT, value);
if (type)
app_control_add_extra_data(app_control, "reply_type", type);
+ if (path != NULL) {
+ app_control_add_extra_data_array(app_control, APP_CONTROL_DATA_PATH, path, 1);
+ }
+
+ if (cursor_position != NULL)
+ app_control_add_extra_data(app_control, "cursor_position_get", cursor_position);
+
set_source_caller_app_id(app_control);
- ret = app_control_reply_to_launch_request( app_control, app_data->source_app_control, APP_CONTROL_RESULT_SUCCEEDED);
+ ret = app_control_reply_to_launch_request(app_control, app_data->source_app_control, APP_CONTROL_RESULT_SUCCEEDED);
if (ret != APP_CONTROL_ERROR_NONE)
PRINTFUNC(DLOG_ERROR, "reply failed : %d", ret);
void reply_to_sender_by_callback_for_back()
{
-
PRINTFUNC(DLOG_DEBUG, "");
app_control_h app_control;
- if(app_control_create(&app_control) == 0) {
+ if (app_control_create(&app_control) == 0) {
int ret;
app_control_add_extra_data(app_control, "back_to_composer", "yes");
- ret = app_control_reply_to_launch_request( app_control, app_data->source_app_control, APP_CONTROL_RESULT_SUCCEEDED);
+ ret = app_control_reply_to_launch_request(app_control, app_data->source_app_control, APP_CONTROL_RESULT_SUCCEEDED);
if (ret != APP_CONTROL_ERROR_NONE)
PRINTFUNC(DLOG_ERROR, "reply failed : %d", ret);
}
}
-
char* get_resource_path()
{
- if(NULL == app_data->res_path) {
+ if (NULL == app_data->res_path) {
app_data->res_path = app_get_resource_path();
PRINTFUNC(DLOG_INFO, "set resource path = %s", app_data->res_path);
}
char* get_shared_resource_path()
{
- if(NULL == app_data->shared_res_path) {
+ if (NULL == app_data->shared_res_path) {
app_data->shared_res_path = app_get_shared_resource_path();
PRINTFUNC(DLOG_INFO, "set shared resource path = %s", app_data->shared_res_path);
}
}
void show_gl_focus(Eina_Bool bVisible){
-
- if(app_data->genlist == NULL)
+ if (app_data->genlist == NULL)
return;
- if(bVisible == EINA_TRUE){
+ if (bVisible == EINA_TRUE){
elm_object_signal_emit(app_data->genlist, "elm,state,focus_bg,enable", "elm");
//elm_layout_theme_set(app_data->genlist, "genlist", "base", "focus_bg");
//elm_object_signal_emit(app_data->genlist, "elm,state,focus_bg,show", "elm");
void show_popup_toast(const char *text, bool check_img)
{
-
PRINTFUNC(DLOG_ERROR, "show_popup_toast");
Evas_Object *popup;
if (check_img) {
string path = get_resource_path();
+ if (_WEARABLE)
+ path = path + "wearable/";
+ else if (_TV)
+ path = path + "tv/";
+ else
+ path = path + "mobile/";
string path_ic = path + "/images/toast_check_icon.png";
Evas_Object * img = elm_image_add(popup);
elm_image_file_set(img, path_ic.c_str(), NULL);
elm_object_part_content_set(popup, "toast,icon", img);
}
- if(text) {
- elm_object_part_text_set(popup,"elm.text", text);
+ if (text) {
+ elm_object_part_text_set(popup, "elm.text", text);
}
eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, _popup_back_cb, NULL);
evas_object_smart_callback_add(popup, "dismissed", _popup_close_cb, NULL);
evas_object_smart_callback_add(popup, "block,clicked", _popup_back_cb, NULL);
- if(elm_config_access_get() == EINA_FALSE)
- elm_popup_timeout_set(popup, 2.0);
- else {
- elm_object_access_info_set(popup, text);
-// Evas_Object *ao = elm_object_part_access_object_get(popup, "access.outline");
-// elm_access_info_cb_set(ao, ELM_ACCESS_INFO, _toast_delete_popup_access_info_cb, popup);
- elm_popup_timeout_set(popup, 8.0);
- }
-
+ elm_popup_timeout_set(popup, 2.0);
evas_object_show(popup);
}
static void _popup_close_cb(void *data, Evas_Object *obj, void *event_info)
{
- if(obj){
+ if (obj){
evas_object_hide(obj);
evas_object_del(obj);
}
static void _popup_back_cb(void *data, Evas_Object *obj, void *event_info)
{
- if(obj)
+ if (obj)
elm_popup_dismiss(obj);
}
-char * _toast_delete_popup_access_info_cb(void *data, Evas_Object *obj)
-{
- PRINTFUNC(DLOG_ERROR, "%s", __func__);
- const char * info = elm_object_part_text_get((Evas_Object*)data,"elm.text");
-
- return strdup(info);
-}
-
void _back_to_genlist_for_selector()
{
+ PRINTFUNC(DLOG_DEBUG, "");
- PRINTFUNC(DLOG_DEBUG,"");
-
- if(!app_data) return;
+ if (!app_data) return;
- if(app_data->app_type == APP_TYPE_STT || app_data->app_type == APP_TYPE_EMOTICON){
- PRINTFUNC(DLOG_DEBUG,"launched as STT/EMOTICON mode, So exit here.");
- reply_to_sender_by_callback(NULL, NULL);
- elm_exit();
+ if (_WEARABLE) {
+ Evas_Object *circle_genlist = (Evas_Object *) evas_object_data_get(app_data->genlist, "circle");
+ eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
+ }
+ if (app_data->app_type == APP_TYPE_STT || app_data->app_type == APP_TYPE_EMOTICON || app_data->app_type == APP_TYPE_KEYBOARD){
+ PRINTFUNC(DLOG_DEBUG, "launched as STT/EMOTICON/KEYBOARD mode, So exit here.");
+ reply_to_sender_by_callback(NULL, NULL, NULL, NULL);
+ ui_app_exit();
}
-
- Evas_Object *circle_genlist = (Evas_Object *) evas_object_data_get(app_data->genlist, "circle");
-
- eext_rotary_object_event_activated_set(circle_genlist, EINA_TRUE);
-
-}
-
-
-char *_it_plus_access_info_cb(void *data, Evas_Object *obj)
-{
- PRINTFUNC(DLOG_DEBUG,"%s", __func__);
- std::string text = std::string(gettext("IDS_ACCS_BODY_BUTTON_TTS"));
-
- return strdup(text.c_str());
-}
-
-char *_access_info_cb(void *data, Evas_Object *obj)
-{
- PRINTFUNC(DLOG_DEBUG,"%s", __func__);
- return strdup(gettext("WDS_TTS_TBBODY_DOUBLE_TAP_TO_SEND"));
-}
-
-Eina_Bool _access_action_next_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info)
-{
- Evas_Object *genlist = (Evas_Object*)data;
- PRINTFUNC(DLOG_ERROR, "[TNT] _access_action_next_cb called, genlist type:%s", evas_object_type_get(genlist));
- Elm_Object_Item *it = elm_genlist_first_item_get(genlist);//emptry item?
- PRINTFUNC(DLOG_ERROR, "[TNT] get first item:%p", it);
- it = elm_genlist_item_next_get(it);//title item(3 button?)
- PRINTFUNC(DLOG_ERROR, "[TNT] get Second item:%p, title_item:%p", it, it_title);
- elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_IN);
- force_highlight_to_top = EINA_TRUE;
- return EINA_TRUE;
-}
-
-Eina_Bool _access_action_prev_cb(void *data, Evas_Object *obj, Elm_Access_Action_Info *action_info)
-{
- Evas_Object *genlist = (Evas_Object*)data;
- PRINTFUNC(DLOG_ERROR, "[TNT] _access_action_prev_cb called, genlist type:%s", evas_object_type_get(genlist));
- Elm_Object_Item *it = elm_genlist_last_item_get(genlist);//plus button item
- PRINTFUNC(DLOG_ERROR, "[TNT] get last item:%p", it);
- elm_genlist_item_show(it, ELM_GENLIST_ITEM_SCROLLTO_IN);
- force_highlight_to_bottom= EINA_TRUE;
- return EINA_TRUE;
}
static void _item_realized(void *data, Evas_Object *obj, void *event_info) //called when list scrolled
{
- PRINTFUNC(DLOG_DEBUG,"%s", __func__);
- if (elm_config_access_get()) {
- Elm_Object_Item *item = (Elm_Object_Item *)event_info;
- Evas_Object *item_access = elm_object_item_access_object_get(item);
-
- if (item == it_empty || item == it_title) {
- elm_access_object_unregister(item_access);
- if (item == it_title)
- {
- Evas_Object *btn = elm_object_item_part_content_get(item, "elm.icon.1.touch_area");
- PRINTFUNC(DLOG_ERROR, "[TNT] 1st button(%p), type:%s",btn, evas_object_type_get(btn));
- Evas_Object *btn_access = btn;//elm_access_object_get(btn);
- PRINTFUNC(DLOG_ERROR, "[TNT] title item realized!!!!, force_highlight_to_top:%d, is_genlist_highlighed:%d",force_highlight_to_top, is_genlist_highlighed);
- if (force_highlight_to_top || !is_genlist_highlighed)
- {
- //highlight to first button.
- PRINTFUNC(DLOG_ERROR, "[TNT] force highlight to 1st button(%p), acces_obj:%p",btn, btn_access);
- elm_access_highlight_set(btn_access);
- force_highlight_to_top = EINA_FALSE;
- is_genlist_highlighed = EINA_TRUE;
- }
- PRINTFUNC(DLOG_ERROR, "[TNT] set highlight pre callback on btn");
- elm_access_action_cb_set(btn_access, ELM_ACCESS_ACTION_HIGHLIGHT_PREV, _access_action_prev_cb, obj);
- }
- }
- else if (item == it_plus) {
- //elm_access_object_unregister(item_access); // there is no guide line
- elm_access_info_cb_set(item_access, ELM_ACCESS_CONTEXT_INFO, _it_plus_access_info_cb, NULL);
- PRINTFUNC(DLOG_ERROR, "[TNT] set highlight next callback on plus item");
- elm_access_action_cb_set(item_access, ELM_ACCESS_ACTION_HIGHLIGHT_NEXT, _access_action_next_cb, obj);
- if (force_highlight_to_bottom)
- {
- PRINTFUNC(DLOG_ERROR, "[TNT] Forcely set highlight on plus item!!");
- elm_access_highlight_set(item_access);
- force_highlight_to_bottom = EINA_FALSE;
- is_genlist_highlighed = EINA_TRUE;
- }
- }
- else {
- elm_access_info_cb_set(item_access, ELM_ACCESS_CONTEXT_INFO, _access_info_cb, NULL);
- }
- }
+ PRINTFUNC(DLOG_DEBUG, "%s", __func__);
}
Evas_Object* _create_genlist(Evas_Object* navi)
{
-
Evas_Object* genlist = elm_genlist_add(navi);
- if(NULL == genlist)
+ if (NULL == genlist)
return NULL;
- elm_genlist_scroller_policy_set(genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
-
- Evas_Object* circle_object_genlist = eext_circle_object_genlist_add(genlist, app_data->circle_surface);
- eext_circle_object_genlist_scroller_policy_set(circle_object_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
- evas_object_data_set(genlist, "circle", (void *) circle_object_genlist);
- eext_rotary_object_event_activated_set(circle_object_genlist, EINA_TRUE);
-
+ elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS);
+ if (_WEARABLE) {
+ Evas_Object* circle_object_genlist = eext_circle_object_genlist_add(genlist, app_data->circle_surface);
+ eext_circle_object_genlist_scroller_policy_set(circle_object_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
+ evas_object_data_set(genlist, "circle", (void *) circle_object_genlist);
+ eext_rotary_object_event_activated_set(circle_object_genlist, EINA_TRUE);
+ }
evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(genlist, EVAS_HINT_FILL, EVAS_HINT_FILL);
show_gl_focus(EINA_FALSE);
+ const char *item_style = NULL;
+ if (_WEARABLE)
+ item_style = "empty";
Elm_Object_Item *nf_main_item = elm_naviframe_item_push(navi,
NULL,
NULL,
NULL,
genlist,
- "empty");
+ item_style);
elm_naviframe_item_pop_cb_set(nf_main_item, back_cb, app_data);
evas_object_smart_callback_add(genlist, "realized", _item_realized, NULL);
static void _item_position_changed_cb(void *data, Evas_Object *obj, void *event_info)
{
- if(!obj) return;
- if(!data) return;
+ if (!obj) return;
+ if (!data) return;
Evas_Object *genlist = (Evas_Object *)obj;
Elm_Object_Item *gen_item = (Elm_Object_Item *)data;
// PRINTFUNC(DLOG_DEBUG,"y=%d",y);
- if( 250 > y && y >= 100 ){
- if(last_step == 0) return;
+ if (250 > y && y >= 100){
+ if (last_step == 0) return;
last_step = 0;
elm_object_item_signal_emit(gen_item, "elm,action,ime,0.0", "elm");
show_gl_focus(EINA_TRUE);
- } else if( 100 > y && y >= 50 ){
- if(last_step == 1) return;
+ } else if (100 > y && y >= 50){
+ if (last_step == 1) return;
last_step = 1;
elm_object_item_signal_emit(gen_item, "elm,action,ime,0.1", "elm");
show_gl_focus(EINA_TRUE);
- } else if( y < 50 && y >=0){
- if(last_step == 2) return;
+ } else if (y < 50 && y >=0){
+ if (last_step == 2) return;
last_step = 2;
elm_object_item_signal_emit(gen_item, "elm,action,ime,0.9", "elm");
show_gl_focus(EINA_FALSE);
}
-
-
}
-static char *
-_main_menu_title_text_get(void *data, Evas_Object *obj, const char *part)
+void _create_genlist_items(void* user_data)
{
- char buf[1024];
-
- snprintf(buf, 1023, "%s", "Select method");
- return strdup(buf);
-}
-
-void _create_genlist_items(void* user_data, bool is_type_reply)
-{
- LOGD("[psw] _create_genlist_items");
-
App_Data* app_data = (App_Data*) user_data;
- if(NULL == app_data->genlist) {
+ if (NULL == app_data->genlist) {
app_data->genlist = _create_genlist(app_data->naviframe);
- if(NULL == app_data->genlist)
+ if (NULL == app_data->genlist)
return;
}
elm_genlist_clear(app_data->genlist);
- g_smartreply_current_number = 0; /* reset previous smartreply size to 0 */
Elm_Genlist_Item_Class * itc0 = elm_genlist_item_class_new();
- itc0->item_style = "title";
- itc0->func.text_get = _main_menu_title_text_get;
+ itc0->item_style = NULL;
+ itc0->func.text_get = NULL;
itc0->func.content_get = NULL;
itc0->func.state_get = NULL;
itc0->func.del = NULL;
Elm_Genlist_Item_Class * itc1 = elm_genlist_item_class_new();
- itc1->item_style = "3button";
- itc1->func.text_get = NULL;
- itc1->func.content_get = __ise_gl_3button_content_get;
- itc1->func.state_get = NULL;
- itc1->func.del = NULL;
-
+ if (g_input_type_data.input_type_array_len == 2){
+ itc1->item_style = "2button_flat";
+ itc1->func.text_get = NULL;
+ itc1->func.content_get = __ise_gl_2button_content_get;
+ itc1->func.state_get = NULL;
+ itc1->func.del = NULL;
+ } else {
+ itc1->item_style = "3button_flat";
+ itc1->func.text_get = NULL;
+ itc1->func.content_get = __ise_gl_3button_content_get;
+ itc1->func.state_get = NULL;
+ itc1->func.del = NULL;
+ }
// dummy title for empty space
it_empty = elm_genlist_item_append(app_data->genlist, itc0,
ELM_GENLIST_ITEM_NONE,
NULL, NULL);
- if(!is_type_reply) {
+ if (app_data->app_type != APP_TYPE_REPLY) {
// 3 Buttons
it_title = elm_genlist_item_append(app_data->genlist, itc1,
NULL, NULL,
ELM_GENLIST_ITEM_NONE,
NULL, NULL);
-
- elm_genlist_item_select_mode_set(it_title, ELM_OBJECT_SELECT_MODE_NONE);
- }
-
- if (input_smartreply_is_enabled() == false) {
- _update_template_items(app_data);
- if(g_template_current_number > 0) {
- Evas_Object *circle_genlist = (Evas_Object *) evas_object_data_get(app_data->genlist, "circle");
- eext_circle_object_genlist_scroller_policy_set(circle_genlist,
- ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
- }
}
- else {
- // dummy title for bottom
- Elm_Object_Item *dummy;
-
- dummy = elm_genlist_item_append(app_data->genlist, itc0,
- NULL, NULL,
- ELM_GENLIST_ITEM_NONE,
- NULL, NULL);
- elm_genlist_item_select_mode_set(dummy, ELM_OBJECT_SELECT_MODE_NONE);
- }
+ elm_genlist_item_select_mode_set(it_title, ELM_OBJECT_SELECT_MODE_NONE);
+ g_template_item_size = _update_template_items(app_data);
Elm_Object_Item *item = elm_genlist_item_next_get(it_title);
elm_genlist_item_show(item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
elm_genlist_item_class_free(itc0);
elm_genlist_item_class_free(itc1);
-}
+}
-void _update_genlist_items(void *user_data)
+void _create_header_items(void *user_data)
{
- int len = 0;
+ 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;
- if (input_smartreply_is_enabled())
- len = input_smartreply_get_reply_num();
+ Elm_Genlist_Item_Class * itc1 = elm_genlist_item_class_new();
+ if (g_input_type_data.input_type_array_len == 2) {
+ itc1->item_style = "2button_flat";
+ itc1->func.text_get = NULL;
+ itc1->func.content_get = __ise_gl_2button_content_get;
+ itc1->func.state_get = NULL;
+ itc1->func.del = NULL;
+ } else {
+ itc1->item_style = "3button_flat";
+ itc1->func.text_get = NULL;
+ itc1->func.content_get = __ise_gl_3button_content_get;
+ itc1->func.state_get = NULL;
+ itc1->func.del = NULL;
+ }
+
+ // dummy title for empty space
+ it_empty = elm_genlist_item_append(app_data->genlist, itc0,
+ NULL, NULL,
+ ELM_GENLIST_ITEM_NONE,
+ NULL, NULL);
- if (g_smartreply_current_number != len)
- _update_smartreply_items(user_data);
+ // 3 Buttons
+ it_title = elm_genlist_item_append(app_data->genlist, itc1,
+ NULL, NULL,
+ ELM_GENLIST_ITEM_NONE,
+ NULL, NULL);
- _update_template_items(user_data);
+ elm_genlist_item_select_mode_set(it_title, ELM_OBJECT_SELECT_MODE_NONE);
- g_smartreply_current_number = len;
+ elm_genlist_item_class_free(itc0);
+ elm_genlist_item_class_free(itc1);
+}
- if (g_smartreply_current_number > 0 || g_template_current_number > 0) {
- Evas_Object *circle_genlist = (Evas_Object *) evas_object_data_get(app_data->genlist, "circle");
- eext_circle_object_genlist_scroller_policy_set(circle_genlist,
- ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+void _update_genlist_items(void *user_data)
+{
+ elm_genlist_clear(app_data->genlist);
+
+ _create_header_items(user_data);
+
+ if (input_smartreply_is_enabled())
+ g_smartreply_item_size = _update_smartreply_items(user_data);
+ else
+ g_smartreply_item_size = 0;
+
+ 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);
}
-void _update_smartreply_items(void *user_data)
+unsigned int _update_smartreply_items(void *user_data)
{
App_Data* app_data;
Elm_Object_Item *first;
- Elm_Object_Item *menu;
- Elm_Object_Item *pos;
- int len = 0;
- int i = 0;
+ unsigned int i = 0;
+ unsigned int len = 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;
+ return item_size;
}
if (app_data->genlist == NULL) {
/* smartreply will update when genlist is exist only */
PRINTFUNC(DLOG_ERROR, "Can not get getlist");
- return;
+ return item_size;
}
- if (input_smartreply_is_enabled())
- len = input_smartreply_get_reply_num();
-
- if (g_smartreply_current_number == len)
- return;
-
+ /* Move to smartreply */
first = elm_genlist_first_item_get(app_data->genlist);
- menu = elm_genlist_item_next_get(first);
-
- /* Remove current smartreply list */
- pos = elm_genlist_item_next_get(menu);
- for (i = 0; i < g_smartreply_current_number; i++) {
- Elm_Object_Item *next;
+ elm_genlist_item_next_get(first);
- if (pos == NULL)
- break;
-
- next = elm_genlist_item_next_get(pos);
- elm_object_item_del(pos);
- pos = next;
- }
+ if (input_smartreply_is_enabled() == false)
+ return item_size;
/* Append newly added smartreply list */
+ len = input_smartreply_get_reply_num();
+
if (len > 0) {
+ const std::vector<TemplateData> template_list = input_template_get_list();
+
Elm_Genlist_Item_Class *itc;
itc = elm_genlist_item_class_new();
-
itc->item_style = "1text";
itc->func.text_get = __ise_smartreply_gl_text_get;
itc->func.content_get = NULL;
itc->func.state_get = NULL;
itc->func.del = NULL;
- pos = menu;
for (i = 0; i < len; i++) {
- pos = elm_genlist_item_insert_after(app_data->genlist,
- itc,
- (void *)i,
- NULL,
- pos,
- ELM_GENLIST_ITEM_NONE,
- __ise_smartreply_gl_sel,
- app_data);
- }
+ char *reply = (char *)"hello";
+ unsigned int j;
+ bool matched;
+
+ matched = false;
- if (menu)
- elm_genlist_item_show(menu, ELM_GENLIST_ITEM_SCROLLTO_TOP);
+ int type;
+ reply = input_smartreply_get_nth_item(i, &type);
+ if (reply == NULL)
+ continue;
+ SECURE_LOGD("SmartReply = [%d]%s", i, reply);
+ for (j = 0; j < template_list.size(); j++) {
+ const char *template_str;
+
+ if (template_list[j].use_gettext)
+ template_str = gettext(template_list[j].text.c_str());
+ else
+ template_str = template_list[j].text.c_str();
+
+ if (!__compare_string(reply, template_str)) {
+ matched = true;
+ break;
+ }
+ }
+
+ if (matched == true) {
+ free(reply);
+ continue;
+ }
+
+ elm_genlist_item_append(app_data->genlist,
+ itc,
+ (void *)(uintptr_t)i,
+ NULL,
+ ELM_GENLIST_ITEM_NONE,
+ __ise_smartreply_gl_sel,
+ app_data);
+
+ item_size++;
+ free(reply);
+ if (item_size >= 3) {
+ break;
+ }
+ }
elm_genlist_item_class_free(itc);
}
-
- g_smartreply_current_number = len;
+ return item_size;
}
+static void _drawing_item_clicked_cb(void *data, Evas_Object * obj, void *event_info)
+{
+ PRINTFUNC(DLOG_DEBUG, "%s", __func__);
+ App_Data* ad = (App_Data*) data;
+ if (!ad)
+ return;
-void _update_template_items(void *user_data)
+ launch_drawing_app(ad);
+}
+
+unsigned int _update_template_items(void *user_data)
{
App_Data* app_data;
Elm_Object_Item *first;
Elm_Object_Item *menu;
Elm_Object_Item *pos;
- Elm_Object_Item *template_pos;
- unsigned int template_len = 0;
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;
+ return item_size;
}
if (app_data->genlist == NULL) {
/* smartreply will update when genlist is exist only */
PRINTFUNC(DLOG_ERROR, "Can not get getlist");
- return;
+ return item_size;
}
- if (app_data->app_type == APP_TYPE_REPLY) {
- menu = elm_genlist_first_item_get(app_data->genlist);
- } else {
- first = elm_genlist_first_item_get(app_data->genlist);
- menu = elm_genlist_item_next_get(first);
- }
+ first = elm_genlist_first_item_get(app_data->genlist);
+ if (first == NULL)
+ return 0;
+ menu = elm_genlist_item_next_get(first);
pos = menu;
/* move to smartreply next if it need */
if (input_smartreply_is_enabled()) {
- int smartreply_len = 0;
-
- smartreply_len = input_smartreply_get_reply_num();
- if (smartreply_len > 0) {
- int j = 0;
-
- for (j = 0; j < smartreply_len; j++) {
- if (pos == NULL)
- break;
+ unsigned int j = 0;
- pos = elm_genlist_item_next_get(pos);
- }
- }
- }
-
- /* Remove Current template list */
- template_pos = elm_genlist_item_next_get(pos);
- for (i = 0 ; i < g_template_current_number; i++) {
- Elm_Object_Item *next;
+ for (j = 0; j < g_smartreply_item_size; j++) {
+ if (pos == NULL)
+ break;
- if (template_pos == NULL) {
- PRINTFUNC(DLOG_ERROR, "Template mismatched, iter : %d, current num: %d",
- i, g_template_current_number);
- break;
+ pos = elm_genlist_item_next_get(pos);
}
-
- next = elm_genlist_item_next_get(template_pos);
- elm_object_item_del(template_pos);
- template_pos = next;
- }
-
- /* Remove Add or dummpy button */
- if(template_pos) {
- Elm_Object_Item *next;
-
- next = elm_genlist_item_next_get(template_pos);
- elm_object_item_del(template_pos);
- template_pos = next;
}
/* Append New Template list */
const std::vector<TemplateData> template_list = input_template_get_list();
- template_len = 0;
if (template_list.size() > 0) {
Elm_Genlist_Item_Class *itc;
itc->func.del = NULL;
for (i = 0; i < template_list.size(); i++) {
- bool matched = false;
-
- if(!template_list[i].use_gettext) {
- int smartreply_len = 0;
- int j = 0;
-
- smartreply_len = input_smartreply_get_reply_num();
- for (j = 0; j < smartreply_len; j++) {
- char *reply = NULL;
-
- reply = input_smartreply_get_nth_item(j);
- if (reply) {
- if (!strcmp(reply, template_list[i].text.c_str())) {
- matched = true;
- free(reply);
- break;
- }
- free(reply);
- }
- }
- }
+ pos = elm_genlist_item_append(app_data->genlist,
+ itc,
+ (void *)(uintptr_t)i,
+ NULL,
+ ELM_GENLIST_ITEM_NONE,
+ __ise_template_gl_sel,
+ app_data);
+ item_size++;
+ }
+ elm_genlist_item_class_free(itc);
- if (matched == false) {
- pos = elm_genlist_item_insert_after(app_data->genlist,
- itc,
- (void *)i,
- NULL,
- pos,
- ELM_GENLIST_ITEM_NONE,
- __ise_template_gl_sel,
- app_data);
- template_len++;
- }
+ // drawing button (+)
+ if (app_data->mime_type == MIME_TYPE_ALL && app_data->app_type == APP_TYPE_SELECT_MODE) {
+ Elm_Genlist_Item_Class *itc;
+ itc = elm_genlist_item_class_new();
+
+ itc->item_style = "1text.1icon";
+ itc->func.text_get = __ise_drawing_text_get;;
+ itc->func.content_get = __ise_drawing_content_get;
+ itc->func.state_get = NULL;
+ itc->func.del = NULL;
+
+ elm_genlist_item_append(app_data->genlist,
+ itc,
+ NULL,
+ NULL,
+ ELM_GENLIST_ITEM_NONE,
+ _drawing_item_clicked_cb,
+ app_data);
+
+ elm_genlist_item_class_free(itc);
}
- 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;
+
+ 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;
+ }
- // template add button (+)
-/* if (!input_template_is_user_template()) {
+ 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.1icon";
- itc->func.text_get = __ise_addtemplate_gl_text_get;;
- itc->func.content_get = __ise_gl_1button_content_get;
+ 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);
- pos = elm_genlist_item_insert_after(app_data->genlist,
- itc,
- NULL,
- NULL,
- pos,
- ELM_GENLIST_ITEM_NONE,
- __ise_template_add_gl_sel,
- app_data);
+ // 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;
- elm_genlist_item_class_free(itc);
+ it_empty = elm_genlist_item_append(app_data->genlist, itc0,
+ NULL, NULL,
+ ELM_GENLIST_ITEM_NONE,
+ NULL, NULL);
+ elm_genlist_item_class_free(itc0);
}
-*/
- if (menu)
- elm_genlist_item_show(menu, ELM_GENLIST_ITEM_SCROLLTO_TOP);
- g_template_current_number = template_len;
+ return item_size;
}
+bool __compare_string(const char * smart_str, const char * template_str)
+{
+ int src_len = 0;
+ int dst_len = 0;
+ bool ret = true;
+
+ if(!smart_str||!template_str)
+ return ret;
+
+ src_len = strlen(smart_str);
+ dst_len = strlen(template_str);
+
+ if(smart_str[src_len-1] == '.')
+ src_len--;
+
+ while(template_str[dst_len-1] == ' ')
+ dst_len--;
+ if(template_str[dst_len-1] == '.')
+ dst_len--;
+
+ dst_len = (dst_len > src_len)? dst_len : src_len;
+
+ if(!strncmp(smart_str, template_str, (size_t)dst_len))
+ ret = false;
+
+ return (ret);
+}
bool _app_create(void* user_data)
{
- int width=1000, height=1000;
// App_Data* app_data = NULL;
Evas_Object* layout = NULL;
Evas_Object* conform = NULL;
Evas_Object* bg = NULL;
Evas_Object* window = NULL;
- Eext_Circle_Surface *surface;
+ Eext_Circle_Surface *surface = NULL;
if (!user_data) {
return false;
}
_app_language_changed(NULL, NULL);
-#ifdef SUPPORT_LOG_MANAGER
- log_manager_init();
-#endif
app_data = (App_Data*)user_data;
elm_win_title_set(window, PACKAGE);
elm_win_borderless_set(window, EINA_TRUE);
-// ecore_x_window_size_get(ecore_x_window_root_first_get(), &width, &height);
- evas_object_resize(window, width, height);
elm_win_indicator_mode_set(window, ELM_WIN_INDICATOR_SHOW);
- }
- else {
+ } else {
LOGE("elm_win_add() is failed.");
return false;
}
evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
conform = elm_conformant_add(window);
- surface = eext_circle_surface_conformant_add(conform);
- evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ if (_WEARABLE)
+ surface = eext_circle_surface_conformant_add(conform);
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(window, conform);
elm_object_content_set(conform, layout);
void _app_service(app_control_h service, void* user_data)
{
int ret;
- bool b_ret;
char *context = NULL;
- char *app_id = NULL;
+ char **input_type_array = NULL;
+ 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;
- ret = app_control_get_extra_data(service, "selector_keyboard_app_id", &app_id);
- if (ret == APP_CONTROL_ERROR_NONE) {
- PRINTFUNC(DLOG_DEBUG, "app_id = %s", app_id);
- }
-
- if(app_id){
- if(!strcmp(app_id, "com.samsung.message.appcontrol.compose") || !strcmp(app_id, "com.samsung.wemail-send")) {
- app_data->reply_type = REPLY_APP_CONTROL;
- } else {
- 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;
+
+ g_set_mimetype_in_app_service = false;
+
+ ret = app_control_get_mime(service, &mime_type);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ LOGD("Fail to get mime type : %d", ret);
+ } else {
+ if (mime_type) {
+ LOGD("mime type = %s", mime_type);
+ if (!strncmp(mime_type, "image/", strlen("image/"))) {
+ app_data->mime_type = MIME_TYPE_IMAGE;
+ app_data->app_type = APP_TYPE_DRAWING;
+ g_set_mimetype_in_app_service = true;
+ launch_drawing_app((void *)app_data);
+ if (mime_type)
+ free(mime_type);
+ goto ACTIVATE;
+ } else if (!strncmp(mime_type, "audio/", strlen("audio/"))) {
+ app_data->mime_type = MIME_TYPE_AUDIO;
+ app_data->app_type = APP_TYPE_STT;
+ _stt_clicked_cb((void *)app_data, NULL, NULL);
+ if (mime_type)
+ free(mime_type);
+ goto ACTIVATE;
+ } else if (!strncmp(mime_type, "text/", strlen("text/"))) {
+ app_data->mime_type = MIME_TYPE_TEXT;
+ }
}
}
-
- if(app_id)
- free(app_id);
-
- bool is_type_reply = false;
- ret = app_control_get_extra_data(service, APP_CONTROL_DATA_INPUT_TYPE, &context);
- if (ret == APP_CONTROL_ERROR_NONE) {
- if(!strcmp(context, "input_voice")) {
- app_data->app_type = APP_TYPE_STT;
- _stt_clicked_cb( (void *)app_data, NULL, NULL );
- goto ACTIVATE;
- } else if(!strcmp(context, "input_emoticon")) {
- app_data->app_type = APP_TYPE_EMOTICON;
- _emoticon_clicked_cb( (void *)app_data, NULL, NULL);
- goto ACTIVATE;
- } else if(!strcmp(context, "input_keyboard")) {
- app_data->app_type = APP_TYPE_KEYBOARD;
- input_keyboard_init(service);
- _keyboard_clicked_cb( (void *)app_data, NULL, NULL);
- goto ACTIVATE;
- } else if(!strcmp(context, "keyboard_input_from_sms")) {
- app_data->app_type = APP_TYPE_KEYBOARD_FROM_SMS;
- input_keyboard_init(service);
- _keyboard_clicked_cb( (void *)app_data, NULL, NULL);
- goto ACTIVATE;
- } else if(!strcmp(context, "input_reply")) {
- app_data->app_type = APP_TYPE_REPLY;
- is_type_reply = true;
+ if (mime_type)
+ free(mime_type);
+
+ if (_TV || _MOBILE) {
+ app_data->app_type = APP_TYPE_KEYBOARD;
+ input_keyboard_init(service);
+ _keyboard_clicked_cb((void *)app_data, NULL, NULL);
+ goto ACTIVATE;
+ }
+
+ ret = app_control_is_extra_data_array(service, APP_CONTROL_DATA_INPUT_TYPE, &is_extra_data_array);
+ if ( is_extra_data_array == true) {
+ ret = app_control_get_extra_data_array(service, APP_CONTROL_DATA_INPUT_TYPE, &input_type_array, &input_type_array_len);
+ g_input_type_data.input_type_array = input_type_array;
+ g_input_type_data.input_type_array_len = input_type_array_len;
+ } else {
+ ret = app_control_get_extra_data(service, APP_CONTROL_DATA_INPUT_TYPE, &context);
+ if (ret == APP_CONTROL_ERROR_NONE) {
+ if (!strcmp(context, "input_voice")) {
+ app_data->app_type = APP_TYPE_STT;
+ _stt_clicked_cb((void *)app_data, NULL, NULL);
+ goto ACTIVATE;
+ } else if (!strcmp(context, "input_recording")) {
+ app_data->app_type = APP_TYPE_RECORDING;
+ _stt_clicked_cb((void *)app_data, NULL, NULL);
+ goto ACTIVATE;
+ } else if (!strcmp(context, "input_emoticon")) {
+ app_data->app_type = APP_TYPE_EMOTICON;
+ _emoticon_clicked_cb((void *)app_data, NULL, NULL);
+ goto ACTIVATE;
+ } else if (!strcmp(context, "input_keyboard")) {
+ app_data->app_type = APP_TYPE_KEYBOARD;
+ input_keyboard_init(service);
+ _keyboard_clicked_cb((void *)app_data, NULL, NULL);
+ goto ACTIVATE;
+ } else if (!strcmp(context, "input_drawing")) {
+ app_data->app_type = APP_TYPE_DRAWING;
+ _drawing_item_clicked_cb((void *)app_data, NULL, NULL);
+ goto ACTIVATE;
+ } else if (!strcmp(context, "input_reply")) {
+ app_data->app_type = APP_TYPE_REPLY;
+ }
}
}
input_keyboard_init(service);
-// input_smartreply_init(service);
-// input_smartreply_set_notify(_input_smartreply_notify_cb, NULL);
-
-// if (input_smartreply_is_enabled())
-// input_smartreply_get_reply_async();
+ input_smartreply_init(service);
+ input_smartreply_set_notify(_input_smartreply_notify_cb, NULL);
+ if (input_smartreply_is_enabled())
+ input_smartreply_get_reply_async();
input_template_init(service);
input_template_set_notify(_input_template_notify_cb, NULL);
- _create_genlist_items(app_data, is_type_reply);
+ _create_genlist_items(app_data);
ACTIVATE :
elm_win_activate(app_data->win_main);
-// app_control_request_transient_app(service, elm_win_xwindow_get(app_data->win_main), _app_control_request_transient_app_cb, NULL);
- if(context)
+ if (context)
free(context);
}
-
void _app_pause(void* user_data)
{
PRINTFUNC(DLOG_DEBUG, "");
void _app_resume(void* user_data)
{
PRINTFUNC(DLOG_DEBUG, "");
+ resume_voice();
+
+ if (g_set_mimetype_in_app_resume) {
+ app_control_destroy(app_data->source_app_control);
+ app_data->source_app_control = NULL;
+ ui_app_exit();
+ }
+
+ if (g_set_mimetype_in_app_service) {
+ g_set_mimetype_in_app_resume = true;
+ }
}
void _app_terminate(void* user_data)
App_Data* app_data = NULL;
app_data = (App_Data*)user_data;
- if(app_data->genlist){
+ if (app_data->genlist){
evas_object_smart_callback_del(app_data->genlist, "elm,item,position,changed", _item_position_changed_cb);
}
- if(app_data->res_path)
+ if (app_data->res_path)
free(app_data->res_path);
- if(app_data->shared_res_path)
+ if (app_data->shared_res_path)
free(app_data->shared_res_path);
input_keyboard_deinit();
input_template_unset_notify();
input_template_deinit();
-#ifdef SUPPORT_LOG_MANAGER
- log_manager_exit();
-#endif
+ input_type_deinit();
}
static int init_i18n(const char *domain, const char *dir, char *lang_str)
{
if (setlocale(LC_ALL, "") == NULL) {
- PRINTFUNC(DLOG_INFO,"Some environment variable is invalid, setlocale(LC_ALL, \"\") has returns\ed a null pointer");
+ PRINTFUNC(DLOG_INFO, "Some environment variable is invalid, setlocale(LC_ALL, \"\") has returns\ed a null pointer");
if (setlocale(LC_ALL, lang_str) == NULL)
return -1;
}
}
}
+void input_type_deinit(void)
+{
+ int i = 0;
+ char **data_array = NULL;
+ data_array = g_input_type_data.input_type_array;
+ if (data_array) {
+ for (i = 0; i < g_input_type_data.input_type_array_len; i++) {
+ if (*(data_array + i))
+ free(*(data_array + i));
+ }
+ free(data_array);
+ }
+ g_input_type_data.input_type_array = NULL;
+ g_input_type_data.input_type_array_len = 0;
+}
-int main(int argc, char* argv[])
+EXPORTED int main(int argc, char* argv[])
{
- App_Data app_data = {0,};
- ui_app_lifecycle_callback_s event_callback = {0,};
- app_event_handler_h handlers[5] = {NULL, };
+ App_Data app_data = {0, };
+ ui_app_lifecycle_callback_s event_callback = {0, };
+ app_event_handler_h handlers[5] = {NULL, };
event_callback.create = _app_create;
event_callback.terminate = _app_terminate;
event_callback.resume = _app_resume;
event_callback.app_control = _app_service;
- ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, NULL, &app_data);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, NULL, &app_data);
ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, NULL, &app_data);
ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, NULL, &app_data);
ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, _app_language_changed, &app_data);
return ret;
}
-
-#ifdef SUPPORT_LOG_MANAGER
-static void log_manager_init(void)
-{
- if (g_log_manager)
- return;
-
- samsung_log_manager_create(&g_log_manager);
-}
-
-static void log_manager_exit(void)
-{
- samsung_log_manager_destroy(g_log_manager);
- g_log_manager = NULL;
-}
-
-static void log_manager_set(const char *feature, const char *extra, const char *value)
-{
- const char *uri = USE_APP_FEATURE_SURVEY_URI;
-
- unsigned int request_id;
- bundle *log_data;
-
- if (g_log_manager == NULL) {
- PRINTFUNC(DLOG_ERROR, "log manager doesn't initialized");
- return;
- }
-
- if (feature == NULL) {
- PRINTFUNC(DLOG_ERROR, "feature is empty");
- return;
- }
-
- log_data = bundle_create();
-
- bundle_add(log_data, "app_id", PACKAGE);
- bundle_add(log_data, "feature", feature);
-
- if (extra)
- bundle_add(log_data, "extra", extra);
- if (value)
- bundle_add(log_data, "value", value);
-
- samsung_log_manager_insert(g_log_manager, uri, log_data, NULL, NULL, &request_id);
-
- bundle_free(log_data);
-}
-#endif
-