From 9b3e687e2dc2cd18d06d520e509ddbcaa16aa1ac Mon Sep 17 00:00:00 2001 From: Michal Szczecinski Date: Tue, 9 Apr 2013 09:53:38 +0200 Subject: [PATCH] [TDIS-4986] Screen page numbering fixed --- include/index.h | 2 +- src/all_apps/layout.c | 2 +- src/index.c | 21 +++++++++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/include/index.h b/include/index.h index 88654c8..7ad27f2 100644 --- a/include/index.h +++ b/include/index.h @@ -23,7 +23,7 @@ extern void index_bring_in(Evas_Object *index, int idx); -extern Evas_Object *index_create(Evas_Object *layout, unsigned int count); +extern Evas_Object *index_create(Evas_Object *layout, unsigned int count, unsigned int current_idx); extern Evas_Object *index_update(Evas_Object *layout, Evas_Object *index, unsigned int count); extern void index_destroy(Evas_Object *index); diff --git a/src/all_apps/layout.c b/src/all_apps/layout.c index 04b391e..64704e4 100644 --- a/src/all_apps/layout.c +++ b/src/all_apps/layout.c @@ -321,7 +321,7 @@ HAPI Evas_Object *all_apps_layout_create(Evas_Object *controlbar, int rotate) evas_object_size_hint_max_set(all_apps, width, height); evas_object_resize(all_apps, width, height); - index = index_create(all_apps, 0); + index = index_create(all_apps, 0,0); if (NULL == index) { evas_object_del(all_apps); _E("cannot create index."); diff --git a/src/index.c b/src/index.c index d840d3d..0ac9f87 100644 --- a/src/index.c +++ b/src/index.c @@ -52,7 +52,7 @@ HAPI void index_destroy(Evas_Object *index) -HAPI Evas_Object *index_create(Evas_Object *tab, unsigned int count) +HAPI Evas_Object *index_create(Evas_Object *tab, unsigned int count,unsigned int current_idx) { Evas_Object *index; Evas_Object *scroller; @@ -78,7 +78,7 @@ HAPI Evas_Object *index_create(Evas_Object *tab, unsigned int count) elm_index_level_go(index, 0); if (count > 0) { - index_bring_in(index, 0); + index_bring_in(index, current_idx); } elm_object_part_content_set(tab, PAGE_CONTROLLER_GROUP_NAME, index); @@ -108,9 +108,22 @@ HAPI Evas_Object *index_create(Evas_Object *tab, unsigned int count) HAPI Evas_Object *index_update(Evas_Object *layout, Evas_Object *index, unsigned int count) { - + int idx; + Elm_Object_Item *idx_it; + idx_it = elm_index_selected_item_get(index, 0); + idx = (int) elm_object_item_data_get(idx_it); + + if(count == idx) + { + idx--; + } + if(idx == -1) + { + idx = 0; + } + _D("Current index %d, Current count: %d", idx,count); index_destroy(index); - return index_create(layout, count); + return index_create(layout, count,idx); } -- 2.7.4