From: Iscaro Date: Fri, 10 Aug 2012 17:48:29 +0000 (-0300) Subject: Several changes in the contacts layout tab and accross the App. X-Git-Tag: accepted/2.0alpha/20121205.174825~101 X-Git-Url: http://review.tizen.org/git/?p=profile%2Fivi%2Flemolo.git;a=commitdiff_plain;h=b6f657678e0ae4a03b1cd2c959e82bd8b8478ac4 Several changes in the contacts layout tab and accross the App. And now we have a contact bar separator like the iphone's. --- diff --git a/Makefile.am b/Makefile.am index 67f3fa3..c4cdc1d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -96,7 +96,6 @@ data/themes/images/bt_swap_released.png \ data/themes/images/person.png THEME_INCLUDES = \ -data/themes/includes/button.edc \ data/themes/includes/call.edc \ data/themes/includes/colors.edc \ data/themes/includes/contacts-bg.edc \ diff --git a/data/themes/default-hd.edc b/data/themes/default-hd.edc index 1b85d88..e5ece60 100644 --- a/data/themes/default-hd.edc +++ b/data/themes/default-hd.edc @@ -25,6 +25,8 @@ #define CONTACT_PHOTO_SIZE 128 #define CONTACT_HALF_PHOTO 64 -#define LIST_CONTACT_HEIGHT (CONTACT_PHOTO_SIZE + 60) +#define LIST_CONTACT_HEIGHT 170 + +#define GROUP_HEIGHT 30 #include "default.edc" diff --git a/data/themes/default-sd.edc b/data/themes/default-sd.edc index b2d310d..88cdebf 100644 --- a/data/themes/default-sd.edc +++ b/data/themes/default-sd.edc @@ -23,8 +23,10 @@ #define SIZE_SMALL 10 #define SIZE_TINY 8 -#define CONTACT_PHOTO_SIZE 128 -#define CONTACT_HALF_PHOTO 64 -#define LIST_CONTACT_HEIGHT (CONTACT_PHOTO_SIZE + 30) +#define CONTACT_PHOTO_SIZE 64 +#define CONTACT_HALF_PHOTO 32 +#define LIST_CONTACT_HEIGHT 90 + +#define GROUP_HEIGHT 20 #include "default.edc" diff --git a/data/themes/default.edc b/data/themes/default.edc index 9646c78..51fc741 100644 --- a/data/themes/default.edc +++ b/data/themes/default.edc @@ -10,6 +10,5 @@ collections { #include "includes/history.edc" #include "includes/history-bg.edc" #include "includes/scroller.edc" -#include "includes/button.edc" } diff --git a/data/themes/includes/button.edc b/data/themes/includes/button.edc deleted file mode 100644 index ea9fe30..0000000 --- a/data/themes/includes/button.edc +++ /dev/null @@ -1,109 +0,0 @@ -group { - name: "elm/button/base/contacts-btn"; - - parts { - part { - name: "bg"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - color: 255 255 255 0; - color_class: "action"; - } - description { - state: "pressed" 0.0; - inherit: "default" 0.0; - color: 255 255 255 255; - } - } - - part { - name: "elm.text.phone"; - type: TEXT; - mouse_events: 0; - description { - state: "default" 0.0; - color: 255 255 255 255; - color_class: "action"; - rel2 { - relative: 1.0 0.5; - } - text { - font: FONT_NORMAL; - size: SIZE_MEDIUM; - size_range: SIZE_TINY SIZE_HUGE; - fit: 1 1; - align: 0.5 0.5; - ellipsis: 1.0; - } - } - description { - state: "pressed" 0.0; - inherit: "default" 0.0; - color: 16 16 16 255; - } - } - - part { - name: "elm.text.type"; - type: TEXT; - mouse_events: 0; - description { - state: "default" 0.0; - color: 255 255 255 128; - color_class: "action"; - rel1 { - to: "elm.text.phone"; - relative: 0.0 1.0; - } - rel2 { - relative: 1.0 1.0; - offset: 0 0; - } - text { - font: FONT_NORMAL; - size: SIZE_MEDIUM; - size_range: SIZE_TINY SIZE_HUGE; - fit: 1 1; - align: 0.5 0.5; - ellipsis: 0.0; - } - } - description { - state: "pressed" 0.0; - inherit: "default" 0.0; - color: 16 16 16 255; - } - } - } - - programs { - - program { - signal: "mouse,clicked,1"; - source: "bg"; - action: SIGNAL_EMIT "elm,action,click" ""; - } - - program { - signal: "mouse,down,1"; - source: "bg"; - transition: ACCELERATE 0.3; - action: STATE_SET "pressed" 0.0; - target: "bg"; - target: "elm.text.phone"; - target: "elm.text.type"; - } - - program { - signal: "mouse,up,1"; - source: "bg"; - transition: DECELERATE 0.3; - action: STATE_SET "default" 0.0; - target: "bg"; - target: "elm.text.phone"; - target: "elm.text.type"; - } - } -} diff --git a/data/themes/includes/contacts-bg.edc b/data/themes/includes/contacts-bg.edc index 6932baa..3b36565 100644 --- a/data/themes/includes/contacts-bg.edc +++ b/data/themes/includes/contacts-bg.edc @@ -51,7 +51,7 @@ group { visible: 1; rel1 { relative: 0.0 0.0; - offset: 0 BORDER_PADDING; + offset: 0 0; } } description { diff --git a/data/themes/includes/contacts.edc b/data/themes/includes/contacts.edc index d2d3be0..2786cc7 100644 --- a/data/themes/includes/contacts.edc +++ b/data/themes/includes/contacts.edc @@ -25,6 +25,60 @@ group { } part { + name: "img.border"; + type: RECT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 255; + color_class: "action"; + rel1 { + to: "swallow.photo"; + relative: 0.0 0.0; + offset: -1 -1; + } + rel2 { + to: "swallow.photo"; + relative: 1.0 1.0; + offset: 0 0; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + color_class: "bg"; + } + } + + part { + name: "img.bg"; + type: RECT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 255; + color_class: "dark"; + rel1 { + to: "swallow.photo"; + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + to: "swallow.photo"; + relative: 1.0 1.0; + offset: -1 -1; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + color_class: "bg"; + } + } + + part { name: "swallow.photo"; type: SWALLOW; scale: 1; @@ -33,18 +87,20 @@ group { state: "default" 0.0; min: CONTACT_PHOTO_SIZE CONTACT_PHOTO_SIZE; max: CONTACT_PHOTO_SIZE CONTACT_PHOTO_SIZE; + align: 0.0 0.5; + fixed: 1 1; rel1 { relative: 0.0 0.0; - offset: BORDER_PADDING ITEM_PADDING; + offset: BORDER_PADDING 0; } rel2 { - relative: 0.0 0.0; - offset: (BORDER_PADDING+CONTACT_PHOTO_SIZE) (CONTACT_PHOTO_SIZE+ITEM_PADDING); + relative: 0.0 1.0; + offset: BORDER_PADDING -1; } } } - part { + part { name: "text.contacts.name"; type: TEXT; scale: 1; @@ -60,15 +116,13 @@ group { } rel2 { to_y: "swallow.photo"; - relative: 1.0 1.0; - offset: -BORDER_PADDING -CONTACT_HALF_PHOTO; + relative: 1.0 0.7; + offset: (-BORDER_PADDING -1) -1; } text { font: FONT_NORMAL; - size: SIZE_HUGE; - size_range: SIZE_TINY SIZE_HUGE; - fit: 1 1; - align: 0.0 0.5; + size: SIZE_LARGE; + align: 0.0 0.0; ellipsis: 0.0; } } @@ -79,41 +133,38 @@ group { } } - part { + part { name: "text.contacts.last"; type: TEXT; scale: 1; mouse_events: 0; description { state: "default" 0.0; - color: 255 255 255 128; - color_class: "action"; + color: 255 255 255 255; + color_class: "light"; rel1 { - to: "text.contacts.name"; - relative: 0.0 1.0; - offset: 0 ITEM_PADDING; + to: "swallow.photo"; + relative: 1.0 0.7; + offset: ITEM_PADDING 0; } rel2 { - to_x: "text.contacts.name"; to_y: "swallow.photo"; relative: 1.0 1.0; - offset: 0 -1; + offset: (-BORDER_PADDING -1) -1; } - text { + text { font: FONT_NORMAL; size: SIZE_MEDIUM; - size_range: SIZE_SMALL SIZE_MEDIUM; - fit: 1 1; align: 0.0 0.5; ellipsis: 0.0; - } + } } description { state: "selected" 0.0; inherit: "default" 0.0; color_class: "bg"; } - } + } programs { @@ -124,6 +175,7 @@ group { target: "bg"; target: "text.contacts.name"; target: "text.contacts.last"; + target: "img.border"; } program { @@ -133,6 +185,55 @@ group { target: "bg"; target: "text.contacts.name"; target: "text.contacts.last"; + target: "img.border"; + } + } + } +} + +group { + name: "elm/genlist/item/group_contacts/default"; + + data { + item: "texts" "text.group"; + } + + parts { + part { + name: "bg"; + type: RECT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 255; + color_class: "action"; + min: (BORDER_PADDING + CONTACT_PHOTO_SIZE) GROUP_HEIGHT; + max: (BORDER_PADDING + CONTACT_PHOTO_SIZE) GROUP_HEIGHT; + align: 0.0 0.5; + } + } + + part { + name: "text.group"; + type: TEXT; + mouse_events: 0; + scale: 1; + description { + state: "default" 0.0; + color: 255 255 255 255; + color_class: "bg"; + rel2 { + to: "bg"; + offset: -ITEM_PADDING -1; + } + text { + font: FONT_BOLD; + size: SIZE_SMALL; + fit: 1 1; + align: 1.0 0.5; + ellipsis: 0.0; + } } } } @@ -144,6 +245,60 @@ group { parts { part { + name: "img.border"; + type: RECT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 255; + color_class: "action"; + rel1 { + to: "swallow.photo"; + relative: 0.0 0.0; + offset: -1 -1; + } + rel2 { + to: "swallow.photo"; + relative: 1.0 1.0; + offset: 0 0; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + color_class: "bg"; + } + } + + part { + name: "img.bg"; + type: RECT; + scale: 1; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 255; + color_class: "dark"; + rel1 { + to: "swallow.photo"; + relative: 0.0 0.0; + offset: 0 0; + } + rel2 { + to: "swallow.photo"; + relative: 1.0 1.0; + offset: -1 -1; + } + } + description { + state: "selected" 0.0; + inherit: "default" 0.0; + color_class: "bg"; + } + } + + part { name: "swallow.photo"; type: SWALLOW; scale: 1; @@ -175,21 +330,20 @@ group { rel1 { to: "swallow.photo"; relative: 1.0 0.0; - offset: ITEM_PADDING 0; + offset: ITEM_PADDING ITEM_PADDING; } rel2 { to_y: "swallow.photo"; - relative: 1.0 1.0; - offset: -BORDER_PADDING -CONTACT_HALF_PHOTO; + relative: 1.0 0.5; + offset: -BORDER_PADDING -ITEM_PADDING; } text { font: FONT_NORMAL; size: SIZE_HUGE; - size_range: SIZE_LARGE SIZE_HUGE; - fit: 1 1; + fit: 0 0; align: 0.0 0.5; ellipsis: 0.0; - } + } } } @@ -202,71 +356,26 @@ group { state: "default" 0.0; color: 255 255 255 128; color_class: "action"; - rel1 { + rel1 { to: "text.name"; relative: 0.0 1.0; - offset: 0 ITEM_PADDING; + offset: 0 ITEM_PADDING; } - rel2 { + rel2 { to_x: "text.name"; to_y: "swallow.photo"; relative: 1.0 1.0; - offset: 0 -1; + offset: 0 ITEM_PADDING; } text { font: FONT_NORMAL; size: SIZE_MEDIUM; - size_range: SIZE_SMALL SIZE_MEDIUM; - fit: 1 1; - align: 0.0 0.5; + fit: 0 1; + align: 0.0 0.0; ellipsis: 0.0; } } } -#define SEPARATOR(id, rely, offy, relto) \ - part { \ - name: "separator.dark."##id; \ - type: RECT; \ - mouse_events: 0; \ - description { \ - state: "default" 0.0; \ - color: 255 255 255 255; \ - color_class: "dark"; \ - rel1 { \ - relative: 0.0 rely; \ - offset: 0 offy; \ - to_y: relto; \ - } \ - rel2 { \ - relative: 1.0 rely; \ - offset: -1 (offy + SEPARATOR_HEIGHT / 2); \ - to_y: relto; \ - } \ - } \ - } \ - part { \ - name: "separator.bg."##id; \ - type: RECT; \ - mouse_events: 0; \ - description { \ - state: "default" 0.0; \ - color: 255 255 255 255; \ - color_class: "bg"; \ - rel1 { \ - relative: 0.0 rely; \ - offset: 0 (offy + SEPARATOR_HEIGHT / 2); \ - to_y: relto; \ - } \ - rel2 { \ - relative: 1.0 rely; \ - offset: -1 (offy + SEPARATOR_HEIGHT); \ - to_y: relto; \ - } \ - } \ - } - - SEPARATOR("btn", 0.0, -SEPARATOR_HEIGHT, "bg.buttons"); -#undef SEPARATOR part { name: "box.phones"; @@ -277,17 +386,16 @@ group { state: "default" 0.0; box { layout: "vertical_homogeneous"; - padding: 0 ITEM_PADDING; } rel1 { to_y: "swallow.photo"; relative: 0.0 1.0; - offset: BORDER_PADDING (ITEM_PADDING+ACTION_HEIGHT); + offset: 0 (ITEM_PADDING+ACTION_HEIGHT); } rel2 { to_y: "bg.buttons"; relative: 1.0 0.0; - offset: (-BORDER_PADDING-1) (-SEPARATOR_HEIGHT - 1); + offset: -1 0; } } } @@ -400,6 +508,7 @@ group { } group { + name: "elm/icon/no-picture/default"; images{ @@ -419,3 +528,164 @@ group { } } } +group { + + name: "elm/button/base/contacts"; + + parts { + part { + name: "bg"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 255 255 255 0; + color_class: "action"; + } + description { + state: "pressed" 0.0; + inherit: "default" 0.0; + color: 255 255 255 255; + } + } + + part { + name: "elm.text.phone"; + type: TEXT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 255; + color_class: "action"; + rel1 { + offset: BORDER_PADDING 0; + } + rel2 { + to_y: "elm.text.type"; + relative: 1.0 0.0; + offset: (-BORDER_PADDING -1) ITEM_PADDING; + } + text { + font: FONT_NORMAL; + size: SIZE_HUGE; + size_range: SIZE_SMALL SIZE_HUGE; + fit: 1 1; + align: 0.5 0.5; + ellipsis: 1.0; + } + } + description { + state: "pressed" 0.0; + inherit: "default" 0.0; + color: 16 16 16 255; + } + } + + part { + name: "elm.text.type"; + type: TEXT; + mouse_events: 0; + description { + state: "default" 0.0; + color: 255 255 255 128; + color_class: "action"; + align: 0.5 1.0; + fixed: 1 1; + rel1 { + relative: 0.0 1.0; + offset: BORDER_PADDING (-ITEM_PADDING - 1); + } + rel2 { + relative: 1.0 1.0; + offset: (-BORDER_PADDING -1) (-ITEM_PADDING - 1); + } + text { + font: FONT_NORMAL; + size: SIZE_MEDIUM; + min: 0 1; + align: 0.5 1.0; + ellipsis: 0.0; + } + } + description { + state: "pressed" 0.0; + inherit: "default" 0.0; + color: 16 16 16 255; + } + } + +#define SEPARATOR(id, rely, offy, relto) \ + part { \ + name: "separator.dark."##id; \ + type: RECT; \ + mouse_events: 0; \ + description { \ + state: "default" 0.0; \ + color: 255 255 255 255; \ + color_class: "dark"; \ + rel1 { \ + relative: 0.0 rely; \ + offset: 0 offy; \ + to_y: relto; \ + } \ + rel2 { \ + relative: 1.0 rely; \ + offset: -1 (offy + SEPARATOR_HEIGHT / 2); \ + to_y: relto; \ + } \ + } \ + } \ + part { \ + name: "separator.bg."##id; \ + type: RECT; \ + mouse_events: 0; \ + description { \ + state: "default" 0.0; \ + color: 255 255 255 255; \ + color_class: "bg"; \ + rel1 { \ + relative: 0.0 rely; \ + offset: 0 (offy + SEPARATOR_HEIGHT / 2); \ + to_y: relto; \ + } \ + rel2 { \ + relative: 1.0 rely; \ + offset: -1 (offy + SEPARATOR_HEIGHT); \ + to_y: relto; \ + } \ + } \ + } + + SEPARATOR("bottom", 1.0, -SEPARATOR_HEIGHT, ""); +#undef SEPARATOR + } + + programs { + + program { + signal: "mouse,clicked,1"; + source: "bg"; + action: SIGNAL_EMIT "elm,action,click" ""; + } + + program { + signal: "mouse,down,1"; + source: "bg"; + transition: ACCELERATE 0.3; + action: STATE_SET "pressed" 0.0; + target: "bg"; + target: "elm.text.phone"; + target: "elm.text.type"; + } + + program { + signal: "mouse,up,1"; + source: "bg"; + transition: DECELERATE 0.3; + action: STATE_SET "default" 0.0; + target: "bg"; + target: "elm.text.phone"; + target: "elm.text.type"; + } + } +} diff --git a/data/themes/includes/keypad.edc b/data/themes/includes/keypad.edc index e8ecb02..ef8e7f5 100644 --- a/data/themes/includes/keypad.edc +++ b/data/themes/includes/keypad.edc @@ -57,10 +57,13 @@ group { state: "default" 0.0; color: 255 255 255 255; color_class: "action"; - min: WIDTH ACTION_HEIGHT; + min: (WIDTH - BORDER_PADDING*2) ACTION_HEIGHT; + rel1 { + offset: BORDER_PADDING 0; + } rel2 { relative: 1.0 0.0; - offset: -1.0 (ACTION_HEIGHT - 1); + offset: (-BORDER_PADDING -1) (ACTION_HEIGHT - 1); } text { text: "+1 (12) 3456-7890"; @@ -82,26 +85,25 @@ group { description { state: "default" 0.0; color: 255 255 255 255; - color_class: "action"; + color_class: "light"; visible: 0; - max: (WIDTH/2) SIZE_MEDIUM; + fixed: 1 1; rel1 { to: "elm.text.display"; relative: 0.0 1.0; - offset: (-WIDTH/2 + BORDER_PADDING) 0; + offset: 0 0; } rel2 { to: "elm.text.display"; - relative: 1.0 1.0; - offset: 0 SIZE_MEDIUM; + relative: 0.5 1.0; + offset: -ITEM_PADDING -1; } text { - font: FONT_NORMAL; - size: SIZE_MEDIUM; - size_range: SIZE_TINY SIZE_HUGE; - fit: 1 1; - align: 0.0 0.0; + font: FONT_BOLD; + size: SIZE_SMALL; + align: 1.0 0.0; ellipsis: 0.0; + min: 0 1; } } description { @@ -112,33 +114,68 @@ group { } part { - name: "elm.text.phone.type"; + name: "text.separator"; type: TEXT; mouse_events: 0; scale: 1; description { state: "default" 0.0; color: 255 255 255 255; - color_class: "action"; + color_class: "light"; visible: 0; - max: (WIDTH/2) SIZE_MEDIUM; + fixed: 1 1; rel1 { to: "elm.text.contact"; relative: 1.0 0.0; offset: 0 0; } rel2 { - to: "elm.text.contact"; + to: "elm.text.phone.type"; + relative: 0.0 1.0; + offset: -1 -1; + } + text { + font: FONT_BOLD; + size: SIZE_SMALL; + align: 0.5 0.0; + min: 0 1; + text: "-"; + } + } + description { + state: "show" 0.0; + inherit: "default" 0.0; + visible: 1; + } + } + + part { + name: "elm.text.phone.type"; + type: TEXT; + mouse_events: 0; + scale: 1; + description { + state: "default" 0.0; + color: 255 255 255 255; + color_class: "light"; + visible: 0; + fixed: 1 1; + rel1 { + to: "elm.text.display"; + relative: 0.5 1.0; + offset: ITEM_PADDING 0; + } + rel2 { + to: "elm.text.display"; relative: 1.0 1.0; - offset: (WIDTH/2 - BORDER_PADDING) 0; + offset: -1 -1; } text { - font: FONT_NORMAL; - size: SIZE_MEDIUM; - size_range: SIZE_TINY SIZE_HUGE; - fit: 1 1; - align: 1.0 0.0; + font: FONT_BOLD; + size: SIZE_SMALL; + align: 0.0 0.0; ellipsis: 0.0; + min: 0 1; } } description { @@ -528,6 +565,7 @@ group { action: STATE_SET "show" 0.0; target: "elm.text.contact"; target: "elm.text.phone.type"; + target: "text.separator"; } program { @@ -536,6 +574,7 @@ group { action: STATE_SET "default" 0.0; target: "elm.text.contact"; target: "elm.text.phone.type"; + target: "text.separator"; } } } diff --git a/dialer/contacts.c b/dialer/contacts.c index 6a1703b..04489f9 100644 --- a/dialer/contacts.c +++ b/dialer/contacts.c @@ -25,7 +25,7 @@ typedef struct _Contacts { char *path; Eet_Data_Descriptor *edd; Eet_Data_Descriptor *edd_list; - Elm_Genlist_Item_Class *itc; + Elm_Genlist_Item_Class *itc, *group; Evas_Object *genlist, *layout, *details; Contacts_List *c_list; } Contacts; @@ -150,6 +150,7 @@ static void _on_del(void *data, Evas *e __UNUSED__, _contacts_info_free(c_info); free(contacts->c_list); elm_genlist_item_class_free(contacts->itc); + elm_genlist_item_class_free(contacts->group); free(contacts->path); free(contacts); eet_shutdown(); @@ -184,7 +185,7 @@ static void _on_item_click(void *data, Evas_Object *obj __UNUSED__, btn = elm_button_add(details); EINA_SAFETY_ON_NULL_RETURN(btn); - elm_object_style_set(btn, "contacts-btn"); + elm_object_style_set(btn, "contacts"); phone = phone_format(c_info->mobile); elm_object_part_text_set(btn, "elm.text.type", "Mobile"); elm_object_part_text_set(btn, "elm.text.phone", phone); @@ -199,7 +200,7 @@ static void _on_item_click(void *data, Evas_Object *obj __UNUSED__, btn = elm_button_add(details); EINA_SAFETY_ON_NULL_RETURN(btn); - elm_object_style_set(btn, "contacts-btn"); + elm_object_style_set(btn, "contacts"); phone = phone_format(c_info->home); elm_object_part_text_set(btn, "elm.text.type", "Home"); elm_object_part_text_set(btn, "elm.text.phone", phone); @@ -214,7 +215,7 @@ static void _on_item_click(void *data, Evas_Object *obj __UNUSED__, btn = elm_button_add(details); EINA_SAFETY_ON_NULL_RETURN(btn); - elm_object_style_set(btn, "contacts-btn"); + elm_object_style_set(btn, "contacts"); phone = phone_format(c_info->work); elm_object_part_text_set(btn, "elm.text.type", "Work"); elm_object_part_text_set(btn, "elm.text.phone", phone); @@ -246,7 +247,8 @@ static void _contacts_read(Contacts *contacts) Contact_Info *c_info; Eina_List *l; Eet_File *efile; - + Elm_Object_Item *it = NULL; + char group; efile = eet_open(contacts->path, EET_FILE_MODE_READ); if (efile) { @@ -259,13 +261,24 @@ static void _contacts_read(Contacts *contacts) EINA_SAFETY_ON_NULL_RETURN(contacts->c_list); contacts->c_list->list = eina_list_sort(contacts->c_list->list, 0, _sort_by_name_cb); - + group = '\0'; EINA_LIST_FOREACH(contacts->c_list->list, l, c_info) { if (!c_info) continue; - elm_genlist_item_append(contacts->genlist,contacts->itc, c_info, - NULL,ELM_GENLIST_ITEM_NONE, - _on_item_click, contacts); + if (group != c_info->name[0]) { + group = c_info->name[0]; + it = elm_genlist_item_append(contacts->genlist, + contacts->group, + c_info, NULL, + ELM_GENLIST_ITEM_GROUP, + NULL, + NULL); + elm_genlist_item_select_mode_set(it, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); + } + elm_genlist_item_append(contacts->genlist,contacts->itc, + c_info, it, + ELM_GENLIST_ITEM_NONE, + _on_item_click, contacts); } } @@ -288,6 +301,15 @@ static char *_item_label_get(void *data, Evas_Object *obj __UNUSED__, return NULL; } +static char *_group_label_get(void *data, Evas_Object *obj __UNUSED__, + const char *part __UNUSED__) +{ + Contact_Info *c_info = data; + char buf[2]; + snprintf(buf, sizeof(buf), "%c", c_info->name[0]); + return strdup(buf); +} + static Evas_Object *_item_content_get(void *data, Evas_Object *obj, @@ -307,6 +329,7 @@ static Evas_Object *_item_content_get(void *data, } photo = picture_icon_get(obj, c_info->picture); + return photo; } @@ -325,7 +348,7 @@ Evas_Object *contacts_add(Evas_Object *parent) char base_dir[PATH_MAX], *path; Contacts *contacts; Evas_Object *obj, *genlist, *details; - Elm_Genlist_Item_Class *itc; + Elm_Genlist_Item_Class *itc, *group; eet_init(); contacts = calloc(1, sizeof(Contacts)); @@ -349,6 +372,15 @@ Evas_Object *contacts_add(Evas_Object *parent) itc->func.content_get = _item_content_get; itc->func.state_get = NULL; itc->func.del = NULL; + + group = elm_genlist_item_class_new(); + EINA_SAFETY_ON_NULL_GOTO(group, err_group); + group->item_style = "group_contacts"; + group->func.text_get = _group_label_get; + group->func.content_get = NULL; + group->func.state_get = NULL; + group->func.del = NULL; + contacts->group = group; contacts->genlist = genlist; contacts->itc = itc; contacts->layout = obj; @@ -386,6 +418,8 @@ err_read: eet_data_descriptor_free(contacts->edd_list); free(path); err_path: + elm_genlist_item_class_free(group); +err_group: elm_genlist_item_class_free(itc); err_genlist: free(obj);