From: Sung-Jin Park Date: Tue, 20 Aug 2019 08:55:08 +0000 (+0900) Subject: pui_sample: stop/destroy current animation before we start a new animation X-Git-Tag: accepted/tizen/5.5/unified/20200102.014046~41 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Flibpui.git;a=commitdiff_plain;h=3547ff549519780a98e7f66aa04e760b88438458 pui_sample: stop/destroy current animation before we start a new animation Change-Id: I960113c991297c07455504c2a997b67d9567c4fc Signed-off-by: Sung-Jin Park --- diff --git a/samples/PUI_sample.c b/samples/PUI_sample.c index 359fd8e..852ddda 100644 --- a/samples/PUI_sample.c +++ b/samples/PUI_sample.c @@ -83,28 +83,24 @@ ani_collection_play(app_data_t *app) return; } + if (app->ani_h) + { + /* stop animation running already */ + ani_stop(app); + pui_ani_destroy(app->ani_h); + app->ani_h = NULL; + } + ani_h = pui_ani_create(app->ph, ani_collection[ani_idx].id); if (!ani_h) { debug_error("Failed to create new PUI animation handle !\n"); - return; - } - - if (app->ani_h) - { - /* stop animation running already */ - e = pui_ani_control(app->ani_h, PUI_ANI_CMD_STOP, 0); - - if (PUI_ERROR_NONE != e) - { - debug_error("Failed on stopping an animation !(cmd:%d, repeat:%d)\n", PUI_ANI_CMD_STOP, 0); - return; - } - debug_info("Animation(%s) will be stopped !\n", pui_ani_get_id(ani_h)); + if (++ani_idx >= n_animation) + ani_idx = 0; - app->ani_h = NULL; + return; } app->ani_h = ani_h;