From: Jaehwan Kim Date: Wed, 27 Apr 2011 10:29:46 +0000 (+0900) Subject: [genlist] change expandable effect X-Git-Tag: REL_I9200_20110603-1~107^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4fede364dca6265d859075a93feaeae1ca8d561c;p=framework%2Fuifw%2Felementary.git [genlist] change expandable effect Change-Id: Iff6ac11ec05687ab3f6351de5abdc11725993336 --- diff --git a/src/lib/elm_genlist.c b/src/lib/elm_genlist.c index 9227129..806a001 100644 --- a/src/lib/elm_genlist.c +++ b/src/lib/elm_genlist.c @@ -5790,10 +5790,9 @@ _item_moving_effect_timer_cb(void *data) Evas_Coord ox, oy, ow, oh, cvx, cvy, cvw, cvh; Elm_Genlist_Item *it, *it2; const Eina_List *l; - double time = 0.4, t; + double time = 0.3, t; int y, dy; Eina_Bool check, end = EINA_FALSE; - // static Eina_Bool first = EINA_TRUE; int in = 0; t = ((0.0 > (t = current_time_get() - wd->start_time)) ? 0.0 : t) / 1000; @@ -5801,6 +5800,30 @@ _item_moving_effect_timer_cb(void *data) evas_object_geometry_get(wd->pan_smart, &ox, &oy, &ow, &oh); evas_output_viewport_get(evas_object_evas_get(wd->pan_smart), &cvx, &cvy, &cvw, &cvh); if (t > time) end = EINA_TRUE; + + it2 = elm_genlist_item_next_get(wd->expand_item); + while (it2) + { + if (wd->expand_item->expanded_depth == it2->expanded_depth) break; + it2 = elm_genlist_item_next_get(it2); + } + dy = 0; + if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND) + dy = it2->scrl_y - it2->old_scrl_y; + else if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT) + dy = wd->expand_item_gap; + + if (t <= time) + { + y = ((1 - (1 - (t / time)) * (1 - (t /time))) * dy); + } + else + { + end = EINA_TRUE; + y = dy; + } + + check = EINA_FALSE; EINA_INLIST_FOREACH(wd->blocks, itb) { itb->w = wd->minw; @@ -5811,43 +5834,11 @@ _item_moving_effect_timer_cb(void *data) { EINA_LIST_FOREACH(itb->items, l, it) { - if (wd->move_effect_mode != ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE) - { - it2 = it; - check = EINA_FALSE; - do { - if(it2->parent == wd->expand_item) check = EINA_TRUE; - it2 = it2->parent; - } while(it2); - if(check) continue; - } - dy = 0; - //printf(" s: %d %d ", oy, oh); - if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND) - dy = it->scrl_y - it->old_scrl_y; - else if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT) - { - // printf("%d %d\n", it->old_scrl_y, wd->expand_item_end); - if(wd->expand_item_end < it->old_scrl_y) - dy = wd->expand_item_gap; - } - else if (wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_DELETE) - { - if (wd->expand_item_end < it->old_scrl_y) - dy = wd->expand_item_gap; - } - if (t <= time) - y = (1 * sin((t / time) * (M_PI / 2)) * dy); - else - { - end = EINA_TRUE; - y = dy; - } + if (it == it2) check = EINA_TRUE; + if (!check) continue; if (!it->old_scrl_y) it->old_scrl_y = it->scrl_y; - - if (it->old_scrl_y + y < oy + oh) { if (!it->realized) _item_realize(it, in, 0); @@ -5870,49 +5861,46 @@ _item_moving_effect_timer_cb(void *data) if (it->group_item) evas_object_raise(it->group_item->base.view); } + } + } + } - if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND) + if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND) + { + it = elm_genlist_item_prev_get(it2); + while(it) + { + if((it->scrl_y < it2->old_scrl_y + y) && (it->expanded_depth > it2->expanded_depth)) + { + if(!it->effect_done) { - it2 = elm_genlist_item_prev_get(it); - while(it2) - { - if((it2->scrl_y < it->old_scrl_y + y) && (it2->expanded_depth > it->expanded_depth)) - { - if(!it2->effect_done) - { - //edje_object_signal_emit(it2->base.view, "elm,state,expand_flip", ""); - evas_object_move(it2->base.view, it2->scrl_x, it2->scrl_y); - evas_object_show(it2->base.view); - it2->effect_done = EINA_TRUE; - } - // break; - } - it2 = elm_genlist_item_prev_get(it2); - } + edje_object_signal_emit(it->base.view, "flip_item", ""); + evas_object_show(it->base.view); + it->effect_done = EINA_TRUE; } - else if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT) + } + it = elm_genlist_item_prev_get(it); + if (it->expanded_depth <= it2->expanded_depth) break; + } + } + else if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT) + { + it = elm_genlist_item_prev_get(it2); + while(it) + { + if((it->scrl_y > it2->old_scrl_y + y) && (it->expanded_depth > it2->expanded_depth)) + { + if(!it->effect_done) { - it2 = elm_genlist_item_prev_get(it); - while(it2) - { - if((it2->scrl_y > it->old_scrl_y + y) && (it2->expanded_depth > it->expanded_depth)) - { - if(!it2->effect_done) - { - edje_object_signal_emit(it2->base.view, "elm,state,hide", ""); - it2->effect_done = EINA_TRUE; - } - } - else - break; - it2 = elm_genlist_item_prev_get(it2); - } + edje_object_signal_emit(it->base.view, "elm,state,hide", ""); + it->effect_done = EINA_TRUE; } } + else + break; + it = elm_genlist_item_prev_get(it); } } - // first = EINA_FALSE; - // printf("\n"); if (end) { if (wd->item_moving_effect_timer) @@ -5928,9 +5916,7 @@ _item_moving_effect_timer_cb(void *data) } } } - //evas_render(evas_object_evas_get(wd->obj)); wd->item_moving_effect_timer = NULL; - // first = EINA_TRUE; _item_auto_scroll(wd); evas_object_lower(wd->alpha_bg); @@ -5953,7 +5939,6 @@ _emit_contract(Elm_Genlist_Item *it) Elm_Genlist_Item *it2; Eina_List *l; - // printf("%p is emited contract\n", it); edje_object_signal_emit(it->base.view, "elm,state,contract_flip", ""); it->effect_done = EINA_FALSE; @@ -5982,15 +5967,9 @@ _item_flip_effect_show(Elm_Genlist_Item *it) if (it2->parent && it == it2->parent) { if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_EXPAND) - { - edje_object_signal_emit(it2->base.view, "flip_item", ""); - if(check) - evas_object_move(it2->base.view, -9999, -9999); - else - evas_object_show(it2->base.view); - } + edje_object_signal_emit(it2->base.view, "elm,state,unvisible", ""); else if(wd->move_effect_mode == ELM_GENLIST_ITEM_MOVE_EFFECT_CONTRACT) - _emit_contract(it2); + _emit_contract(it2); } }