* limitations under the License.
*/
+#include <app.h>
#include <app_preference.h>
#include <Elementary.h>
#include <string>
#include <vector>
+#include <stdint.h>
#include <vconf.h>
#include <vconf-keys.h>
typedef struct {
int code;
- char* name;
+ const char* name;
}Emoticon;
static Elm_Object_Item *it_emoticon_empty = NULL;
static Elm_Object_Item *it_emoticon_recent_group = NULL;
static Elm_Object_Item *it_emoticon_emoji_group = NULL;
+static Elm_Object_Item* it_drawing = NULL;
static Elm_Object_Item *it_last = NULL;
static Elm_Genlist_Item_Class *itc_emoticon = NULL;
} emoticon_content_s;
static emoticon_content_s emoticon_contents_pool[EMOTICON_CNT] = { 0, };
+static emoticon_content_s emoticon_drawing_pool = { 0, };
static emoticon_content_s emoticon_recents_pool[RECENT_CNT] = { 0, };
};
-static Eina_Bool _custom_back_cb(void *data, Elm_Object_Item *it)
-{
- _back_to_genlist_for_selector();
- return EINA_TRUE;
-}
-
-
//---------------------------------------------------------------------------------------//
static Eina_Bool _custom_back_cb2(void *data, Elm_Object_Item *it)
lazy_loading_timer_for_contents = NULL;
}
+ if(emoticon_drawing_pool.used == 0){
+ evas_object_del(emoticon_drawing_pool.content);
+ }
+ emoticon_drawing_pool.content = NULL;
+
//Recent EMOTICONS : the recent emoiton need to be updated whenever emoticon view is generated, so deleted here.
for (i=0;i< RECENT_CNT;i++)
{
void set_recent_emoticons(vector <int> &emoticon_list, int val)
{
- int i;
+ unsigned int i;
int ret = PREFERENCE_ERROR_NONE;
if (emoticon_list.size() > 0) {
if (PREFERENCE_ERROR_NONE != ret) {
PRINTFUNC(DLOG_ERROR, "preference_set_string error!(%d)", ret);
}
+
+}
+
+static void _drawing_app_control_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
+{
+ char* path = NULL;
+ app_control_get_extra_data(reply, APP_CONTROL_DATA_PATH, &path);
+
+ if(path){
+ PRINTFUNC(DLOG_DEBUG, "path=%s", path);
+ free(path);
+ reply_to_sender_by_callback((const char*)path, "image", NULL);
+ }
+ ui_app_exit();
+}
+
+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;
+
+ Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+ if (item)
+ elm_genlist_item_selected_set(item, EINA_FALSE);
+
+ /* launch */
+ app_control_h request = NULL;
+ app_control_create(&request);
+ app_control_set_app_id(request, "com.samsung.sketch");
+ //app_control_set_app_id(request, "wearable-input.sketch");
+
+ int ret = app_control_send_launch_request(request, _drawing_app_control_reply_cb, NULL);
+ if (ret != APP_CONTROL_ERROR_NONE) {
+ PRINTFUNC(DLOG_DEBUG, "error code = 0x%x", ret);
+ }
+ app_control_destroy(request);
}
static void _emoticon_item_clicked_cb(void *data, Evas_Object * obj, void *event_info)
{
- int index = (int)data;
+ int index = (uintptr_t)data;
PRINTFUNC(DLOG_DEBUG, "index = %d", index);
set_recent_emoticons(recent_emoji_list, index);
int length;
- const Eina_Unicode unicode_event[2] = { emoticon_info[index].code, 0 };
+ const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[index].code, 0 };
char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
- reply_to_sender_by_callback((const char*)utf_8, "emoticon");
+ reply_to_sender_by_callback((const char*)utf_8, "emoticon", NULL);
PRINTFUNC(SECURE_DEBUG, "[%d]%s", index, utf_8);
if (utf_8)
free(utf_8);
- elm_exit();
+ ui_app_exit();
}
Evas_Object* get_emoticon_button(Evas_Object* parent, int index){
evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
int length;
- const Eina_Unicode unicode_event[2] = { emoticon_info[index].code, 0 };
+ const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[index].code, 0 };
char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
elm_object_part_text_set(btn, "elm.text", utf_8);
evas_object_layer_set(btn, 32000);
- evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void *)index);
+ evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void *)(uintptr_t)index);
return btn;
}
evas_object_size_hint_align_set(btn, EVAS_HINT_FILL, EVAS_HINT_FILL);
int length;
- const Eina_Unicode unicode_event[2] = { emoticon_info[recent_emoji_list.at(index)].code, 0 };
+ const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[recent_emoji_list.at(index)].code, 0 };
char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
elm_object_part_text_set(btn, "elm.text", utf_8);
- evas_object_data_set(btn, "index", (void*) recent_emoji_list.at(index));
+ evas_object_data_set(btn, "index", (void*)(uintptr_t) recent_emoji_list.at(index));
if (utf_8)
free(utf_8);
evas_object_layer_set(btn, 32000);
- evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void*) recent_emoji_list.at(index));
+ evas_object_smart_callback_add(btn, "clicked", _emoticon_item_clicked_cb, (void*)(uintptr_t) recent_emoji_list.at(index));
return btn;
}
static char * __emoticon_gl_text_get(void *data, Evas_Object *obj, const char *part)
{
//PRINTFUNC(DLOG_DEBUG,"part = %s", part);
-
const char* str = (const char*) data;
if (!str)
return NULL;
const Elm_Genlist_Item_Class *itc = elm_genlist_item_item_class_get(it);
-// PRINTFUNC(DLOG_DEBUG,"%s - stype[%s]", __func__, itc->item_style);
+ //PRINTFUNC(DLOG_DEBUG,"%s - stype[%s]", __func__, itc->item_style);
if (!strcmp(itc->item_style, "3button_flat")) {
- int index = (int)elm_object_item_data_get(it);
+ int index = (uintptr_t)elm_object_item_data_get(it);
//PRINTFUNC(DLOG_DEBUG,"it = %p", it);
PRINTFUNC(DLOG_DEBUG, "index = %d %d %d", index, index+1, index+2);
emoticon_contents_pool[index+2].used = 0;
}
} else if (!strcmp(itc->item_style, "3button_flat_recent")) {
- int index = (int)elm_object_item_data_get(it);
+ unsigned int index = (uintptr_t)elm_object_item_data_get(it);
//PRINTFUNC(DLOG_DEBUG,"index = %d",index);
if (index < recent_emoji_list.size()) {
if (index + 2 < recent_emoji_list.size()) {
emoticon_recents_pool[index+2].used = 0;
}
+ } else if (it_drawing == it) {
+ //PRINTFUNC(DLOG_DEBUG,"it_drawing = %p", it_drawing);
+ emoticon_drawing_pool.used = 0;
}
}
+static Evas_Object * __emoticon_gl_1_content_get(void *data, Evas_Object *obj, const char *part)
+{
+ 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();
+ 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";
+ PRINTFUNC(DLOG_DEBUG, "path_ic = %s", path_ic.c_str());
+ elm_image_file_set(ic, path_ic.c_str(), NULL);
+ elm_object_content_set(btn, ic);
+ evas_object_layer_set(btn, 32000);
+
+ emoticon_drawing_pool.index = 0;
+ emoticon_drawing_pool.content = btn;
+ emoticon_drawing_pool.used = 0;
+ 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 * __emoticon_gl_recent_content_get(void *data, Evas_Object *obj, const char *part)
{
if (is_content_reuse_on) {
- int index = (int)data;
+ unsigned int index = (uintptr_t)data;
int new_index = 0;
- //PRINTFUNC(DLOG_DEBUG,"%s %d", part, index);
+ //PRINTFUNC(DLOG_DEBUG,"%s %d", part, index);
if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
if (!strcmp(part, "elm.icon.1")) {
if (index >= recent_emoji_list.size()) return NULL;
return btn;
}
} else {
- int index = (int)data;
+ unsigned int index = (uintptr_t)data;
int new_index = 0;
- // PRINTFUNC(DLOG_DEBUG,"%s %d", part, index);
+ //PRINTFUNC(DLOG_DEBUG,"%s %d", part, index);
if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
if (!strcmp(part, "elm.icon.1")) {
if (index >= recent_emoji_list.size()) return NULL;
static Evas_Object * __emoticon_gl_emoticon_content_get(void *data, Evas_Object *obj, const char *part)
{
//PRINTFUNC(DLOG_DEBUG,"%s", __func__);
-
if (is_content_reuse_on) {
- int index = (int)data;
+ int index = (uintptr_t)data;
int new_index = 0;
if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
elm_object_part_text_set(btn, "elm.text", strdup(utf_8));
#else
int length;
- const Eina_Unicode unicode_event[2] = { emoticon_info[new_index].code, 0 };
+ const Eina_Unicode unicode_event[2] = { (Eina_Unicode)emoticon_info[new_index].code, 0 };
char* utf_8 = eina_unicode_unicode_to_utf8(unicode_event, &length);
elm_object_part_text_set(btn, "elm.text", utf_8);
- evas_object_data_set(btn, "index", (void*)new_index);
+ evas_object_data_set(btn, "index", (void*)(uintptr_t)new_index);
if (utf_8)
free(utf_8);
return btn;
}
} else {
- int index = (int)data;
+ int index = (uintptr_t)data;
int new_index = 0;
if (!strcmp(part, "elm.icon.1") || (!strcmp(part, "elm.icon.2")) || (!strcmp(part, "elm.icon.3"))) {
return NULL;
}
-
void _create_reusable_recents(Evas_Object *parent)
{
if (!parent) {
return;
}
- int i;
+ unsigned int i;
for (i = 0; i < recent_emoji_list.size(); i++ ) {
emoticon_recents_pool[i].index = i;
emoticon_recents_pool[i].content = get_recent_emoticon_button(parent, i);
int i;
for (i = loading_done_for_item; i < loading_top; i++ ) {
if (i%3 == 0)
- elm_genlist_item_append(gl, itc_emoticon, (void*)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)i);
+ elm_genlist_item_append(gl, itc_emoticon, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i);
}
loading_done_for_item = loading_top;
for (i = 0; i < INITAL_ITEM_UNIT; i++ ) {
if (i%3 == 0)
- elm_genlist_item_append(gl, itc_emoticon, (void*)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)i);
+ elm_genlist_item_append(gl, itc_emoticon, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i);
}
lazy_loading_timer_for_items = ecore_timer_add(0.1, _lazy_loader_cb_for_items, (void *)gl);
if (NULL == genlist)
return NULL;
- Evas_Object* circle_object_genlist = eext_circle_object_genlist_add(genlist, ad->circle_surface);
- eext_circle_object_genlist_scroller_policy_set(circle_object_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
- evas_object_data_set(genlist, "circle", (void *) circle_object_genlist);
- eext_rotary_object_event_activated_set(circle_object_genlist, EINA_TRUE);
-
+ if (_WEARABLE) {
+ Evas_Object* circle_object_genlist = eext_circle_object_genlist_add(genlist, ad->circle_surface);
+ eext_circle_object_genlist_scroller_policy_set(circle_object_genlist, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
+ 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);
evas_object_show(genlist);
- Elm_Object_Item *nf_emoticon_item = elm_naviframe_item_push(ad->naviframe, NULL, NULL, NULL, genlist, "empty");
+ const char *item_style = NULL;
+ if (_WEARABLE)
+ item_style = "empty";
+ Elm_Object_Item *nf_emoticon_item = elm_naviframe_item_push(ad->naviframe, NULL, NULL, NULL, genlist, item_style);
elm_naviframe_item_pop_cb_set(nf_emoticon_item, _custom_back_cb2, ad);
if (!gl)
return;
- int i;
+ unsigned int i;
Elm_Object_Item *it = NULL;
Elm_Object_Item *first_it = NULL;
itc_dummy->func.state_get = NULL;
itc_dummy->func.del = NULL;
- Elm_Genlist_Item_Class *itc_group = elm_genlist_item_class_new();
+ Elm_Genlist_Item_Class *itc_1text_1icon = elm_genlist_item_class_new();
+ itc_1text_1icon->item_style = "drawing";
+ itc_1text_1icon->func.text_get = __emoticon_gl_text_get;
+ itc_1text_1icon->func.content_get = __emoticon_gl_1_content_get;
+ itc_1text_1icon->func.state_get = NULL;
+ itc_1text_1icon->func.del = NULL;
+ Elm_Genlist_Item_Class *itc_group = elm_genlist_item_class_new();
itc_group->item_style = "groupindex";
itc_group->func.text_get = __emoticon_gl_text_get;
itc_group->func.content_get = NULL;
itc_group->func.del = NULL;
Elm_Genlist_Item_Class *itc_recent = elm_genlist_item_class_new();
- if (is_content_reuse_on) {
-// itc_recent->content_reusable = EINA_TRUE;
- }
itc_recent->item_style = "3button_flat_recent";
itc_recent->func.text_get = NULL;
itc_recent->func.content_get = __emoticon_gl_recent_content_get;
itc_recent->func.del = NULL;
itc_emoticon = elm_genlist_item_class_new();
- if (is_content_reuse_on) {
-// itc_emoticon->content_reusable = EINA_TRUE;
- }
itc_emoticon->item_style = "3button_flat";
itc_emoticon->func.text_get = NULL;
itc_emoticon->func.content_get = __emoticon_gl_emoticon_content_get;
// dummy title for empty space
it_emoticon_empty = elm_genlist_item_append(gl, itc_dummy, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ // Drawing
+ it_drawing = elm_genlist_item_append(gl, itc_1text_1icon, "Doodle", NULL, ELM_GENLIST_ITEM_NONE, _drawing_item_clicked_cb, (void *)app_data);
+ first_it = it_drawing;
+
if (recent_emoji_list.size() > 0) {
if (is_content_reuse_on) {
_create_reusable_recents(gl);
for (i=0;i < recent_emoji_list.size();i=i+3)
{
- it = elm_genlist_item_append(gl, itc_recent, (void*)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)i);
+ it = elm_genlist_item_append(gl, itc_recent, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i);
}
}
} else {
// Emoticons
for (i=0;i< EMOTICON_CNT;i=i+3) {
- it = elm_genlist_item_append(gl, itc_emoticon, (void*)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)i);
+ it = elm_genlist_item_append(gl, itc_emoticon, (void*)(uintptr_t)i, NULL, ELM_GENLIST_ITEM_NONE, NULL, (void *)(uintptr_t)i);
it_last = it;
}
elm_genlist_item_class_free(itc_emoticon);
elm_genlist_item_class_free(itc_recent);
elm_genlist_item_class_free(itc_group);
+ elm_genlist_item_class_free(itc_1text_1icon);
elm_genlist_item_class_free(itc_dummy);
}
it_emoticon_empty = NULL;
it_emoticon_recent_group = NULL;
it_emoticon_emoji_group = NULL;
+ it_drawing = NULL;
it_last = NULL;
get_recent_emoticons(recent_emoji_list);