From 5df7cf6b50790a86f744bef063714d530a69b230 Mon Sep 17 00:00:00 2001 From: "moon87.park" Date: Mon, 14 Dec 2015 16:48:41 +0900 Subject: [PATCH] [Telegram] Optimize the entry in chat view And Modify the 'Create new group' view Change-Id: Iefaef04ed9e9fc9936ef3c84077c27ae697a7f81 --- TelegramTizen/res/edje/telegram_init_screen.edc | 117 +++++----------- TelegramTizen/res/edje/telegram_theme.edc | 178 +++++++----------------- TelegramTizen/src/group_chat_entry_view.c | 96 +++++++------ TelegramTizen/src/tg_search_message_view.c | 3 +- 4 files changed, 142 insertions(+), 252 deletions(-) diff --git a/TelegramTizen/res/edje/telegram_init_screen.edc b/TelegramTizen/res/edje/telegram_init_screen.edc index b779f8b..96f10b0 100644 --- a/TelegramTizen/res/edje/telegram_init_screen.edc +++ b/TelegramTizen/res/edje/telegram_init_screen.edc @@ -3330,8 +3330,8 @@ group description { state: "default" 0.0; rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 0.2; } - color: 255 255 255 255; + rel2 { relative: 1.0 1.0; } + color: 250 250 250 255; } } part{ @@ -3340,95 +3340,50 @@ group description{ state: "default" 0.0; rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 0.2; } + rel2 { relative: 1.0 0.0; } + align: 0.5 0.0; + min: 0 120; + fixed: 0 1; } } part { - name: "contacts_header,bg"; - type: RECT; - description { - state: "default" 0.0; - rel1 { relative: 0.0 0.2; } - rel2 { relative: 1.0 0.27; } - color: 96 96 96 255; - } - } - part { - name: "swallow.contacts_header"; - type: SWALLOW; - description { - state: "default" 0.0; - rel1 { relative: 0.0 0.2; } - rel2 { relative: 1.0 0.27; } - color: 96 96 96 255; - } - } - - part{ - name: "swallow.group_chat_buddy_list_box"; - type:SWALLOW; - description{ - state: "default" 0.0; - rel1 { relative: 0.0 1.0;} - rel2 { relative: 1.0 1.0;} - align: 0.5 1.0; - min: 0 100; - fixed: 0 1; - color: 50 100 255 255; + name: "text,pad"; + type: SPACER; + description { + rel1 { relative: 0.0 1.0; to_y: "swallow.group_chat_entry_box"; } + rel2 { relative: 0.0 1.0; to_y: "swallow.group_chat_entry_box"; } + min: 40 0; + fixed: 1 0; + align: 0.0 0.5; } } - } - } - - group - { - name: "group_chat_photo_name_entry"; - parts{ - part{ - name: "swallow.cam_box, bg"; - type: RECT; - description{ - state: "default" 0.0; - rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 0.9; } - color: 255 255 255 255; - } - } - - part{ - name: "swallow.cam_box"; - type: SWALLOW; - description{ - state: "default" 0.0; - rel1 { relative: 0.0 0.0; } - rel2 { relative: 1.0 0.9; } - color: 0 0 0 0; - } - } - - part{ - name: "swallow.entry_box,bg"; - type: IMAGE; - description{ - state: "default" 0.0; - rel1 { relative: 0.28 0.65; } - rel2 { relative: 0.9 0.68; } - max: 800 2; - image { - normal: "telegram_date_divider.#.png"; + part { + name: "text,selected"; + type: TEXT; + description { + state: "default" 0.0; + rel1 { relative: 1.0 1.0; to_x: "text,pad"; to_y: "swallow.group_chat_entry_box"; } + rel2 { relative: 1.0 1.0; to: "swallow.group_chat_entry_box"; } + align: 0.5 0.0; + color: 37 137 186 255; + text { + min: 0 1; + size: 32; + text: "selected"; + align: 0.0 0.5; } - color: 0 0 0 51; - } - } - + min: 0 64; + fixed: 0 1; + } + } part{ - name: "swallow.entry_box"; + name: "swallow.group_chat_buddy_list_box"; type:SWALLOW; description{ state: "default" 0.0; - rel1 { relative: 0.3 0.3;} - rel2 { relative: 0.87 0.65;} - color: 50 100 255 255; + rel1 { relative: 0.0 1.0; to_y: "text,selected"; } + rel2 { relative: 1.0 1.0; } + align: 0.5 0.0; } } } diff --git a/TelegramTizen/res/edje/telegram_theme.edc b/TelegramTizen/res/edje/telegram_theme.edc index 71a2b5b..acfdef4 100644 --- a/TelegramTizen/res/edje/telegram_theme.edc +++ b/TelegramTizen/res/edje/telegram_theme.edc @@ -2005,19 +2005,19 @@ type:TEXT; description { rel1 { relative: 0.0 0.0; to: "base"; } rel2 { relative: 1.0 0.0; to: "base"; } - min: 0 10; + min: 0 36; align: 0.5 0.0; fixed: 1 0; } } part { - name: "left,pad"; + name: "text,left,pad"; type: SPACER; scale: 1; description { rel1 { relative: 0.0 0.0; } rel2 { relative: 0.0 1.0; } - min: 15 0; + min: 72 0; align: 0.0 0.5; fixed: 1 0; } @@ -2059,30 +2059,6 @@ type:TEXT; } } part { - name: "text,left,pad"; - type: SPACER; - scale: 1; - description { - rel1 { relative: 1.0 0.0; to: "left,pad"; } - rel2 { relative: 1.0 1.0; to: "left,pad"; } - align: 0.0 0.5; - min: 57 0; - fixed: 1 0; - } - } - part { - name: "text,top,pad"; - type: SPACER; - scale: 1; - description { - rel1 { relative: 0.0 1.0; to: "elm.top.pad"; } - rel2 { relative: 1.0 1.0; to: "elm.top.pad"; } - align: 0.5 0.0; - min: 0 26; - fixed: 0 1; - } - } - part { name: "elm.spacer.limit"; type: SPACER; scale: 1; @@ -2101,8 +2077,8 @@ type:TEXT; scale: 1; description { state: "default" 0.0; - rel1 { relative: 1.0 1.0; to_x: "text,left,pad"; to_y: "text,top,pad"; } - rel2 { relative: 0.0 0.0; to: "elm.bubble.rightbottom.pad"; } + rel1 { relative: 1.0 1.0; to_x: "text,left,pad"; to_y: "elm.top.pad"; } + rel2 { relative: 1.0 0.0; to: "elm.bottom.pad"; } min: 159 0; max: 159 0; fixed: 1 1; @@ -2124,8 +2100,8 @@ type:TEXT; multiline: 1; description { state: "default" 0.0; - rel1 { relative: 0.0 1.0; to_x: "elm.text.spacer"; to_y: "text,top,pad";} - rel2 { relative: 1.0 0.0; to_x: "elm.text.spacer"; to_y: "elm.rightbottom.pad"; } + rel1 { relative: 0.0 1.0; to_x: "elm.text.spacer"; to_y: "elm.top.pad";} + rel2 { relative: 1.0 0.0; to_x: "elm.text.spacer"; to_y: "elm.bottom.pad"; } align: 0.0 0.0; fixed: 1 0; text { @@ -2161,6 +2137,18 @@ type:TEXT; } } part { + name: "elm.bottom.pad"; + type: SPACER; + scale: 1; + description { + rel1 { relative: 0.0 1.0; } + rel2 { relative: 1.0 1.0; } + align: 0.5 1.0; + min: 0 74; + fixed: 0 1; + } + } + part { name: "time"; type: TEXT; mouse_events: 1; @@ -2203,30 +2191,6 @@ type:TEXT; } } part { - name: "elm.rightbottom.pad"; - type: SPACER; - scale: 1; - description { - rel1 { relative: 1.0 0.0; to_y: "elm.bottom.pad"; } - rel2 { relative: 1.0 0.0; to_y: "elm.bottom.pad"; } - min: 0 64; - align: 0.0 1.0; - fixed: 1 1; - } - } - part { - name: "elm.bottom.pad"; - type: SPACER; - scale: 1; - description { - rel1 { relative: 0.0 1.0; } - rel2 { relative: 1.0 1.0; } - align: 0.5 1.0; - min: 0 10; - fixed: 0 1; - } - } - part { name: "event.rect"; type: RECT; repeat_events: 1; @@ -2325,8 +2289,6 @@ type:TEXT; scale: 1; description { state: "default" 0.0; - //min: 720 0; - //max: 720 -1; } } part { @@ -2336,7 +2298,7 @@ type:TEXT; description { rel1 { relative: 0.0 0.0; to: "base"; } rel2 { relative: 1.0 0.0; to: "base"; } - min: 0 10; + min: 0 36; align: 0.5 0.0; fixed: 0 1; } @@ -2348,12 +2310,39 @@ type:TEXT; description { rel1 { relative: 1.0 0.0; } rel2 { relative: 1.0 1.0; } - min: 15 0; + min: 72 0; align: 1.0 0.5; fixed: 1 0; } } part { + name: "elm.bubble.rightbottom.pad"; + type: SPACER; + scale: 1; + description { + rel1{ + to: "elm.text"; + relative: 1.0 1.0; + } + rel2.to: "elm.text"; + align: 0.0 0.0; + min: 57 64; + fixed: 1 1; + } + } + part { + name: "elm.bottom.pad"; + type: SPACER; + scale: 1; + description { + rel1 { relative: 0.0 1.0; } + rel2 { relative: 1.0 1.0; } + align: 0.5 1.0; + min: 0 74; + fixed: 0 1; + } + } + part { name: "elm.image.bg.ef"; type: IMAGE; scale: 1; @@ -2390,30 +2379,6 @@ type:TEXT; } } part { - name: "text,right,pad"; - type: SPACER; - scale: 1; - description { - rel1 { relative: 0.0 0.0; to: "right,pad"; } - rel2 { relative: 0.0 1.0; to: "right,pad"; } - align: 1.0 0.5; - min: 57 0; - fixed: 1 0; - } - } - part { - name: "text,top,pad"; - type: SPACER; - scale: 1; - description { - rel1 { relative: 0.0 1.0; to: "elm.top.pad"; } - rel2 { relative: 1.0 1.0; to: "elm.top.pad"; } - align: 0.5 0.0; - min: 0 26; - fixed: 0 1; - } - } - part { name: "elm.spacer.limit"; type: SPACER; scale: 1; @@ -2432,8 +2397,8 @@ type:TEXT; scale: 1; description { state: "default" 0.0; - rel1 { relative: 1.0 1.0; to: "elm.bubble.leftbottom.pad"; } - rel2 { relative: 0.0 1.0; to: "text,right,pad"; } + rel1 { relative: 1.0 1.0; to: "elm.bottom.pad"; } + rel2 { relative: 0.0 1.0; to: "right,pad"; } min: 159 0; max: 159 0; fixed: 1 1; @@ -2455,8 +2420,8 @@ type:TEXT; multiline: 1; description { state: "default" 0.0; - rel1 { relative: 0.0 1.0; to_x: "elm.text.spacer"; to_y: "text,top,pad";} - rel2 { relative: 1.0 0.0; to_x: "elm.text.spacer"; to_y: "elm.bubble.leftbottom.pad"; } + rel1 { relative: 0.0 1.0; to_x: "elm.text.spacer"; to_y: "elm.top.pad";} + rel2 { relative: 1.0 0.0; to_x: "elm.text.spacer"; to_y: "elm.bottom.pad"; } align: 1.0 0.0; fixed: 1 0; text { @@ -2477,21 +2442,6 @@ type:TEXT; } } part { - name: "elm.bubble.rightbottom.pad"; - type: SPACER; - scale: 1; - description { - rel1{ - to: "elm.text"; - relative: 1.0 1.0; - } - rel2.to: "elm.text"; - align: 0.0 0.0; - min: 57 64; - fixed: 1 1; - } - } - part { name: "time"; type: TEXT; mouse_events: 1; @@ -2534,30 +2484,6 @@ type:TEXT; } } part { - name: "elm.bubble.leftbottom.pad"; - type: SPACER; - scale: 1; - description { - rel1 { relative: 0.0 0.0; to_y: "elm.bottom.pad"; } - rel2 { relative: 0.0 0.0; to_y: "elm.bottom.pad"; } - min: 0 64; - fixed: 1 1; - align: 0.0 1.0; - } - } - part { - name: "elm.bottom.pad"; - type: SPACER; - scale: 1; - description { - rel1 { relative: 0.0 1.0; } - rel2 { relative: 1.0 1.0; } - align: 0.5 1.0; - min: 0 10; - fixed: 0 1; - } - } - part { name: "event.rect"; type: RECT; repeat_events: 1; diff --git a/TelegramTizen/src/group_chat_entry_view.c b/TelegramTizen/src/group_chat_entry_view.c index 402bc84..36b17ea 100644 --- a/TelegramTizen/src/group_chat_entry_view.c +++ b/TelegramTizen/src/group_chat_entry_view.c @@ -132,7 +132,7 @@ char* on_group_buddy_name_get_cb(void *data, Evas_Object *obj, const char *part) { int id = (int)data; Eina_List* selected_buddies = evas_object_data_get(obj, "selected_buddies"); - + appdata_s* ad = evas_object_data_get(obj, "app_data"); int size = eina_list_count(selected_buddies); if (size <= 0) { @@ -149,13 +149,14 @@ char* on_group_buddy_name_get_cb(void *data, Evas_Object *obj, const char *part) user_data_with_pic_s* item = eina_list_nth(selected_buddies, id); user_data_s* user = item->use_data; - if (!strcmp(part,"elm.text")){ - char* user_name = replace(user->print_name, '_', " "); - char buf[512] = {'\0'}; - snprintf(buf, 512, "%s", user_name); - free(user_name); - return strdup(buf); - + if (!strcmp(part,"elm.text.main.left.top") || !strcmp(part,"elm.text")){ + char *full_name = replace(user->print_name, '_', " "); + return full_name; + } else if (!strcmp(part, "elm.text.sub.left.bottom") || !strcmp(part,"elm.text.sub")) { + char* last_seen = get_budy_state(ad, user->user_id.id); + if (last_seen) { + return last_seen; + } } return NULL; @@ -178,7 +179,8 @@ Evas_Object* on_group_buddy_selection_part_content_get_cb(void *data, Evas_Objec if (user->photo_path && strcmp(user->photo_path, "") != 0) { profile_pic = create_image_object_from_file(user->photo_path, obj); } else { - profile_pic = create_image_object_from_file(ui_utils_get_resource(DEFAULT_PROFILE_PIC), obj); + profile_pic = create_image_object_from_file(ui_utils_get_resource(DEFAULT_LIST_THUMB_SINGLE_PIC), obj); + evas_object_color_set(profile_pic, 45, 165, 224, 255); } char edj_path[PATH_MAX] = {0, }; @@ -246,12 +248,7 @@ void on_group_chat_cancel_buton_clicked(void *data, Evas_Object *object, void *e elm_panel_hidden_set(ad->panel, EINA_FALSE); } -char* group_chat_entry_requested_cb(void *data, Evas_Object *obj, const char *part) -{ - //int id = (int) data; - return NULL; -} - +#if 0 Evas_Object* group_chat_pic_requested_cb(void *data, Evas_Object *obj, const char *part) { Evas_Object *eo = NULL; @@ -281,6 +278,17 @@ Evas_Object* group_chat_pic_requested_cb(void *data, Evas_Object *obj, const cha } return eo; } +#endif + +static void _on_name_entry_focused(void *data, Evas_Object *obj, void *event_info) +{ + Evas_Object *layout = data; + if (elm_object_focus_get(layout)) { + elm_object_signal_emit(layout, "elm,state,focused", ""); + } else{ + elm_object_signal_emit(layout, "elm,state,unfocused", ""); + } +} void launch_group_chat_name_entry_view(void *data) { @@ -303,17 +311,34 @@ void launch_group_chat_name_entry_view(void *data) elm_object_content_set(scroller, main_layout); Evas_Object* entry_layout = elm_layout_add(ad->win); - app_get_resource(TELEGRAM_INIT_VIEW_EDJ, edj_path, (int)PATH_MAX); - elm_layout_file_set(entry_layout, edj_path, "group_chat_photo_name_entry"); - evas_object_show(entry_layout); + elm_layout_theme_set(entry_layout, "layout", "searchfield", "singleline"); + evas_object_size_hint_align_set(entry_layout, EVAS_HINT_FILL, 0.0); + evas_object_size_hint_weight_set(entry_layout, EVAS_HINT_EXPAND, 0.0); + + /* entry */ + + Evas_Object* name_entry = elm_entry_add(entry_layout); + elm_entry_cursor_end_set(name_entry); + evas_object_size_hint_weight_set(name_entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(name_entry, EVAS_HINT_FILL, EVAS_HINT_FILL); + elm_entry_single_line_set(name_entry, EINA_TRUE); + elm_entry_scrollable_set (name_entry, EINA_FALSE); + elm_entry_cnp_mode_set(name_entry, ELM_CNP_MODE_NO_IMAGE); + elm_entry_context_menu_disabled_set(name_entry, EINA_TRUE); + elm_object_part_text_set(name_entry, "elm.guide", i18n_get_text("IDS_TGRAM_NPBODY_NEW_GROUP_NAME_ABB")); + elm_object_focus_set(name_entry, EINA_FALSE); + + limit_filter_data.max_char_count = 20; + elm_entry_markup_filter_append(name_entry, elm_entry_filter_limit_size, &limit_filter_data); + evas_object_show(name_entry); + elm_object_part_content_set(entry_layout, "elm.swallow.content", name_entry); + evas_object_smart_callback_add(name_entry, "focused", _on_name_entry_focused, entry_layout); elm_object_part_content_set(main_layout, "swallow.group_chat_entry_box", entry_layout); #if 0 Evas_Object* cam_icon = elm_image_add(main_layout); elm_image_file_set(cam_icon, ui_utils_get_resource(CAMERA_ICON), NULL); evas_object_show(cam_icon); -#endif -#if 0 Evas_Object *cam_icon = create_image_object_from_file(ui_utils_get_resource(DEFAULT_LIST_THUMB_MULTI_PIC), main_layout); evas_object_color_set(cam_icon, 45, 165, 224, 255); @@ -333,13 +358,12 @@ void launch_group_chat_name_entry_view(void *data) evas_object_smart_callback_add(cam_icon, "clicked", on_image_load_options_cb, (void*)cam_icon); elm_object_part_content_set(entry_layout, "swallow.cam_box", eo); -#endif - /********************* list *************************/ + /********************* list *************************/ + Evas_Object *list = elm_genlist_add(ad->nf); - elm_list_mode_set(list, ELM_LIST_COMPRESS); elm_genlist_mode_set(list, ELM_LIST_COMPRESS); evas_object_size_hint_weight_set(list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(list, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -360,14 +384,10 @@ void launch_group_chat_name_entry_view(void *data) /******************** list *************************/ +#endif - Evas_Object* name_entry = elm_entry_add(main_layout); - elm_entry_single_line_set(name_entry, EINA_TRUE); - limit_filter_data.max_char_count = 20; - elm_entry_markup_filter_append(name_entry, elm_entry_filter_limit_size, &limit_filter_data); - evas_object_show(name_entry); - elm_object_part_content_set(entry_layout, "swallow.entry_box", name_entry); + /***************** contacts header *************************/ Eina_List* selected_buddies = NULL; @@ -379,20 +399,10 @@ void launch_group_chat_name_entry_view(void *data) } } - /***************** contacts header *************************/ - Evas_Object* contact_lbl = elm_label_add(ad->nf); - evas_object_show(contact_lbl); - evas_object_size_hint_weight_set(contact_lbl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(contact_lbl, EVAS_HINT_FILL, EVAS_HINT_FILL); - char res_str[256] = {'\0'}; sprintf(res_str, i18n_get_text("IDS_TGRAM_BODY_PD_PARTICIPANTS"), eina_list_count(selected_buddies)); - char count_str[256] = {'\0'}; - sprintf(count_str, "  %s", res_str); - - elm_object_text_set(contact_lbl, count_str); - elm_object_part_content_set(main_layout, "swallow.contacts_header", contact_lbl); + elm_object_part_text_set(main_layout, "text,selected", res_str); /***************** contacts header *************************/ @@ -400,8 +410,6 @@ void launch_group_chat_name_entry_view(void *data) Evas_Object* buddy_gen_list = elm_genlist_add(ad->nf); elm_list_mode_set(buddy_gen_list, ELM_LIST_COMPRESS); - // FIXME: Deprecated API - //elm_genlist_decorate_mode_set(buddy_gen_list, ELM_LIST_COMPRESS); evas_object_size_hint_weight_set(buddy_gen_list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(buddy_gen_list, EVAS_HINT_FILL, EVAS_HINT_FILL); @@ -415,7 +423,7 @@ void launch_group_chat_name_entry_view(void *data) evas_object_data_set(name_entry, "selected_buddies", (void*)selected_buddies); //evas_object_data_set(name_entry, "cam_icon", cam_icon); - itc.item_style = "default_style"; + itc.item_style = "type1"; itc.func.text_get = on_group_buddy_name_get_cb; itc.func.content_get = on_group_buddy_selection_part_content_get_cb; itc.func.state_get = NULL; @@ -436,7 +444,7 @@ void launch_group_chat_name_entry_view(void *data) elm_object_part_content_set(main_layout, "swallow.group_chat_buddy_list_box", buddy_gen_list); - Elm_Object_Item* chat_nav_item = elm_naviframe_item_push(ad->nf, "New Group", NULL, NULL, scroller, NULL); + Elm_Object_Item* chat_nav_item = elm_naviframe_item_push(ad->nf, i18n_get_text("IDS_TGRAM_HEADER_CREATE_GROUP_ABB"), NULL, NULL, scroller, NULL); Evas_Object *done_btn = elm_button_add(ad->nf); elm_object_style_set(done_btn, "naviframe/title_right"); diff --git a/TelegramTizen/src/tg_search_message_view.c b/TelegramTizen/src/tg_search_message_view.c index 28da3e3..8057ff3 100644 --- a/TelegramTizen/src/tg_search_message_view.c +++ b/TelegramTizen/src/tg_search_message_view.c @@ -457,7 +457,8 @@ static void _on_search_entry_changed(void *data, Evas_Object *obj, void *event_i EINA_LIST_FOREACH(ad->main_list, l, item) { //user = item->use_data; - if (ucol_ncompare(item->peer_print_name, entry_text, strlen(entry_text)) == 0) { + if (ucol_search(item->peer_print_name, entry_text) != -ENOENT) { + LOGD("search result : %d", ucol_search(item->peer_print_name, entry_text)); result_list = eina_list_append(result_list, item); } } -- 2.7.4